Ticket #18599: 18599.3.patch
File 18599.3.patch, 3.2 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/class-wp-themes-list-table.php
175 175 ?> 176 176 <a href="<?php echo $preview_link; ?>" class="<?php echo $thickbox_class; ?> screenshot"> 177 177 <?php if ( $screenshot ) : ?> 178 <img src="<?php echo $theme_root_uri . '/' . $stylesheet . '/' . $screenshot; ?>" alt="" />178 <img src="<?php echo esc_url( _get_theme_screenshot_url( $stylesheet_dir, $template_dir, $screenshot ) ); ?>" alt="" /> 179 179 <?php endif; ?> 180 180 </a> 181 181 <h3><?php -
wp-admin/themes.php
81 81 <h3><?php _e('Current Theme'); ?></h3> 82 82 <div id="current-theme"> 83 83 <?php if ( $ct->screenshot ) : ?> 84 <img src="<?php echo $ct->theme_root_uri . '/' . $ct->stylesheet . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />84 <img src="<?php echo esc_url( _get_theme_screenshot_url( $ct->stylesheet_dir, $ct->template_dir, $ct->screenshot ) ); ?>" alt="<?php _e('Current theme preview'); ?>" /> 85 85 <?php endif; ?> 86 86 <h4><?php 87 87 /* translators: 1: theme title, 2: theme version, 3: theme author */ -
wp-includes/theme.php
293 293 $template = $theme_data['Template']; 294 294 $stylesheet = dirname($theme_file); 295 295 296 $screenshot = false;297 foreach ( array('png', 'gif', 'jpg', 'jpeg') as $ext ) {298 if (file_exists("$theme_root/$stylesheet/screenshot.$ext")) {299 $screenshot = "screenshot.$ext";300 break;301 }302 }303 304 296 if ( empty($name) ) { 305 297 $name = dirname($theme_file); 306 298 $title = $name; … … 393 385 if ( empty($stylesheet_dir) ) 394 386 $stylesheet_dir = '/'; 395 387 388 $screenshot = false; 389 foreach ( array('png', 'gif', 'jpg', 'jpeg') as $ext ) { 390 if ( file_exists("$stylesheet_dir/screenshot.$ext") || file_exists("$template_dir/screenshot.$ext") ) { 391 $screenshot = "screenshot.$ext"; 392 break; 393 } 394 } 395 396 396 // Check for theme name collision. This occurs if a theme is copied to 397 397 // a new theme directory and the theme header is not updated. Whichever 398 398 // theme is first keeps the name. Subsequent themes get a suffix applied. … … 1989 1989 1990 1990 add_action( 'delete_attachment', '_delete_attachment_theme_mod' ); 1991 1991 1992 /** 1993 * Retrieve screenshot URL for a theme. 1994 * 1995 * If a child theme screenshot is missing, the one from a parent theme is used. 1996 * 1997 * @access private 1998 * @since 3.3.0 1999 */ 2000 function _get_theme_screenshot_url( $stylesheet_dir, $template_dir, $screenshot ) { 2001 $screenshot_url = false; 2002 2003 if ( file_exists("$stylesheet_dir/$screenshot") ) 2004 $screenshot_url = str_replace( WP_CONTENT_DIR, content_url(), "$stylesheet_dir/$screenshot" ); 2005 elseif ( file_exists("$template_dir/$screenshot") ) 2006 $screenshot_url = str_replace( WP_CONTENT_DIR, content_url(), "$template_dir/$screenshot" ); 2007 2008 return $screenshot_url; 2009 } 2010 1992 2011 ?>