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

git-svn-id: http://svn.automattic.com/wordpress/trunk@20105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-03-04 01:16:32 +00:00
parent e251ff1c04
commit c973568e76

View File

@ -791,7 +791,7 @@ final class WP_Theme implements ArrayAccess {
* @since 3.4.0
* @access public
*
* @param string $uri Type of URL to include, either 'relative' or an absolute URI. Defaults to absolute URI.
* @param string $uri Type of URL to return, either 'relative' or an absolute URI. Defaults to absolute URI.
* @return mixed Screenshot file. False if the theme does not have a screenshot.
*/
public function get_screenshot( $uri = 'uri' ) {
@ -861,15 +861,18 @@ final class WP_Theme implements ArrayAccess {
* @since 3.4.0
* @access public
*
* @return array Screenshots.
* @param string $uri Type of URL to return, either 'relative' or an absolute URI. Defaults to absolute URI.
* @return array Screenshots. Empty array if no screenshors are found.
*/
public function get_screenshots() {
public function get_screenshots( $uri = 'uri' ) {
if ( ! $count = $this->get_screenshot_count() )
return array();
$screenshots = array( $this->get_screenshot( 'relative' ) );
$pre = 'relative' == $uri ? '' : $this->get_stylesheet_directory_uri() . '/';
$screenshots = array( $pre . $this->get_screenshot( 'relative' ) );
for ( $i = 2; $i <= $count; $i++ )
$screenshots[] = 'screenshot-' . $i . '.png';
$screenshots[] = $pre . 'screenshot-' . $i . '.png';
return $screenshots;
}