Changeset 36689 for trunk/src/wp-includes/class-wp-customize-control.php
- Timestamp:
- 02/24/2016 06:27:45 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-control.php
r36114 r36689 64 64 */ 65 65 public $setting = 'default'; 66 67 /** 68 * Capability required to use this control. 69 * 70 * Normally this is empty and the capability is derived from the capabilities 71 * of the associated `$settings`. 72 * 73 * @since 4.5.0 74 * @access public 75 * @var string 76 */ 77 public $capability; 66 78 67 79 /** … … 188 200 189 201 // Process settings. 190 if ( empty( $this->settings ) ) {202 if ( ! isset( $this->settings ) ) { 191 203 $this->settings = $id; 192 204 } … … 197 209 $settings[ $key ] = $this->manager->get_setting( $setting ); 198 210 } 199 } else {211 } else if ( is_string( $this->settings ) ) { 200 212 $this->setting = $this->manager->get_setting( $this->settings ); 201 213 $settings['default'] = $this->setting; … … 300 312 301 313 /** 302 * Check if the theme supports the control and check user capabilities. 314 * Checks if the user can use this control. 315 * 316 * Returns false if the user cannot manipulate one of the associated settings, 317 * or if one of the associated settings does not exist. Also returns false if 318 * the associated section does not exist or if its capability check returns 319 * false. 303 320 * 304 321 * @since 3.4.0 … … 307 324 */ 308 325 final public function check_capabilities() { 326 if ( ! empty( $this->capability ) && ! current_user_can( $this->capability ) ) { 327 return false; 328 } 329 309 330 foreach ( $this->settings as $setting ) { 310 if ( ! $setting ->check_capabilities() )331 if ( ! $setting || ! $setting->check_capabilities() ) { 311 332 return false; 333 } 312 334 } 313 335 314 336 $section = $this->manager->get_section( $this->section ); 315 if ( isset( $section ) && ! $section->check_capabilities() ) 337 if ( isset( $section ) && ! $section->check_capabilities() ) { 316 338 return false; 339 } 317 340 318 341 return true;
Note: See TracChangeset
for help on using the changeset viewer.