aboutsummaryrefslogtreecommitdiff
path: root/srcs/wordpress/wp-includes/widgets
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-07-27 10:05:23 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-07-27 10:05:23 +0200
commit5bf66662a9bdd62c5bccab15e607cd95cfb8fcab (patch)
tree39a1a4629749056191c05dfd899f931701b7acf3 /srcs/wordpress/wp-includes/widgets
parent5afd237bbd22028b85532b8c0b3fcead49a00764 (diff)
downloadft_server-master.tar.gz
ft_server-master.tar.bz2
ft_server-master.zip
Removed wordpress and phpmyadmin, my server doesn't handle it well and it brings shame on my famillyHEADmaster
Diffstat (limited to 'srcs/wordpress/wp-includes/widgets')
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-nav-menu-widget.php174
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-archives.php208
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-calendar.php102
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-categories.php183
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-custom-html.php335
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-links.php182
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-media-audio.php205
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-media-gallery.php260
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-media-image.php371
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-media-video.php257
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-media.php446
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-meta.php119
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-pages.php164
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-recent-comments.php188
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-recent-posts.php156
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-rss.php144
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-search.php91
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-tag-cloud.php203
-rw-r--r--srcs/wordpress/wp-includes/widgets/class-wp-widget-text.php566
19 files changed, 0 insertions, 4354 deletions
diff --git a/srcs/wordpress/wp-includes/widgets/class-wp-nav-menu-widget.php b/srcs/wordpress/wp-includes/widgets/class-wp-nav-menu-widget.php
deleted file mode 100644
index 8f1a208..0000000
--- a/srcs/wordpress/wp-includes/widgets/class-wp-nav-menu-widget.php
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-/**
- * Widget API: WP_Nav_Menu_Widget class
- *
- * @package WordPress
- * @subpackage Widgets
- * @since 4.4.0
- */
-
-/**
- * Core class used to implement the Navigation Menu widget.
- *
- * @since 3.0.0
- *
- * @see WP_Widget
- */
-class WP_Nav_Menu_Widget extends WP_Widget {
-
- /**
- * Sets up a new Navigation Menu widget instance.
- *
- * @since 3.0.0
- */
- public function __construct() {
- $widget_ops = array(
- 'description' => __( 'Add a navigation menu to your sidebar.' ),
- 'customize_selective_refresh' => true,
- );
- parent::__construct( 'nav_menu', __( 'Navigation Menu' ), $widget_ops );
- }
-
- /**
- * Outputs the content for the current Navigation Menu widget instance.
- *
- * @since 3.0.0
- *
- * @param array $args Display arguments including 'before_title', 'after_title',
- * 'before_widget', and 'after_widget'.
- * @param array $instance Settings for the current Navigation Menu widget instance.
- */
- public function widget( $args, $instance ) {
- // Get menu
- $nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false;
-
- if ( ! $nav_menu ) {
- return;
- }
-
- $title = ! empty( $instance['title'] ) ? $instance['title'] : '';
-
- /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
- $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
-
- echo $args['before_widget'];
-
- if ( $title ) {
- echo $args['before_title'] . $title . $args['after_title'];
- }
-
- $nav_menu_args = array(
- 'fallback_cb' => '',
- 'menu' => $nav_menu,
- );
-
- /**
- * Filters the arguments for the Navigation Menu widget.
- *
- * @since 4.2.0
- * @since 4.4.0 Added the `$instance` parameter.
- *
- * @param array $nav_menu_args {
- * An array of arguments passed to wp_nav_menu() to retrieve a navigation menu.
- *
- * @type callable|bool $fallback_cb Callback to fire if the menu doesn't exist. Default empty.
- * @type mixed $menu Menu ID, slug, or name.
- * }
- * @param WP_Term $nav_menu Nav menu object for the current menu.
- * @param array $args Display arguments for the current widget.
- * @param array $instance Array of settings for the current widget.
- */
- wp_nav_menu( apply_filters( 'widget_nav_menu_args', $nav_menu_args, $nav_menu, $args, $instance ) );
-
- echo $args['after_widget'];
- }
-
- /**
- * Handles updating settings for the current Navigation Menu widget instance.
- *
- * @since 3.0.0
- *
- * @param array $new_instance New settings for this instance as input by the user via
- * WP_Widget::form().
- * @param array $old_instance Old settings for this instance.
- * @return array Updated settings to save.
- */
- public function update( $new_instance, $old_instance ) {
- $instance = array();
- if ( ! empty( $new_instance['title'] ) ) {
- $instance['title'] = sanitize_text_field( $new_instance['title'] );
- }
- if ( ! empty( $new_instance['nav_menu'] ) ) {
- $instance['nav_menu'] = (int) $new_instance['nav_menu'];
- }
- return $instance;
- }
-
- /**
- * Outputs the settings form for the Navigation Menu widget.
- *
- * @since 3.0.0
- *
- * @param array $instance Current settings.
- * @global WP_Customize_Manager $wp_customize
- */
- public function form( $instance ) {
- global $wp_customize;
- $title = isset( $instance['title'] ) ? $instance['title'] : '';
- $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
-
- // Get menus
- $menus = wp_get_nav_menus();
-
- $empty_menus_style = '';
- $not_empty_menus_style = '';
- if ( empty( $menus ) ) {
- $empty_menus_style = ' style="display:none" ';
- } else {
- $not_empty_menus_style = ' style="display:none" ';
- }
-
- $nav_menu_style = '';
- if ( ! $nav_menu ) {
- $nav_menu_style = 'display: none;';
- }
-
- // If no menus exists, direct the user to go and create some.
- ?>
- <p class="nav-menu-widget-no-menus-message" <?php echo $not_empty_menus_style; ?>>
- <?php
- if ( $wp_customize instanceof WP_Customize_Manager ) {
- $url = 'javascript: wp.customize.panel( "nav_menus" ).focus();';
- } else {
- $url = admin_url( 'nav-menus.php' );
- }
-
- /* translators: %s: URL to create a new menu. */
- printf( __( 'No menus have been created yet. <a href="%s">Create some</a>.' ), esc_attr( $url ) );
- ?>
- </p>
- <div class="nav-menu-widget-form-controls" <?php echo $empty_menus_style; ?>>
- <p>
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
- <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>"/>
- </p>
- <p>
- <label for="<?php echo $this->get_field_id( 'nav_menu' ); ?>"><?php _e( 'Select Menu:' ); ?></label>
- <select id="<?php echo $this->get_field_id( 'nav_menu' ); ?>" name="<?php echo $this->get_field_name( 'nav_menu' ); ?>">
- <option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
- <?php foreach ( $menus as $menu ) : ?>
- <option value="<?php echo esc_attr( $menu->term_id ); ?>" <?php selected( $nav_menu, $menu->term_id ); ?>>
- <?php echo esc_html( $menu->name ); ?>
- </option>
- <?php endforeach; ?>
- </select>
- </p>
- <?php if ( $wp_customize instanceof WP_Customize_Manager ) : ?>
- <p class="edit-selected-nav-menu" style="<?php echo $nav_menu_style; ?>">
- <button type="button" class="button"><?php _e( 'Edit Menu' ); ?></button>
- </p>
- <?php endif; ?>
- </div>
- <?php
- }
-}
diff --git a/srcs/wordpress/wp-includes/widgets/class-wp-widget-archives.php b/srcs/wordpress/wp-includes/widgets/class-wp-widget-archives.php
deleted file mode 100644
index 4cf0db8..0000000
--- a/srcs/wordpress/wp-includes/widgets/class-wp-widget-archives.php
+++ /dev/null
@@ -1,208 +0,0 @@
-<?php
-/**
- * Widget API: WP_Widget_Archives class
- *
- * @package WordPress
- * @subpackage Widgets
- * @since 4.4.0
- */
-
-/**
- * Core class used to implement the Archives widget.
- *
- * @since 2.8.0
- *
- * @see WP_Widget
- */
-class WP_Widget_Archives extends WP_Widget {
-
- /**
- * Sets up a new Archives widget instance.
- *
- * @since 2.8.0
- */
- public function __construct() {
- $widget_ops = array(
- 'classname' => 'widget_archive',
- 'description' => __( 'A monthly archive of your site&#8217;s Posts.' ),
- 'customize_selective_refresh' => true,
- );
- parent::__construct( 'archives', __( 'Archives' ), $widget_ops );
- }
-
- /**
- * Outputs the content for the current Archives widget instance.
- *
- * @since 2.8.0
- *
- * @param array $args Display arguments including 'before_title', 'after_title',
- * 'before_widget', and 'after_widget'.
- * @param array $instance Settings for the current Archives widget instance.
- */
- public function widget( $args, $instance ) {
- $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Archives' );
-
- /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
- $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
-
- $c = ! empty( $instance['count'] ) ? '1' : '0';
- $d = ! empty( $instance['dropdown'] ) ? '1' : '0';
-
- echo $args['before_widget'];
-
- if ( $title ) {
- echo $args['before_title'] . $title . $args['after_title'];
- }
-
- if ( $d ) {
- $dropdown_id = "{$this->id_base}-dropdown-{$this->number}";
- ?>
- <label class="screen-reader-text" for="<?php echo esc_attr( $dropdown_id ); ?>"><?php echo $title; ?></label>
- <select id="<?php echo esc_attr( $dropdown_id ); ?>" name="archive-dropdown">
- <?php
- /**
- * Filters the arguments for the Archives widget drop-down.
- *
- * @since 2.8.0
- * @since 4.9.0 Added the `$instance` parameter.
- *
- * @see wp_get_archives()
- *
- * @param array $args An array of Archives widget drop-down arguments.
- * @param array $instance Settings for the current Archives widget instance.
- */
- $dropdown_args = apply_filters(
- 'widget_archives_dropdown_args',
- array(
- 'type' => 'monthly',
- 'format' => 'option',
- 'show_post_count' => $c,
- ),
- $instance
- );
-
- switch ( $dropdown_args['type'] ) {
- case 'yearly':
- $label = __( 'Select Year' );
- break;
- case 'monthly':
- $label = __( 'Select Month' );
- break;
- case 'daily':
- $label = __( 'Select Day' );
- break;
- case 'weekly':
- $label = __( 'Select Week' );
- break;
- default:
- $label = __( 'Select Post' );
- break;
- }
-
- $type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"';
- ?>
-
- <option value=""><?php echo esc_attr( $label ); ?></option>
- <?php wp_get_archives( $dropdown_args ); ?>
-
- </select>
-
-<script<?php echo $type_attr; ?>>
-/* <![CDATA[ */
-(function() {
- var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );
- function onSelectChange() {
- if ( dropdown.options[ dropdown.selectedIndex ].value !== '' ) {
- document.location.href = this.options[ this.selectedIndex ].value;
- }
- }
- dropdown.onchange = onSelectChange;
-})();
-/* ]]> */
-</script>
-
- <?php } else { ?>
- <ul>
- <?php
- /**
- * Filters the arguments for the Archives widget.
- *
- * @since 2.8.0
- * @since 4.9.0 Added the `$instance` parameter.
- *
- * @see wp_get_archives()
- *
- * @param array $args An array of Archives option arguments.
- * @param array $instance Array of settings for the current widget.
- */
- wp_get_archives(
- apply_filters(
- 'widget_archives_args',
- array(
- 'type' => 'monthly',
- 'show_post_count' => $c,
- ),
- $instance
- )
- );
- ?>
- </ul>
- <?php
- }
-
- echo $args['after_widget'];
- }
-
- /**
- * Handles updating settings for the current Archives widget instance.
- *
- * @since 2.8.0
- *
- * @param array $new_instance New settings for this instance as input by the user via
- * WP_Widget_Archives::form().
- * @param array $old_instance Old settings for this instance.
- * @return array Updated settings to save.
- */
- public function update( $new_instance, $old_instance ) {
- $instance = $old_instance;
- $new_instance = wp_parse_args(
- (array) $new_instance,
- array(
- 'title' => '',
- 'count' => 0,
- 'dropdown' => '',
- )
- );
- $instance['title'] = sanitize_text_field( $new_instance['title'] );
- $instance['count'] = $new_instance['count'] ? 1 : 0;
- $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0;
-
- return $instance;
- }
-
- /**
- * Outputs the settings form for the Archives widget.
- *
- * @since 2.8.0
- *
- * @param array $instance Current settings.
- */
- public function form( $instance ) {
- $instance = wp_parse_args(
- (array) $instance,
- array(
- 'title' => '',
- 'count' => 0,
- 'dropdown' => '',
- )
- );
- ?>
- <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
- <p>
- <input class="checkbox" type="checkbox"<?php checked( $instance['dropdown'] ); ?> id="<?php echo $this->get_field_id( 'dropdown' ); ?>" name="<?php echo $this->get_field_name( 'dropdown' ); ?>" /> <label for="<?php echo $this->get_field_id( 'dropdown' ); ?>"><?php _e( 'Display as dropdown' ); ?></label>
- <br/>
- <input class="checkbox" type="checkbox"<?php checked( $instance['count'] ); ?> id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" /> <label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Show post counts' ); ?></label>
- </p>
- <?php
- }
-}
diff --git a/srcs/wordpress/wp-includes/widgets/class-wp-widget-calendar.php b/srcs/wordpress/wp-includes/widgets/class-wp-widget-calendar.php
deleted file mode 100644
index ab80033..0000000
--- a/srcs/wordpress/wp-includes/widgets/class-wp-widget-calendar.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-/**
- * Widget API: WP_Widget_Calendar class
- *
- * @package WordPress
- * @subpackage Widgets
- * @since 4.4.0
- */
-
-/**
- * Core class used to implement the Calendar widget.
- *
- * @since 2.8.0
- *
- * @see WP_Widget
- */
-class WP_Widget_Calendar extends WP_Widget {
- /**
- * Ensure that the ID attribute only appears in the markup once
- *
- * @since 4.4.0
- * @var int
- */
- private static $instance = 0;
-
- /**
- * Sets up a new Calendar widget instance.
- *
- * @since 2.8.0
- */
- public function __construct() {
- $widget_ops = array(
- 'classname' => 'widget_calendar',
- 'description' => __( 'A calendar of your site’s posts.' ),
- 'customize_selective_refresh' => true,
- );
- parent::__construct( 'calendar', __( 'Calendar' ), $widget_ops );
- }
-
- /**
- * Outputs the content for the current Calendar widget instance.
- *
- * @since 2.8.0
- *
- * @param array $args Display arguments including 'before_title', 'after_title',
- * 'before_widget', and 'after_widget'.
- * @param array $instance The settings for the particular instance of the widget.
- */
- public function widget( $args, $instance ) {
- $title = ! empty( $instance['title'] ) ? $instance['title'] : '';
-
- /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
- $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
-
- echo $args['before_widget'];
- if ( $title ) {
- echo $args['before_title'] . $title . $args['after_title'];
- }
- if ( 0 === self::$instance ) {
- echo '<div id="calendar_wrap" class="calendar_wrap">';
- } else {
- echo '<div class="calendar_wrap">';
- }
- get_calendar();
- echo '</div>';
- echo $args['after_widget'];
-
- self::$instance++;
- }
-
- /**
- * Handles updating settings for the current Calendar widget instance.
- *
- * @since 2.8.0
- *
- * @param array $new_instance New settings for this instance as input by the user via
- * WP_Widget::form().
- * @param array $old_instance Old settings for this instance.
- * @return array Updated settings to save.
- */
- public function update( $new_instance, $old_instance ) {
- $instance = $old_instance;
- $instance['title'] = sanitize_text_field( $new_instance['title'] );
-
- return $instance;
- }
-
- /**
- * Outputs the settings form for the Calendar widget.
- *
- * @since 2.8.0
- *
- * @param array $instance Current settings.
- */
- public function form( $instance ) {
- $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
- ?>
- <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
- <?php
- }
-}
diff --git a/srcs/wordpress/wp-includes/widgets/class-wp-widget-categories.php b/srcs/wordpress/wp-includes/widgets/class-wp-widget-categories.php
deleted file mode 100644
index 92f30c0..0000000
--- a/srcs/wordpress/wp-includes/widgets/class-wp-widget-categories.php
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-/**
- * Widget API: WP_Widget_Categories class
- *
- * @package WordPress
- * @subpackage Widgets
- * @since 4.4.0
- */
-
-/**
- * Core class used to implement a Categories widget.
- *
- * @since 2.8.0
- *
- * @see WP_Widget
- */
-class WP_Widget_Categories extends WP_Widget {
-
- /**
- * Sets up a new Categories widget instance.
- *
- * @since 2.8.0
- */
- public function __construct() {
- $widget_ops = array(
- 'classname' => 'widget_categories',
- 'description' => __( 'A list or dropdown of categories.' ),
- 'customize_selective_refresh' => true,
- );
- parent::__construct( 'categories', __( 'Categories' ), $widget_ops );
- }
-
- /**
- * Outputs the content for the current Categories widget instance.
- *
- * @since 2.8.0
- *
- * @staticvar bool $first_dropdown
- *
- * @param array $args Display arguments including 'before_title', 'after_title',
- * 'before_widget', and 'after_widget'.
- * @param array $instance Settings for the current Categories widget instance.
- */
- public function widget( $args, $instance ) {
- static $first_dropdown = true;
-
- $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Categories' );
-
- /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
- $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
-
- $c = ! empty( $instance['count'] ) ? '1' : '0';
- $h = ! empty( $instance['hierarchical'] ) ? '1' : '0';
- $d = ! empty( $instance['dropdown'] ) ? '1' : '0';
-
- echo $args['before_widget'];
-
- if ( $title ) {
- echo $args['before_title'] . $title . $args['after_title'];
- }
-
- $cat_args = array(
- 'orderby' => 'name',
- 'show_count' => $c,
- 'hierarchical' => $h,
- );
-
- if ( $d ) {
- echo sprintf( '<form action="%s" method="get">', esc_url( home_url() ) );
- $dropdown_id = ( $first_dropdown ) ? 'cat' : "{$this->id_base}-dropdown-{$this->number}";
- $first_dropdown = false;
-
- echo '<label class="screen-reader-text" for="' . esc_attr( $dropdown_id ) . '">' . $title . '</label>';
-
- $cat_args['show_option_none'] = __( 'Select Category' );
- $cat_args['id'] = $dropdown_id;
-
- /**
- * Filters the arguments for the Categories widget drop-down.
- *
- * @since 2.8.0
- * @since 4.9.0 Added the `$instance` parameter.
- *
- * @see wp_dropdown_categories()
- *
- * @param array $cat_args An array of Categories widget drop-down arguments.
- * @param array $instance Array of settings for the current widget.
- */
- wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args, $instance ) );
-
- echo '</form>';
-
- $type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"';
- ?>
-
-<script<?php echo $type_attr; ?>>
-/* <![CDATA[ */
-(function() {
- var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );
- function onCatChange() {
- if ( dropdown.options[ dropdown.selectedIndex ].value > 0 ) {
- dropdown.parentNode.submit();
- }
- }
- dropdown.onchange = onCatChange;
-})();
-/* ]]> */
-</script>
-
- <?php
- } else {
- ?>
- <ul>
- <?php
- $cat_args['title_li'] = '';
-
- /**
- * Filters the arguments for the Categories widget.
- *
- * @since 2.8.0
- * @since 4.9.0 Added the `$instance` parameter.
- *
- * @param array $cat_args An array of Categories widget options.
- * @param array $instance Array of settings for the current widget.
- */
- wp_list_categories( apply_filters( 'widget_categories_args', $cat_args, $instance ) );
- ?>
- </ul>
- <?php
- }
-
- echo $args['after_widget'];
- }
-
- /**
- * Handles updating settings for the current Categories widget instance.
- *
- * @since 2.8.0
- *
- * @param array $new_instance New settings for this instance as input by the user via
- * WP_Widget::form().
- * @param array $old_instance Old settings for this instance.
- * @return array Updated settings to save.
- */
- public function update( $new_instance, $old_instance ) {
- $instance = $old_instance;
- $instance['title'] = sanitize_text_field( $new_instance['title'] );
- $instance['count'] = ! empty( $new_instance['count'] ) ? 1 : 0;
- $instance['hierarchical'] = ! empty( $new_instance['hierarchical'] ) ? 1 : 0;
- $instance['dropdown'] = ! empty( $new_instance['dropdown'] ) ? 1 : 0;
-
- return $instance;
- }
-
- /**
- * Outputs the settings form for the Categories widget.
- *
- * @since 2.8.0
- *
- * @param array $instance Current settings.
- */
- public function form( $instance ) {
- //Defaults
- $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
- $count = isset( $instance['count'] ) ? (bool) $instance['count'] : false;
- $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
- $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;
- ?>
- <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
-
- <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'dropdown' ); ?>" name="<?php echo $this->get_field_name( 'dropdown' ); ?>"<?php checked( $dropdown ); ?> />
- <label for="<?php echo $this->get_field_id( 'dropdown' ); ?>"><?php _e( 'Display as dropdown' ); ?></label><br />
-
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>"<?php checked( $count ); ?> />
- <label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Show post counts' ); ?></label><br />
-
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'hierarchical' ); ?>" name="<?php echo $this->get_field_name( 'hierarchical' ); ?>"<?php checked( $hierarchical ); ?> />
- <label for="<?php echo $this->get_field_id( 'hierarchical' ); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>
- <?php
- }
-
-}
diff --git a/srcs/wordpress/wp-includes/widgets/class-wp-widget-custom-html.php b/srcs/wordpress/wp-includes/widgets/class-wp-widget-custom-html.php
deleted file mode 100644
index 951cf4b..0000000
--- a/srcs/wordpress/wp-includes/widgets/class-wp-widget-custom-html.php
+++ /dev/null
@@ -1,335 +0,0 @@
-<?php
-/**
- * Widget API: WP_Widget_Custom_HTML class
- *
- * @package WordPress
- * @subpackage Widgets
- * @since 4.8.1
- */
-
-/**
- * Core class used to implement a Custom HTML widget.
- *
- * @since 4.8.1
- *
- * @see WP_Widget
- */
-class WP_Widget_Custom_HTML extends WP_Widget {
-
- /**
- * Whether or not the widget has been registered yet.
- *
- * @since 4.9.0
- * @var bool
- */
- protected $registered = false;
-
- /**
- * Default instance.
- *
- * @since 4.8.1
- * @var array
- */
- protected $default_instance = array(
- 'title' => '',
- 'content' => '',
- );
-
- /**
- * Sets up a new Custom HTML widget instance.
- *
- * @since 4.8.1
- */
- public function __construct() {
- $widget_ops = array(
- 'classname' => 'widget_custom_html',
- 'description' => __( 'Arbitrary HTML code.' ),
- 'customize_selective_refresh' => true,
- );
- $control_ops = array(
- 'width' => 400,
- 'height' => 350,
- );
- parent::__construct( 'custom_html', __( 'Custom HTML' ), $widget_ops, $control_ops );
- }
-
- /**
- * Add hooks for enqueueing assets when registering all widget instances of this widget class.
- *
- * @since 4.9.0
- *
- * @param integer $number Optional. The unique order number of this widget instance
- * compared to other instances of the same class. Default -1.
- */
- public function _register_one( $number = -1 ) {
- parent::_register_one( $number );
- if ( $this->registered ) {
- return;
- }
- $this->registered = true;
-
- wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.idBases.push( %s );', wp_json_encode( $this->id_base ) ) );
-
- // Note that the widgets component in the customizer will also do the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts().
- add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) );
-
- // Note that the widgets component in the customizer will also do the 'admin_footer-widgets.php' action in WP_Customize_Widgets::print_footer_scripts().
- add_action( 'admin_footer-widgets.php', array( 'WP_Widget_Custom_HTML', 'render_control_template_scripts' ) );
-
- // Note this action is used to ensure the help text is added to the end.
- add_action( 'admin_head-widgets.php', array( 'WP_Widget_Custom_HTML', 'add_help_text' ) );
- }
-
- /**
- * Filter gallery shortcode attributes.
- *
- * Prevents all of a site's attachments from being shown in a gallery displayed on a
- * non-singular template where a $post context is not available.
- *
- * @since 4.9.0
- *
- * @param array $attrs Attributes.
- * @return array Attributes.
- */
- public function _filter_gallery_shortcode_attrs( $attrs ) {
- if ( ! is_singular() && empty( $attrs['id'] ) && empty( $attrs['include'] ) ) {
- $attrs['id'] = -1;
- }
- return $attrs;
- }
-
- /**
- * Outputs the content for the current Custom HTML widget instance.
- *
- * @since 4.8.1
- *
- * @global WP_Post $post Global post object.
- *
- * @param array $args Display arguments including 'before_title', 'after_title',
- * 'before_widget', and 'after_widget'.
- * @param array $instance Settings for the current Custom HTML widget instance.
- */
- public function widget( $args, $instance ) {
- global $post;
-
- // Override global $post so filters (and shortcodes) apply in a consistent context.
- $original_post = $post;
- if ( is_singular() ) {
- // Make sure post is always the queried object on singular queries (not from another sub-query that failed to clean up the global $post).
- $post = get_queried_object();
- } else {
- // Nullify the $post global during widget rendering to prevent shortcodes from running with the unexpected context on archive queries.
- $post = null;
- }
-
- // Prevent dumping out all attachments from the media library.
- add_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) );
-
- $instance = array_merge( $this->default_instance, $instance );
-
- /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
- $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
-
- // Prepare instance data that looks like a normal Text widget.
- $simulated_text_widget_instance = array_merge(
- $instance,
- array(
- 'text' => isset( $instance['content'] ) ? $instance['content'] : '',
- 'filter' => false, // Because wpautop is not applied.
- 'visual' => false, // Because it wasn't created in TinyMCE.
- )
- );
- unset( $simulated_text_widget_instance['content'] ); // Was moved to 'text' prop.
-
- /** This filter is documented in wp-includes/widgets/class-wp-widget-text.php */
- $content = apply_filters( 'widget_text', $instance['content'], $simulated_text_widget_instance, $this );
-
- // Adds noreferrer and noopener relationships, without duplicating values, to all HTML A elements that have a target.
- $content = wp_targeted_link_rel( $content );
-
- /**
- * Filters the content of the Custom HTML widget.
- *
- * @since 4.8.1
- *
- * @param string $content The widget content.
- * @param array $instance Array of settings for the current widget.
- * @param WP_Widget_Custom_HTML $this Current Custom HTML widget instance.
- */
- $content = apply_filters( 'widget_custom_html_content', $content, $instance, $this );
-
- // Restore post global.
- $post = $original_post;
- remove_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) );
-
- // Inject the Text widget's container class name alongside this widget's class name for theme styling compatibility.
- $args['before_widget'] = preg_replace( '/(?<=\sclass=["\'])/', 'widget_text ', $args['before_widget'] );
-
- echo $args['before_widget'];
- if ( ! empty( $title ) ) {
- echo $args['before_title'] . $title . $args['after_title'];
- }
- echo '<div class="textwidget custom-html-widget">'; // The textwidget class is for theme styling compatibility.
- echo $content;
- echo '</div>';
- echo $args['after_widget'];
- }
-
- /**
- * Handles updating settings for the current Custom HTML widget instance.
- *
- * @since 4.8.1
- *
- * @param array $new_instance New settings for this instance as input by the user via
- * WP_Widget::form().
- * @param array $old_instance Old settings for this instance.
- * @return array Settings to save or bool false to cancel saving.
- */
- public function update( $new_instance, $old_instance ) {
- $instance = array_merge( $this->default_instance, $old_instance );
- $instance['title'] = sanitize_text_field( $new_instance['title'] );
- if ( current_user_can( 'unfiltered_html