PHP 클래스 WP_Customize_Setting, wordpress

Handles saving and sanitizing of settings.
또한 보기: WP_Customize_Manager
부터: 3.4.0
상속: extends WP_Fields_API_Field
파일 보기 프로젝트 열기: johnpbloch/wordpress 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$capability string Capability required to edit this setting.
$default
$dirty boolean This is used to ensure that a setting will be sent from the pane to the preview when loading the Customizer. Normally a setting only is synced to the preview if it has been changed. This allows the setting to be sent from the start.
$id string Unique string identifier for the setting.
$manager WP_Customize_Manager
$sanitize_callback
$sanitize_js_callback
$theme_supports string Feature a theme is required to support to enable this setting.
$transport
$type string
$validate_callback callback Server-side sanitization callback for the setting's value.

보호된 프로퍼티들

프로퍼티 타입 설명
$_original_value mixed Original non-previewed value stored by the preview method.
$_previewed_blog_id integer The ID for the current site when the preview() method was called.
$aggregated_multidimensionals array Cache of multidimensional values to improve performance.
$id_data array
$is_multidimensional_aggregated boolean Whether the multidimensional setting is aggregated.
$is_previewed boolean Whether or not preview() was called.

공개 메소드들

메소드 설명
__construct ( WP_Customize_Manager $manager, string $id, array $args = [] ) Constructor.
_clear_aggregated_multidimensional_preview_applied_flag ( ) Clear out the previewed-applied flag for a multidimensional-aggregated value whenever its post value is updated.
_multidimensional_preview_filter ( mixed $original ) : mixed Callback function to filter multidimensional theme mods and options.
_preview_filter ( mixed $original ) : mixed Callback function to filter non-multidimensional theme mods and options.
check_capabilities ( ) : boolean Validate user capabilities whether the theme supports the setting.
id_data ( ) : array Get parsed ID data for multidimensional setting.
is_current_blog_previewed ( ) : boolean Return true if the current site is not the same as the previewed site.
js_value ( ) : mixed Sanitize the setting's value for use in JavaScript.
json ( ) : array Retrieves the data to export to the client via JSON.
post_value ( mixed $default = null ) : mixed Fetch and sanitize the $_POST value for the setting.
preview ( ) : boolean Add filters to supply the setting's value when accessed.
reset_aggregated_multidimensionals ( ) Reset $aggregated_multidimensionals static variable.
sanitize ( string | array $value ) : string | array | null | WP_Error Sanitize an input.
save ( ) : false | void Checks user capabilities and theme supports, and then saves the value of the setting.
validate ( mixed $value ) : true | WP_Error Validates an input.
value ( ) : mixed Fetch the value of the setting.

보호된 메소드들

메소드 설명
_update_option ( ) Deprecated method.
_update_theme_mod ( ) Deprecated method.
aggregate_multidimensional ( ) Set up the setting for aggregated multidimensional values.
get_root_value ( mixed $default = null ) : mixed Get the root value for a setting, especially for multidimensional ones.
multidimensional ( &$root, $keys, boolean $create = false ) : array | void Multidimensional helper function.
multidimensional_get ( $root, $keys, mixed $default = null ) : mixed Will attempt to fetch a specific value from a multidimensional array.
multidimensional_isset ( $root, $keys ) : boolean Will attempt to check if a specific value in a multidimensional array is set.
multidimensional_replace ( $root, $keys, mixed $value ) : mixed Will attempt to replace a specific value in a multidimensional array.
set_root_value ( mixed $value ) : boolean Set the root value for a setting, especially for multidimensional ones.
update ( mixed $value ) : boolean Save the value of the setting, using the related API.

메소드 상세

__construct() 공개 메소드

Any supplied $args override class property defaults.
부터: 3.4.0
public __construct ( WP_Customize_Manager $manager, string $id, array $args = [] )
$manager WP_Customize_Manager
$id string An specific ID of the setting. Can be a theme mod or option name.
$args array Setting arguments.

