Changeset 20419
- Timestamp:
- 04/10/2012 02:25:03 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-upgrader.php
r20329 r20419 712 712 713 713 $this->skin->feedback('parent_theme_prepare_install', $api->name, $api->version); 714 714 715 715 add_filter('install_theme_complete_actions', '__return_false', 999); // Don't show any actions after installing the theme. 716 716 … … 736 736 return $install_result; 737 737 } 738 738 739 739 function hide_activate_preview_actions($actions) { 740 740 unset($actions['activate'], $actions['preview']); … … 1495 1495 1496 1496 $theme_info = $this->upgrader->theme_info(); 1497 if ( empty( $theme_info) )1497 if ( empty( $theme_info ) ) 1498 1498 return; 1499 $name = $theme_info->display('Name'); 1499 1500 $name = $theme_info->display('Name'); 1500 1501 $stylesheet = $this->upgrader->result['destination_name']; 1501 $template = $theme_info->get_template(); 1502 1503 $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => 1, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) ); 1504 $activate_link = wp_nonce_url("themes.php?action=activate&template=" . urlencode($template) . "&stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template); 1505 1506 $install_actions = array( 1507 'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview “%s”'), $name)) . '">' . __('Preview') . '</a>', 1508 'activate' => '<a href="' . $activate_link . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate “%s”'), $name ) ) . '">' . __('Activate') . '</a>' 1509 ); 1502 $template = $theme_info->get_template(); 1503 1504 $preview_link = add_query_arg( array( 1505 'preview' => 1, 1506 'template' => $template, 1507 'stylesheet' => $stylesheet, 1508 ), trailingslashit( get_home_url() ) ); 1509 1510 $customize_attributes = 'title="' . esc_attr( sprintf( __( 'Customize “%s”' ), $name ) ) . '" 1511 . data-customize-template="' . esc_attr( $template ) . '" data-customize-stylesheet="' . esc_attr( $stylesheet ) . '"'; 1512 1513 $activate_link = add_query_arg( array( 1514 'action' => 'activate', 1515 'template' => $template, 1516 'stylesheet' => $stylesheet, 1517 ), admin_url('themes.php') ); 1518 $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $template ); 1519 1520 $install_actions = array(); 1521 $install_actions['preview'] = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-js" title="' . esc_attr(sprintf(__('Preview “%s”'), $name ) ) . '">' . __('Preview') . '</a>'; 1522 $install_actions['preview'] .= '<a href="#" class="hide-if-no-js load-customize" ' . $customize_attributes . '>' . __('Customize') . '</a>'; 1523 $install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate “%s”'), $name ) ) . '">' . __('Activate') . '</a>'; 1510 1524 1511 1525 if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) … … 1551 1565 $update_actions = array(); 1552 1566 if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) { 1553 $name = $theme_info->display('Name');1567 $name = $theme_info->display('Name'); 1554 1568 $stylesheet = $this->upgrader->result['destination_name']; 1555 $template = $theme_info->get_template(); 1556 1557 $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) ); 1558 $activate_link = wp_nonce_url("themes.php?action=activate&template=" . urlencode($template) . "&stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template); 1559 1560 $update_actions['preview'] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview “%s”'), $name)) . '">' . __('Preview') . '</a>'; 1561 $update_actions['activate'] = '<a href="' . $activate_link . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate “%s”'), $name ) ) . '">' . __('Activate') . '</a>'; 1562 1563 if ( ( ! $this->result || is_wp_error($this->result) ) || $stylesheet == get_stylesheet() ) 1569 $template = $theme_info->get_template(); 1570 1571 $preview_link = add_query_arg( array( 1572 'preview' => 1, 1573 'template' => $template, 1574 'stylesheet' => $stylesheet, 1575 ), trailingslashit( get_home_url() ) ); 1576 1577 $customize_attributes = 'title="' . esc_attr( sprintf( __( 'Customize “%s”' ), $name ) ) . '" 1578 . data-customize-template="' . esc_attr( $template ) . '" data-customize-stylesheet="' . esc_attr( $stylesheet ) . '"'; 1579 1580 $activate_link = add_query_arg( array( 1581 'action' => 'activate', 1582 'template' => $template, 1583 'stylesheet' => $stylesheet, 1584 ), admin_url('themes.php') ); 1585 $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $template ); 1586 1587 $update_actions['preview'] = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-js" title="' . esc_attr(sprintf(__('Preview “%s”'), $name ) ) . '">' . __('Preview') . '</a>'; 1588 $update_actions['preview'] .= '<a href="#" class="hide-if-no-js load-customize" ' . $customize_attributes . '>' . __('Customize') . '</a>'; 1589 $update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate “%s”'), $name ) ) . '">' . __('Activate') . '</a>'; 1590 1591 if ( ( ! $this->result || is_wp_error( $this->result ) ) || $stylesheet == get_stylesheet() ) 1564 1592 unset($update_actions['preview'], $update_actions['activate']); 1565 1593 } -
trunk/wp-admin/theme-install.php
r19887 r20419 31 31 32 32 wp_enqueue_script( 'theme-install' ); 33 34 add_thickbox();35 wp_enqueue_script( 'theme-preview' );36 33 wp_enqueue_script( 'theme' ); 37 34 -
trunk/wp-admin/themes.php
r20354 r20419 67 67 ); 68 68 69 add_thickbox();70 wp_enqueue_script( 'theme-preview' );71 69 wp_enqueue_script( 'theme' ); 70 wp_customize_loader(); 72 71 73 72 endif; -
trunk/wp-admin/update.php
r20267 r20419 153 153 check_admin_referer('upgrade-theme_' . $theme); 154 154 155 add_thickbox();156 wp_enqueue_script('theme-preview'); 155 wp_customize_loader(); 156 157 157 $title = __('Update Theme'); 158 158 $parent_file = 'themes.php'; … … 205 205 wp_die($api); 206 206 207 add_thickbox();208 wp_enqueue_script('theme-preview'); 207 wp_customize_loader(); 208 209 209 $title = __('Install Themes'); 210 210 $parent_file = 'themes.php'; … … 231 231 $file_upload = new File_Upload_Upgrader('themezip', 'package'); 232 232 233 wp_customize_loader(); 234 233 235 $title = __('Upload Theme'); 234 236 $parent_file = 'themes.php'; 235 237 $submenu_file = 'theme-install.php'; 236 add_thickbox(); 237 wp_enqueue_script('theme-preview'); 238 238 239 require_once(ABSPATH . 'wp-admin/admin-header.php'); 239 240 -
trunk/wp-includes/class-wp-customize.php
r20392 r20419 30 30 add_action( 'admin_init', array( $this, 'admin_init' ) ); 31 31 add_action( 'wp_loaded', array( $this, 'wp_loaded' ) ); 32 add_action( 'admin_footer', array( $this, 'admin_footer' ) );33 32 34 33 add_action( 'customize_previewing', array( $this, 'customize_previewing' ) ); … … 276 275 $this->save(); 277 276 278 wp_enqueue_script( 'customize-loader' );279 280 277 if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) 281 278 return; … … 293 290 294 291 die; 295 }296 297 /**298 * Print the customize template.299 *300 * @since 3.4.0301 */302 public function admin_footer() {303 ?>304 <div id="customize-container" class="wp-full-overlay">305 <input type="hidden" class="admin-url" value="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>" />306 <a href="#" class="close-full-overlay"><?php printf( __( '← Return to %s' ), get_admin_page_title() ); ?></a>307 <a href="#" class="collapse-sidebar button-secondary" title="<?php esc_attr_e('Collapse Sidebar'); ?>">308 <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span>309 <span class="collapse-sidebar-arrow"></span>310 </a>311 </div>312 <?php313 292 } 314 293 -
trunk/wp-includes/general-template.php
r20417 r20419 2109 2109 * 2110 2110 * If any of the settings need to be changed, this can be done with another js 2111 * file similar to media-upload.js and theme-preview.js. That file should2111 * file similar to media-upload.js. That file should 2112 2112 * require array('thickbox') to ensure it is loaded after. 2113 2113 * -
trunk/wp-includes/js/customize-loader.dev.js
r20352 r20419 42 42 Loader.initialize(); 43 43 44 $('# current-theme, #availablethemes').on( 'click', '.load-customize', function( event ) {44 $('#wpbody').on( 'click', '.load-customize', function( event ) { 45 45 var load = $(this); 46 46 -
trunk/wp-includes/script-loader.php
r20358 r20419 365 365 $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 ); 366 366 367 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'thickbox' ), false, 1 ); 368 367 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'jquery' ), false, 1 ); 368 369 // @todo: Core no longer uses theme-preview.js. Remove? 369 370 $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), false, 1 ); 370 371 -
trunk/wp-includes/theme.php
r20375 r20419 1564 1564 } 1565 1565 1566 function wp_customize_load() { 1566 /** 1567 * Includes and instantiates the WP_Customize class. 1568 * 1569 * Fires when ?customize=on. 1570 * 1571 * @since 3.4.0 1572 */ 1573 function _wp_customize_include() { 1567 1574 // Load on themes.php or ?customize=on 1568 if ( ! ( isset( $_REQUEST['customize'] ) && 'on' == $_REQUEST['customize'] ) && 'themes.php' != $GLOBALS['pagenow'])1575 if ( ! ( isset( $_REQUEST['customize'] ) && 'on' == $_REQUEST['customize'] ) ) 1569 1576 return; 1570 1577 … … 1574 1581 $GLOBALS['customize'] = new WP_Customize; 1575 1582 } 1576 add_action( 'plugins_loaded', 'wp_customize_load' ); 1583 add_action( 'plugins_loaded', '_wp_customize_include' ); 1584 1585 /** 1586 * Includes the loading scripts for the theme customizer and 1587 * adds the action to print the customize container template. 1588 * 1589 * @since 3.4.0 1590 */ 1591 function wp_customize_loader() { 1592 wp_enqueue_script( 'customize-loader' ); 1593 add_action( 'admin_footer', '_wp_customize_loader_template' ); 1594 } 1595 1596 /** 1597 * Print the customize container template. 1598 * 1599 * @since 3.4.0 1600 */ 1601 function _wp_customize_loader_template() { 1602 ?> 1603 <div id="customize-container" class="wp-full-overlay"> 1604 <input type="hidden" class="admin-url" value="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>" /> 1605 <a href="#" class="close-full-overlay"><?php printf( __( '← Return to %s' ), get_admin_page_title() ); ?></a> 1606 <a href="#" class="collapse-sidebar button-secondary" title="<?php esc_attr_e('Collapse Sidebar'); ?>"> 1607 <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span> 1608 <span class="collapse-sidebar-arrow"></span> 1609 </a> 1610 </div> 1611 <?php 1612 }
Note: See TracChangeset
for help on using the changeset viewer.