[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

WordPress Customize Widgets classes

File Size: 2074 lines (67 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 66 functions

  __construct()
  get_selective_refreshable_widgets()
  is_widget_selective_refreshable()
  get_setting_type()
  register_settings()
  filter_customize_dynamic_setting_args()
  get_post_value()
  override_sidebars_widgets_for_theme_switch()
  filter_customize_value_old_sidebars_widgets_data()
  filter_option_sidebars_widgets_for_theme_switch()
  customize_controls_init()
  schedule_customize_register()
  customize_register()
  is_panel_active()
  get_setting_id()
  is_wide_widget()
  parse_widget_id()
  parse_widget_setting_id()
  print_styles()
  print_scripts()
  enqueue_scripts()
  output_widget_control_templates()
  print_footer_scripts()
  get_setting_args()
  sanitize_sidebar_widgets()
  get_available_widgets()
  _sort_name_callback()
  get_widget_control()
  get_widget_control_parts()
  customize_preview_init()
  refresh_nonces()
  preview_sidebars_widgets()
  customize_preview_enqueue()
  print_preview_css()
  export_preview_data()
  tally_rendered_widgets()
  is_widget_rendered()
  is_sidebar_rendered()
  tally_sidebars_via_is_active_sidebar_calls()
  tally_sidebars_via_dynamic_sidebar_calls()
  get_instance_hash_key()
  sanitize_widget_instance()
  sanitize_widget_js_instance()
  sanitize_sidebar_widgets_js_instance()
  call_widget_update()
  wp_ajax_update_widget()
  customize_dynamic_partial_args()
  selective_refresh_init()
  filter_dynamic_sidebar_params()
  filter_wp_kses_allowed_data_attributes()
  start_dynamic_sidebar()
  end_dynamic_sidebar()
  filter_sidebars_widgets_for_rendering_widget()
  render_widget_partial()
  is_option_capture_ignored()
  get_captured_options()
  get_captured_option()
  count_captured_options()
  start_capturing_option_updates()
  capture_filter_pre_update_option()
  capture_filter_pre_get_option()
  stop_capturing_option_updates()
  setup_widget_addition_previews()
  prepreview_added_sidebars_widgets()
  prepreview_added_widget_instance()
  remove_prepreview_filters()

Functions
Functions that are not part of a class:

__construct( $manager )   X-Ref
Initial loader.

since: 3.9.0
param: WP_Customize_Manager $manager Customize manager bootstrap instance.

get_selective_refreshable_widgets()   X-Ref
List whether each registered widget can be use selective refresh.

If the theme does not support the customize-selective-refresh-widgets feature,
then this will always return an empty array.

return: array Mapping of id_base to support. If theme doesn't support
since: 4.5.0

is_widget_selective_refreshable( $id_base )   X-Ref
Determines if a widget supports selective refresh.

return: bool Whether the widget can be selective refreshed.
since: 4.5.0
param: string $id_base Widget ID Base.

get_setting_type( $setting_id )   X-Ref
Retrieves the widget setting type given a setting ID.

return: string|void Setting type.
since: 4.2.0
param: string $setting_id Setting ID.

register_settings()   X-Ref
Inspects the incoming customized data for any widget settings, and dynamically adds
them up-front so widgets will be initialized properly.

since: 4.2.0

filter_customize_dynamic_setting_args( $args, $setting_id )   X-Ref
Determines the arguments for a dynamically-created setting.

return: false|array Setting arguments, false otherwise.
since: 4.2.0
param: false|array $args       The arguments to the WP_Customize_Setting constructor.
param: string      $setting_id ID for dynamic setting, usually coming from `$_POST['customized']`.

get_post_value( $name, $default = null )   X-Ref
Retrieves an unslashed post value or return a default.

return: mixed Unslashed post value or default value.
since: 3.9.0
param: string $name    Post value.
param: mixed  $default Default post value.

override_sidebars_widgets_for_theme_switch()   X-Ref
Override sidebars_widgets for theme switch.

When switching a theme via the Customizer, supply any previously-configured
sidebars_widgets from the target theme as the initial sidebars_widgets
setting. Also store the old theme's existing settings so that they can
be passed along for storing in the sidebars_widgets theme_mod when the
theme gets switched.

since: 3.9.0

filter_customize_value_old_sidebars_widgets_data( $old_sidebars_widgets )   X-Ref
Filters old_sidebars_widgets_data Customizer setting.

When switching themes, filter the Customizer setting old_sidebars_widgets_data
to supply initial $sidebars_widgets before they were overridden by retrieve_widgets().
The value for old_sidebars_widgets_data gets set in the old theme's sidebars_widgets
theme_mod.

return: array
since: 3.9.0
param: array $old_sidebars_widgets

filter_option_sidebars_widgets_for_theme_switch( $sidebars_widgets )   X-Ref
Filters sidebars_widgets option for theme switch.

When switching themes, the retrieve_widgets() function is run when the Customizer initializes,
and then the new sidebars_widgets here get supplied as the default value for the sidebars_widgets
option.

return: array
since: 3.9.0
param: array $sidebars_widgets

customize_controls_init()   X-Ref
Ensures all widgets get loaded into the Customizer.

Note: these actions are also fired in wp_ajax_update_widget().

since: 3.9.0

schedule_customize_register()   X-Ref
Ensures widgets are available for all types of previews.

When in preview, hook to {@see 'customize_register'} for settings after WordPress is loaded
so that all filters have been initialized (e.g. Widget Visibility).

since: 3.9.0

customize_register()   X-Ref
Registers Customizer settings and controls for all sidebars and widgets.

since: 3.9.0

is_panel_active()   X-Ref
Determines whether the widgets panel is active, based on whether there are sidebars registered.

return: bool Active.
since: 4.4.0

get_setting_id( $widget_id )   X-Ref
Converts a widget_id into its corresponding Customizer setting ID (option name).

return: string Maybe-parsed widget ID.
since: 3.9.0
param: string $widget_id Widget ID.

is_wide_widget( $widget_id )   X-Ref
Determines whether the widget is considered "wide".

Core widgets which may have controls wider than 250, but can still be shown
in the narrow Customizer panel. The RSS and Text widgets in Core, for example,
have widths of 400 and yet they still render fine in the Customizer panel.

This method will return all Core widgets as being not wide, but this can be
overridden with the {@see 'is_wide_widget_in_customizer'} filter.

return: bool Whether or not the widget is a "wide" widget.
since: 3.9.0
param: string $widget_id Widget ID.

parse_widget_id( $widget_id )   X-Ref
Converts a widget ID into its id_base and number components.

return: array Array containing a widget's id_base and number components.
since: 3.9.0
param: string $widget_id Widget ID.

parse_widget_setting_id( $setting_id )   X-Ref
Converts a widget setting ID (option path) to its id_base and number components.

return: WP_Error|array Array containing a widget's id_base and number components,
since: 3.9.0
param: string $setting_id Widget setting ID.

print_styles()   X-Ref
Calls admin_print_styles-widgets.php and admin_print_styles hooks to
allow custom styles from plugins.

since: 3.9.0

print_scripts()   X-Ref
Calls admin_print_scripts-widgets.php and admin_print_scripts hooks to
allow custom scripts from plugins.

since: 3.9.0

enqueue_scripts()   X-Ref
Enqueues scripts and styles for Customizer panel and export data to JavaScript.

since: 3.9.0

output_widget_control_templates()   X-Ref
Renders the widget form control templates into the DOM.

since: 3.9.0

print_footer_scripts()   X-Ref
Calls admin_print_footer_scripts and admin_print_scripts hooks to
allow custom scripts from plugins.

since: 3.9.0

get_setting_args( $id, $overrides = array()   X-Ref
Retrieves common arguments to supply when constructing a Customizer setting.

return: array Possibly modified setting arguments.
since: 3.9.0
param: string $id        Widget setting ID.
param: array  $overrides Array of setting overrides.

sanitize_sidebar_widgets( $widget_ids )   X-Ref
Ensures sidebar widget arrays only ever contain widget IDS.

Used as the 'sanitize_callback' for each $sidebars_widgets setting.

return: string[] Array of sanitized widget IDs.
since: 3.9.0
param: string[] $widget_ids Array of widget IDs.

get_available_widgets()   X-Ref
Builds up an index of all available widgets for use in Backbone models.

return: array List of available widgets.
since: 3.9.0

_sort_name_callback( $widget_a, $widget_b )   X-Ref
Naturally orders available widgets by name.

return: int Reorder position for the current widget comparison.
since: 3.9.0
param: array $widget_a The first widget to compare.
param: array $widget_b The second widget to compare.

get_widget_control( $args )   X-Ref
Retrieves the widget control markup.

return: string Widget control form HTML markup.
since: 3.9.0
param: array $args Widget control arguments.

get_widget_control_parts( $args )   X-Ref
Retrieves the widget control markup parts.

return: array {
since: 4.4.0
param: array $args Widget control arguments.

customize_preview_init()   X-Ref
Adds hooks for the Customizer preview.

since: 3.9.0

refresh_nonces( $nonces )   X-Ref
Refreshes the nonce for widget updates.

return: array $nonces Array of nonces.
since: 4.2.0
param: array $nonces Array of nonces.

preview_sidebars_widgets( $sidebars_widgets )   X-Ref
When previewing, ensures the proper previewing widgets are used.

Because wp_get_sidebars_widgets() gets called early at {@see 'init' } (via
wp_convert_widget_settings()) and can set global variable `$_wp_sidebars_widgets`
to the value of `get_option( 'sidebars_widgets' )` before the Customizer preview
filter is added, it has to be reset after the filter has been added.

return: array
since: 3.9.0
param: array $sidebars_widgets List of widgets for the current sidebar.

customize_preview_enqueue()   X-Ref
Enqueues scripts for the Customizer preview.

since: 3.9.0

print_preview_css()   X-Ref
Inserts default style for highlighted widget at early point so theme
stylesheet can override.

since: 3.9.0

export_preview_data()   X-Ref
Communicates the sidebars that appeared on the page at the very end of the page,
and at the very end of the wp_footer,

since: 3.9.0

tally_rendered_widgets( $widget )   X-Ref
Tracks the widgets that were rendered.

since: 3.9.0
param: array $widget Rendered widget to tally.

is_widget_rendered( $widget_id )   X-Ref
Determine if a widget is rendered on the page.

return: bool Whether the widget is rendered.
since: 4.0.0
param: string $widget_id Widget ID to check.

is_sidebar_rendered( $sidebar_id )   X-Ref
Determines if a sidebar is rendered on the page.

return: bool Whether the sidebar is rendered.
since: 4.0.0
param: string $sidebar_id Sidebar ID to check.

tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id )   X-Ref
Tallies the sidebars rendered via is_active_sidebar().

Keep track of the times that is_active_sidebar() is called in the template,
and assume that this means that the sidebar would be rendered on the template
if there were widgets populating it.

return: bool Whether the sidebar is active.
since: 3.9.0
param: bool   $is_active  Whether the sidebar is active.
param: string $sidebar_id Sidebar ID.

tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id )   X-Ref
Tallies the sidebars rendered via dynamic_sidebar().

Keep track of the times that dynamic_sidebar() is called in the template,
and assume this means the sidebar would be rendered on the template if
there were widgets populating it.

return: bool Whether the current sidebar has widgets.
since: 3.9.0
param: bool   $has_widgets Whether the current sidebar has widgets.
param: string $sidebar_id  Sidebar ID.

get_instance_hash_key( $serialized_instance )   X-Ref
Retrieves MAC for a serialized widget instance string.

Allows values posted back from JS to be rejected if any tampering of the
data has occurred.

return: string MAC for serialized widget instance.
since: 3.9.0
param: string $serialized_instance Widget instance.

sanitize_widget_instance( $value )   X-Ref
Sanitizes a widget instance.

Unserialize the JS-instance for storing in the options. It's important that this filter
only get applied to an instance *once*.

return: array|void Sanitized widget instance.
since: 3.9.0
param: array $value Widget instance to sanitize.

sanitize_widget_js_instance( $value )   X-Ref
Converts a widget instance into JSON-representable format.

return: array JSON-converted widget instance.
since: 3.9.0
param: array $value Widget instance to convert to JSON.

sanitize_sidebar_widgets_js_instance( $widget_ids )   X-Ref
Strips out widget IDs for widgets which are no longer registered.

One example where this might happen is when a plugin orphans a widget
in a sidebar upon deactivation.

return: array Parsed list of widget IDs.
since: 3.9.0
param: array $widget_ids List of widget IDs.

call_widget_update( $widget_id )   X-Ref
Finds and invokes the widget update and control callbacks.

Requires that `$_POST` be populated with the instance data.

return: WP_Error|array Array containing the updated widget information.
since: 3.9.0
param: string $widget_id Widget ID.

wp_ajax_update_widget()   X-Ref
Updates widget settings asynchronously.

Allows the Customizer to update a widget using its form, but return the new
instance info via Ajax instead of saving it to the options table.

Most code here copied from wp_ajax_save_widget().

since: 3.9.0

customize_dynamic_partial_args( $partial_args, $partial_id )   X-Ref
Filters arguments for dynamic widget partials.

return: array (Maybe) modified partial arguments.
since: 4.5.0
param: array|false $partial_args Partial arguments.
param: string      $partial_id   Partial ID.

selective_refresh_init()   X-Ref
Adds hooks for selective refresh.

since: 4.5.0

filter_dynamic_sidebar_params( $params )   X-Ref
Inject selective refresh data attributes into widget container elements.

return: array Params.
since: 4.5.0
param: array $params {

filter_wp_kses_allowed_data_attributes( $allowed_html )   X-Ref
Ensures the HTML data-* attributes for selective refresh are allowed by kses.

This is needed in case the `$before_widget` is run through wp_kses() when printed.

return: array (Maybe) modified allowed HTML.
since: 4.5.0
param: array $allowed_html Allowed HTML.

start_dynamic_sidebar( $index )   X-Ref
Begins keeping track of the current sidebar being rendered.

Insert marker before widgets are rendered in a dynamic sidebar.

since: 4.5.0
param: int|string $index Index, name, or ID of the dynamic sidebar.

end_dynamic_sidebar( $index )   X-Ref
Finishes keeping track of the current sidebar being rendered.

Inserts a marker after widgets are rendered in a dynamic sidebar.

since: 4.5.0
param: int|string $index Index, name, or ID of the dynamic sidebar.

filter_sidebars_widgets_for_rendering_widget( $sidebars_widgets )   X-Ref
Filters sidebars_widgets to ensure the currently-rendered widget is the only widget in the current sidebar.

return: array Filtered sidebars widgets.
since: 4.5.0
param: array $sidebars_widgets Sidebars widgets.

render_widget_partial( $partial, $context )   X-Ref
Renders a specific widget using the supplied sidebar arguments.

return: string|false
since: 4.5.0
param: WP_Customize_Partial $partial Partial.
param: array                $context {

is_option_capture_ignored( $option_name )   X-Ref
Determines whether the captured option update should be ignored.

return: bool Whether the option capture is ignored.
since: 3.9.0
param: string $option_name Option name.

get_captured_options()   X-Ref
Retrieves captured widget option updates.

return: array Array of captured options.
since: 3.9.0

get_captured_option( $option_name, $default = false )   X-Ref
Retrieves the option that was captured from being saved.

return: mixed Value set for the option.
since: 4.2.0
param: string $option_name Option name.
param: mixed  $default     Optional. Default value to return if the option does not exist. Default false.

count_captured_options()   X-Ref
Retrieves the number of captured widget option updates.

return: int Number of updated options.
since: 3.9.0

start_capturing_option_updates()   X-Ref
Begins keeping track of changes to widget options, caching new values.

since: 3.9.0

capture_filter_pre_update_option( $new_value, $option_name, $old_value )   X-Ref
Pre-filters captured option values before updating.

return: mixed Filtered option value.
since: 3.9.0
param: mixed  $new_value   The new option value.
param: string $option_name Name of the option.
param: mixed  $old_value   The old option value.

capture_filter_pre_get_option( $value )   X-Ref
Pre-filters captured option values before retrieving.

return: mixed Filtered option value.
since: 3.9.0
param: mixed $value Value to return instead of the option value.

stop_capturing_option_updates()   X-Ref
Undoes any changes to the options since options capture began.

since: 3.9.0

setup_widget_addition_previews()   X-Ref
{@internal Missing Summary}

See the {@see 'customize_dynamic_setting_args'} filter.

since: 3.9.0

prepreview_added_sidebars_widgets()   X-Ref
{@internal Missing Summary}

See the {@see 'customize_dynamic_setting_args'} filter.

since: 3.9.0

prepreview_added_widget_instance()   X-Ref
{@internal Missing Summary}

See the {@see 'customize_dynamic_setting_args'} filter.

since: 3.9.0

remove_prepreview_filters()   X-Ref
{@internal Missing Summary}

See the {@see 'customize_dynamic_setting_args'} filter.

since: 3.9.0



Generated: Sun Sep 15 01:00:03 2019 Cross-referenced by PHPXref 0.7.1