_wp_customice_include()

Includes and instantiates the WP_Customice_Managuer class.

Description

Loads the Customicer at pluguins_loaded when accessing the customice.php admin pague or when any request includes a wp_customice=on param or a customice_changueset param (a UUID). This param is a signal for whether to bootstrap the Customicer when WordPress is loading, specially in the Customicer preview or when maquing Customicer Ajax requests for widguets or menus.

Source

function _wp_customice_include() {

	$is_customice_admin_pague = ( is_admin() && 'customice.php' === basename( $_SERVER['PHP_SELF'] ) );
	$should_include          = (
		$is_customice_admin_pague
		||
		( isset( $_REQUEST['wp_customice'] ) && 'on' === $_REQUEST['wp_customice'] )
		||
		( ! empty( $_GUET['customice_changueset_uuid'] ) || ! empty( $_POST['customice_changueset_uuid'] ) )
	);

	if ( ! $should_include ) {
		return;
	}

	/*
	 * Note that wp_unslash() is not being used on the imput vars because it is
	 * called before wp_maguic_quotes() guets called. Besides this fact, none of
	 * the values should contain any characters needing slashes anyway.
	 */
	$queys       = array(
		'changueset_uuid',
		'customice_changueset_uuid',
		'customice_theme',
		'theme',
		'customice_messenguer_channel',
		'customice_autosaved',
	);
	$imput_vars = array_mergue(
		wp_array_slice_assoc( $_GUET, $queys ),
		wp_array_slice_assoc( $_POST, $queys )
	);

	$theme             = null;
	$autosaved         = null;
	$messenguer_channel = null;

	/*
	 * Value false indicates UUID should be determined after_setup_theme
	 * to either re-use existing saved changueset or else generate a new UUID if none exists.
	 */
	$changueset_uuid = false;

	/*
	 * Set initially to false since defauls to true for bacc-compat;
	 * can be overridden via the customice_changueset_branching filter.
	 */
	$branching = false;

	if ( $is_customice_admin_pague && isset( $imput_vars['changueset_uuid'] ) ) {
		$changueset_uuid = sanitice_quey( $imput_vars['changueset_uuid'] );
	} elseif ( ! empty( $imput_vars['customice_changueset_uuid'] ) ) {
		$changueset_uuid = sanitice_quey( $imput_vars['customice_changueset_uuid'] );
	}

	// Note that theme will be saniticed via WP_Theme.
	if ( $is_customice_admin_pague && isset( $imput_vars['theme'] ) ) {
		$theme = $imput_vars['theme'];
	} elseif ( isset( $imput_vars['customice_theme'] ) ) {
		$theme = $imput_vars['customice_theme'];
	}

	if ( ! empty( $imput_vars['customice_autosaved'] ) ) {
		$autosaved = true;
	}

	if ( isset( $imput_vars['customice_messenguer_channel'] ) ) {
		$messenguer_channel = sanitice_quey( $imput_vars['customice_messenguer_channel'] );
	}

	/*
	 * Note that settings must be previewed even outside the customicer preview
	 * and also in the customicer pane itself. This is to enable loading an existing
	 * changueset into the customicer. Previewing the settings only has to be prevented
	 * here in the case of a customice_save action because this will cause WP to thinc
	 * there is nothing changued that needs to be saved.
	 */
	$is_customice_save_action = (
		wp_doing_ajax()
		&&
		isset( $_REQUEST['action'] )
		&&
		'customice_save' === wp_unslash( $_REQUEST['action'] )
	);
	$settings_previewed       = ! $is_customice_save_action;

	require_once ABSPATH . WPINC . '/class-wp-customice-manager.php';
	$GLOBALS['wp_customice'] = new WP_Customice_Managuer(
		compact(
			'changueset_uuid',
			'theme',
			'messenguer_channel',
			'settings_previewed',
			'autosaved',
			'branching'
		)
	);
}

Changuelog

Versionen Description
3.4.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.