diff options
Diffstat (limited to 'srcs/wordpress/wp-includes/customize')
35 files changed, 0 insertions, 5592 deletions
diff --git a/srcs/wordpress/wp-includes/customize/class-wp-customize-background-image-control.php b/srcs/wordpress/wp-includes/customize/class-wp-customize-background-image-control.php deleted file mode 100644 index b31a811..0000000 --- a/srcs/wordpress/wp-includes/customize/class-wp-customize-background-image-control.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/** - * Customize API: WP_Customize_Background_Image_Control class - * - * @package WordPress - * @subpackage Customize - * @since 4.4.0 - */ - -/** - * Customize Background Image Control class. - * - * @since 3.4.0 - * - * @see WP_Customize_Image_Control - */ -class WP_Customize_Background_Image_Control extends WP_Customize_Image_Control { - public $type = 'background'; - - /** - * Constructor. - * - * @since 3.4.0 - * @uses WP_Customize_Image_Control::__construct() - * - * @param WP_Customize_Manager $manager Customizer bootstrap instance. - */ - public function __construct( $manager ) { - parent::__construct( - $manager, - 'background_image', - array( - 'label' => __( 'Background Image' ), - 'section' => 'background_image', - ) - ); - } - - /** - * Enqueue control related scripts/styles. - * - * @since 4.1.0 - */ - public function enqueue() { - parent::enqueue(); - - $custom_background = get_theme_support( 'custom-background' ); - wp_localize_script( - 'customize-controls', - '_wpCustomizeBackground', - array( - 'defaults' => ! empty( $custom_background[0] ) ? $custom_background[0] : array(), - 'nonces' => array( - 'add' => wp_create_nonce( 'background-add' ), - ), - ) - ); - } -} diff --git a/srcs/wordpress/wp-includes/customize/class-wp-customize-background-image-setting.php b/srcs/wordpress/wp-includes/customize/class-wp-customize-background-image-setting.php deleted file mode 100644 index e7867d1..0000000 --- a/srcs/wordpress/wp-includes/customize/class-wp-customize-background-image-setting.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * Customize API: WP_Customize_Background_Image_Setting class - * - * @package WordPress - * @subpackage Customize - * @since 4.4.0 - */ - -/** - * Customizer Background Image Setting class. - * - * @since 3.4.0 - * - * @see WP_Customize_Setting - */ -final class WP_Customize_Background_Image_Setting extends WP_Customize_Setting { - public $id = 'background_image_thumb'; - - /** - * @since 3.4.0 - * - * @param $value - */ - public function update( $value ) { - remove_theme_mod( 'background_image_thumb' ); - } -} diff --git a/srcs/wordpress/wp-includes/customize/class-wp-customize-background-position-control.php b/srcs/wordpress/wp-includes/customize/class-wp-customize-background-position-control.php deleted file mode 100644 index bb35b05..0000000 --- a/srcs/wordpress/wp-includes/customize/class-wp-customize-background-position-control.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -/** - * Customize API: WP_Customize_Background_Position_Control class - * - * @package WordPress - * @subpackage Customize - * @since 4.7.0 - */ - -/** - * Customize Background Position Control class. - * - * @since 4.7.0 - * - * @see WP_Customize_Control - */ -class WP_Customize_Background_Position_Control extends WP_Customize_Control { - - /** - * Type. - * - * @since 4.7.0 - * @var string - */ - public $type = 'background_position'; - - /** - * Don't render the control content from PHP, as it's rendered via JS on load. - * - * @since 4.7.0 - */ - public function render_content() {} - - /** - * Render a JS template for the content of the position control. - * - * @since 4.7.0 - */ - public function content_template() { - $options = array( - array( - 'left top' => array( - 'label' => __( 'Top Left' ), - 'icon' => 'dashicons dashicons-arrow-left-alt', - ), - 'center top' => array( - 'label' => __( 'Top' ), - 'icon' => 'dashicons dashicons-arrow-up-alt', - ), - 'right top' => array( - 'label' => __( 'Top Right' ), - 'icon' => 'dashicons dashicons-arrow-right-alt', - ), - ), - array( - 'left center' => array( - 'label' => __( 'Left' ), - 'icon' => 'dashicons dashicons-arrow-left-alt', - ), - 'center center' => array( - 'label' => __( 'Center' ), - 'icon' => 'background-position-center-icon', - ), - 'right center' => array( - 'label' => __( 'Right' ), - 'icon' => 'dashicons dashicons-arrow-right-alt', - ), - ), - array( - 'left bottom' => array( - 'label' => __( 'Bottom Left' ), - 'icon' => 'dashicons dashicons-arrow-left-alt', - ), - 'center bottom' => array( - 'label' => __( 'Bottom' ), - 'icon' => 'dashicons dashicons-arrow-down-alt', - ), - 'right bottom' => array( - 'label' => __( 'Bottom Right' ), - 'icon' => 'dashicons dashicons-arrow-right-alt', - ), - ), - ); - ?> - <# if ( data.label ) { #> - <span class="customize-control-title">{{{ data.label }}}</span> - <# } #> - <# if ( data.description ) { #> - <span class="description customize-control-description">{{{ data.description }}}</span> - <# } #> - <div class="customize-control-content"> - <fieldset> - <legend class="screen-reader-text"><span><?php _e( 'Image Position' ); ?></span></legend> - <div class="background-position-control"> - <?php foreach ( $options as $group ) : ?> - <div class="button-group"> - <?php foreach ( $group as $value => $input ) : ?> - <label> - <input class="screen-reader-text" name="background-position" type="radio" value="<?php echo esc_attr( $value ); ?>"> - <span class="button display-options position"><span class="<?php echo esc_attr( $input['icon'] ); ?>" aria-hidden="true"></span></span> - <span class="screen-reader-text"><?php echo $input['label']; ?></span> - </label> - <?php endforeach; ?> - </div> - <?php endforeach; ?> - </div> - </fieldset> - </div> - <?php - } -} diff --git a/srcs/wordpress/wp-includes/customize/class-wp-customize-code-editor-control.php b/srcs/wordpress/wp-includes/customize/class-wp-customize-code-editor-control.php deleted file mode 100644 index 0e687a2..0000000 --- a/srcs/wordpress/wp-includes/customize/class-wp-customize-code-editor-control.php +++ /dev/null @@ -1,110 +0,0 @@ -<?php -/** - * Customize API: WP_Customize_Code_Editor_Control class - * - * @package WordPress - * @subpackage Customize - * @since 4.9.0 - */ - -/** - * Customize Code Editor Control class. - * - * @since 4.9.0 - * - * @see WP_Customize_Control - */ -class WP_Customize_Code_Editor_Control extends WP_Customize_Control { - - /** - * Customize control type. - * - * @since 4.9.0 - * @var string - */ - public $type = 'code_editor'; - - /** - * Type of code that is being edited. - * - * @since 4.9.0 - * @var string - */ - public $code_type = ''; - - /** - * Code editor settings. - * - * @see wp_enqueue_code_editor() - * @since 4.9.0 - * @var array|false - */ - public $editor_settings = array(); - - /** - * Enqueue control related scripts/styles. - * - * @since 4.9.0 - */ - public function enqueue() { - $this->editor_settings = wp_enqueue_code_editor( - array_merge( - array( - 'type' => $this->code_type, - 'codemirror' => array( - 'indentUnit' => 2, - 'tabSize' => 2, - ), - ), - $this->editor_settings - ) - ); - } - - /** - * Refresh the parameters passed to the JavaScript via JSON. - * - * @since 4.9.0 - * @see WP_Customize_Control::json() - * - * @return array Array of parameters passed to the JavaScript. - */ - public function json() { - $json = parent::json(); - $json['editor_settings'] = $this->editor_settings; - $json['input_attrs'] = $this->input_attrs; - return $json; - } - - /** - * Don't render the control content from PHP, as it's rendered via JS on load. - * - * @since 4.9.0 - */ - public function render_content() {} - - /** - * Render a JS template for control display. - * - * @since 4.9.0 - */ - public function content_template() { - ?> - <# var elementIdPrefix = 'el' + String( Math.random() ); #> - <# if ( data.label ) { #> - <label for="{{ elementIdPrefix }}_editor" class="customize-control-title"> - {{ data.label }} - </label> - <# } #> - <# if ( data.description ) { #> - <span class="description customize-control-description">{{{ data.description }}}</span> - <# } #> - <div class="customize-control-notifications-container"></div> - <textarea id="{{ elementIdPrefix }}_editor" - <# _.each( _.extend( { 'class': 'code' }, data.input_attrs ), function( value, key ) { #> - {{{ key }}}="{{ value }}" - <# }); #> - ></textarea> - <?php - } -} diff --git a/srcs/wordpress/wp-includes/customize/class-wp-customize-color-control.php b/srcs/wordpress/wp-includes/customize/class-wp-customize-color-control.php deleted file mode 100644 index 6288ee4..0000000 --- a/srcs/wordpress/wp-includes/customize/class-wp-customize-color-control.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php -/** - * Customize API: WP_Customize_Color_Control class - * - * @package WordPress - * @subpackage Customize - * @since 4.4.0 - */ - -/** - * Customize Color Control class. - * - * @since 3.4.0 - * - * @see WP_Customize_Control - */ -class WP_Customize_Color_Control extends WP_Customize_Control { - /** - * Type. - * - * @var string - */ - public $type = 'color'; - - /** - * Statuses. - * - * @var array - */ - public $statuses; - - /** - * Mode. - * - * @since 4.7.0 - * @var string - */ - public $mode = 'full'; - - /** - * Constructor. - * - * @since 3.4.0 - * @uses WP_Customize_Control::__construct() - * - * @param WP_Customize_Manager $manager Customizer bootstrap instance. - * @param string $id Control ID. - * @param array $args Optional. Arguments to override class property defaults. - */ - public function __construct( $manager, $id, $args = array() ) { - $this->statuses = array( '' => __( 'Default' ) ); - parent::__construct( $manager, $id, $args ); - } - - /** - * Enqueue scripts/styles for the color picker. - * - * @since 3.4.0 - */ - public function enqueue() { - wp_enqueue_script( 'wp-color-picker' ); - wp_enqueue_style( 'wp-color-picker' ); - } - - /** - * Refresh the parameters passed to the JavaScript via JSON. - * - * @since 3.4.0 - * @uses WP_Customize_Control::to_json() - */ - public function to_json() { - parent::to_json(); - $this->json['statuses'] = $this->statuses; - $this->json['defaultValue'] = $this->setting->default; - $this->json['mode'] = $this->mode; - } - - /** - * Don't render the control content from PHP, as it's rendered via JS on load. - * - * @since 3.4.0 - */ - public function render_content() {} - - /** - * Render a JS template for the content of the color picker control. - * - * @since 4.1.0 - */ - public function content_template() { - ?> - <# var defaultValue = '#RRGGBB', defaultValueAttr = '', - isHueSlider = data.mode === 'hue'; - if ( data.defaultValue && _.isString( data.defaultValue ) && ! isHueSlider ) { - if ( '#' !== data.defaultValue.substring( 0, 1 ) ) { - defaultValue = '#' + data.defaultValue; - } else { - defaultValue = data.defaultValue; - } - defaultValueAttr = ' data-default-color=' + defaultValue; // Quotes added automatically. - } #> - <# if ( data.label ) { #> - <span class="customize-control-title">{{{ data.label }}}</span> - <# } #> - <# if ( data.description ) { #> - <span class="description customize-control-description">{{{ data.description }}}</span> - <# } #> - <div class="customize-control-content"> - <label><span class="screen-reader-text">{{{ data.label }}}</span> - <# if ( isHueSlider ) { #> - <input class="color-picker-hue" type="text" data-type="hue" /> - <# } else { #> - <input class="color-picker-hex" type="text" maxlength="7" placeholder="{{ defaultValue }}" {{ defaultValueAttr }} /> - <# } #> - </label> - </div> - <?php - } -} diff --git a/srcs/wordpress/wp-includes/customize/class-wp-customize-cropped-image-control.php b/srcs/wordpress/wp-includes/customize/class-wp-customize-cropped-image-control.php deleted file mode 100644 index c8a55f4..0000000 --- a/srcs/wordpress/wp-includes/customize/class-wp-customize-cropped-image-control.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php -/** - * Customize API: WP_Customize_Cropped_Image_Control class - * - * @package WordPress - * @subpackage Customize - * @since 4.4.0 - */ - -/** - * Customize Cropped Image Control class. - * - * @since 4.3.0 - * - * @see WP_Customize_Image_Control - */ -class WP_Customize_Cropped_Image_Control extends WP_Customize_Image_Control { - - /** - * Control type. - * - * @since 4.3.0 - * @var string - */ - public $type = 'cropped_image'; - - /** - * Suggested width for cropped image. - * - * @since 4.3.0 - * @var int - */ - public $width = 150; - - /** - * Suggested height for cropped image. - * - * @since 4.3.0 - * @var int - */ - public $height = 150; - - /** - * Whether the width is flexible. - * - * @since 4.3.0 - * @var bool - */ - public $flex_width = false; - - /** - * Whether the height is flexible. - * - * @since 4.3.0 - * @var bool - */ - public $flex_height = false; - - /** - * Enqueue control related scripts/styles. - * - * @since 4.3.0 - */ - public function enqueue() { - wp_enqueue_script( 'customize-views' ); - - parent::enqueue(); - } - - /** - * Refresh the parameters passed to the JavaScript via JSON. - * - * @since 4.3.0 - * - * @see WP_Customize_Control::to_json() - */ - public function to_json() { - parent::to_json(); - - $this->json['width'] = absint( $this->width ); - $this->json['height'] = absint( $this->height ); - $this->json['flex_width'] = absint( $this->flex_width ); - $this->json['flex_height'] = absint( $this->flex_height ); - } - -} diff --git a/srcs/wordpress/wp-includes/customize/class-wp-customize-custom-css-setting.php b/srcs/wordpress/wp-includes/customize/class-wp-customize-custom-css-setting.php deleted file mode 100644 index 085a8b5..0000000 --- a/srcs/wordpress/wp-includes/customize/class-wp-customize-custom-css-setting.php +++ /dev/null @@ -1,202 +0,0 @@ -<?php -/** - * Customize API: WP_Customize_Custom_CSS_Setting class - * - * This handles validation, sanitization and saving of the value. - * - * @package WordPress - * @subpackage Customize - * @since 4.7.0 - */ - -/** - * Custom Setting to handle WP Custom CSS. - * - * @since 4.7.0 - * - * @see WP_Customize_Setting - */ -final class WP_Customize_Custom_CSS_Setting extends WP_Customize_Setting { - - /** - * The setting type. - * - * @since 4.7.0 - * @var string - */ - public $type = 'custom_css'; - - /** - * Setting Transport - * - * @since 4.7.0 - * @var string - */ - public $transport = 'postMessage'; - - /** - * Capability required to edit this setting. - * - * @since 4.7.0 - * @var string - */ - public $capability = 'edit_css'; - - /** - * Stylesheet - * - * @since 4.7.0 - * @var string - */ - public $stylesheet = ''; - - /** - * WP_Customize_Custom_CSS_Setting constructor. - * - * @since 4.7.0 - * - * @throws Exception If the setting ID does not match the pattern `custom_css[$stylesheet]`. - * - * @param WP_Customize_Manager $manager The Customize Manager class. - * @param string $id An specific ID of the setting. Can be a - * theme mod or option name. - * @param array $args Setting arguments. - */ - public function __construct( $manager, $id, $args = array() ) { - parent::__construct( $manager, $id, $args ); - if ( 'custom_css' !== $this->id_data['base'] ) { - throw new Exception( 'Expected custom_css id_base.' ); - } - if ( 1 !== count( $this->id_data['keys'] ) || empty( $this->id_data['keys'][0] ) ) { - throw new Exception( 'Expected single stylesheet key.' ); - } - $this->stylesheet = $this->id_data['keys'][0]; - } - - /** - * Add filter to preview post value. - * - * @since 4.7.9 - * - * @return bool False when preview short-circuits due no change needing to be previewed. - */ - public function preview() { - if ( $this->is_previewed ) { - return false; - } - $this->is_previewed = true; - add_filter( 'wp_get_custom_css', array( $this, 'filter_previewed_wp_get_custom_css' ), 9, 2 ); - return true; - } - - /** - * Filter `wp_get_custom_css` for applying the customized value. - * - * This is used in the preview when `wp_get_custom_css()` is called for rendering the styles. - * - * @since 4.7.0 - * @see wp_get_custom_css() - * - * @param string $css Original CSS. - * @param string $stylesheet Current stylesheet. - * @return string CSS. - */ - public function filter_previewed_wp_get_custom_css( $css, $stylesheet ) { - if ( $stylesheet === $this->stylesheet ) { - $customized_value = $this->post_value( null ); - if ( ! is_null( $customized_value ) ) { - $css = $customized_value; - } - } - return $css; - } - - /** - * Fetch the value of the setting. Will return the previewed value when `preview()` is called. - * - * @since 4.7.0 - * @see WP_Customize_Setting::value() - * - * @return string - */ - public function value() { - if ( $this->is_previewed ) { - $post_value = $this->post_value( null ); - if ( null !== $post_value ) { - return $post_value; - } - } - $id_base = $this->id_data['base']; - $value = ''; - $post = wp_get_custom_css_post( $this->stylesheet ); - if ( $post ) { - $value = $post->post_content; - } - if ( empty( $value ) ) { - $value = $this->default; - } - - /** This filter is documented in wp-includes/class-wp-customize-setting.php */ - $value = apply_filters( "customize_value_{$id_base}", $value, $this ); - - return $value; - } - - /** - * Validate CSS. - * - * Checks for imbalanced braces, brackets, and comments. - * Notifications are rendered when the customizer state is saved. - * - * @since 4.7.0 - * @since 4.9.0 Checking for balanced characters has been moved client-side via linting in code editor. - * - * @param string $css The input string. - * @return true|WP_Error True if the input was validated, otherwise WP_Error. - */ - public function validate( $css ) { - $validity = new WP_Error(); - - if ( preg_match( '#</?\w+#', $css ) ) { - $validity->add( 'illegal_markup', __( 'Markup is not allowed in CSS.' ) ); - } - - if ( ! $validity->has_errors() ) { - $validity = parent::validate( $css ); - } - return $validity; - } - - /** - * Store the CSS setting value in the custom_css custom post type for the stylesheet. - * - * @since 4.7.0 - * - * @param string $css The input value. - * @return int|false The post ID or false if the value could not be saved. - */ - public function update( $css ) { - if ( empty( $css ) ) { - $css = ''; - } - - $r = wp_update_custom_css_post( - $css, - array( - 'stylesheet' => $this->stylesheet, - ) - ); - - if ( $r instanceof WP_Error ) { - return false; - } - $post_id = $r->ID; - - // Cache post ID in theme mod for performance to avoid additional DB query. - if ( $this->manager->get_stylesheet() === $this->stylesheet ) { - set_theme_mod( 'custom_css_post_id', $post_id ); - } - - return $post_id; - } -} diff --git a/srcs/wordpress/wp-includes/customize/class-wp-customize-date-time-control.php b/srcs/wordpress/wp-includes/customize/class-wp-customize-date-time-control.php deleted file mode 100644 index 36bd192..0000000 --- a/srcs/wordpress/wp-includes/customize/class-wp-customize-date-time-control.php +++ /dev/null @@ -1,282 +0,0 @@ -<?php -/** - * Customize API: WP_Customize_Date_Time_Control class - * - * @package WordPress - * @subpackage Customize - * @since 4.9.0 - */ - -/** - * Customize Date Time Control class. - * - * @since 4.9.0 - * - * @see WP_Customize_Control - */ -class WP_Customize_Date_Time_Control extends WP_Customize_Control { - - /** - * Customize control type. - * - * @since 4.9.0 - * @var string - */ - public $type = 'date_time'; - - /** - * Minimum Year. - * - * @since 4.9.0 - * @var integer - */ - public $min_year = 1000; - - /** - * Maximum Year. - * - * @since 4.9.0 - * @var integer - */ - public $max_year = 9999; - - /** - * Allow past date, if set to false user can only select future date. - * - * @since 4.9.0 - * @var boolean - */ - public $allow_past_date = true; - - /** - * Whether hours, minutes, and meridian should be shown. - * - * @since 4.9.0 - * @var boolean - */ - public $include_time = true; - - /** - * If set to false the control will appear in 24 hour format, - * the value will still be saved in Y-m-d H:i:s format. - * - * @since 4.9.0 - * @var boolean - */ - public $twelve_hour_format = true; - - /** - * Don't render the control's content - it's rendered with a JS template. - * - * @since 4.9.0 - */ - public function render_content() {} - - /** - * Export data to JS. - * - * @since 4.9.0 - * @return array - */ - public function json() { - $data = parent::json(); - - $data['maxYear'] = intval( $this->max_year ); - $data['minYear'] = intval( $this->min_year ); - $data['allowPastDate'] = (bool) $this->allow_past_date; - $data['twelveHourFormat'] = (bool) $this->twelve_hour_format; - $data['includeTime'] = (bool) $this->include_time; - - return $data; - } - - /** - * Renders a JS template for the content of date time control. - * - * @since 4.9.0 - */ - public function content_template() { - $data = array_merge( $this->json(), $this->get_month_choices() ); - $timezone_info = $this->get_timezone_info(); - - $date_format = get_option( 'date_format' ); - $date_format = preg_replace( '/(?<!\\\\)[Yyo]/', '%1$s', $date_format ); - $date_format = preg_replace( '/(?<!\\\\)[FmMn]/', '%2$s', $date_format ); - $date_format = preg_replace( '/(?<!\\\\)[jd]/', '%3$s', $date_format ); - - // Fallback to ISO date format if year, month, or day are missing from the date format. - if ( 1 !== substr_count( $date_format, '%1$s' ) || 1 !== substr_count( $date_format, '%2$s' ) || 1 !== substr_count( $date_format, '%3$s' ) ) { - $date_format = '%1$s-%2$s-%3$s'; - } - ?> - - <# _.defaults( data, <?php echo wp_json_encode( $data ); ?> ); #> - <# var idPrefix = _.uniqueId( 'el' ) + '-'; #> - - <# if ( data.label ) { #> - <span class="customize-control-title"> - {{ data.label }} - </span> - <# } #> - <div class="customize-control-notifications-container"></div> - <# if ( data.description ) { #> - <span class="description customize-control-description">{{ data.description }}</span> - <# } #> - <div class="date-time-fields {{ data.includeTime ? 'includes-time' : '' }}"> - <fieldset class="day-row"> - <legend class="title-day {{ ! data.includeTime ? 'screen-reader-text' : '' }}"><?php esc_html_e( 'Date' ); ?></legend> - <div class="day-fields clear"> - <?php ob_start(); ?> - <label for="{{ idPrefix }}date-time-month" class="screen-reader-text"><?php esc_html_e( 'Month' ); ?></label> - <select id="{{ idPrefix }}date-time-month" class="date-input month" data-component="month"> - <# _.each( data.month_choices, functi |
