403Webshell
Server IP : 104.26.2.156  /  Your IP : 216.73.216.185
Web Server : nginx/1.27.1
System : Linux us-1 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User : vinodai ( 3134)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /storage/v1396/videnn/public_html/wp-content/plugins/astra-sites/inc/assets/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /storage/v1396/videnn/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