@@ -18,36 +18,36 @@ discard block |
||
18 | 18 | $color_overlay_style = ''; |
19 | 19 | $color_overlay_classes = ''; |
20 | 20 | |
21 | - $image_url = ! post_password_required() ? get_the_post_thumbnail_url( get_the_ID(), 'twentytwenty-fullscreen' ) : ''; |
|
21 | + $image_url = ! post_password_required() ? get_the_post_thumbnail_url(get_the_ID(), 'twentytwenty-fullscreen') : ''; |
|
22 | 22 | |
23 | - if ( $image_url ) { |
|
24 | - $cover_header_style = ' style="background-image: url( ' . esc_url( $image_url ) . ' );"'; |
|
23 | + if ($image_url) { |
|
24 | + $cover_header_style = ' style="background-image: url( '.esc_url($image_url).' );"'; |
|
25 | 25 | $cover_header_classes = ' bg-image'; |
26 | 26 | } |
27 | 27 | |
28 | 28 | // Get the color used for the color overlay. |
29 | - $color_overlay_color = get_theme_mod( 'cover_template_overlay_background_color' ); |
|
30 | - if ( $color_overlay_color ) { |
|
31 | - $color_overlay_style = ' style="color: ' . esc_attr( $color_overlay_color ) . ';"'; |
|
29 | + $color_overlay_color = get_theme_mod('cover_template_overlay_background_color'); |
|
30 | + if ($color_overlay_color) { |
|
31 | + $color_overlay_style = ' style="color: '.esc_attr($color_overlay_color).';"'; |
|
32 | 32 | } else { |
33 | 33 | $color_overlay_style = ''; |
34 | 34 | } |
35 | 35 | |
36 | 36 | // Get the fixed background attachment option. |
37 | - if ( get_theme_mod( 'cover_template_fixed_background', true ) ) { |
|
37 | + if (get_theme_mod('cover_template_fixed_background', true)) { |
|
38 | 38 | $cover_header_classes .= ' bg-attachment-fixed'; |
39 | 39 | } |
40 | 40 | |
41 | 41 | // Get the opacity of the color overlay. |
42 | - $color_overlay_opacity = get_theme_mod( 'cover_template_overlay_opacity' ); |
|
43 | - $color_overlay_opacity = ( false === $color_overlay_opacity ) ? 80 : $color_overlay_opacity; |
|
44 | - $color_overlay_classes .= ' opacity-' . $color_overlay_opacity; |
|
42 | + $color_overlay_opacity = get_theme_mod('cover_template_overlay_opacity'); |
|
43 | + $color_overlay_opacity = (false === $color_overlay_opacity) ? 80 : $color_overlay_opacity; |
|
44 | + $color_overlay_classes .= ' opacity-'.$color_overlay_opacity; |
|
45 | 45 | ?> |
46 | 46 | |
47 | 47 | <div class="cover-header <?php echo $cover_header_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>"<?php echo $cover_header_style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- We need to double check this, but for now, we want to pass PHPCS ;) ?>> |
48 | 48 | <div class="cover-header-inner-wrapper screen-height"> |
49 | 49 | <div class="cover-header-inner"> |
50 | - <div class="cover-color-overlay color-accent<?php echo esc_attr( $color_overlay_classes ); ?>"<?php echo $color_overlay_style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- We need to double check this, but for now, we want to pass PHPCS ;) ?>></div> |
|
50 | + <div class="cover-color-overlay color-accent<?php echo esc_attr($color_overlay_classes); ?>"<?php echo $color_overlay_style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- We need to double check this, but for now, we want to pass PHPCS ;) ?>></div> |
|
51 | 51 | |
52 | 52 | <header class="entry-header has-text-align-center"> |
53 | 53 | <div class="entry-header-inner section-inner medium"> |
@@ -61,31 +61,31 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @param bool Whether to show the categories in article header. Default true. |
63 | 63 | */ |
64 | - $show_categories = apply_filters( 'twentytwenty_show_categories_in_entry_header', true ); |
|
64 | + $show_categories = apply_filters('twentytwenty_show_categories_in_entry_header', true); |
|
65 | 65 | |
66 | - if ( true === $show_categories && has_category() ) { |
|
66 | + if (true === $show_categories && has_category()) { |
|
67 | 67 | ?> |
68 | 68 | |
69 | 69 | <div class="entry-categories"> |
70 | - <span class="screen-reader-text"><?php _e( 'Categories', 'twentytwenty' ); ?></span> |
|
70 | + <span class="screen-reader-text"><?php _e('Categories', 'twentytwenty'); ?></span> |
|
71 | 71 | <div class="entry-categories-inner"> |
72 | - <?php the_category( ' ' ); ?> |
|
72 | + <?php the_category(' '); ?> |
|
73 | 73 | </div><!-- .entry-categories-inner --> |
74 | 74 | </div><!-- .entry-categories --> |
75 | 75 | |
76 | 76 | <?php |
77 | 77 | } |
78 | 78 | |
79 | - the_title( '<h1 class="entry-title">', '</h1>' ); |
|
79 | + the_title('<h1 class="entry-title">', '</h1>'); |
|
80 | 80 | |
81 | - if ( is_page() ) { |
|
81 | + if (is_page()) { |
|
82 | 82 | ?> |
83 | 83 | |
84 | 84 | <div class="to-the-content-wrapper"> |
85 | 85 | |
86 | 86 | <a href="#post-inner" class="to-the-content fill-children-current-color"> |
87 | - <?php twentytwenty_the_theme_svg( 'arrow-down' ); ?> |
|
88 | - <div class="screen-reader-text"><?php _e( 'Scroll Down', 'twentytwenty' ); ?></div> |
|
87 | + <?php twentytwenty_the_theme_svg('arrow-down'); ?> |
|
88 | + <div class="screen-reader-text"><?php _e('Scroll Down', 'twentytwenty'); ?></div> |
|
89 | 89 | </a><!-- .to-the-content --> |
90 | 90 | |
91 | 91 | </div><!-- .to-the-content-wrapper --> |
@@ -95,23 +95,23 @@ discard block |
||
95 | 95 | |
96 | 96 | $intro_text_width = ''; |
97 | 97 | |
98 | - if ( is_singular() ) { |
|
98 | + if (is_singular()) { |
|
99 | 99 | $intro_text_width = ' small'; |
100 | 100 | } else { |
101 | 101 | $intro_text_width = ' thin'; |
102 | 102 | } |
103 | 103 | |
104 | - if ( has_excerpt() ) { |
|
104 | + if (has_excerpt()) { |
|
105 | 105 | ?> |
106 | 106 | |
107 | - <div class="intro-text section-inner max-percentage<?php echo esc_attr( $intro_text_width ); ?>"> |
|
107 | + <div class="intro-text section-inner max-percentage<?php echo esc_attr($intro_text_width); ?>"> |
|
108 | 108 | <?php the_excerpt(); ?> |
109 | 109 | </div> |
110 | 110 | |
111 | 111 | <?php |
112 | 112 | } |
113 | 113 | |
114 | - twentytwenty_the_post_meta( get_the_ID(), 'single-top' ); |
|
114 | + twentytwenty_the_post_meta(get_the_ID(), 'single-top'); |
|
115 | 115 | |
116 | 116 | } |
117 | 117 | ?> |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | <?php |
136 | 136 | wp_link_pages( |
137 | 137 | array( |
138 | - 'before' => '<nav class="post-nav-links bg-light-background" aria-label="' . esc_attr__( 'Page', 'twentytwenty' ) . '"><span class="label">' . __( 'Pages:', 'twentytwenty' ) . '</span>', |
|
138 | + 'before' => '<nav class="post-nav-links bg-light-background" aria-label="'.esc_attr__('Page', 'twentytwenty').'"><span class="label">'.__('Pages:', 'twentytwenty').'</span>', |
|
139 | 139 | 'after' => '</nav>', |
140 | 140 | 'link_before' => '<span class="page-number">', |
141 | 141 | 'link_after' => '</span>', |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | |
145 | 145 | edit_post_link(); |
146 | 146 | // Single bottom post meta. |
147 | - twentytwenty_the_post_meta( get_the_ID(), 'single-bottom' ); |
|
147 | + twentytwenty_the_post_meta(get_the_ID(), 'single-bottom'); |
|
148 | 148 | |
149 | - if ( post_type_supports( get_post_type( get_the_ID() ), 'author' ) && is_single() ) { |
|
149 | + if (post_type_supports(get_post_type(get_the_ID()), 'author') && is_single()) { |
|
150 | 150 | |
151 | - get_template_part( 'template-parts/entry-author-bio' ); |
|
151 | + get_template_part('template-parts/entry-author-bio'); |
|
152 | 152 | |
153 | 153 | } |
154 | 154 | ?> |
@@ -157,16 +157,16 @@ discard block |
||
157 | 157 | |
158 | 158 | <?php |
159 | 159 | |
160 | - if ( is_single() ) { |
|
160 | + if (is_single()) { |
|
161 | 161 | |
162 | - get_template_part( 'template-parts/navigation' ); |
|
162 | + get_template_part('template-parts/navigation'); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /* |
166 | 166 | * Output comments wrapper if it's a post, or if comments are open, |
167 | 167 | * or if there's a comment number – and check for password. |
168 | 168 | */ |
169 | - if ( ( is_single() || is_page() ) && ( comments_open() || get_comments_number() ) && ! post_password_required() ) { |
|
169 | + if ((is_single() || is_page()) && (comments_open() || get_comments_number()) && ! post_password_required()) { |
|
170 | 170 | ?> |
171 | 171 | |
172 | 172 | <div class="comments-wrapper section-inner"> |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | |
10 | 10 | $entry_header_classes = ''; |
11 | 11 | |
12 | -if ( is_singular() ) { |
|
12 | +if (is_singular()) { |
|
13 | 13 | $entry_header_classes .= ' header-footer-group'; |
14 | 14 | } |
15 | 15 | |
16 | 16 | ?> |
17 | 17 | |
18 | -<header class="entry-header has-text-align-center<?php echo esc_attr( $entry_header_classes ); ?>"> |
|
18 | +<header class="entry-header has-text-align-center<?php echo esc_attr($entry_header_classes); ?>"> |
|
19 | 19 | |
20 | 20 | <div class="entry-header-inner section-inner medium"> |
21 | 21 | |
@@ -27,36 +27,36 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param bool Whether to show the categories in header. Default true. |
29 | 29 | */ |
30 | - $show_categories = apply_filters( 'twentytwenty_show_categories_in_entry_header', true ); |
|
30 | + $show_categories = apply_filters('twentytwenty_show_categories_in_entry_header', true); |
|
31 | 31 | |
32 | - if ( true === $show_categories && has_category() ) { |
|
32 | + if (true === $show_categories && has_category()) { |
|
33 | 33 | ?> |
34 | 34 | |
35 | 35 | <div class="entry-categories"> |
36 | - <span class="screen-reader-text"><?php _e( 'Categories', 'twentytwenty' ); ?></span> |
|
36 | + <span class="screen-reader-text"><?php _e('Categories', 'twentytwenty'); ?></span> |
|
37 | 37 | <div class="entry-categories-inner"> |
38 | - <?php the_category( ' ' ); ?> |
|
38 | + <?php the_category(' '); ?> |
|
39 | 39 | </div><!-- .entry-categories-inner --> |
40 | 40 | </div><!-- .entry-categories --> |
41 | 41 | |
42 | 42 | <?php |
43 | 43 | } |
44 | 44 | |
45 | - if ( is_singular() ) { |
|
46 | - the_title( '<h1 class="entry-title">', '</h1>' ); |
|
45 | + if (is_singular()) { |
|
46 | + the_title('<h1 class="entry-title">', '</h1>'); |
|
47 | 47 | } else { |
48 | - the_title( '<h2 class="entry-title heading-size-1"><a href="' . esc_url( get_permalink() ) . '">', '</a></h2>' ); |
|
48 | + the_title('<h2 class="entry-title heading-size-1"><a href="'.esc_url(get_permalink()).'">', '</a></h2>'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $intro_text_width = ''; |
52 | 52 | |
53 | - if ( is_singular() ) { |
|
53 | + if (is_singular()) { |
|
54 | 54 | $intro_text_width = ' small'; |
55 | 55 | } else { |
56 | 56 | $intro_text_width = ' thin'; |
57 | 57 | } |
58 | 58 | |
59 | - if ( has_excerpt() && is_singular() ) { |
|
59 | + if (has_excerpt() && is_singular()) { |
|
60 | 60 | ?> |
61 | 61 | |
62 | 62 | <div class="intro-text section-inner max-percentage<?php echo $intro_text_width; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>"> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | // Default to displaying the post meta. |
70 | - twentytwenty_the_post_meta( get_the_ID(), 'single-top' ); |
|
70 | + twentytwenty_the_post_meta(get_the_ID(), 'single-top'); |
|
71 | 71 | ?> |
72 | 72 | |
73 | 73 | </div><!-- .entry-header-inner --> |
@@ -15,18 +15,18 @@ |
||
15 | 15 | * Generate a unique ID for each form and a string containing an aria-label |
16 | 16 | * if one was passed to get_search_form() in the args array. |
17 | 17 | */ |
18 | -$twentytwenty_unique_id = twentytwenty_unique_id( 'search-form-' ); |
|
18 | +$twentytwenty_unique_id = twentytwenty_unique_id('search-form-'); |
|
19 | 19 | |
20 | -$twentytwenty_aria_label = ! empty( $args['aria_label'] ) ? 'aria-label="' . esc_attr( $args['aria_label'] ) . '"' : ''; |
|
20 | +$twentytwenty_aria_label = ! empty($args['aria_label']) ? 'aria-label="'.esc_attr($args['aria_label']).'"' : ''; |
|
21 | 21 | // Backward compatibility, in case a child theme template uses a `label` argument. |
22 | -if ( empty( $twentytwenty_aria_label ) && ! empty( $args['label'] ) ) { |
|
23 | - $twentytwenty_aria_label = 'aria-label="' . esc_attr( $args['label'] ) . '"'; |
|
22 | +if (empty($twentytwenty_aria_label) && ! empty($args['label'])) { |
|
23 | + $twentytwenty_aria_label = 'aria-label="'.esc_attr($args['label']).'"'; |
|
24 | 24 | } |
25 | 25 | ?> |
26 | -<form role="search" <?php echo $twentytwenty_aria_label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above. ?> method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>"> |
|
27 | - <label for="<?php echo esc_attr( $twentytwenty_unique_id ); ?>"> |
|
28 | - <span class="screen-reader-text"><?php _e( 'Search for:', 'twentytwenty' ); // phpcs:ignore: WordPress.Security.EscapeOutput.UnsafePrintingFunction -- core trusts translations ?></span> |
|
29 | - <input type="search" id="<?php echo esc_attr( $twentytwenty_unique_id ); ?>" class="search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder', 'twentytwenty' ); ?>" value="<?php echo get_search_query(); ?>" name="s" /> |
|
26 | +<form role="search" <?php echo $twentytwenty_aria_label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above. ?> method="get" class="search-form" action="<?php echo esc_url(home_url('/')); ?>"> |
|
27 | + <label for="<?php echo esc_attr($twentytwenty_unique_id); ?>"> |
|
28 | + <span class="screen-reader-text"><?php _e('Search for:', 'twentytwenty'); // phpcs:ignore: WordPress.Security.EscapeOutput.UnsafePrintingFunction -- core trusts translations ?></span> |
|
29 | + <input type="search" id="<?php echo esc_attr($twentytwenty_unique_id); ?>" class="search-field" placeholder="<?php echo esc_attr_x('Search …', 'placeholder', 'twentytwenty'); ?>" value="<?php echo get_search_query(); ?>" name="s" /> |
|
30 | 30 | </label> |
31 | - <input type="submit" class="search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'twentytwenty' ); ?>" /> |
|
31 | + <input type="submit" class="search-submit" value="<?php echo esc_attr_x('Search', 'submit button', 'twentytwenty'); ?>" /> |
|
32 | 32 | </form> |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @since Twenty Twenty 1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! class_exists( 'TwentyTwenty_Customize' ) ) { |
|
10 | +if ( ! class_exists('TwentyTwenty_Customize')) { |
|
11 | 11 | /** |
12 | 12 | * CUSTOMIZER SETTINGS |
13 | 13 | * |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
24 | 24 | */ |
25 | - public static function register( $wp_customize ) { |
|
25 | + public static function register($wp_customize) { |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Site Title & Description. |
29 | 29 | * */ |
30 | - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
31 | - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
30 | + $wp_customize->get_setting('blogname')->transport = 'postMessage'; |
|
31 | + $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; |
|
32 | 32 | |
33 | 33 | $wp_customize->selective_refresh->add_partial( |
34 | 34 | 'blogname', |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | 'retina_logo', |
73 | 73 | array( |
74 | 74 | 'capability' => 'edit_theme_options', |
75 | - 'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ), |
|
75 | + 'sanitize_callback' => array(__CLASS__, 'sanitize_checkbox'), |
|
76 | 76 | 'transport' => 'postMessage', |
77 | 77 | ) |
78 | 78 | ); |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | 'type' => 'checkbox', |
84 | 84 | 'section' => 'title_tagline', |
85 | 85 | 'priority' => 10, |
86 | - 'label' => __( 'Retina logo', 'twentytwenty' ), |
|
87 | - 'description' => __( 'Scales the logo to half its uploaded size, making it sharp on high-res screens.', 'twentytwenty' ), |
|
86 | + 'label' => __('Retina logo', 'twentytwenty'), |
|
87 | + 'description' => __('Scales the logo to half its uploaded size, making it sharp on high-res screens.', 'twentytwenty'), |
|
88 | 88 | ) |
89 | 89 | ); |
90 | 90 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $wp_customize, |
104 | 104 | 'header_footer_background_color', |
105 | 105 | array( |
106 | - 'label' => __( 'Header & Footer Background Color', 'twentytwenty' ), |
|
106 | + 'label' => __('Header & Footer Background Color', 'twentytwenty'), |
|
107 | 107 | 'section' => 'colors', |
108 | 108 | ) |
109 | 109 | ) |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | 'accent_hue_active', |
115 | 115 | array( |
116 | 116 | 'capability' => 'edit_theme_options', |
117 | - 'sanitize_callback' => array( __CLASS__, 'sanitize_select' ), |
|
117 | + 'sanitize_callback' => array(__CLASS__, 'sanitize_select'), |
|
118 | 118 | 'transport' => 'postMessage', |
119 | 119 | 'default' => 'default', |
120 | 120 | ) |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | array( |
126 | 126 | 'type' => 'radio', |
127 | 127 | 'section' => 'colors', |
128 | - 'label' => __( 'Primary Color', 'twentytwenty' ), |
|
128 | + 'label' => __('Primary Color', 'twentytwenty'), |
|
129 | 129 | 'choices' => array( |
130 | - 'default' => _x( 'Default', 'color', 'twentytwenty' ), |
|
131 | - 'custom' => _x( 'Custom', 'color', 'twentytwenty' ), |
|
130 | + 'default' => _x('Default', 'color', 'twentytwenty'), |
|
131 | + 'custom' => _x('Custom', 'color', 'twentytwenty'), |
|
132 | 132 | ), |
133 | 133 | ) |
134 | 134 | ); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | ), |
174 | 174 | 'type' => 'theme_mod', |
175 | 175 | 'transport' => 'postMessage', |
176 | - 'sanitize_callback' => array( __CLASS__, 'sanitize_accent_accessible_colors' ), |
|
176 | + 'sanitize_callback' => array(__CLASS__, 'sanitize_accent_accessible_colors'), |
|
177 | 177 | ) |
178 | 178 | ); |
179 | 179 | |
@@ -185,17 +185,17 @@ discard block |
||
185 | 185 | array( |
186 | 186 | 'section' => 'colors', |
187 | 187 | 'settings' => 'accent_hue', |
188 | - 'description' => __( 'Apply a custom color for links, buttons, featured images.', 'twentytwenty' ), |
|
188 | + 'description' => __('Apply a custom color for links, buttons, featured images.', 'twentytwenty'), |
|
189 | 189 | 'mode' => 'hue', |
190 | - 'active_callback' => static function() use ( $wp_customize ) { |
|
191 | - return ( 'custom' === $wp_customize->get_setting( 'accent_hue_active' )->value() ); |
|
190 | + 'active_callback' => static function() use ($wp_customize) { |
|
191 | + return ('custom' === $wp_customize->get_setting('accent_hue_active')->value()); |
|
192 | 192 | }, |
193 | 193 | ) |
194 | 194 | ) |
195 | 195 | ); |
196 | 196 | |
197 | 197 | // Update background color with postMessage, so inline CSS output is updated as well. |
198 | - $wp_customize->get_setting( 'background_color' )->transport = 'postMessage'; |
|
198 | + $wp_customize->get_setting('background_color')->transport = 'postMessage'; |
|
199 | 199 | |
200 | 200 | /** |
201 | 201 | * Theme Options |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $wp_customize->add_section( |
205 | 205 | 'options', |
206 | 206 | array( |
207 | - 'title' => __( 'Theme Options', 'twentytwenty' ), |
|
207 | + 'title' => __('Theme Options', 'twentytwenty'), |
|
208 | 208 | 'priority' => 40, |
209 | 209 | 'capability' => 'edit_theme_options', |
210 | 210 | ) |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | array( |
218 | 218 | 'capability' => 'edit_theme_options', |
219 | 219 | 'default' => true, |
220 | - 'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ), |
|
220 | + 'sanitize_callback' => array(__CLASS__, 'sanitize_checkbox'), |
|
221 | 221 | ) |
222 | 222 | ); |
223 | 223 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | 'type' => 'checkbox', |
228 | 228 | 'section' => 'options', |
229 | 229 | 'priority' => 10, |
230 | - 'label' => __( 'Show search in header', 'twentytwenty' ), |
|
230 | + 'label' => __('Show search in header', 'twentytwenty'), |
|
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | array( |
239 | 239 | 'capability' => 'edit_theme_options', |
240 | 240 | 'default' => true, |
241 | - 'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ), |
|
241 | + 'sanitize_callback' => array(__CLASS__, 'sanitize_checkbox'), |
|
242 | 242 | ) |
243 | 243 | ); |
244 | 244 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | 'type' => 'checkbox', |
249 | 249 | 'section' => 'options', |
250 | 250 | 'priority' => 10, |
251 | - 'label' => __( 'Show author bio', 'twentytwenty' ), |
|
251 | + 'label' => __('Show author bio', 'twentytwenty'), |
|
252 | 252 | ) |
253 | 253 | ); |
254 | 254 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | array( |
260 | 260 | 'capability' => 'edit_theme_options', |
261 | 261 | 'default' => 'full', |
262 | - 'sanitize_callback' => array( __CLASS__, 'sanitize_select' ), |
|
262 | + 'sanitize_callback' => array(__CLASS__, 'sanitize_select'), |
|
263 | 263 | ) |
264 | 264 | ); |
265 | 265 | |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | 'type' => 'radio', |
270 | 270 | 'section' => 'options', |
271 | 271 | 'priority' => 10, |
272 | - 'label' => __( 'On archive pages, posts show:', 'twentytwenty' ), |
|
272 | + 'label' => __('On archive pages, posts show:', 'twentytwenty'), |
|
273 | 273 | 'choices' => array( |
274 | - 'full' => __( 'Full text', 'twentytwenty' ), |
|
275 | - 'summary' => __( 'Summary', 'twentytwenty' ), |
|
274 | + 'full' => __('Full text', 'twentytwenty'), |
|
275 | + 'summary' => __('Summary', 'twentytwenty'), |
|
276 | 276 | ), |
277 | 277 | ) |
278 | 278 | ); |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | $wp_customize->add_section( |
284 | 284 | 'cover_template_options', |
285 | 285 | array( |
286 | - 'title' => __( 'Cover Template', 'twentytwenty' ), |
|
286 | + 'title' => __('Cover Template', 'twentytwenty'), |
|
287 | 287 | 'capability' => 'edit_theme_options', |
288 | - 'description' => __( 'Settings for the "Cover Template" page template. Add a featured image to use as background.', 'twentytwenty' ), |
|
288 | + 'description' => __('Settings for the "Cover Template" page template. Add a featured image to use as background.', 'twentytwenty'), |
|
289 | 289 | 'priority' => 42, |
290 | 290 | ) |
291 | 291 | ); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | array( |
298 | 298 | 'capability' => 'edit_theme_options', |
299 | 299 | 'default' => true, |
300 | - 'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ), |
|
300 | + 'sanitize_callback' => array(__CLASS__, 'sanitize_checkbox'), |
|
301 | 301 | 'transport' => 'postMessage', |
302 | 302 | ) |
303 | 303 | ); |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | array( |
308 | 308 | 'type' => 'checkbox', |
309 | 309 | 'section' => 'cover_template_options', |
310 | - 'label' => __( 'Fixed Background Image', 'twentytwenty' ), |
|
311 | - 'description' => __( 'Creates a parallax effect when the visitor scrolls.', 'twentytwenty' ), |
|
310 | + 'label' => __('Fixed Background Image', 'twentytwenty'), |
|
311 | + 'description' => __('Creates a parallax effect when the visitor scrolls.', 'twentytwenty'), |
|
312 | 312 | ) |
313 | 313 | ); |
314 | 314 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $wp_customize->add_setting( |
345 | 345 | 'cover_template_overlay_background_color', |
346 | 346 | array( |
347 | - 'default' => twentytwenty_get_color_for_area( 'content', 'accent' ), |
|
347 | + 'default' => twentytwenty_get_color_for_area('content', 'accent'), |
|
348 | 348 | 'sanitize_callback' => 'sanitize_hex_color', |
349 | 349 | ) |
350 | 350 | ); |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | $wp_customize, |
355 | 355 | 'cover_template_overlay_background_color', |
356 | 356 | array( |
357 | - 'label' => __( 'Overlay Background Color', 'twentytwenty' ), |
|
358 | - 'description' => __( 'The color used for the overlay. Defaults to the accent color.', 'twentytwenty' ), |
|
357 | + 'label' => __('Overlay Background Color', 'twentytwenty'), |
|
358 | + 'description' => __('The color used for the overlay. Defaults to the accent color.', 'twentytwenty'), |
|
359 | 359 | 'section' => 'cover_template_options', |
360 | 360 | ) |
361 | 361 | ) |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | $wp_customize, |
377 | 377 | 'cover_template_overlay_text_color', |
378 | 378 | array( |
379 | - 'label' => __( 'Overlay Text Color', 'twentytwenty' ), |
|
380 | - 'description' => __( 'The color used for the text in the overlay.', 'twentytwenty' ), |
|
379 | + 'label' => __('Overlay Text Color', 'twentytwenty'), |
|
380 | + 'description' => __('The color used for the text in the overlay.', 'twentytwenty'), |
|
381 | 381 | 'section' => 'cover_template_options', |
382 | 382 | ) |
383 | 383 | ) |
@@ -397,8 +397,8 @@ discard block |
||
397 | 397 | $wp_customize->add_control( |
398 | 398 | 'cover_template_overlay_opacity', |
399 | 399 | array( |
400 | - 'label' => __( 'Overlay Opacity', 'twentytwenty' ), |
|
401 | - 'description' => __( 'Make sure that the contrast is high enough so that the text is readable.', 'twentytwenty' ), |
|
400 | + 'label' => __('Overlay Opacity', 'twentytwenty'), |
|
401 | + 'description' => __('Make sure that the contrast is high enough so that the text is readable.', 'twentytwenty'), |
|
402 | 402 | 'section' => 'cover_template_options', |
403 | 403 | 'type' => 'range', |
404 | 404 | 'input_attrs' => twentytwenty_customize_opacity_range(), |
@@ -422,15 +422,15 @@ discard block |
||
422 | 422 | * @param array $value The value we want to sanitize. |
423 | 423 | * @return array Returns sanitized value. Each item in the array gets sanitized separately. |
424 | 424 | */ |
425 | - public static function sanitize_accent_accessible_colors( $value ) { |
|
425 | + public static function sanitize_accent_accessible_colors($value) { |
|
426 | 426 | |
427 | 427 | // Make sure the value is an array. Do not typecast, use empty array as fallback. |
428 | - $value = is_array( $value ) ? $value : array(); |
|
428 | + $value = is_array($value) ? $value : array(); |
|
429 | 429 | |
430 | 430 | // Loop values. |
431 | - foreach ( $value as $area => $values ) { |
|
432 | - foreach ( $values as $context => $color_val ) { |
|
433 | - $value[ $area ][ $context ] = sanitize_hex_color( $color_val ); |
|
431 | + foreach ($value as $area => $values) { |
|
432 | + foreach ($values as $context => $color_val) { |
|
433 | + $value[$area][$context] = sanitize_hex_color($color_val); |
|
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
@@ -446,10 +446,10 @@ discard block |
||
446 | 446 | * @param object $setting The selected setting. |
447 | 447 | * @return string The input from the setting or the default setting. |
448 | 448 | */ |
449 | - public static function sanitize_select( $input, $setting ) { |
|
450 | - $input = sanitize_key( $input ); |
|
451 | - $choices = $setting->manager->get_control( $setting->id )->choices; |
|
452 | - return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); |
|
449 | + public static function sanitize_select($input, $setting) { |
|
450 | + $input = sanitize_key($input); |
|
451 | + $choices = $setting->manager->get_control($setting->id)->choices; |
|
452 | + return (array_key_exists($input, $choices) ? $input : $setting->default); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
@@ -460,43 +460,43 @@ discard block |
||
460 | 460 | * @param bool $checked Whether or not a box is checked. |
461 | 461 | * @return bool |
462 | 462 | */ |
463 | - public static function sanitize_checkbox( $checked ) { |
|
464 | - return ( ( isset( $checked ) && true === $checked ) ? true : false ); |
|
463 | + public static function sanitize_checkbox($checked) { |
|
464 | + return ((isset($checked) && true === $checked) ? true : false); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | } |
468 | 468 | |
469 | 469 | // Setup the Theme Customizer settings and controls. |
470 | - add_action( 'customize_register', array( 'TwentyTwenty_Customize', 'register' ) ); |
|
470 | + add_action('customize_register', array('TwentyTwenty_Customize', 'register')); |
|
471 | 471 | |
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
475 | 475 | * PARTIAL REFRESH FUNCTIONS |
476 | 476 | * */ |
477 | -if ( ! function_exists( 'twentytwenty_customize_partial_blogname' ) ) { |
|
477 | +if ( ! function_exists('twentytwenty_customize_partial_blogname')) { |
|
478 | 478 | /** |
479 | 479 | * Render the site title for the selective refresh partial. |
480 | 480 | * |
481 | 481 | * @since Twenty Twenty 1.0 |
482 | 482 | */ |
483 | 483 | function twentytwenty_customize_partial_blogname() { |
484 | - bloginfo( 'name' ); |
|
484 | + bloginfo('name'); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | |
488 | -if ( ! function_exists( 'twentytwenty_customize_partial_blogdescription' ) ) { |
|
488 | +if ( ! function_exists('twentytwenty_customize_partial_blogdescription')) { |
|
489 | 489 | /** |
490 | 490 | * Render the site description for the selective refresh partial. |
491 | 491 | * |
492 | 492 | * @since Twenty Twenty 1.0 |
493 | 493 | */ |
494 | 494 | function twentytwenty_customize_partial_blogdescription() { |
495 | - bloginfo( 'description' ); |
|
495 | + bloginfo('description'); |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | |
499 | -if ( ! function_exists( 'twentytwenty_customize_partial_site_logo' ) ) { |
|
499 | +if ( ! function_exists('twentytwenty_customize_partial_site_logo')) { |
|
500 | 500 | /** |
501 | 501 | * Render the site logo for the selective refresh partial. |
502 | 502 | * |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @since Twenty Twenty 1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! class_exists( 'TwentyTwenty_Walker_Page' ) ) { |
|
10 | +if ( ! class_exists('TwentyTwenty_Walker_Page')) { |
|
11 | 11 | /** |
12 | 12 | * CUSTOM PAGE WALKER |
13 | 13 | * A custom walker for pages. |
@@ -31,68 +31,68 @@ discard block |
||
31 | 31 | * @param array $args Optional. Array of arguments. Default empty array. |
32 | 32 | * @param int $current_object_id Optional. ID of the current page. Default 0. |
33 | 33 | */ |
34 | - public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) { |
|
34 | + public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) { |
|
35 | 35 | // Restores the more descriptive, specific name for use within this method. |
36 | 36 | $page = $data_object; |
37 | 37 | $current_page_id = $current_object_id; |
38 | 38 | |
39 | - if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { |
|
39 | + if (isset($args['item_spacing']) && 'preserve' === $args['item_spacing']) { |
|
40 | 40 | $t = "\t"; |
41 | 41 | $n = "\n"; |
42 | 42 | } else { |
43 | 43 | $t = ''; |
44 | 44 | $n = ''; |
45 | 45 | } |
46 | - if ( $depth ) { |
|
47 | - $indent = str_repeat( $t, $depth ); |
|
46 | + if ($depth) { |
|
47 | + $indent = str_repeat($t, $depth); |
|
48 | 48 | } else { |
49 | 49 | $indent = ''; |
50 | 50 | } |
51 | 51 | |
52 | - $css_class = array( 'page_item', 'page-item-' . $page->ID ); |
|
52 | + $css_class = array('page_item', 'page-item-'.$page->ID); |
|
53 | 53 | |
54 | - if ( isset( $args['pages_with_children'][ $page->ID ] ) ) { |
|
54 | + if (isset($args['pages_with_children'][$page->ID])) { |
|
55 | 55 | $css_class[] = 'page_item_has_children'; |
56 | 56 | } |
57 | 57 | |
58 | - if ( ! empty( $current_page_id ) ) { |
|
59 | - $_current_page = get_post( $current_page_id ); |
|
60 | - if ( $_current_page && in_array( $page->ID, $_current_page->ancestors, true ) ) { |
|
58 | + if ( ! empty($current_page_id)) { |
|
59 | + $_current_page = get_post($current_page_id); |
|
60 | + if ($_current_page && in_array($page->ID, $_current_page->ancestors, true)) { |
|
61 | 61 | $css_class[] = 'current_page_ancestor'; |
62 | 62 | } |
63 | - if ( $page->ID === $current_page_id ) { |
|
63 | + if ($page->ID === $current_page_id) { |
|
64 | 64 | $css_class[] = 'current_page_item'; |
65 | - } elseif ( $_current_page && $page->ID === $_current_page->post_parent ) { |
|
65 | + } elseif ($_current_page && $page->ID === $_current_page->post_parent) { |
|
66 | 66 | $css_class[] = 'current_page_parent'; |
67 | 67 | } |
68 | - } elseif ( get_option( 'page_for_posts' ) === $page->ID ) { |
|
68 | + } elseif (get_option('page_for_posts') === $page->ID) { |
|
69 | 69 | $css_class[] = 'current_page_parent'; |
70 | 70 | } |
71 | 71 | |
72 | 72 | /** This filter is documented in wp-includes/class-walker-page.php */ |
73 | - $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page_id ) ); |
|
74 | - $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : ''; |
|
73 | + $css_classes = implode(' ', apply_filters('page_css_class', $css_class, $page, $depth, $args, $current_page_id)); |
|
74 | + $css_classes = $css_classes ? ' class="'.esc_attr($css_classes).'"' : ''; |
|
75 | 75 | |
76 | - if ( '' === $page->post_title ) { |
|
76 | + if ('' === $page->post_title) { |
|
77 | 77 | /* translators: %d: ID of a post. */ |
78 | - $page->post_title = sprintf( __( '#%d (no title)', 'twentytwenty' ), $page->ID ); |
|
78 | + $page->post_title = sprintf(__('#%d (no title)', 'twentytwenty'), $page->ID); |
|
79 | 79 | } |
80 | 80 | |
81 | - $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before']; |
|
82 | - $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after']; |
|
81 | + $args['link_before'] = empty($args['link_before']) ? '' : $args['link_before']; |
|
82 | + $args['link_after'] = empty($args['link_after']) ? '' : $args['link_after']; |
|
83 | 83 | |
84 | 84 | $atts = array(); |
85 | - $atts['href'] = get_permalink( $page->ID ); |
|
86 | - $atts['aria-current'] = ( $page->ID === $current_page_id ) ? 'page' : ''; |
|
85 | + $atts['href'] = get_permalink($page->ID); |
|
86 | + $atts['aria-current'] = ($page->ID === $current_page_id) ? 'page' : ''; |
|
87 | 87 | |
88 | 88 | /** This filter is documented in wp-includes/class-walker-page.php */ |
89 | - $atts = apply_filters( 'page_menu_link_attributes', $atts, $page, $depth, $args, $current_page_id ); |
|
89 | + $atts = apply_filters('page_menu_link_attributes', $atts, $page, $depth, $args, $current_page_id); |
|
90 | 90 | |
91 | 91 | $attributes = ''; |
92 | - foreach ( $atts as $attr => $value ) { |
|
93 | - if ( ! empty( $value ) ) { |
|
94 | - $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
95 | - $attributes .= ' ' . $attr . '="' . $value . '"'; |
|
92 | + foreach ($atts as $attr => $value) { |
|
93 | + if ( ! empty($value)) { |
|
94 | + $value = ('href' === $attr) ? esc_url($value) : esc_attr($value); |
|
95 | + $attributes .= ' '.$attr.'="'.$value.'"'; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -100,19 +100,19 @@ discard block |
||
100 | 100 | $args['list_item_after'] = ''; |
101 | 101 | |
102 | 102 | // Wrap the link in a div and append a sub menu toggle. |
103 | - if ( isset( $args['show_toggles'] ) && true === $args['show_toggles'] ) { |
|
103 | + if (isset($args['show_toggles']) && true === $args['show_toggles']) { |
|
104 | 104 | // Wrap the menu item link contents in a div, used for positioning. |
105 | 105 | $args['list_item_before'] = '<div class="ancestor-wrapper">'; |
106 | 106 | $args['list_item_after'] = ''; |
107 | 107 | |
108 | 108 | // Add a toggle to items with children. |
109 | - if ( isset( $args['pages_with_children'][ $page->ID ] ) ) { |
|
109 | + if (isset($args['pages_with_children'][$page->ID])) { |
|
110 | 110 | |
111 | - $toggle_target_string = '.menu-modal .page-item-' . $page->ID . ' > ul'; |
|
111 | + $toggle_target_string = '.menu-modal .page-item-'.$page->ID.' > ul'; |
|
112 | 112 | $toggle_duration = twentytwenty_toggle_duration(); |
113 | 113 | |
114 | 114 | // Add the sub menu toggle. |
115 | - $args['list_item_after'] .= '<button class="toggle sub-menu-toggle fill-children-current-color" data-toggle-target="' . $toggle_target_string . '" data-toggle-type="slidetoggle" data-toggle-duration="' . absint( $toggle_duration ) . '" aria-expanded="false"><span class="screen-reader-text">' . __( 'Show sub menu', 'twentytwenty' ) . '</span>' . twentytwenty_get_theme_svg( 'chevron-down' ) . '</button>'; |
|
115 | + $args['list_item_after'] .= '<button class="toggle sub-menu-toggle fill-children-current-color" data-toggle-target="'.$toggle_target_string.'" data-toggle-type="slidetoggle" data-toggle-duration="'.absint($toggle_duration).'" aria-expanded="false"><span class="screen-reader-text">'.__('Show sub menu', 'twentytwenty').'</span>'.twentytwenty_get_theme_svg('chevron-down').'</button>'; |
|
116 | 116 | |
117 | 117 | } |
118 | 118 | |
@@ -121,33 +121,33 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | // Add icons to menu items with children. |
124 | - if ( isset( $args['show_sub_menu_icons'] ) && true === $args['show_sub_menu_icons'] ) { |
|
125 | - if ( isset( $args['pages_with_children'][ $page->ID ] ) ) { |
|
124 | + if (isset($args['show_sub_menu_icons']) && true === $args['show_sub_menu_icons']) { |
|
125 | + if (isset($args['pages_with_children'][$page->ID])) { |
|
126 | 126 | $args['list_item_after'] = '<span class="icon"></span>'; |
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - $output .= $indent . sprintf( |
|
130 | + $output .= $indent.sprintf( |
|
131 | 131 | '<li%s>%s<a%s>%s%s%s</a>%s', |
132 | 132 | $css_classes, |
133 | 133 | $args['list_item_before'], |
134 | 134 | $attributes, |
135 | 135 | $args['link_before'], |
136 | 136 | /** This filter is documented in wp-includes/post-template.php */ |
137 | - apply_filters( 'the_title', $page->post_title, $page->ID ), |
|
137 | + apply_filters('the_title', $page->post_title, $page->ID), |
|
138 | 138 | $args['link_after'], |
139 | 139 | $args['list_item_after'] |
140 | 140 | ); |
141 | 141 | |
142 | - if ( ! empty( $args['show_date'] ) ) { |
|
143 | - if ( 'modified' === $args['show_date'] ) { |
|
142 | + if ( ! empty($args['show_date'])) { |
|
143 | + if ('modified' === $args['show_date']) { |
|
144 | 144 | $time = $page->post_modified; |
145 | 145 | } else { |
146 | 146 | $time = $page->post_date; |
147 | 147 | } |
148 | 148 | |
149 | - $date_format = empty( $args['date_format'] ) ? '' : $args['date_format']; |
|
150 | - $output .= ' ' . mysql2date( $date_format, $time ); |
|
149 | + $date_format = empty($args['date_format']) ? '' : $args['date_format']; |
|
150 | + $output .= ' '.mysql2date($date_format, $time); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @since Twenty Twenty 1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! class_exists( 'TwentyTwenty_SVG_Icons' ) ) { |
|
10 | +if ( ! class_exists('TwentyTwenty_SVG_Icons')) { |
|
11 | 11 | /** |
12 | 12 | * SVG ICONS CLASS |
13 | 13 | * Retrieve the SVG code for the specified icon. Based on a solution in Twenty Nineteen. |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | * @param string $group Icon group. |
26 | 26 | * @param string $color Color. |
27 | 27 | */ |
28 | - public static function get_svg( $icon, $group = 'ui', $color = '#1A1A1B' ) { |
|
29 | - if ( 'ui' === $group ) { |
|
28 | + public static function get_svg($icon, $group = 'ui', $color = '#1A1A1B') { |
|
29 | + if ('ui' === $group) { |
|
30 | 30 | $arr = self::$ui_icons; |
31 | - } elseif ( 'social' === $group ) { |
|
31 | + } elseif ('social' === $group) { |
|
32 | 32 | $arr = self::$social_icons; |
33 | 33 | } else { |
34 | 34 | $arr = array(); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @param array $arr Array of icons. |
46 | 46 | */ |
47 | - $arr = apply_filters( "twentytwenty_svg_icons_{$group}", $arr ); |
|
47 | + $arr = apply_filters("twentytwenty_svg_icons_{$group}", $arr); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Filters an SVG icon's color. |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | * @param string $icon The icon name. |
56 | 56 | * @param string $group The icon group. |
57 | 57 | */ |
58 | - $color = apply_filters( 'twentytwenty_svg_icon_color', $color, $icon, $group ); |
|
58 | + $color = apply_filters('twentytwenty_svg_icon_color', $color, $icon, $group); |
|
59 | 59 | |
60 | - if ( array_key_exists( $icon, $arr ) ) { |
|
60 | + if (array_key_exists($icon, $arr)) { |
|
61 | 61 | $repl = '<svg class="svg-icon" aria-hidden="true" role="img" focusable="false" '; |
62 | - $svg = preg_replace( '/^<svg /', $repl, trim( $arr[ $icon ] ) ); // Add extra attributes to SVG code. |
|
63 | - $svg = str_replace( '#1A1A1B', $color, $svg ); // Replace the color. |
|
64 | - $svg = str_replace( '#', '%23', $svg ); // Urlencode hashes. |
|
65 | - $svg = preg_replace( "/([\n\t]+)/", ' ', $svg ); // Remove newlines & tabs. |
|
66 | - $svg = preg_replace( '/>\s*</', '><', $svg ); // Remove whitespace between SVG tags. |
|
62 | + $svg = preg_replace('/^<svg /', $repl, trim($arr[$icon])); // Add extra attributes to SVG code. |
|
63 | + $svg = str_replace('#1A1A1B', $color, $svg); // Replace the color. |
|
64 | + $svg = str_replace('#', '%23', $svg); // Urlencode hashes. |
|
65 | + $svg = preg_replace("/([\n\t]+)/", ' ', $svg); // Remove newlines & tabs. |
|
66 | + $svg = preg_replace('/>\s*</', '><', $svg); // Remove whitespace between SVG tags. |
|
67 | 67 | return $svg; |
68 | 68 | } |
69 | 69 | return null; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @param string $uri The URL to retrieve SVG for. |
79 | 79 | */ |
80 | - public static function get_social_link_svg( $uri ) { |
|
80 | + public static function get_social_link_svg($uri) { |
|
81 | 81 | static $regex_map; // Only compute regex map once, for performance. |
82 | - if ( ! isset( $regex_map ) ) { |
|
82 | + if ( ! isset($regex_map)) { |
|
83 | 83 | $regex_map = array(); |
84 | 84 | |
85 | 85 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @param array $social_icons_map Array of default social icons. |
94 | 94 | */ |
95 | - $map = apply_filters( 'twentytwenty_social_icons_map', self::$social_icons_map ); |
|
95 | + $map = apply_filters('twentytwenty_social_icons_map', self::$social_icons_map); |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * Filters Twenty Twenty's array of social icons. |
@@ -101,18 +101,18 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @param array $social_icons Array of default social icons. |
103 | 103 | */ |
104 | - $social_icons = apply_filters( 'twentytwenty_svg_icons_social', self::$social_icons ); |
|
104 | + $social_icons = apply_filters('twentytwenty_svg_icons_social', self::$social_icons); |
|
105 | 105 | |
106 | - foreach ( array_keys( $social_icons ) as $icon ) { |
|
107 | - $domains = array_key_exists( $icon, $map ) ? $map[ $icon ] : array( sprintf( '%s.com', $icon ) ); |
|
108 | - $domains = array_map( 'trim', $domains ); // Remove leading/trailing spaces, to prevent regex from failing to match. |
|
109 | - $domains = array_map( 'preg_quote', $domains ); |
|
110 | - $regex_map[ $icon ] = sprintf( '/(%s)/i', implode( '|', $domains ) ); |
|
106 | + foreach (array_keys($social_icons) as $icon) { |
|
107 | + $domains = array_key_exists($icon, $map) ? $map[$icon] : array(sprintf('%s.com', $icon)); |
|
108 | + $domains = array_map('trim', $domains); // Remove leading/trailing spaces, to prevent regex from failing to match. |
|
109 | + $domains = array_map('preg_quote', $domains); |
|
110 | + $regex_map[$icon] = sprintf('/(%s)/i', implode('|', $domains)); |
|
111 | 111 | } |
112 | 112 | } |
113 | - foreach ( $regex_map as $icon => $regex ) { |
|
114 | - if ( preg_match( $regex, $uri ) ) { |
|
115 | - return twentytwenty_get_theme_svg( $icon, 'social' ); |
|
113 | + foreach ($regex_map as $icon => $regex) { |
|
114 | + if (preg_match($regex, $uri)) { |
|
115 | + return twentytwenty_get_theme_svg($icon, 'social'); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | return null; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since Twenty Twenty 1.0 |
12 | 12 | */ |
13 | 13 | |
14 | -if ( ! class_exists( 'TwentyTwenty_Script_Loader' ) ) { |
|
14 | +if ( ! class_exists('TwentyTwenty_Script_Loader')) { |
|
15 | 15 | /** |
16 | 16 | * A class that provides a way to add `async` or `defer` attributes to scripts. |
17 | 17 | * |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | * @param string $handle The script handle. |
33 | 33 | * @return string Script HTML string. |
34 | 34 | */ |
35 | - public function filter_script_loader_tag( $tag, $handle ) { |
|
36 | - foreach ( array( 'async', 'defer' ) as $attr ) { |
|
37 | - if ( ! wp_scripts()->get_data( $handle, $attr ) ) { |
|
35 | + public function filter_script_loader_tag($tag, $handle) { |
|
36 | + foreach (array('async', 'defer') as $attr) { |
|
37 | + if ( ! wp_scripts()->get_data($handle, $attr)) { |
|
38 | 38 | continue; |
39 | 39 | } |
40 | 40 | // Prevent adding attribute when already added in #12009. |
41 | - if ( ! preg_match( ":\s$attr(=|>|\s):", $tag ) ) { |
|
42 | - $tag = preg_replace( ':(?=></script>):', " $attr", $tag, 1 ); |
|
41 | + if ( ! preg_match(":\s$attr(=|>|\s):", $tag)) { |
|
42 | + $tag = preg_replace(':(?=></script>):', " $attr", $tag, 1); |
|
43 | 43 | } |
44 | 44 | // Only allow async or defer, not both. |
45 | 45 | break; |
@@ -7,9 +7,9 @@ |
||
7 | 7 | * @since Twenty Twenty 1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( class_exists( 'WP_Customize_Control' ) ) { |
|
10 | +if (class_exists('WP_Customize_Control')) { |
|
11 | 11 | |
12 | - if ( ! class_exists( 'TwentyTwenty_Separator_Control' ) ) { |
|
12 | + if ( ! class_exists('TwentyTwenty_Separator_Control')) { |
|
13 | 13 | /** |
14 | 14 | * Separator Control. |
15 | 15 | * |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since Twenty Twenty 1.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! class_exists( 'TwentyTwenty_Non_Latin_Languages' ) ) { |
|
12 | +if ( ! class_exists('TwentyTwenty_Non_Latin_Languages')) { |
|
13 | 13 | /** |
14 | 14 | * Language handling. |
15 | 15 | * |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | * @param string $type Whether to return CSS for the "front-end", "block-editor", or "classic-editor". |
28 | 28 | * @return void |
29 | 29 | */ |
30 | - public static function get_non_latin_css( $type = 'front-end' ) { |
|
30 | + public static function get_non_latin_css($type = 'front-end') { |
|
31 | 31 | |
32 | 32 | // Fetch site locale. |
33 | - $locale = get_bloginfo( 'language' ); |
|
33 | + $locale = get_bloginfo('language'); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Filters the fallback fonts for non-latin languages. |
@@ -44,67 +44,67 @@ discard block |
||
44 | 44 | array( |
45 | 45 | |
46 | 46 | // Arabic. |
47 | - 'ar' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
48 | - 'ary' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
49 | - 'azb' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
50 | - 'ckb' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
51 | - 'fa-IR' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
52 | - 'haz' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
53 | - 'ps' => array( 'Tahoma', 'Arial', 'sans-serif' ), |
|
47 | + 'ar' => array('Tahoma', 'Arial', 'sans-serif'), |
|
48 | + 'ary' => array('Tahoma', 'Arial', 'sans-serif'), |
|
49 | + 'azb' => array('Tahoma', 'Arial', 'sans-serif'), |
|
50 | + 'ckb' => array('Tahoma', 'Arial', 'sans-serif'), |
|
51 | + 'fa-IR' => array('Tahoma', 'Arial', 'sans-serif'), |
|
52 | + 'haz' => array('Tahoma', 'Arial', 'sans-serif'), |
|
53 | + 'ps' => array('Tahoma', 'Arial', 'sans-serif'), |
|
54 | 54 | |
55 | 55 | // Chinese Simplified (China) - Noto Sans SC. |
56 | - 'zh-CN' => array( '\'PingFang SC\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif' ), |
|
56 | + 'zh-CN' => array('\'PingFang SC\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif'), |
|
57 | 57 | |
58 | 58 | // Chinese Traditional (Taiwan) - Noto Sans TC. |
59 | - 'zh-TW' => array( '\'PingFang TC\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif' ), |
|
59 | + 'zh-TW' => array('\'PingFang TC\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif'), |
|
60 | 60 | |
61 | 61 | // Chinese (Hong Kong) - Noto Sans HK. |
62 | - 'zh-HK' => array( '\'PingFang HK\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif' ), |
|
62 | + 'zh-HK' => array('\'PingFang HK\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif'), |
|
63 | 63 | |
64 | 64 | // Cyrillic. |
65 | - 'bel' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
66 | - 'bg-BG' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
67 | - 'kk' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
68 | - 'mk-MK' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
69 | - 'mn' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
70 | - 'ru-RU' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
71 | - 'sah' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
72 | - 'sr-RS' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
73 | - 'tt-RU' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
74 | - 'uk' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), |
|
65 | + 'bel' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
66 | + 'bg-BG' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
67 | + 'kk' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
68 | + 'mk-MK' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
69 | + 'mn' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
70 | + 'ru-RU' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
71 | + 'sah' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
72 | + 'sr-RS' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
73 | + 'tt-RU' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
74 | + 'uk' => array('\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif'), |
|
75 | 75 | |
76 | 76 | // Devanagari. |
77 | - 'bn-BD' => array( 'Arial', 'sans-serif' ), |
|
78 | - 'hi-IN' => array( 'Arial', 'sans-serif' ), |
|
79 | - 'mr' => array( 'Arial', 'sans-serif' ), |
|
80 | - 'ne-NP' => array( 'Arial', 'sans-serif' ), |
|
77 | + 'bn-BD' => array('Arial', 'sans-serif'), |
|
78 | + 'hi-IN' => array('Arial', 'sans-serif'), |
|
79 | + 'mr' => array('Arial', 'sans-serif'), |
|
80 | + 'ne-NP' => array('Arial', 'sans-serif'), |
|
81 | 81 | |
82 | 82 | // Greek. |
83 | - 'el' => array( '\'Helvetica Neue\', Helvetica, Arial, sans-serif' ), |
|
83 | + 'el' => array('\'Helvetica Neue\', Helvetica, Arial, sans-serif'), |
|
84 | 84 | |
85 | 85 | // Gujarati. |
86 | - 'gu' => array( 'Arial', 'sans-serif' ), |
|
86 | + 'gu' => array('Arial', 'sans-serif'), |
|
87 | 87 | |
88 | 88 | // Hebrew. |
89 | - 'he-IL' => array( '\'Arial Hebrew\'', 'Arial', 'sans-serif' ), |
|
89 | + 'he-IL' => array('\'Arial Hebrew\'', 'Arial', 'sans-serif'), |
|
90 | 90 | |
91 | 91 | // Japanese. |
92 | - 'ja' => array( 'sans-serif' ), |
|
92 | + 'ja' => array('sans-serif'), |
|
93 | 93 | |
94 | 94 | // Korean. |
95 | - 'ko-KR' => array( '\'Apple SD Gothic Neo\'', '\'Malgun Gothic\'', '\'Nanum Gothic\'', 'Dotum', 'sans-serif' ), |
|
95 | + 'ko-KR' => array('\'Apple SD Gothic Neo\'', '\'Malgun Gothic\'', '\'Nanum Gothic\'', 'Dotum', 'sans-serif'), |
|
96 | 96 | |
97 | 97 | // Thai. |
98 | - 'th' => array( '\'Sukhumvit Set\'', '\'Helvetica Neue\'', 'Helvetica', 'Arial', 'sans-serif' ), |
|
98 | + 'th' => array('\'Sukhumvit Set\'', '\'Helvetica Neue\'', 'Helvetica', 'Arial', 'sans-serif'), |
|
99 | 99 | |
100 | 100 | // Vietnamese. |
101 | - 'vi' => array( '\'Libre Franklin\'', 'sans-serif' ), |
|
101 | + 'vi' => array('\'Libre Franklin\'', 'sans-serif'), |
|
102 | 102 | |
103 | 103 | ) |
104 | 104 | ); |
105 | 105 | |
106 | 106 | // Return if the selected language has no fallback fonts. |
107 | - if ( empty( $font_family[ $locale ] ) ) { |
|
107 | + if (empty($font_family[$locale])) { |
|
108 | 108 | return; |
109 | 109 | } |
110 | 110 | |
@@ -118,19 +118,19 @@ discard block |
||
118 | 118 | $elements = apply_filters( |
119 | 119 | 'twentytwenty_get_localized_font_family_elements', |
120 | 120 | array( |
121 | - 'front-end' => array( 'body', 'input', 'textarea', 'button', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-file__button', '.has-drop-cap:not(:focus)::first-letter', '.entry-content .wp-block-archives', '.entry-content .wp-block-categories', '.entry-content .wp-block-cover-image', '.entry-content .wp-block-latest-comments', '.entry-content .wp-block-latest-posts', '.entry-content .wp-block-pullquote', '.entry-content .wp-block-quote.is-large', '.entry-content .wp-block-quote.is-style-large', '.entry-content .wp-block-archives *', '.entry-content .wp-block-categories *', '.entry-content .wp-block-latest-posts *', '.entry-content .wp-block-latest-comments *', '.entry-content p', '.entry-content ol', '.entry-content ul', '.entry-content dl', '.entry-content dt', '.entry-content cite', '.entry-content figcaption', '.entry-content .wp-caption-text', '.comment-content p', '.comment-content ol', '.comment-content ul', '.comment-content dl', '.comment-content dt', '.comment-content cite', '.comment-content figcaption', '.comment-content .wp-caption-text', '.widget_text p', '.widget_text ol', '.widget_text ul', '.widget_text dl', '.widget_text dt', '.widget-content .rssSummary', '.widget-content cite', '.widget-content figcaption', '.widget-content .wp-caption-text' ), |
|
122 | - 'block-editor' => array( '.editor-styles-wrapper > *', '.editor-styles-wrapper p', '.editor-styles-wrapper ol', '.editor-styles-wrapper ul', '.editor-styles-wrapper dl', '.editor-styles-wrapper dt', '.editor-post-title__block .editor-post-title__input', '.editor-styles-wrapper .wp-block-post-title', '.editor-styles-wrapper .wp-block h1', '.editor-styles-wrapper .wp-block h2', '.editor-styles-wrapper .wp-block h3', '.editor-styles-wrapper .wp-block h4', '.editor-styles-wrapper .wp-block h5', '.editor-styles-wrapper .wp-block h6', '.editor-styles-wrapper .has-drop-cap:not(:focus)::first-letter', '.editor-styles-wrapper cite', '.editor-styles-wrapper figcaption', '.editor-styles-wrapper .wp-caption-text' ), |
|
123 | - 'classic-editor' => array( 'body#tinymce.wp-editor', 'body#tinymce.wp-editor p', 'body#tinymce.wp-editor ol', 'body#tinymce.wp-editor ul', 'body#tinymce.wp-editor dl', 'body#tinymce.wp-editor dt', 'body#tinymce.wp-editor figcaption', 'body#tinymce.wp-editor .wp-caption-text', 'body#tinymce.wp-editor .wp-caption-dd', 'body#tinymce.wp-editor cite', 'body#tinymce.wp-editor table' ), |
|
121 | + 'front-end' => array('body', 'input', 'textarea', 'button', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-file__button', '.has-drop-cap:not(:focus)::first-letter', '.entry-content .wp-block-archives', '.entry-content .wp-block-categories', '.entry-content .wp-block-cover-image', '.entry-content .wp-block-latest-comments', '.entry-content .wp-block-latest-posts', '.entry-content .wp-block-pullquote', '.entry-content .wp-block-quote.is-large', '.entry-content .wp-block-quote.is-style-large', '.entry-content .wp-block-archives *', '.entry-content .wp-block-categories *', '.entry-content .wp-block-latest-posts *', '.entry-content .wp-block-latest-comments *', '.entry-content p', '.entry-content ol', '.entry-content ul', '.entry-content dl', '.entry-content dt', '.entry-content cite', '.entry-content figcaption', '.entry-content .wp-caption-text', '.comment-content p', '.comment-content ol', '.comment-content ul', '.comment-content dl', '.comment-content dt', '.comment-content cite', '.comment-content figcaption', '.comment-content .wp-caption-text', '.widget_text p', '.widget_text ol', '.widget_text ul', '.widget_text dl', '.widget_text dt', '.widget-content .rssSummary', '.widget-content cite', '.widget-content figcaption', '.widget-content .wp-caption-text'), |
|
122 | + 'block-editor' => array('.editor-styles-wrapper > *', '.editor-styles-wrapper p', '.editor-styles-wrapper ol', '.editor-styles-wrapper ul', '.editor-styles-wrapper dl', '.editor-styles-wrapper dt', '.editor-post-title__block .editor-post-title__input', '.editor-styles-wrapper .wp-block-post-title', '.editor-styles-wrapper .wp-block h1', '.editor-styles-wrapper .wp-block h2', '.editor-styles-wrapper .wp-block h3', '.editor-styles-wrapper .wp-block h4', '.editor-styles-wrapper .wp-block h5', '.editor-styles-wrapper .wp-block h6', '.editor-styles-wrapper .has-drop-cap:not(:focus)::first-letter', '.editor-styles-wrapper cite', '.editor-styles-wrapper figcaption', '.editor-styles-wrapper .wp-caption-text'), |
|
123 | + 'classic-editor' => array('body#tinymce.wp-editor', 'body#tinymce.wp-editor p', 'body#tinymce.wp-editor ol', 'body#tinymce.wp-editor ul', 'body#tinymce.wp-editor dl', 'body#tinymce.wp-editor dt', 'body#tinymce.wp-editor figcaption', 'body#tinymce.wp-editor .wp-caption-text', 'body#tinymce.wp-editor .wp-caption-dd', 'body#tinymce.wp-editor cite', 'body#tinymce.wp-editor table'), |
|
124 | 124 | ) |
125 | 125 | ); |
126 | 126 | |
127 | 127 | // Return if the specified type doesn't exist. |
128 | - if ( empty( $elements[ $type ] ) ) { |
|
128 | + if (empty($elements[$type])) { |
|
129 | 129 | return; |
130 | 130 | } |
131 | 131 | |
132 | 132 | // Return the specified styles. |
133 | - return twentytwenty_generate_css( implode( ',', $elements[ $type ] ), 'font-family', implode( ',', $font_family[ $locale ] ), null, null, false ); |
|
133 | + return twentytwenty_generate_css(implode(',', $elements[$type]), 'font-family', implode(',', $font_family[$locale]), null, null, false); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | } |