Make WordPress Core

Changeset 20105


Ignore:
Timestamp:
03/04/2012 01:16:32 AM (12 years ago)
Author:
nacin
Message:

Allow get_screenshots() to return absolute URLs. Make this the default; relative can be achieved with 'relative' as the argument. see #20103.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-theme.php

    r20045 r20105  
    792792     * @access public
    793793     *
    794      * @param string $uri Type of URL to include, either 'relative' or an absolute URI. Defaults to absolute URI.
     794     * @param string $uri Type of URL to return, either 'relative' or an absolute URI. Defaults to absolute URI.
    795795     * @return mixed Screenshot file. False if the theme does not have a screenshot.
    796796     */
     
    862862     * @access public
    863863     *
    864      * @return array Screenshots.
    865      */
    866     public function get_screenshots() {
     864     * @param string $uri Type of URL to return, either 'relative' or an absolute URI. Defaults to absolute URI.
     865     * @return array Screenshots. Empty array if no screenshors are found.
     866     */
     867    public function get_screenshots( $uri = 'uri' ) {
    867868        if ( ! $count = $this->get_screenshot_count() )
    868869            return array();
    869870
    870         $screenshots = array( $this->get_screenshot( 'relative' ) );
     871        $pre = 'relative' == $uri ? '' : $this->get_stylesheet_directory_uri() . '/';
     872
     873        $screenshots = array( $pre . $this->get_screenshot( 'relative' ) );
    871874        for ( $i = 2; $i <= $count; $i++ )
    872             $screenshots[] = 'screenshot-' . $i . '.png';
     875            $screenshots[] = $pre . 'screenshot-' . $i . '.png';
    873876        return $screenshots;
    874877    }
Note: See TracChangeset for help on using the changeset viewer.