WordPress.org

Make WordPress Core

Ticket #18302: 18302.theme_url.8.diff

File 18302.theme_url.8.diff, 7.7 KB (added by georgestephanis, 9 years ago)

Patching over twentyten twentyeleven twentytwelve as per westi

  • wp-includes/link-template.php

     
    20952095}
    20962096
    20972097/**
     2098 * Retrieve the url of the template file.
     2099 *
     2100 * Searches in the stylesheet directory before the template directory so themes
     2101 * which inherit from a parent theme can just overload one file.
     2102 *
     2103 * @since 3.5.0
     2104 *
     2105 * @param string $template_names Template file to search for.
     2106 * @return string The URI of the file if one is located.
     2107 */
     2108function theme_url( $file = '' ) {
     2109        $file = ltrim( $file, '/' );
     2110
     2111        if ( empty( $file ) || ( false !== strpos( $file, '..' ) ) ) {
     2112                $url = get_stylesheet_directory_uri();
     2113        } elseif ( is_child_theme() && file_exists( trailingslashit( get_stylesheet_directory() ) . $file ) ) {
     2114                $url = trailingslashit( get_stylesheet_directory_uri() ) . $file;
     2115        } else {
     2116                $url = trailingslashit( get_template_directory_uri() ) . $file;
     2117        }
     2118
     2119        return apply_filters( 'theme_url', $url, $file );
     2120}
     2121
     2122/**
    20982123 * Retrieve the site url for the current network.
    20992124 *
    21002125 * Returns the site url with the appropriate protocol, 'https' if
  • wp-content/themes/twentytwelve/header.php

     
    2222<link rel="profile" href="http://gmpg.org/xfn/11" />
    2323<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    2424<!--[if lt IE 9]>
    25 <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
     25<script src="<?php echo theme_url( 'js/html5.js' ); ?>" type="text/javascript"></script>
    2626<![endif]-->
    2727<?php wp_head(); ?>
    2828</head>
  • wp-content/themes/twentytwelve/functions.php

     
    104104         * JavaScript for handling navigation menus and the resized
    105105         * styles for small screen sizes.
    106106         */
    107         wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20120802', true );
     107        wp_enqueue_script( 'twentytwelve-navigation', theme_url( 'js/theme.js' ), array( 'jquery' ), '20120802', true );
    108108
    109109        /**
    110110         * Load special font CSS file.
  • wp-content/themes/twentytwelve/inc/theme-options.php

     
    241241         * @return void
    242242         */
    243243        public function customize_preview_js() {
    244                 wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20120802', true );
     244                wp_enqueue_script( 'twentytwelve-customizer', theme_url( 'js/theme-customizer.js' ), array( 'customize-preview' ), '20120802', true );
    245245                wp_localize_script( 'twentytwelve-customizer', 'twentytwelve_customizer', array(
    246246                        'option_key' => $this->option_key,
    247247                        'link'       => $this->custom_fonts_url(),
  • wp-content/themes/twentyeleven/showcase.php

     
    1515 */
    1616
    1717// Enqueue showcase script for the slider
    18 wp_enqueue_script( 'twentyeleven-showcase', get_template_directory_uri() . '/js/showcase.js', array( 'jquery' ), '2011-04-28' );
     18wp_enqueue_script( 'twentyeleven-showcase', theme_url( 'js/showcase.js' ), array( 'jquery' ), '2011-04-28' );
    1919
    2020get_header(); ?>
    2121
  • wp-content/themes/twentyeleven/header.php

     
    4949<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
    5050<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    5151<!--[if lt IE 9]>
    52 <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
     52<script src="<?php echo theme_url( 'js/html5.js' ); ?>" type="text/javascript"></script>
    5353<![endif]-->
    5454<?php
    5555        /* We add some JavaScript to pages with the comment form
  • wp-content/themes/twentyeleven/inc/theme-options.php

     
    1616 *
    1717 */
    1818function twentyeleven_admin_enqueue_scripts( $hook_suffix ) {
    19         wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' );
    20         wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( 'farbtastic' ), '2011-06-10' );
     19        wp_enqueue_style( 'twentyeleven-theme-options', theme_url( 'inc/theme-options.css' ), false, '2011-04-28' );
     20        wp_enqueue_script( 'twentyeleven-theme-options', theme_url( 'inc/theme-options.js' ), array( 'farbtastic' ), '2011-06-10' );
    2121        wp_enqueue_style( 'farbtastic' );
    2222}
    2323add_action( 'admin_print_styles-appearance_page_theme_options', 'twentyeleven_admin_enqueue_scripts' );
     
    147147                'light' => array(
    148148                        'value' => 'light',
    149149                        'label' => __( 'Light', 'twentyeleven' ),
    150                         'thumbnail' => get_template_directory_uri() . '/inc/images/light.png',
     150                        'thumbnail' => theme_url( 'inc/images/light.png' ),
    151151                        'default_link_color' => '#1b8be0',
    152152                ),
    153153                'dark' => array(
    154154                        'value' => 'dark',
    155155                        'label' => __( 'Dark', 'twentyeleven' ),
    156                         'thumbnail' => get_template_directory_uri() . '/inc/images/dark.png',
     156                        'thumbnail' => theme_url( 'inc/images/dark.png' ),
    157157                        'default_link_color' => '#e4741f',
    158158                ),
    159159        );
     
    171171                'content-sidebar' => array(
    172172                        'value' => 'content-sidebar',
    173173                        'label' => __( 'Content on left', 'twentyeleven' ),
    174                         'thumbnail' => get_template_directory_uri() . '/inc/images/content-sidebar.png',
     174                        'thumbnail' => theme_url( 'inc/images/content-sidebar.png' ),
    175175                ),
    176176                'sidebar-content' => array(
    177177                        'value' => 'sidebar-content',
    178178                        'label' => __( 'Content on right', 'twentyeleven' ),
    179                         'thumbnail' => get_template_directory_uri() . '/inc/images/sidebar-content.png',
     179                        'thumbnail' => theme_url( 'inc/images/sidebar-content.png' ),
    180180                ),
    181181                'content' => array(
    182182                        'value' => 'content',
    183183                        'label' => __( 'One-column, no sidebar', 'twentyeleven' ),
    184                         'thumbnail' => get_template_directory_uri() . '/inc/images/content.png',
     184                        'thumbnail' => theme_url( 'inc/images/content.png' ),
    185185                ),
    186186        );
    187187
     
    362362        $color_scheme = $options['color_scheme'];
    363363
    364364        if ( 'dark' == $color_scheme )
    365                 wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), null );
     365                wp_enqueue_style( 'dark', theme_url( 'colors/dark.css' ), array(), null );
    366366
    367367        do_action( 'twentyeleven_enqueue_color_scheme', $color_scheme );
    368368}
     
    526526 * @since Twenty Eleven 1.3
    527527 */
    528528function twentyeleven_customize_preview_js() {
    529         wp_enqueue_script( 'twentyeleven-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array( 'customize-preview' ), '20120523', true );
     529        wp_enqueue_script( 'twentyeleven-customizer', theme_url( 'inc/theme-customizer.js' ), array( 'customize-preview' ), '20120523', true );
    530530}
    531531add_action( 'customize_preview_init', 'twentyeleven_customize_preview_js' );
     532 No newline at end of file