unsanitized_post_values example

continue;
                }

                $post_value = $setting->post_value( null );
                if ( ! is_null( $post_value ) && (int) $post_value === $this->previous_term_id ) {
                    $this->manager->set_post_value( $setting->id, $this->term_id );
                    $setting->save();
                }
            }

            // Make sure that any nav_menu widgets referencing the placeholder nav menu get updated and sent back to client.             foreach ( array_keys( $this->manager->unsanitized_post_values() ) as $setting_id ) {
                $nav_menu_widget_setting = $this->manager->get_setting( $setting_id );
                if ( ! $nav_menu_widget_setting || ! preg_match( '/^widget_nav_menu\[/', $nav_menu_widget_setting->id ) ) {
                    continue;
                }

                $widget_instance = $nav_menu_widget_setting->post_value(); // Note that this calls WP_Customize_Widgets::sanitize_widget_instance().                 if ( empty( $widget_instance['nav_menu'] ) || (int) $widget_instance['nav_menu'] !== $this->previous_term_id ) {
                    continue;
                }

                $widget_instance['nav_menu'] = $this->term_id;
                

    public function post_value( $setting$default_value = null ) {
        $post_values = $this->unsanitized_post_values();
        if ( ! array_key_exists( $setting->id, $post_values ) ) {
            return $default_value;
        }

        $value = $post_values[ $setting->id ];
        $valid = $setting->validate( $value );
        if ( is_wp_error( $valid ) ) {
            return $default_value;
        }

        $value = $setting->sanitize( $value );
        
$setting_class = 'WP_Customize_Nav_Menu_Item_Setting';
        }
        return $setting_class;
    }

    /** * Adds the customizer settings and controls. * * @since 4.3.0 */
    public function customize_register() {
        $changeset = $this->manager->unsanitized_post_values();

        // Preview settings for nav menus early so that the sections and controls will be added properly.         $nav_menus_setting_ids = array();
        foreach ( array_keys( $changeset ) as $setting_id ) {
            if ( preg_match( '/^(nav_menu_locations|nav_menu|nav_menu_item)\[/', $setting_id ) ) {
                $nav_menus_setting_ids[] = $setting_id;
            }
        }
        $settings = $this->manager->add_dynamic_settings( $nav_menus_setting_ids );
        if ( $this->manager->settings_previewed() ) {
            foreach ( $settings as $setting ) {
                

    }

    /** * Inspects the incoming customized data for any widget settings, and dynamically adds * them up-front so widgets will be initialized properly. * * @since 4.2.0 */
    public function register_settings() {
        $widget_setting_ids   = array();
        $incoming_setting_ids = array_keys( $this->manager->unsanitized_post_values() );
        foreach ( $incoming_setting_ids as $setting_id ) {
            if ( ! is_null( $this->get_setting_type( $setting_id ) ) ) {
                $widget_setting_ids[] = $setting_id;
            }
        }
        if ( $this->manager->doing_ajax( 'update-widget' ) && isset( $_REQUEST['widget-id'] ) ) {
            $widget_setting_ids[] = $this->get_setting_id( wp_unslash( $_REQUEST['widget-id'] ) );
        }

        $settings = $this->manager->add_dynamic_settings( array_unique( $widget_setting_ids ) );

        

        do_action( 'customize_render_partials_after', $this$partials );

        $response = array(
            'contents' => $contents,
        );

        if ( defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY ) {
            $response['errors'] = $this->triggered_errors;
        }

        $setting_validities             = $this->manager->validate_setting_values( $this->manager->unsanitized_post_values() );
        $exported_setting_validities    = array_map( array( $this->manager, 'prepare_setting_validity_for_js' )$setting_validities );
        $response['setting_validities'] = $exported_setting_validities;

        /** * Filters the response from rendering the partials. * * Plugins may use this filter to inject `$scripts` and `$styles`, which are dependencies * for the partials being rendered. The response data will be available to the client via * the `render-partials-response` JS event, so the client can then inject the scripts and * styles into the DOM if they have not already been enqueued there. * * If plugins do this, they'll need to take care for any scripts that do `document.write()` * and make sure that these are not injected, or else to override the function to no-op, * or else the page will be destroyed. * * Plugins should be aware that `$scripts` and `$styles` may eventually be included by * default in the response. * * @since 4.5.0 * * @param array $response { * Response. * * @type array $contents Associative array mapping a partial ID its corresponding array of contents * for the containers requested. * @type array $errors List of errors triggered during rendering of partials, if `WP_DEBUG_DISPLAY` * is enabled. * } * @param WP_Customize_Selective_Refresh $refresh Selective refresh component. * @param array $partials Placements' context data for the partials rendered in the request. * The array is keyed by partial ID, with each item being an array of * the placements' context data. */
Home | Imprint | This part of the site doesn't use cookies.