WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/23/2012 05:56:42 PM (8 years ago)
Author:
nacin
Message:

Customize API shuffling.

  • Rename WP_Customize to WP_Customize_Manager.
  • Move customize-controls.php to wp-admin/customize.php.
  • Make customize.php the formal entry point, rather than admin.php?customize=on.
  • Rename is_current_theme_active() to is_theme_active().
  • Add getters for the theme, settings, controls, and sections properties.
  • Allow customize.php (no ?theme=) to load the active theme. Not used yet.

see #20736.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/customize.php

    r20847 r20852  
    88 */
    99
    10 if ( ! defined( 'ABSPATH' ) )
    11     die;
     10require_once( './admin.php' );
     11if ( ! current_user_can( 'edit_theme_options' ) )
     12    die( 'Cap check failed' );
    1213
    13 global $wp_scripts;
     14global $wp_scripts, $wp_customize;
     15
     16if ( ! $wp_customize->is_preview() )
     17    die( 'is_preview() failed' );
     18
     19wp_reset_vars( array( 'theme' ) );
     20
     21if ( ! $theme )
     22    $theme = get_stylesheet();
    1423
    1524$registered = $wp_scripts->registered;
     
    3443_wp_admin_html_begin();
    3544
    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') ) ) );
    3746?><title><?php echo $admin_title; ?></title><?php
    3847
     
    5463                <div class="customize-section-title">
    5564                    <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>
    5766                </div>
    5867                <div class="customize-section-content">
    59                     <?php if ( $screenshot = $this->theme->get_screenshot() ) : ?>
     68                    <?php if ( $screenshot = $wp_customize->theme()->get_screenshot() ) : ?>
    6069                        <img class="theme-screenshot" src="<?php echo esc_url( $screenshot ); ?>" />
    6170                    <?php endif; ?>
    6271
    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>
    6574                    <?php endif; ?>
    6675                </div>
     
    6978            <div id="customize-theme-controls"><ul>
    7079                <?php
    71                 foreach ( $this->sections as $section )
     80                foreach ( $wp_customize->sections() as $section )
    7281                    $section->maybe_render();
    7382                ?>
     
    7786        <div id="customize-footer-actions" class="wp-full-overlay-footer">
    7887            <?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');
    8089            submit_button( $save_text, 'primary', 'save', false );
    8190            ?>
     
    109118    $settings = array(
    110119        '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(),
    113122        ),
    114123        'url'      => array(
     
    121130    );
    122131
    123     foreach ( $this->settings as $id => $setting ) {
     132    foreach ( $wp_customize->settings() as $id => $setting ) {
    124133        $settings['settings'][ $id ] = array(
    125134            'value'     => $setting->js_value(),
     
    128137    }
    129138
    130     foreach ( $this->controls as $id => $control ) {
     139    foreach ( $wp_customize->controls() as $id => $control ) {
    131140        $control->to_json();
    132141        $settings['controls'][ $id ] = $control->json;
Note: See TracChangeset for help on using the changeset viewer.