Changeset 20248 for trunk/wp-includes/class-wp-customize-setting.php
- Timestamp:
- 03/21/2012 10:55:43 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/class-wp-customize-setting.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-customize-setting.php
r20232 r20248 9 9 10 10 class WP_Customize_Setting { 11 public $manager; 11 12 public $id; 12 13 public $priority = 10; … … 36 37 * @param array $args Setting arguments. 37 38 */ 38 function __construct( $ id, $args = array() ) {39 function __construct( $manager, $id, $args = array() ) { 39 40 $keys = array_keys( get_class_vars( __CLASS__ ) ); 40 41 foreach ( $keys as $key ) { … … 43 44 } 44 45 46 $this->manager = $manager; 45 47 $this->id = $id; 46 48 … … 266 268 */ 267 269 public final function check_capabilities() { 268 global $customize;269 270 270 if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) 271 271 return false; … … 274 274 return false; 275 275 276 $section = $ customize->get_section( $this->section );276 $section = $this->manager->get_section( $this->section ); 277 277 if ( isset( $section ) && ! $section->check_capabilities() ) 278 278 return false; … … 282 282 283 283 /** 284 * Render the control.285 * 286 * @since 3.4.0 287 */ 288 public final function _render() {284 * Check capabiliites and render the control. 285 * 286 * @since 3.4.0 287 */ 288 public final function maybe_render() { 289 289 if ( ! $this->check_capabilities() ) 290 290 return; 291 291 292 do_action( 'customize_render_' . $this->id ); 292 do_action( 'customize_render_setting', $this ); 293 do_action( 'customize_render_setting_' . $this->id, $this ); 293 294 294 295 $this->render(); … … 301 302 */ 302 303 protected function render() { 303 $this->_render_type();304 }305 306 /**307 * Retrieve the name attribute for an input.308 *309 * @since 3.4.0310 *311 * @return string The name.312 */313 public final function get_name() {314 return self::name_prefix . esc_attr( $this->id );315 }316 317 /**318 * Echo the HTML name attribute for an input.319 *320 * @since 3.4.0321 *322 * @return string The HTML name attribute.323 */324 public final function name() {325 echo 'name="' . $this->get_name() . '"';326 }327 328 /**329 * Render the control type.330 *331 * @todo Improve value and checked attributes.332 *333 * @since 3.4.0334 */335 public final function _render_type() {336 304 switch( $this->control ) { 337 305 case 'text': … … 415 383 <?php 416 384 break; 417 default: 418 do_action( 'customize_render_control-' . $this->control, $this ); 419 420 } 385 } 386 } 387 388 /** 389 * Retrieve the name attribute for an input. 390 * 391 * @since 3.4.0 392 * 393 * @return string The name. 394 */ 395 public final function get_name() { 396 return self::name_prefix . esc_attr( $this->id ); 397 } 398 399 /** 400 * Echo the HTML name attribute for an input. 401 * 402 * @since 3.4.0 403 * 404 * @return string The HTML name attribute. 405 */ 406 public final function name() { 407 echo 'name="' . $this->get_name() . '"'; 421 408 } 422 409
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)