Ticket #19910: 19910.replace-link.patch
File 19910.replace-link.patch, 4.9 KB (added by , 13 years ago) |
---|
-
wp-includes/js/customize-loader.dev.js
48 48 Loader.initialize(); 49 49 50 50 // Override 'preview' links on themes page. 51 $('.thickbox-preview').click( function( event ) { 52 var href, template, stylesheet; 53 54 // Stop the thickbox. 51 $('.activate-customizer').click( function( event ) { 55 52 event.preventDefault(); 56 event.stopImmediatePropagation();57 53 58 // Extract the template/stylesheet from the preview link's url. 59 href = $(this).attr('href'); 60 template = href.match('template=([^&]*)')[1]; 61 stylesheet = href.match('stylesheet=([^&]*)')[1]; 54 // Extract the template/stylesheet from the data attributes. 55 template = $(this).data( 'template' ); 56 stylesheet = $(this).data( 'stylesheet' ); 62 57 63 58 // Load the theme. 64 59 Loader.open({ 65 60 template: template, 66 61 stylesheet: stylesheet 67 62 }); 68 }).filter( function() { 69 return 'Preview' == $(this).text(); 70 }).text('Customize'); 63 }) 71 64 }); 72 65 73 66 // Expose the API to the world. -
wp-includes/script-loader.php
359 359 360 360 $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 ); 361 361 362 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( ' thickbox' ), false, 1 );362 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'jquery' ), false, 1 ); 363 363 364 364 $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), false, 1 ); 365 365 -
wp-admin/includes/class-wp-themes-list-table.php
11 11 12 12 var $search = array(); 13 13 var $features = array(); 14 14 15 15 function __construct() { 16 16 parent::__construct( array( 17 17 'ajax' => true, … … 145 145 $parent_theme = $themes[$theme_name]['Parent Theme']; 146 146 $theme_root = $themes[$theme_name]['Theme Root']; 147 147 $theme_root_uri = $themes[$theme_name]['Theme Root URI']; 148 $preview_link = esc_url( add_query_arg( array( 'preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => true, 'TB_iframe' => 'true' ), home_url( '/' ) ) );149 $preview_text = esc_attr( sprintf( __( 'Preview of “%s”' ), $title ) );150 148 $tags = $themes[$theme_name]['Tags']; 151 $ thickbox_class = 'thickbox thickbox-preview';149 $customize_data = sprintf( 'data-stylesheet="%s" data-template="%s"', esc_attr( $stylesheet ), esc_attr( $template ) ); 152 150 $activate_link = wp_nonce_url( "themes.php?action=activate&template=" . urlencode( $template ) . "&stylesheet=" . urlencode( $stylesheet ), 'switch-theme_' . $template ); 153 151 $activate_text = esc_attr( sprintf( __( 'Activate “%s”' ), $title ) ); 154 152 $actions = array(); 155 153 $actions[] = '<a href="' . $activate_link . '" class="activatelink" title="' . $activate_text . '">' . __( 'Activate' ) . '</a>'; 156 $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $theme_name ) ) . '">' . __( 'Preview' ) . '</a>';154 $actions[] = '<a class="activate-customizer hide-if-no-js" href="#" title="' . esc_attr( sprintf( __( 'Customize “%s”' ), $theme_name ) ) . '"' . $customize_data . '>' . __( 'Customize' ) . '</a>'; 157 155 if ( ! is_multisite() && current_user_can( 'delete_themes' ) ) 158 156 $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url( "themes.php?action=delete&template=$stylesheet", 'delete-theme_' . $stylesheet ) . '" onclick="' . "return confirm( '" . esc_js( sprintf( __( "You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete." ), $theme_name ) ) . "' );" . '">' . __( 'Delete' ) . '</a>'; 159 157 $actions = apply_filters( 'theme_action_links', $actions, $themes[$theme_name] ); 160 158 161 159 $actions = implode ( ' | ', $actions ); 162 160 ?> 163 <a href=" <?php echo $preview_link; ?>" class="<?php echo $thickbox_class; ?> screenshot">161 <a href="#" class="screenshot activate-customizer" <?php echo $customize_data; ?>> 164 162 <?php if ( $screenshot ) : ?> 165 163 <img src="<?php echo $theme_root_uri . '/' . $stylesheet . '/' . $screenshot; ?>" alt="" /> 166 164 <?php endif; ?> -
wp-admin/themes.php
66 66 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 67 67 ); 68 68 69 add_thickbox();70 wp_enqueue_script( 'theme-preview' );71 69 wp_enqueue_script( 'theme' ); 72 70 73 71 endif;