_clear_aggregated_multidimensional_preview_applied_flag() 최종 공개 메소드

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.
또한 보기: WP_Customize_Manager::set_post_value()
또한 보기: WP_Customize_Setting::_multidimensional_preview_filter()
부터: 4.4.0

_multidimensional_preview_filter() 최종 공개 메소드

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.
또한 보기: WP_Customize_Setting::$aggregated_multidimensionals
부터: 4.4.0
final public _multidimensional_preview_filter ( mixed $original ) : mixed
$original mixed Original root value.
리턴 mixed New or old value.

_preview_filter() 공개 메소드

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.
부터: 3.4.0
public _preview_filter ( mixed $original ) : mixed
$original mixed Old value.
리턴 mixed New or old value.

_update_option() 보호된 메소드

Deprecated method.
사용 중단: 4.4.0 Deprecated in favor of update() method.
부터: 3.4.0
protected _update_option ( )

_update_theme_mod() 보호된 메소드

Deprecated method.
사용 중단: 4.4.0 Deprecated in favor of update() method.
부터: 3.4.0
protected _update_theme_mod ( )

aggregate_multidimensional() 보호된 메소드

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

check_capabilities() 최종 공개 메소드

Validate user capabilities whether the theme supports the setting.
부터: 3.4.0
final public check_capabilities ( ) : boolean
리턴 boolean False if theme doesn't support the setting or user can't change setting, otherwise true.

get_root_value() 보호된 메소드

Get the root value for a setting, especially for multidimensional ones.
부터: 4.4.0
protected get_root_value ( mixed $default = null ) : mixed
$default mixed Value to return if root does not exist.
리턴 mixed

id_data() 최종 공개 메소드

Get parsed ID data for multidimensional setting.
부터: 4.4.0
final public id_data ( ) : array
리턴 array { ID data for multidimensional setting. @type string $base ID base @type array $keys Keys for multidimensional array. }

is_current_blog_previewed() 공개 메소드

Return true if the current site is not the same as the previewed site.
부터: 4.2.0
public is_current_blog_previewed ( ) : boolean
리턴 boolean If preview() has been called.

js_value() 공개 메소드

Sanitize the setting's value for use in JavaScript.
부터: 3.4.0
public js_value ( ) : mixed
리턴 mixed The requested escaped value.

json() 공개 메소드

Retrieves the data to export to the client via JSON.
부터: 4.6.0
public json ( ) : array
리턴 array Array of parameters passed to JavaScript.

multidimensional() 최종 보호된 메소드

Multidimensional helper function.
부터: 3.4.0
final protected multidimensional ( &$root, $keys, boolean $create = false ) : array | void
$root
$keys
$create boolean Default is false.
리턴 array | void Keys are 'root', 'node', and 'key'.

multidimensional_get() 최종 보호된 메소드

Will attempt to fetch a specific value from a multidimensional array.
부터: 3.4.0
final protected multidimensional_get ( $root, $keys, mixed $default = null ) : mixed
$root
$keys
$default mixed A default value which is used as a fallback. Default is null.
리턴 mixed The requested value or the default value.

multidimensional_isset() 최종 보호된 메소드

Will attempt to check if a specific value in a multidimensional array is set.
부터: 3.4.0
final protected multidimensional_isset ( $root, $keys ) : boolean
$root
$keys
리턴 boolean True if value is set, false if not.

multidimensional_replace() 최종 보호된 메소드

Will attempt to replace a specific value in a multidimensional array.
부터: 3.4.0
final protected multidimensional_replace ( $root, $keys, mixed $value ) : mixed
$root
$keys
$value mixed The value to update.
리턴 mixed

post_value() 최종 공개 메소드

During a save request prior to save, post_value() provides the new value while value() does not.
부터: 3.4.0
final public post_value ( mixed $default = null ) : mixed
$default mixed A default value which is used as a fallback. Default is null.
리턴 mixed The default value on failure, otherwise the sanitized and validated value.

