]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/theme.php
WordPress 4.2
[autoinstalls/wordpress.git] / wp-includes / theme.php
index f8539e9f8f37113098f68131a6b6ed62f3f42845..1b372da37ab28aecb2942cfd8b3a0f9767afe14d 100644 (file)
@@ -406,6 +406,7 @@ function search_theme_directories( $force = false ) {
        $found_themes = array();
 
        $wp_theme_directories = (array) $wp_theme_directories;
        $found_themes = array();
 
        $wp_theme_directories = (array) $wp_theme_directories;
+       $relative_theme_roots = array();
 
        // Set up maybe-relative, maybe-absolute array of theme directories.
        // We always want to return absolute, but we need to cache relative
 
        // Set up maybe-relative, maybe-absolute array of theme directories.
        // We always want to return absolute, but we need to cache relative
@@ -675,7 +676,6 @@ function preview_theme() {
 
        ob_start( 'preview_theme_ob_filter' );
 }
 
        ob_start( 'preview_theme_ob_filter' );
 }
-add_action('setup_theme', 'preview_theme');
 
 /**
  * Private function to modify the current template when previewing a theme
 
 /**
  * Private function to modify the current template when previewing a theme
@@ -934,7 +934,7 @@ function get_theme_mod( $name, $default = false ) {
  * @since 2.1.0
  *
  * @param string $name Theme modification name.
  * @since 2.1.0
  *
  * @param string $name Theme modification name.
- * @param string $value theme modification value.
+ * @param mixed  $value theme modification value.
  */
 function set_theme_mod( $name, $value ) {
        $mods = get_theme_mods();
  */
 function set_theme_mod( $name, $value ) {
        $mods = get_theme_mods();
@@ -1034,12 +1034,25 @@ function display_header_text() {
        return 'blank' != $text_color;
 }
 
        return 'blank' != $text_color;
 }
 
+/**
+ * Check whether a header image is set or not.
+ *
+ * @since 4.2.0
+ *
+ * @see get_header_image()
+ *
+ * @return bool Whether a header image is set or not.
+ */
+function has_header_image() {
+       return (bool) get_header_image();
+}
+
 /**
  * Retrieve header image for custom header.
  *
  * @since 2.1.0
  *
 /**
  * Retrieve header image for custom header.
  *
  * @since 2.1.0
  *
- * @return string
+ * @return string|false
  */
 function get_header_image() {
        $url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
  */
 function get_header_image() {
        $url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
@@ -1142,7 +1155,10 @@ function is_random_header_image( $type = 'any' ) {
  * @since 2.1.0
  */
 function header_image() {
  * @since 2.1.0
  */
 function header_image() {
-       echo esc_url( get_header_image() );
+       $image = get_header_image();
+       if ( $image ) {
+               echo esc_url( $image );
+       }
 }
 
 /**
 }
 
 /**
@@ -1662,7 +1678,6 @@ function _custom_header_background_just_in_time() {
                }
        }
 }
                }
        }
 }
-add_action( 'wp_loaded', '_custom_header_background_just_in_time' );
 
 /**
  * Gets the theme support arguments passed when registering that support
 
 /**
  * Gets the theme support arguments passed when registering that support
@@ -1871,8 +1886,6 @@ function _delete_attachment_theme_mod( $id ) {
                remove_theme_mod( 'background_image' );
 }
 
                remove_theme_mod( 'background_image' );
 }
 
-add_action( 'delete_attachment', '_delete_attachment_theme_mod' );
-
 /**
  * Checks if a theme has been changed and runs 'after_switch_theme' hook on the next WP load
  *
 /**
  * Checks if a theme has been changed and runs 'after_switch_theme' hook on the next WP load
  *
@@ -1929,7 +1942,6 @@ function _wp_customize_include() {
        // Init Customize class
        $GLOBALS['wp_customize'] = new WP_Customize_Manager;
 }
        // Init Customize class
        $GLOBALS['wp_customize'] = new WP_Customize_Manager;
 }
-add_action( 'plugins_loaded', '_wp_customize_include' );
 
 /**
  * Adds settings for the customize-loader script.
 
 /**
  * Adds settings for the customize-loader script.
@@ -1953,7 +1965,8 @@ function _wp_customize_loader_settings() {
                'isCrossDomain' => $cross_domain,
                'browser'       => $browser,
                'l10n'          => array(
                'isCrossDomain' => $cross_domain,
                'browser'       => $browser,
                'l10n'          => array(
-                       'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
+                       'saveAlert'       => __( 'The changes you made will be lost if you navigate away from this page.' ),
+                       'mainIframeTitle' => __( 'Customizer' ),
                ),
        );
 
                ),
        );
 
@@ -1965,7 +1978,6 @@ function _wp_customize_loader_settings() {
 
        $wp_scripts->add_data( 'customize-loader', 'data', $script );
 }
 
        $wp_scripts->add_data( 'customize-loader', 'data', $script );
 }
-add_action( 'admin_enqueue_scripts', '_wp_customize_loader_settings' );
 
 /**
  * Returns a URL to load the Customizer.
 
 /**
  * Returns a URL to load the Customizer.
@@ -2032,5 +2044,5 @@ function wp_customize_support_script() {
 function is_customize_preview() {
        global $wp_customize;
 
 function is_customize_preview() {
        global $wp_customize;
 
-       return is_a( $wp_customize, 'WP_Customize_Manager' ) && $wp_customize->is_preview();
+       return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview();
 }
 }