WordPress.org

Make WordPress Core

Changeset 20043


Ignore:
Timestamp:
02/29/12 20:31:56 (2 years ago)
Author:
nacin
Message:

Have WP_Theme::get_screenshot() default to an absolute URI. Allow 'relative' to be requested. see #20103, see #19816.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-themes-list-table.php

    r20029 r20043  
    153153            ?> 
    154154            <a href="<?php echo $preview_link; ?>" class="thickbox thickbox-preview screenshot"> 
    155             <?php if ( $theme->get_screenshot() ) : ?> 
    156                 <img src="<?php echo esc_url( $theme->get_screenshot( 'absolute' ) ); ?>" alt="" /> 
     155            <?php if ( $screenshot = $theme->get_screenshot() ) : ?> 
     156                <img src="<?php echo esc_url( $screenshot ); ?>" alt="" /> 
    157157            <?php endif; ?> 
    158158            </a> 
  • trunk/wp-admin/themes.php

    r20029 r20043  
    100100<h3><?php _e( 'Current Theme' ); ?></h3> 
    101101<div id="current-theme"> 
    102 <?php if ( $ct->get_screenshot() ) : ?> 
    103 <img src="<?php echo $ct->get_screenshot( 'absolute' ); ?>" alt="<?php esc_attr_e( 'Current theme preview'); ?>" /> 
     102<?php if ( $screenshot = $ct->get_screenshot() ) : ?> 
     103<img src="<?php echo esc_url( $screenshot ); ?>" alt="<?php esc_attr_e( 'Current theme preview'); ?>" /> 
    104104<?php endif; ?> 
    105105<h4><?php 
  • trunk/wp-includes/class-wp-theme.php

    r20041 r20043  
    281281                return $this->get_stylesheet(); 
    282282            case 'screenshot' : 
    283                 return $this->get_screenshot(); 
     283                return $this->get_screenshot( 'relative' ); 
    284284            // 'author' and 'description' did not previously return translated data. 
    285285            case 'description' : 
     
    361361                return $this->get_stylesheet_directory(); 
    362362            case 'Screenshot' : 
    363                 return $this->get_screenshot(); 
     363                return $this->get_screenshot( 'relative' ); 
    364364            case 'Tags' : 
    365365                return $this->get('Tags'); 
     
    793793     * @access public 
    794794     * 
    795      * @param string $uri Type of URL to include, either relative or absolute. Defaults to relative. 
     795     * @param string $uri Type of URL to include, either 'relative' or an absolute URI. Defaults to absolute URI. 
    796796     * @return mixed Screenshot file. False if the theme does not have a screenshot. 
    797797     */ 
    798     public function get_screenshot( $uri = 'relative' ) { 
     798    public function get_screenshot( $uri = 'uri' ) { 
    799799        $screenshot = $this->cache_get( 'screenshot' ); 
    800800        if ( $screenshot ) { 
    801             if ( 'absolute' == $uri ) 
    802                 return $this->get_stylesheet_directory_uri() . '/' . $screenshot; 
    803             return $screenshot; 
     801            if ( 'relative' == $uri ) 
     802                return $screenshot; 
     803            return $this->get_stylesheet_directory_uri() . '/' . $screenshot; 
    804804        } elseif ( 0 === $screenshot ) { 
    805805            return false; 
     
    841841        // This will set the screenshot cache. 
    842842        // If there is no screenshot, the screenshot_count cache will also be set. 
    843         if ( ! $screenshot = $this->get_screenshot() ) 
     843        if ( ! $screenshot = $this->get_screenshot( 'relative' ) ) 
    844844            return 0; 
    845845 
     
    869869            return array(); 
    870870 
    871         $screenshots = array( $this->get_screenshot() ); 
     871        $screenshots = array( $this->get_screenshot( 'relative' ) ); 
    872872        for ( $i = 2; $i <= $count; $i++ ) 
    873873            $screenshots[] = 'screenshot-' . $i . '.png'; 
  • trunk/wp-includes/customize-controls.php

    r20031 r20043  
    2929 
    3030$theme = wp_get_theme(); 
    31 $screenshot = $theme->get_screenshot( 'absolute' ); 
     31$screenshot = $theme->get_screenshot(); 
    3232 
    3333// Let's roll. 
Note: See TracChangeset for help on using the changeset viewer.