Changeset 43571 for trunk/src/wp-includes/class-wp-customize-manager.php
- Timestamp:
- 08/17/2018 01:50:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-manager.php
r43535 r43571 1479 1479 1480 1480 $this->set_post_value( 1481 $nav_menu_setting_id, array( 1481 $nav_menu_setting_id, 1482 array( 1482 1483 'name' => isset( $nav_menu['name'] ) ? $nav_menu['name'] : $nav_menu_location, 1483 1484 ) … … 2277 2278 public function validate_setting_values( $setting_values, $options = array() ) { 2278 2279 $options = wp_parse_args( 2279 $options, array( 2280 $options, 2281 array( 2280 2282 'validate_capability' => false, 2281 2283 'validate_existence' => false, … … 2714 2716 ); 2715 2717 $setting_validities = $this->validate_setting_values( 2716 $validated_values, array( 2718 $validated_values, 2719 array( 2717 2720 'validate_capability' => true, 2718 2721 'validate_existence' => true, … … 4015 4018 $l10n = array( 4016 4019 /* translators: %s: User who is customizing the changeset in customizer. */ 4017 'locked' => __( '%s is already customizing this changeset. Please wait until they are done to try customizing. Your latest changes have been autosaved.' ),4020 'locked' => __( '%s is already customizing this changeset. Please wait until they are done to try customizing. Your latest changes have been autosaved.' ), 4018 4021 /* translators: %s: User who is customizing the changeset in customizer. */ 4019 4022 'locked_allow_override' => __( '%s is already customizing this changeset. Do you want to take over?' ), … … 4022 4025 $l10n = array( 4023 4026 /* translators: %s: User who is customizing the changeset in customizer. */ 4024 'locked' => __( '%s is already customizing this site. Please wait until they are done to try customizing. Your latest changes have been autosaved.' ),4027 'locked' => __( '%s is already customizing this site. Please wait until they are done to try customizing. Your latest changes have been autosaved.' ), 4025 4028 /* translators: %s: User who is customizing the changeset in customizer. */ 4026 4029 'locked_allow_override' => __( '%s is already customizing this site. Do you want to take over?' ), … … 4030 4033 foreach ( $this->registered_control_types as $control_type ) { 4031 4034 $control = new $control_type( 4032 $this, 'temp', array( 4035 $this, 4036 'temp', 4037 array( 4033 4038 'settings' => array(), 4034 4039 ) … … 4307 4312 $controls = array(); 4308 4313 $this->controls = wp_list_sort( 4309 $this->controls, array( 4314 $this->controls, 4315 array( 4310 4316 'priority' => 'ASC', 4311 4317 'instance_number' => 'ASC', 4312 ), 'ASC', true 4318 ), 4319 'ASC', 4320 true 4313 4321 ); 4314 4322 … … 4325 4333 // Prepare sections. 4326 4334 $this->sections = wp_list_sort( 4327 $this->sections, array( 4335 $this->sections, 4336 array( 4328 4337 'priority' => 'ASC', 4329 4338 'instance_number' => 'ASC', 4330 ), 'ASC', true 4339 ), 4340 'ASC', 4341 true 4331 4342 ); 4332 4343 $sections = array(); … … 4338 4349 4339 4350 $section->controls = wp_list_sort( 4340 $section->controls, array( 4351 $section->controls, 4352 array( 4341 4353 'priority' => 'ASC', 4342 4354 'instance_number' => 'ASC', … … 4358 4370 // Prepare panels. 4359 4371 $this->panels = wp_list_sort( 4360 $this->panels, array( 4372 $this->panels, 4373 array( 4361 4374 'priority' => 'ASC', 4362 4375 'instance_number' => 'ASC', 4363 ), 'ASC', true 4376 ), 4377 'ASC', 4378 true 4364 4379 ); 4365 4380 $panels = array(); … … 4371 4386 4372 4387 $panel->sections = wp_list_sort( 4373 $panel->sections, array( 4388 $panel->sections, 4389 array( 4374 4390 'priority' => 'ASC', 4375 4391 'instance_number' => 'ASC', 4376 ), 'ASC', true 4392 ), 4393 'ASC', 4394 true 4377 4395 ); 4378 4396 $panels[ $panel->id ] = $panel; … … 4383 4401 $this->containers = array_merge( $this->panels, $this->sections ); 4384 4402 $this->containers = wp_list_sort( 4385 $this->containers, array( 4403 $this->containers, 4404 array( 4386 4405 'priority' => 'ASC', 4387 4406 'instance_number' => 'ASC', 4388 ), 'ASC', true 4407 ), 4408 'ASC', 4409 true 4389 4410 ); 4390 4411 } … … 4403 4424 wp_enqueue_script( 'updates' ); 4404 4425 wp_localize_script( 4405 'updates', '_wpUpdatesItemCounts', array( 4426 'updates', 4427 '_wpUpdatesItemCounts', 4428 array( 4406 4429 'totals' => wp_get_update_data(), 4407 4430 ) … … 4643 4666 'interim-login' => 1, 4644 4667 'customize-login' => 1, 4645 ), wp_login_url() 4668 ), 4669 wp_login_url() 4646 4670 ); 4647 4671 … … 4841 4865 } 4842 4866 echo "})( _wpCustomizeSettings.controls );\n"; 4843 ?>4867 ?> 4844 4868 </script> 4845 4869 <?php … … 4892 4916 $this->add_panel( 4893 4917 new WP_Customize_Themes_Panel( 4894 $this, 'themes', array( 4918 $this, 4919 'themes', 4920 array( 4895 4921 'title' => $this->theme()->display( 'Name' ), 4896 4922 'description' => ( … … 4906 4932 $this->add_section( 4907 4933 new WP_Customize_Themes_Section( 4908 $this, 'installed_themes', array( 4934 $this, 4935 'installed_themes', 4936 array( 4909 4937 'title' => __( 'Installed themes' ), 4910 4938 'action' => 'installed', … … 4919 4947 $this->add_section( 4920 4948 new WP_Customize_Themes_Section( 4921 $this, 'wporg_themes', array( 4949 $this, 4950 'wporg_themes', 4951 array( 4922 4952 'title' => __( 'WordPress.org themes' ), 4923 4953 'action' => 'wporg', … … 4934 4964 $this->add_setting( 4935 4965 new WP_Customize_Filter_Setting( 4936 $this, 'active_theme', array( 4966 $this, 4967 'active_theme', 4968 array( 4937 4969 'capability' => 'switch_themes', 4938 4970 ) … … 4943 4975 4944 4976 $this->add_section( 4945 'title_tagline', array( 4977 'title_tagline', 4978 array( 4946 4979 'title' => __( 'Site Identity' ), 4947 4980 'priority' => 20, … … 4950 4983 4951 4984 $this->add_setting( 4952 'blogname', array( 4985 'blogname', 4986 array( 4953 4987 'default' => get_option( 'blogname' ), 4954 4988 'type' => 'option', … … 4958 4992 4959 4993 $this->add_control( 4960 'blogname', array( 4994 'blogname', 4995 array( 4961 4996 'label' => __( 'Site Title' ), 4962 4997 'section' => 'title_tagline', … … 4965 5000 4966 5001 $this->add_setting( 4967 'blogdescription', array( 5002 'blogdescription', 5003 array( 4968 5004 'default' => get_option( 'blogdescription' ), 4969 5005 'type' => 'option', … … 4973 5009 4974 5010 $this->add_control( 4975 'blogdescription', array( 5011 'blogdescription', 5012 array( 4976 5013 'label' => __( 'Tagline' ), 4977 5014 'section' => 'title_tagline', … … 4982 5019 if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) { 4983 5020 $this->add_setting( 4984 'header_text', array( 5021 'header_text', 5022 array( 4985 5023 'theme_supports' => array( 'custom-logo', 'header-text' ), 4986 5024 'default' => 1, … … 4990 5028 4991 5029 $this->add_control( 4992 'header_text', array( 5030 'header_text', 5031 array( 4993 5032 'label' => __( 'Display Site Title and Tagline' ), 4994 5033 'section' => 'title_tagline', … … 5000 5039 5001 5040 $this->add_setting( 5002 'site_icon', array( 5041 'site_icon', 5042 array( 5003 5043 'type' => 'option', 5004 5044 'capability' => 'manage_options', … … 5009 5049 $this->add_control( 5010 5050 new WP_Customize_Site_Icon_Control( 5011 $this, 'site_icon', array( 5051 $this, 5052 'site_icon', 5053 array( 5012 5054 'label' => __( 'Site Icon' ), 5013 5055 'description' => sprintf( … … 5026 5068 5027 5069 $this->add_setting( 5028 'custom_logo', array( 5070 'custom_logo', 5071 array( 5029 5072 'theme_supports' => array( 'custom-logo' ), 5030 5073 'transport' => 'postMessage', … … 5035 5078 $this->add_control( 5036 5079 new WP_Customize_Cropped_Image_Control( 5037 $this, 'custom_logo', array( 5080 $this, 5081 'custom_logo', 5082 array( 5038 5083 'label' => __( 'Logo' ), 5039 5084 'section' => 'title_tagline', … … 5057 5102 5058 5103 $this->selective_refresh->add_partial( 5059 'custom_logo', array( 5104 'custom_logo', 5105 array( 5060 5106 'settings' => array( 'custom_logo' ), 5061 5107 'selector' => '.custom-logo-link', … … 5068 5114 5069 5115 $this->add_section( 5070 'colors', array( 5116 'colors', 5117 array( 5071 5118 'title' => __( 'Colors' ), 5072 5119 'priority' => 40, … … 5075 5122 5076 5123 $this->add_setting( 5077 'header_textcolor', array( 5124 'header_textcolor', 5125 array( 5078 5126 'theme_supports' => array( 'custom-header', 'header-text' ), 5079 5127 'default' => get_theme_support( 'custom-header', 'default-text-color' ), … … 5087 5135 // With custom value 5088 5136 $this->add_control( 5089 'display_header_text', array( 5137 'display_header_text', 5138 array( 5090 5139 'settings' => 'header_textcolor', 5091 5140 'label' => __( 'Display Site Title and Tagline' ), … … 5098 5147 $this->add_control( 5099 5148 new WP_Customize_Color_Control( 5100 $this, 'header_textcolor', array( 5149 $this, 5150 'header_textcolor', 5151 array( 5101 5152 'label' => __( 'Header Text Color' ), 5102 5153 'section' => 'colors', … … 5108 5159 // With sanitize_callback 5109 5160 $this->add_setting( 5110 'background_color', array( 5161 'background_color', 5162 array( 5111 5163 'default' => get_theme_support( 'custom-background', 'default-color' ), 5112 5164 'theme_supports' => 'custom-background', … … 5119 5171 $this->add_control( 5120 5172 new WP_Customize_Color_Control( 5121 $this, 'background_color', array( 5173 $this, 5174 'background_color', 5175 array( 5122 5176 'label' => __( 'Background Color' ), 5123 5177 'section' => 'colors', … … 5163 5217 5164 5218 $this->add_section( 5165 'header_image', array( 5219 'header_image', 5220 array( 5166 5221 'title' => $title, 5167 5222 'description' => $description, … … 5172 5227 5173 5228 $this->add_setting( 5174 'header_video', array( 5229 'header_video', 5230 array( 5175 5231 'theme_supports' => array( 'custom-header', 'video' ), 5176 5232 'transport' => 'postMessage', … … 5181 5237 5182 5238 $this->add_setting( 5183 'external_header_video', array( 5239 'external_header_video', 5240 array( 5184 5241 'theme_supports' => array( 'custom-header', 'video' ), 5185 5242 'transport' => 'postMessage', … … 5191 5248 $this->add_setting( 5192 5249 new WP_Customize_Filter_Setting( 5193 $this, 'header_image', array( 5250 $this, 5251 'header_image', 5252 array( 5194 5253 'default' => sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() ), 5195 5254 'theme_supports' => 'custom-header', … … 5200 5259 $this->add_setting( 5201 5260 new WP_Customize_Header_Image_Setting( 5202 $this, 'header_image_data', array( 5261 $this, 5262 'header_image_data', 5263 array( 5203 5264 'theme_supports' => 'custom-header', 5204 5265 ) … … 5218 5279 $this->add_control( 5219 5280 new WP_Customize_Media_Control( 5220 $this, 'header_video', array( 5281 $this, 5282 'header_video', 5283 array( 5221 5284 'theme_supports' => array( 'custom-header', 'video' ), 5222 5285 'label' => __( 'Header Video' ), … … 5230 5293 5231 5294 $this->add_control( 5232 'external_header_video', array( 5295 'external_header_video', 5296 array( 5233 5297 'theme_supports' => array( 'custom-header', 'video' ), 5234 5298 'type' => 'url', … … 5242 5306 5243 5307 $this->selective_refresh->add_partial( 5244 'custom_header', array( 5308 'custom_header', 5309 array( 5245 5310 'selector' => '#wp-custom-header', 5246 5311 'render_callback' => 'the_custom_header_markup', … … 5253 5318 5254 5319 $this->add_section( 5255 'background_image', array( 5320 'background_image', 5321 array( 5256 5322 'title' => __( 'Background Image' ), 5257 5323 'theme_supports' => 'custom-background', … … 5261 5327 5262 5328 $this->add_setting( 5263 'background_image', array( 5329 'background_image', 5330 array( 5264 5331 'default' => get_theme_support( 'custom-background', 'default-image' ), 5265 5332 'theme_supports' => 'custom-background', … … 5270 5337 $this->add_setting( 5271 5338 new WP_Customize_Background_Image_Setting( 5272 $this, 'background_image_thumb', array( 5339 $this, 5340 'background_image_thumb', 5341 array( 5273 5342 'theme_supports' => 'custom-background', 5274 5343 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), … … 5280 5349 5281 5350 $this->add_setting( 5282 'background_preset', array( 5351 'background_preset', 5352 array( 5283 5353 'default' => get_theme_support( 'custom-background', 'default-preset' ), 5284 5354 'theme_supports' => 'custom-background', … … 5288 5358 5289 5359 $this->add_control( 5290 'background_preset', array( 5360 'background_preset', 5361 array( 5291 5362 'label' => _x( 'Preset', 'Background Preset' ), 5292 5363 'section' => 'background_image', … … 5303 5374 5304 5375 $this->add_setting( 5305 'background_position_x', array( 5376 'background_position_x', 5377 array( 5306 5378 'default' => get_theme_support( 'custom-background', 'default-position-x' ), 5307 5379 'theme_supports' => 'custom-background', … … 5311 5383 5312 5384 $this->add_setting( 5313 'background_position_y', array( 5385 'background_position_y', 5386 array( 5314 5387 'default' => get_theme_support( 'custom-background', 'default-position-y' ), 5315 5388 'theme_supports' => 'custom-background', … … 5320 5393 $this->add_control( 5321 5394 new WP_Customize_Background_Position_Control( 5322 $this, 'background_position', array( 5395 $this, 5396 'background_position', 5397 array( 5323 5398 'label' => __( 'Image Position' ), 5324 5399 'section' => 'background_image', … … 5332 5407 5333 5408 $this->add_setting( 5334 'background_size', array( 5409 'background_size', 5410 array( 5335 5411 'default' => get_theme_support( 'custom-background', 'default-size' ), 5336 5412 'theme_supports' => 'custom-background', … … 5340 5416 5341 5417 $this->add_control( 5342 'background_size', array( 5418 'background_size', 5419 array( 5343 5420 'label' => __( 'Image Size' ), 5344 5421 'section' => 'background_image', … … 5353 5430 5354 5431 $this->add_setting( 5355 'background_repeat', array( 5432 'background_repeat', 5433 array( 5356 5434 'default' => get_theme_support( 'custom-background', 'default-repeat' ), 5357 5435 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), … … 5361 5439 5362 5440 $this->add_control( 5363 'background_repeat', array( 5441 'background_repeat', 5442 array( 5364 5443 'label' => __( 'Repeat Background Image' ), 5365 5444 'section' => 'background_image', … … 5369 5448 5370 5449 $this->add_setting( 5371 'background_attachment', array( 5450 'background_attachment', 5451 array( 5372 5452 'default' => get_theme_support( 'custom-background', 'default-attachment' ), 5373 5453 'sanitize_callback' => array( $this, '_sanitize_background_setting' ), … … 5377 5457 5378 5458 $this->add_control( 5379 'background_attachment', array( 5459 'background_attachment', 5460 array( 5380 5461 'label' => __( 'Scroll with Page' ), 5381 5462 'section' => 'background_image', … … 5399 5480 5400 5481 $this->add_section( 5401 'static_front_page', array( 5482 'static_front_page', 5483 array( 5402 5484 'title' => __( 'Homepage Settings' ), 5403 5485 'priority' => 120, … … 5408 5490 5409 5491 $this->add_setting( 5410 'show_on_front', array( 5492 'show_on_front', 5493 array( 5411 5494 'default' => get_option( 'show_on_front' ), 5412 5495 'capability' => 'manage_options', … … 5416 5499 5417 5500 $this->add_control( 5418 'show_on_front', array( 5501 'show_on_front', 5502 array( 5419 5503 'label' => __( 'Your homepage displays' ), 5420 5504 'section' => 'static_front_page', … … 5428 5512 5429 5513 $this->add_setting( 5430 'page_on_front', array( 5514 'page_on_front', 5515 array( 5431 5516 'type' => 'option', 5432 5517 'capability' => 'manage_options', … … 5435 5520 5436 5521 $this->add_control( 5437 'page_on_front', array( 5522 'page_on_front', 5523 array( 5438 5524 'label' => __( 'Homepage' ), 5439 5525 'section' => 'static_front_page', … … 5444 5530 5445 5531 $this->add_setting( 5446 'page_for_posts', array( 5532 'page_for_posts', 5533 array( 5447 5534 'type' => 'option', 5448 5535 'capability' => 'manage_options', … … 5451 5538 5452 5539 $this->add_control( 5453 'page_for_posts', array( 5540 'page_for_posts', 5541 array( 5454 5542 'label' => __( 'Posts page' ), 5455 5543 'section' => 'static_front_page', … … 5499 5587 5500 5588 $this->add_section( 5501 'custom_css', array( 5589 'custom_css', 5590 array( 5502 5591 'title' => __( 'Additional CSS' ), 5503 5592 'priority' => 200, … … 5508 5597 5509 5598 $custom_css_setting = new WP_Customize_Custom_CSS_Setting( 5510 $this, sprintf( 'custom_css[%s]', get_stylesheet() ), array( 5599 $this, 5600 sprintf( 'custom_css[%s]', get_stylesheet() ), 5601 array( 5511 5602 'capability' => 'edit_css', 5512 5603 'default' => '', … … 5517 5608 $this->add_control( 5518 5609 new WP_Customize_Code_Editor_Control( 5519 $this, 'custom_css', array( 5610 $this, 5611 'custom_css', 5612 array( 5520 5613 'label' => __( 'CSS code' ), 5521 5614 'section' => 'custom_css', … … 5660 5753 'theme' => $theme->slug, 5661 5754 '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ), 5662 ), $update_php 5755 ), 5756 $update_php 5663 5757 ); 5664 5758 … … 5833 5927 if ( '.mp4' !== substr( $video, -4 ) && '.mov' !== substr( $video, -4 ) ) { // Check for .mp4 or .mov format, which (assuming h.264 encoding) are the only cross-browser-supported formats. 5834 5928 $validity->add( 5835 'invalid_file_type', sprintf( 5929 'invalid_file_type', 5930 sprintf( 5836 5931 /* translators: 1: .mp4, 2: .mov */ 5837 5932 __( 'Only %1$s or %2$s files may be used for header video. Please convert your video file and try again, or, upload your video to YouTube and link it with the option below.' ),
Note: See TracChangeset
for help on using the changeset viewer.