[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> class-wp-customize-setting.php (summary)

WordPress Customize Setting classes

File Size: 984 lines (30 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 5 files
 wp-includes/customize/class-wp-customize-header-image-setting.php
 wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
 wp-includes/customize/class-wp-customize-filter-setting.php
 wp-includes/customize/class-wp-customize-nav-menu-setting.php
 wp-includes/customize/class-wp-customize-background-image-setting.php

Defines 1 class

WP_Customize_Setting:: (26 methods):
  __construct()
  id_data()
  aggregate_multidimensional()
  reset_aggregated_multidimensionals()
  is_current_blog_previewed()
  preview()
  _clear_aggregated_multidimensional_preview_applied_flag()
  _preview_filter()
  _multidimensional_preview_filter()
  save()
  post_value()
  sanitize()
  validate()
  get_root_value()
  set_root_value()
  update()
  _update_theme_mod()
  _update_option()
  value()
  js_value()
  json()
  check_capabilities()
  multidimensional()
  multidimensional_replace()
  multidimensional_get()
  multidimensional_isset()


Class: WP_Customize_Setting  - X-Ref

Customize Setting class.

Handles saving and sanitizing of settings.

__construct( $manager, $id, $args = array()   X-Ref
Constructor.

Any supplied $args override class property defaults.

param: WP_Customize_Manager $manager Customizer bootstrap instance.
param: string               $id      A specific ID of the setting.
param: array                $args    {

id_data()   X-Ref
Get parsed ID data for multidimensional setting.

return: array {

aggregate_multidimensional()   X-Ref
Set up the setting for aggregated multidimensional values.

When a multidimensional setting gets aggregated, all of its preview and update
calls get combined into one call, greatly improving performance.


reset_aggregated_multidimensionals()   X-Ref
Reset `$aggregated_multidimensionals` static variable.

This is intended only for use by unit tests.


is_current_blog_previewed()   X-Ref
Return true if the current site is not the same as the previewed site.

return: bool If preview() has been called.

preview()   X-Ref
Add filters to supply the setting's value when accessed.

If the setting already has a pre-existing value and there is no incoming
post value for the setting, then this method will short-circuit since
there is no change to preview.

return: bool False when preview short-circuits due no change needing to be previewed.

_clear_aggregated_multidimensional_preview_applied_flag()   X-Ref
Clear out the previewed-applied flag for a multidimensional-aggregated value whenever its post value is updated.

This ensures that the new value will get sanitized and used the next time
that `WP_Customize_Setting::_multidimensional_preview_filter()`
is called for this setting.


_preview_filter( $original )   X-Ref
Callback function to filter non-multidimensional theme mods and options.

If switch_to_blog() was called after the preview() method, and the current
site is now not the same site, then this method does a no-op and returns
the original value.

param: mixed $original Old value.
return: mixed New or old value.

_multidimensional_preview_filter( $original )   X-Ref
Callback function to filter multidimensional theme mods and options.

For all multidimensional settings of a given type, the preview filter for
the first setting previewed will be used to apply the values for the others.

param: mixed $original Original root value.
return: mixed New or old value.

save()   X-Ref
Checks user capabilities and theme supports, and then saves
the value of the setting.

return: void|false Void on success, false if cap check fails

post_value( $default_value = null )   X-Ref
Fetch and sanitize the $_POST value for the setting.

During a save request prior to save, post_value() provides the new value while value() does not.

param: mixed $default_value A default value which is used as a fallback. Default null.
return: mixed The default value on failure, otherwise the sanitized and validated value.

sanitize( $value )   X-Ref
Sanitize an input.

param: string|array $value The value to sanitize.
return: string|array|null|WP_Error Sanitized value, or `null`/`WP_Error` if invalid.

validate( $value )   X-Ref
Validates an input.

param: mixed $value Value to validate.
return: true|WP_Error True if the input was validated, otherwise WP_Error.

get_root_value( $default_value = null )   X-Ref
Get the root value for a setting, especially for multidimensional ones.

param: mixed $default_value Value to return if root does not exist.
return: mixed

set_root_value( $value )   X-Ref
Set the root value for a setting, especially for multidimensional ones.

param: mixed $value Value to set as root of multidimensional setting.
return: bool Whether the multidimensional root was updated successfully.

update( $value )   X-Ref
Save the value of the setting, using the related API.

param: mixed $value The value to update.
return: bool The result of saving the value.

_update_theme_mod()   X-Ref
Deprecated method.


_update_option()   X-Ref
Deprecated method.


value()   X-Ref
Fetch the value of the setting.

return: mixed The value.

js_value()   X-Ref
Sanitize the setting's value for use in JavaScript.

return: mixed The requested escaped value.

json()   X-Ref
Retrieves the data to export to the client via JSON.

return: array Array of parameters passed to JavaScript.

check_capabilities()   X-Ref
Validate user capabilities whether the theme supports the setting.

return: bool False if theme doesn't support the setting or user can't change setting, otherwise true.

multidimensional( &$root, $keys, $create = false )   X-Ref
Multidimensional helper function.

param: array $root
param: array $keys
param: bool  $create Default false.
return: array|void Keys are 'root', 'node', and 'key'.

multidimensional_replace( $root, $keys, $value )   X-Ref
Will attempt to replace a specific value in a multidimensional array.

param: array $root
param: array $keys
param: mixed $value The value to update.
return: mixed

multidimensional_get( $root, $keys, $default_value = null )   X-Ref
Will attempt to fetch a specific value from a multidimensional array.

param: array $root
param: array $keys
param: mixed $default_value A default value which is used as a fallback. Default null.
return: mixed The requested value or the default value.

multidimensional_isset( $root, $keys )   X-Ref
Will attempt to check if a specific value in a multidimensional array is set.

param: array $root
param: array $keys
return: bool True if value is set, false if not.



Generated : Tue Dec 24 08:20:01 2024 Cross-referenced by PHPXref