Changeset 27398 for trunk/src/wp-includes/class-wp-customize-setting.php
- Timestamp:
- 03/04/2014 08:20:28 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-setting.php
r27262 r27398 2 2 /** 3 3 * Customize Setting Class. 4 * 5 * Handles saving and sanitizing of settings. 4 6 * 5 7 * @package WordPress … … 8 10 */ 9 11 class WP_Customize_Setting { 12 /** 13 * @access public 14 * @var WP_Customize_Manager 15 */ 10 16 public $manager; 17 18 /** 19 * @access public 20 * @var string 21 */ 11 22 public $id; 12 23 13 public $type = 'theme_mod'; 14 public $capability = 'edit_theme_options'; 24 /** 25 * @access public 26 * @var string 27 */ 28 public $type = 'theme_mod'; 29 30 /** 31 * Capability required to edit this setting. 32 * 33 * @var string 34 */ 35 public $capability = 'edit_theme_options'; 36 37 /** 38 * Feature a theme is required to support to enable this setting. 39 * 40 * @access public 41 * @var string 42 */ 15 43 public $theme_supports = ''; 16 44 public $default = ''; 17 45 public $transport = 'refresh'; 18 46 47 /** 48 * Server-side sanitization callback for the setting's value. 49 * 50 * @var callback 51 */ 19 52 public $sanitize_callback = ''; 20 53 public $sanitize_js_callback = ''; 21 54 22 55 protected $id_data = array(); 23 private $_post_value; // Cached, sanitized $_POST value. 56 57 /** 58 * Cached and sanitized $_POST value for the setting. 59 * 60 * @access private 61 * @var mixed 62 */ 63 private $_post_value; 24 64 25 65 /** 26 66 * Constructor. 27 67 * 68 * Any supplied $args override class property defaults. 69 * 28 70 * @since 3.4.0 29 71 * 30 72 * @param WP_Customize_Manager $manager 31 * @param string $idAn specific ID of the setting. Can be a32 * theme mod or option name.33 * @param array $argsSetting arguments.34 * @return WP_Customize_Setting 73 * @param string $id An specific ID of the setting. Can be a 74 * theme mod or option name. 75 * @param array $args Setting arguments. 76 * @return WP_Customize_Setting $setting 35 77 */ 36 78 function __construct( $manager, $id, $args = array() ) { … … 99 141 100 142 /** 101 * Set the value of the parameter for a specific theme. 143 * Check user capabilities and theme supports, and then save 144 * the value of the setting. 102 145 * 103 146 * @since 3.4.0 … … 117 160 118 161 /** 119 * Fetch es, validates, and sanitizes the $_POST value.162 * Fetch and sanitize the $_POST value for the setting. 120 163 * 121 164 * @since 3.4.0 … … 125 168 */ 126 169 public final function post_value( $default = null ) { 170 // Check for a cached value 127 171 if ( isset( $this->_post_value ) ) 128 172 return $this->_post_value; 129 173 174 // Call the manager for the post value 130 175 $result = $this->manager->post_value( $this ); 131 176 … … 150 195 151 196 /** 152 * S et the value of the parameter for a specific theme.197 * Save the value of the setting, using the related API. 153 198 * 154 199 * @since 3.4.0 … … 191 236 192 237 /** 193 * Update the theme mod from the value of the parameter.238 * Update the option from the value of the setting. 194 239 * 195 240 * @since 3.4.0 … … 211 256 212 257 /** 213 * Fetch the value of the parameter for a specific theme.214 * 215 * @since 3.4.0 216 * 217 * @return mixed The requestedvalue.258 * Fetch the value of the setting. 259 * 260 * @since 3.4.0 261 * 262 * @return mixed The value. 218 263 */ 219 264 public function value() { 265 // Get the callback that corresponds to the setting type. 220 266 switch( $this->type ) { 221 267 case 'theme_mod' : … … 239 285 240 286 /** 241 * Escape the parameter's value for use in JavaScript.287 * Sanitize the setting's value for use in JavaScript. 242 288 * 243 289 * @since 3.4.0 … … 255 301 256 302 /** 257 * Check if the theme supports the setting and check user capabilities.303 * Validate user capabilities whether the theme supports the setting. 258 304 * 259 305 * @since 3.4.0
Note: See TracChangeset
for help on using the changeset viewer.