preview() 공개 메소드

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.
부터: 3.4.0
부터: 4.4.0 Added boolean return value.
public preview ( ) : boolean
리턴 boolean False when preview short-circuits due no change needing to be previewed.

reset_aggregated_multidimensionals() 공개 정적인 메소드

This is intended only for use by unit tests.
부터: 4.5.0

sanitize() 공개 메소드

Sanitize an input.
부터: 3.4.0
public sanitize ( string | array $value ) : string | array | null | WP_Error
$value string | array The value to sanitize.
리턴 string | array | null | WP_Error Sanitized value, or `null`/`WP_Error` if invalid.

save() 최종 공개 메소드

Checks user capabilities and theme supports, and then saves the value of the setting.
부터: 3.4.0
final public save ( ) : false | void
리턴 false | void False if cap check fails or value isn't set or is invalid.

set_root_value() 보호된 메소드

Set the root value for a setting, especially for multidimensional ones.
부터: 4.4.0
protected set_root_value ( mixed $value ) : boolean
$value mixed Value to set as root of multidimensional setting.
리턴 boolean Whether the multidimensional root was updated successfully.

update() 보호된 메소드

Save the value of the setting, using the related API.
부터: 3.4.0
protected update ( mixed $value ) : boolean
$value mixed The value to update.
리턴 boolean The result of saving the value.

validate() 공개 메소드

Validates an input.
또한 보기: WP_REST_Request::has_valid_params()
부터: 4.6.0
public validate ( mixed $value ) : true | WP_Error
$value mixed Value to validate.
리턴 true | WP_Error True if the input was validated, otherwise WP_Error.

value() 공개 메소드

Fetch the value of the setting.
부터: 3.4.0
public value ( ) : mixed
리턴 mixed The value.

프로퍼티 상세

$_original_value 보호되어 있는 프로퍼티

Original non-previewed value stored by the preview method.
또한 보기: WP_Customize_Setting::preview()
부터: 4.1.1
protected mixed $_original_value
리턴 mixed

$_previewed_blog_id 보호되어 있는 프로퍼티

The ID for the current site when the preview() method was called.
부터: 4.2.0
protected int $_previewed_blog_id
리턴 integer

$aggregated_multidimensionals 보호되어 있는 정적으로 프로퍼티

Cache of multidimensional values to improve performance.
부터: 4.4.0
protected static array $aggregated_multidimensionals
리턴 array

$capability 공개적으로 프로퍼티

Capability required to edit this setting.
public string $capability
리턴 string

$default 공개적으로 프로퍼티

public $default

$dirty 공개적으로 프로퍼티

This is used to ensure that a setting will be sent from the pane to the preview when loading the Customizer. Normally a setting only is synced to the preview if it has been changed. This allows the setting to be sent from the start.
부터: 4.2.0
public bool $dirty
리턴 boolean

$id 공개적으로 프로퍼티

Unique string identifier for the setting.
public string $id
리턴 string

$id_data 보호되어 있는 프로퍼티

protected array $id_data
리턴 array

$is_multidimensional_aggregated 보호되어 있는 프로퍼티

Whether the multidimensional setting is aggregated.
부터: 4.4.0
protected bool $is_multidimensional_aggregated
리턴 boolean

$is_previewed 보호되어 있는 프로퍼티

Whether or not preview() was called.
부터: 4.4.0
protected bool $is_previewed
리턴 boolean

$manager 공개적으로 프로퍼티

public WP_Customize_Manager $manager
리턴 WP_Customize_Manager

$sanitize_callback 공개적으로 프로퍼티

public $sanitize_callback

$sanitize_js_callback 공개적으로 프로퍼티

public $sanitize_js_callback

$theme_supports 공개적으로 프로퍼티

Feature a theme is required to support to enable this setting.
public string $theme_supports
리턴 string

$transport 공개적으로 프로퍼티

public $transport

$type 공개적으로 프로퍼티

public string $type
리턴 string

$validate_callback 공개적으로 프로퍼티

Server-side sanitization callback for the setting's value.
public callback $validate_callback
리턴 callback