Changeset 41750 for trunk/src/wp-includes/class-wp-customize-manager.php
- Timestamp:
- 10/04/2017 08:01:12 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-manager.php
r41749 r41750 3643 3643 <button type="button" class="button-link button-link-delete"><?php _e( 'Discard changes' ); ?></button> 3644 3644 </script> 3645 <script type="text/html" id="tmpl-customize-selected-changeset-status-control"> 3646 <# var inputId = _.uniqueId( 'customize-selected-changeset-status-control-input-' ); #> 3647 <# var descriptionId = _.uniqueId( 'customize-selected-changeset-status-control-description-' ); #> 3648 <# if ( data.label ) { #> 3649 <label for="{{ inputId }}" class="customize-control-title">{{ data.label }}</label> 3650 <# } #> 3651 <# if ( data.description ) { #> 3652 <span id="{{ descriptionId }}" class="description customize-control-description">{{{ data.description }}}</span> 3653 <# } #> 3654 <# _.each( data.choices, function( choice ) { #> 3655 <# var choiceId = inputId + '-' + choice.status; #> 3656 <span class="customize-inside-control-row"> 3657 <input id="{{ choiceId }}" type="radio" value="{{ choice.status }}" name="{{ inputId }}" data-customize-setting-key-link="default"> 3658 <label for="{{ choiceId }}">{{ choice.label }}</label> 3659 </span> 3660 <# } ); #> 3661 </script> 3645 3662 <?php 3646 3663 } … … 4025 4042 } 4026 4043 4044 $current_user_can_publish = current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts ); 4045 4046 // @todo Include all of the status labels here from script-loader.php, and then allow it to be filtered. 4047 $status_choices = array(); 4048 if ( $current_user_can_publish ) { 4049 $status_choices[] = array( 4050 'status' => 'publish', 4051 'label' => __( 'Publish' ), 4052 ); 4053 } 4054 $status_choices[] = array( 4055 'status' => 'draft', 4056 'label' => __( 'Save Draft' ), 4057 ); 4058 if ( $current_user_can_publish ) { 4059 $status_choices[] = array( 4060 'status' => 'future', 4061 'label' => __( 'Schedule' ), 4062 ); 4063 } 4064 4027 4065 // Prepare Customizer settings to pass to JavaScript. 4028 4066 $changeset_post = null; 4029 4067 if ( $changeset_post_id ) { 4030 4068 $changeset_post = get_post( $changeset_post_id ); 4069 } 4070 4071 if ( $this->changeset_post_id() && 'future' === get_post_status( $this->changeset_post_id() ) ) { 4072 $initial_date = get_the_time( 'Y-m-d H:i:s', $this->changeset_post_id() ); 4073 } else { 4074 $initial_date = current_time( 'mysql', false ); 4031 4075 } 4032 4076 … … 4039 4083 'latestAutoDraftUuid' => $autosave_autodraft_post ? $autosave_autodraft_post->post_name : null, 4040 4084 'status' => $changeset_post ? $changeset_post->post_status : '', 4041 'currentUserCanPublish' => current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts ), 4042 'publishDate' => $changeset_post ? $changeset_post->post_date : '', // @todo Only if future status? Rename to just date? 4085 'currentUserCanPublish' => $current_user_can_publish, 4086 'publishDate' => $initial_date, 4087 'statusChoices' => $status_choices, 4043 4088 ), 4044 4089 'initialServerDate' => current_time( 'mysql', false ), 4090 'dateFormat' => get_option( 'date_format' ), 4091 'timeFormat' => get_option( 'time_format' ), 4045 4092 'initialServerTimestamp' => floor( microtime( true ) * 1000 ), 4046 4093 'initialClientTimestamp' => -1, // To be set with JS below. … … 4206 4253 /* Publish Settings */ 4207 4254 4255 // Note the controls for this section are added via JS. 4208 4256 $this->add_section( 'publish_settings', array( 4209 4257 'title' => __( 'Publish Settings' ), … … 4213 4261 'active_callback' => array( $this, 'is_theme_active' ), 4214 4262 ) ); 4215 4216 /* Publish Settings Controls */4217 $status_choices = array(4218 'publish' => __( 'Publish' ),4219 'draft' => __( 'Save Draft' ),4220 'future' => __( 'Schedule' ),4221 );4222 4223 if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts ) ) {4224 unset( $status_choices['publish'] );4225 }4226 4227 $this->add_control( 'changeset_status', array(4228 'section' => 'publish_settings',4229 'priority' => 10,4230 'settings' => array(),4231 'type' => 'radio',4232 'label' => __( 'Action' ),4233 'choices' => $status_choices,4234 'capability' => 'customize',4235 ) );4236 4237 if ( $this->changeset_post_id() && 'future' === get_post_status( $this->changeset_post_id() ) ) {4238 $initial_date = get_the_time( 'Y-m-d H:i:s', $this->changeset_post_id() );4239 } else {4240 $initial_date = current_time( 'mysql', false );4241 }4242 4243 $this->add_control( new WP_Customize_Date_Time_Control( $this, 'changeset_scheduled_date', array(4244 'section' => 'publish_settings',4245 'priority' => 20,4246 'settings' => array(),4247 'type' => 'date_time',4248 'min_year' => date( 'Y' ),4249 'allow_past_date' => false,4250 'include_time' => true,4251 'twelve_hour_format' => false !== stripos( get_option( 'time_format' ), 'a' ),4252 'description' => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),4253 'capability' => 'customize',4254 'default_value' => $initial_date,4255 ) ) );4256 4263 4257 4264 /* Themes (controls are loaded via ajax) */
Note: See TracChangeset
for help on using the changeset viewer.