WordPress 4.7.1
[autoinstalls/wordpress.git] / wp-includes / class-wp-customize-manager.php
index 127d572be7ecfc9fe10e4b4d85850021787e9b03..f80708a23f360678d4c6cec53f4e6ffdd3ec1d1a 100644 (file)
@@ -798,7 +798,8 @@ final class WP_Customize_Manager {
                        'no_found_rows' => true,
                        'cache_results' => true,
                        'update_post_meta_cache' => false,
-                       'update_term_meta_cache' => false,
+                       'update_post_term_cache' => false,
+                       'lazy_load_term_meta' => false,
                ) );
                if ( ! empty( $changeset_post_query->posts ) ) {
                        // Note: 'fields'=>'ids' is not being used in order to cache the post object as it will be needed.
@@ -1776,6 +1777,17 @@ final class WP_Customize_Manager {
                        }
                        $allowed_hosts[] = $host;
                }
+
+               $switched_locale = switch_to_locale( get_user_locale() );
+               $l10n = array(
+                       'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
+                       'linkUnpreviewable' => __( 'This link is not live-previewable.' ),
+                       'formUnpreviewable' => __( 'This form is not live-previewable.' ),
+               );
+               if ( $switched_locale ) {
+                       restore_previous_locale();
+               }
+
                $settings = array(
                        'changeset' => array(
                                'uuid' => $this->_changeset_uuid,
@@ -1800,11 +1812,7 @@ final class WP_Customize_Manager {
                        'activeControls' => array(),
                        'settingValidities' => $exported_setting_validities,
                        'nonce' => current_user_can( 'customize' ) ? $this->get_nonces() : array(),
-                       'l10n' => array(
-                               'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
-                               'linkUnpreviewable' => __( 'This link is not live-previewable.' ),
-                               'formUnpreviewable' => __( 'This form is not live-previewable.' ),
-                       ),
+                       'l10n' => $l10n,
                        '_dirty' => array_keys( $post_values ),
                );
 
@@ -3889,7 +3897,7 @@ final class WP_Customize_Manager {
                $this->add_setting( 'external_header_video', array(
                        'theme_supports'    => array( 'custom-header', 'video' ),
                        'transport'         => 'postMessage',
-                       'sanitize_callback' => 'esc_url_raw',
+                       'sanitize_callback' => array( $this, '_sanitize_external_header_video' ),
                        'validate_callback' => array( $this, '_validate_external_header_video' ),
                ) );
 
@@ -4311,6 +4319,18 @@ final class WP_Customize_Manager {
                return $validity;
        }
 
+       /**
+        * Callback for sanitizing the external_header_video value.
+        *
+        * @since 4.7.1
+        *
+        * @param string $value URL.
+        * @return string Sanitized URL.
+        */
+       public function _sanitize_external_header_video( $value ) {
+               return esc_url_raw( trim( $value ) );
+       }
+
        /**
         * Callback for rendering the custom logo, used in the custom_logo partial.
         *