C:\xampp\htdocs\landing\wp-content\plugins\amp\includes\widgets\class-amp-widget-archives.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/**
 * Class AMP_Widget_Archives
 *
 * @since 0.7.0
 * @package AMP
 * @codeCoverageIgnore
 */

_deprecated_file__FILE__'2.0.0' );

/**
 * Class AMP_Widget_Archives
 *
 * @deprecated As of 2.0 the AMP_Core_Block_Handler will sanitize the core widgets instead.
 * @internal
 * @since 0.7.0
 * @package AMP
 */
class AMP_Widget_Archives extends WP_Widget_Archives {

    
/**
     * Echoes the markup of the widget.
     *
     * Mainly copied from WP_Widget_Archives::widget()
     * Changes include:
     * An id for the <form>.
     * More escaping.
     * The dropdown is now filtered with 'wp_dropdown_cats.'
     * This enables adding an 'on' attribute, with the id of the form.
     * So changing the dropdown value will redirect to the category page, with valid AMP.
     *
     * @since 0.7.0
     *
     * @param array $args Widget display data.
     * @param array $instance Data for widget.
     * @return void.
     */
    
public function widget$args$instance ) {
        if ( ! 
amp_is_request() ) {
            
parent::widget$args$instance );
            return;
        }

        
$c = ! empty( $instance['count'] ) ? '1' '0';
        
$d = ! empty( $instance['dropdown'] ) ? '1' '0';

        
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
        
$title apply_filters'widget_title', empty( $instance['title'] ) ? __'Archives''default' ) : $instance['title'], $instance$this->id_base );
        echo 
wp_kses_post$args['before_widget'] );
        if ( 
$title ) :
            echo 
wp_kses_post$args['before_title'] . $title $args['after_title'] );
        endif;

        if ( 
$d ) :
            
$dropdown_id "{$this->id_base}-dropdown-{$this->number}";
            
?>
            <form action="<?php echo esc_urlhome_url() ); ?>" method="get" target="_top">
                <label class="screen-reader-text" for="<?php echo esc_attr$dropdown_id ); ?>"><?php echo esc_html$title ); ?></label>
                <select id="<?php echo esc_attr$dropdown_id ); ?>" name="archive-dropdown" on="change:AMP.navigateTo(url=event.value)">
                    <?php

                    
/** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */
                    
$dropdown_args apply_filters(
                        
'widget_archives_dropdown_args',
                        [
                            
'type'            => 'monthly',
                            
'format'          => 'option',
                            
'show_post_count' => $c,
                        ]
                    );

                    switch ( 
$dropdown_args['type'] ) {
                        case 
'yearly':
                            
$label __'Select Year''default' );
                            break;
                        case 
'monthly':
                            
$label __'Select Month''default' );
                            break;
                        case 
'daily':
                            
$label __'Select Day''default' );
                            break;
                        case 
'weekly':
                            
$label __'Select Week''default' );
                            break;
                        default:
                            
$label __'Select Post''default' );
                            break;
                    }
                    
?>
                    <option value=""><?php echo esc_attr$label ); ?></option>
                    <?php wp_get_archives$dropdown_args ); ?>
                </select>
            </form>
        <?php else : ?>
            <ul>
                <?php

                
/** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */
                
wp_get_archives(
                    
apply_filters(
                        
'widget_archives_args',
                        [
                            
'type'            => 'monthly',
                            
'show_post_count' => $c,
                        ]
                    )
                );
                
?>
            </ul>
            <?php
        
endif;
        echo 
wp_kses_post$args['after_widget'] );
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586