Ticket #18599: 18599.patch
File 18599.patch, 4.7 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/class-wp-themes-list-table.php
149 149 $version = $themes[$theme_name]['Version']; 150 150 $description = $themes[$theme_name]['Description']; 151 151 $author = $themes[$theme_name]['Author']; 152 $screenshot = $themes[$theme_name]['Screenshot'];152 $screenshot_uri = $themes[$theme_name]['Screenshot URI']; 153 153 $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir']; 154 154 $template_dir = $themes[$theme_name]['Template Dir']; 155 155 $parent_theme = $themes[$theme_name]['Parent Theme']; … … 174 174 $actions = implode ( ' | ', $actions ); 175 175 ?> 176 176 <a href="<?php echo $preview_link; ?>" class="<?php echo $thickbox_class; ?> screenshot"> 177 <?php if ( $screenshot ) : ?>178 <img src="<?php echo $theme_root_uri . '/' . $stylesheet . '/' . $screenshot; ?>" alt="" />177 <?php if ( $screenshot_uri ) : ?> 178 <img src="<?php echo esc_url( $screenshot_uri ); ?>" alt="" /> 179 179 <?php endif; ?> 180 180 </a> 181 181 <h3><?php -
wp-admin/includes/theme.php
29 29 $ct->stylesheet_dir = $themes[$current_theme]['Stylesheet Dir']; 30 30 $ct->template = $themes[$current_theme]['Template']; 31 31 $ct->stylesheet = $themes[$current_theme]['Stylesheet']; 32 $ct->screenshot = $themes[$current_theme]['Screenshot']; 32 $ct->screenshot = $themes[$current_theme]['Screenshot']; // Deprecated 33 $ct->screenshot_uri = $themes[$current_theme]['Screenshot URI']; 33 34 $ct->description = $themes[$current_theme]['Description']; 34 35 $ct->author = $themes[$current_theme]['Author']; 35 36 $ct->tags = $themes[$current_theme]['Tags']; -
wp-admin/themes.php
80 80 81 81 <h3><?php _e('Current Theme'); ?></h3> 82 82 <div id="current-theme"> 83 <?php if ( $ct->screenshot ) : ?>84 <img src="<?php echo $ct->theme_root_uri . '/' . $ct->stylesheet . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />83 <?php if ( $ct->screenshot_uri ) : ?> 84 <img src="<?php echo esc_url( $ct->screenshot_uri ); ?>" 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; … … 417 409 } 418 410 } 419 411 412 list( $screenshot, $screenshot_uri ) = get_theme_screenshot( $stylesheet_dir, $template_dir ); 413 420 414 $theme_roots[$stylesheet] = str_replace( WP_CONTENT_DIR, '', $theme_root ); 421 415 $wp_themes[$name] = array( 422 416 'Name' => $name, … … 434 428 'Stylesheet Dir' => $stylesheet_dir, 435 429 'Status' => $theme_data['Status'], 436 430 'Screenshot' => $screenshot, 431 'Screenshot URI' => $screenshot_uri, 437 432 'Tags' => $theme_data['Tags'], 438 433 'Theme Root' => $theme_root, 439 434 'Theme Root URI' => str_replace( WP_CONTENT_DIR, content_url(), $theme_root ), … … 465 460 } 466 461 467 462 /** 463 * Get a theme's screenshot filename and URI. Checks parent too for child themes. 464 * 465 * @since 3.3.0 466 * 467 */ 468 function get_theme_screenshot( $stylesheet_dir, $template_dir = null ) { 469 $extensions = array( 'png', 'gif', 'jpg', 'jpeg' ); 470 471 $screenshot = $screenshot_uri = false; 472 473 // Check current theme folder 474 foreach ( $extensions as $ext ) { 475 $check_path = "$stylesheet_dir/screenshot.$ext"; 476 if ( file_exists( $check_path ) ) { 477 return array( 478 "screenshot.$ext", 479 str_replace( WP_CONTENT_DIR, content_url(), $check_path ), 480 ); 481 } 482 } 483 484 // Okay, maybe the parent folder has a screenshot 485 if ( $template_dir && $template_dir != $stylesheet_dir ) { 486 foreach ( $extensions as $ext ) { 487 $check_path = "$template_dir/screenshot.$ext"; 488 if ( file_exists( $check_path ) ) { 489 return array( 490 false, 491 str_replace( WP_CONTENT_DIR, content_url(), $check_path ), 492 ); 493 } 494 } 495 } 496 497 return array( false, false ); 498 } 499 500 /** 468 501 * Retrieve theme roots. 469 502 * 470 503 * @since 2.9.0