WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/29/2012 08:31:56 PM (10 years ago)
Author:
nacin
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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';
Note: See TracChangeset for help on using the changeset viewer.