Make WordPress Core


Ignore:
Timestamp:
03/04/2014 08:20:28 PM (11 years ago)
Author:
nacin
Message:

Update the Customizer API inline docs.

props ericlewis.
fixes #27065.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-setting.php

    r27262 r27398  
    22/**
    33 * Customize Setting Class.
     4 *
     5 * Handles saving and sanitizing of settings.
    46 *
    57 * @package WordPress
     
    810 */
    911class WP_Customize_Setting {
     12    /**
     13     * @access public
     14     * @var WP_Customize_Manager
     15     */
    1016    public $manager;
     17
     18    /**
     19     * @access public
     20     * @var string
     21     */
    1122    public $id;
    1223
    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     */
    1543    public $theme_supports  = '';
    1644    public $default         = '';
    1745    public $transport       = 'refresh';
    1846
     47    /**
     48     * Server-side sanitization callback for the setting's value.
     49     *
     50     * @var callback
     51     */
    1952    public $sanitize_callback    = '';
    2053    public $sanitize_js_callback = '';
    2154
    2255    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;
    2464
    2565    /**
    2666     * Constructor.
    2767     *
     68     * Any supplied $args override class property defaults.
     69     *
    2870     * @since 3.4.0
    2971     *
    3072     * @param WP_Customize_Manager $manager
    31      * @param string $id An specific ID of the setting. Can be a
    32      *                   theme mod or option name.
    33      * @param array $args Setting 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
    3577     */
    3678    function __construct( $manager, $id, $args = array() ) {
     
    99141
    100142    /**
    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.
    102145     *
    103146     * @since 3.4.0
     
    117160
    118161    /**
    119      * Fetches, validates, and sanitizes the $_POST value.
     162     * Fetch and sanitize the $_POST value for the setting.
    120163     *
    121164     * @since 3.4.0
     
    125168     */
    126169    public final function post_value( $default = null ) {
     170        // Check for a cached value
    127171        if ( isset( $this->_post_value ) )
    128172            return $this->_post_value;
    129173
     174        // Call the manager for the post value
    130175        $result = $this->manager->post_value( $this );
    131176
     
    150195
    151196    /**
    152      * Set the value of the parameter for a specific theme.
     197     * Save the value of the setting, using the related API.
    153198     *
    154199     * @since 3.4.0
     
    191236
    192237    /**
    193      * Update the theme mod from the value of the parameter.
     238     * Update the option from the value of the setting.
    194239     *
    195240     * @since 3.4.0
     
    211256
    212257    /**
    213      * Fetch the value of the parameter for a specific theme.
    214      *
    215      * @since 3.4.0
    216      *
    217      * @return mixed The requested value.
     258     * Fetch the value of the setting.
     259     *
     260     * @since 3.4.0
     261     *
     262     * @return mixed The value.
    218263     */
    219264    public function value() {
     265        // Get the callback that corresponds to the setting type.
    220266        switch( $this->type ) {
    221267            case 'theme_mod' :
     
    239285
    240286    /**
    241      * Escape the parameter's value for use in JavaScript.
     287     * Sanitize the setting's value for use in JavaScript.
    242288     *
    243289     * @since 3.4.0
     
    255301
    256302    /**
    257      * Check if the theme supports the setting and check user capabilities.
     303     * Validate user capabilities whether the theme supports the setting.
    258304     *
    259305     * @since 3.4.0
Note: See TracChangeset for help on using the changeset viewer.