Changeset 20852
- Timestamp:
- 05/23/2012 05:56:42 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/customize.php
r20847 r20852 8 8 */ 9 9 10 if ( ! defined( 'ABSPATH' ) ) 11 die; 10 require_once( './admin.php' ); 11 if ( ! current_user_can( 'edit_theme_options' ) ) 12 die( 'Cap check failed' ); 12 13 13 global $wp_scripts; 14 global $wp_scripts, $wp_customize; 15 16 if ( ! $wp_customize->is_preview() ) 17 die( 'is_preview() failed' ); 18 19 wp_reset_vars( array( 'theme' ) ); 20 21 if ( ! $theme ) 22 $theme = get_stylesheet(); 14 23 15 24 $registered = $wp_scripts->registered; … … 34 43 _wp_admin_html_begin(); 35 44 36 $admin_title = sprintf( __( '%1$s — WordPress' ), strip_tags( sprintf( __( 'Customize %s' ), $ this->theme->display('Name') ) ) );45 $admin_title = sprintf( __( '%1$s — WordPress' ), strip_tags( sprintf( __( 'Customize %s' ), $wp_customize->theme()->display('Name') ) ) ); 37 46 ?><title><?php echo $admin_title; ?></title><?php 38 47 … … 54 63 <div class="customize-section-title"> 55 64 <span class="preview-notice"><?php _e('You are previewing'); ?></span> 56 <strong class="theme-name"><?php echo $ this->theme->display('Name'); ?></strong>65 <strong class="theme-name"><?php echo $wp_customize->theme()->display('Name'); ?></strong> 57 66 </div> 58 67 <div class="customize-section-content"> 59 <?php if ( $screenshot = $ this->theme->get_screenshot() ) : ?>68 <?php if ( $screenshot = $wp_customize->theme()->get_screenshot() ) : ?> 60 69 <img class="theme-screenshot" src="<?php echo esc_url( $screenshot ); ?>" /> 61 70 <?php endif; ?> 62 71 63 <?php if ( $ this->theme->get('Description') ): ?>64 <div class="theme-description"><?php echo $ this->theme->display('Description'); ?></div>72 <?php if ( $wp_customize->theme()->get('Description') ): ?> 73 <div class="theme-description"><?php echo $wp_customize->theme()->display('Description'); ?></div> 65 74 <?php endif; ?> 66 75 </div> … … 69 78 <div id="customize-theme-controls"><ul> 70 79 <?php 71 foreach ( $ this->sectionsas $section )80 foreach ( $wp_customize->sections() as $section ) 72 81 $section->maybe_render(); 73 82 ?> … … 77 86 <div id="customize-footer-actions" class="wp-full-overlay-footer"> 78 87 <?php 79 $save_text = $ this->is_current_theme_active() ? __('Save') : __('Save and Activate');88 $save_text = $wp_customize->is_theme_active() ? __('Save') : __('Save and Activate'); 80 89 submit_button( $save_text, 'primary', 'save', false ); 81 90 ?> … … 109 118 $settings = array( 110 119 'theme' => array( 111 'stylesheet' => $ this->get_stylesheet(),112 'active' => $ this->is_current_theme_active(),120 'stylesheet' => $wp_customize->get_stylesheet(), 121 'active' => $wp_customize->is_theme_active(), 113 122 ), 114 123 'url' => array( … … 121 130 ); 122 131 123 foreach ( $ this->settingsas $id => $setting ) {132 foreach ( $wp_customize->settings() as $id => $setting ) { 124 133 $settings['settings'][ $id ] = array( 125 134 'value' => $setting->js_value(), … … 128 137 } 129 138 130 foreach ( $ this->controlsas $id => $control ) {139 foreach ( $wp_customize->controls() as $id => $control ) { 131 140 $control->to_json(); 132 141 $settings['controls'][ $id ] = $control->json; -
trunk/wp-admin/includes/class-wp-plugins-list-table.php
r20525 r20852 70 70 foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { 71 71 if ( isset( $current->response[ $plugin_file ] ) ) { 72 ob_start(); 73 var_dump( $current->response[ $plugin_file ] ); 74 error_log( $plugin_file . ': ' . ob_get_clean() ); 75 } 76 if ( ! empty( $current->response[ $plugin_file ] ) ) { 72 77 $plugins['all'][ $plugin_file ]['update'] = true; 73 78 $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; -
trunk/wp-includes/class-wp-customize-manager.php
r20847 r20852 8 8 */ 9 9 10 final class WP_Customize {10 final class WP_Customize_Manager { 11 11 protected $theme; 12 12 protected $original_stylesheet; … … 33 33 34 34 add_action( 'setup_theme', array( $this, 'setup_theme' ) ); 35 add_action( 'admin_init', array( $this, 'admin_init' ) );36 35 add_action( 'wp_loaded', array( $this, 'wp_loaded' ) ); 37 36 … … 69 68 */ 70 69 public function setup_theme() { 71 if ( ! isset( $_REQUEST['customize'] ) || 'on' != $_REQUEST['customize'])70 if ( ! ( isset( $_REQUEST['customize'] ) && 'on' == $_REQUEST['customize'] ) && ! basename( $_SERVER['PHP_SELF'] ) == 'customize.php' ) 72 71 return; 73 72 … … 91 90 // Initialize $theme and $original_stylesheet if they do not yet exist. 92 91 if ( ! isset( $this->theme ) ) { 93 $this->theme = wp_get_theme( $_REQUEST['theme']);92 $this->theme = wp_get_theme( isset( $_REQUEST['theme'] ) ? $_REQUEST['theme'] : null ); 94 93 if ( ! $this->theme->exists() ) { 95 94 $this->theme = false; … … 146 145 147 146 /** 147 * Generic getter. 148 * 149 * @since 3.4.0 150 * 151 * @return WP_Theme 152 */ 153 public function __call( $callee, $args ) { 154 if ( in_array( $callee, array( 'theme', 'settings', 'controls', 'sections' ) ) ) 155 return $this->$callee; 156 } 157 158 /** 148 159 * Checks if the current theme is active. 149 160 * 150 161 * @since 3.4.0 151 */ 152 public function is_current_theme_active() { 162 * 163 * @return bool 164 */ 165 public function is_theme_active() { 153 166 return $this->get_stylesheet() == $this->original_stylesheet; 154 167 } … … 183 196 } 184 197 185 186 198 /** 187 199 * Print javascript settings. … … 291 303 292 304 /** 293 * Trigger save action and load customize controls.294 *295 * @since 3.4.0296 */297 public function admin_init() {298 if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )299 return;300 301 if ( ! isset( $_GET['customize'] ) || 'on' != $_GET['customize'] )302 return;303 304 if ( empty( $_GET['theme'] ) )305 return;306 307 if ( ! $this->is_preview() )308 return;309 310 if ( ! current_user_can( 'edit_theme_options' ) )311 return;312 313 include( ABSPATH . WPINC . '/customize-controls.php' );314 315 die;316 }317 318 /**319 305 * Switch the theme and trigger the save action of each setting. 320 306 * … … 565 551 566 552 $this->add_setting( 'header_textcolor', array( 567 // @todo: replace with a new accept() setting method 568 // 'sanitize_callback' => 'sanitize_hexcolor', 553 'sanitize_callback' => 'sanitize_header_textcolor', 569 554 'theme_supports' => array( 'custom-header', 'header-text' ), 570 555 'default' => get_theme_support( 'custom-header', 'default-text-color' ), … … 794 779 }; 795 780 781 // Callback function for sanitizing the header textcolor setting. 782 function sanitize_header_textcolor( $color ) { 783 if ( empty( $color ) ) 784 return get_theme_support( 'custom-header', 'default-text-color' ); 785 786 elseif ( $color == 'blank' ) 787 return 'blank'; 788 789 return sanitize_hexcolor( $color ); 790 } 791 796 792 // Callback function for sanitizing a hex color 797 793 function sanitize_hexcolor( $color ) { -
trunk/wp-includes/theme.php
r20802 r20852 1567 1567 1568 1568 /** 1569 * Includes and instantiates the WP_Customize class.1569 * Includes and instantiates the WP_Customize_Manager class. 1570 1570 * 1571 1571 * Fires when ?customize=on. … … 1575 1575 function _wp_customize_include() { 1576 1576 // Load on themes.php or ?customize=on 1577 if ( ! ( isset( $_REQUEST['customize'] ) && 'on' == $_REQUEST['customize']) )1577 if ( ! ( ( isset( $_REQUEST['customize'] ) && 'on' == $_REQUEST['customize'] ) || 'customize.php' == basename( $_SERVER['PHP_SELF'] ) ) ) 1578 1578 return; 1579 1579 1580 require( ABSPATH . WPINC . '/class-wp-customize .php' );1580 require( ABSPATH . WPINC . '/class-wp-customize-manager.php' ); 1581 1581 // Init Customize class 1582 $GLOBALS['wp_customize'] = new WP_Customize ;1582 $GLOBALS['wp_customize'] = new WP_Customize_Manager; 1583 1583 } 1584 1584 add_action( 'plugins_loaded', '_wp_customize_include' ); … … 1605 1605 */ 1606 1606 function wp_customize_url( $stylesheet ) { 1607 return esc_url( admin_url( ' admin.php' ) . '?customize=on&theme=' . $stylesheet );1608 } 1607 return esc_url( admin_url( 'customize.php' ) . '?theme=' . $stylesheet ); 1608 }
Note: See TracChangeset
for help on using the changeset viewer.