Completed
Branch master (d2f79a)
by
unknown
07:00 queued 14s
created
classes/class-twenty-twenty-one-customize-notice-control.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@
 block discarded – undo
36 36
 	public function render_content() {
37 37
 		?>
38 38
 		<div class="notice notice-warning">
39
-			<p><?php esc_html_e( 'To access the Dark Mode settings, select a light background color.', 'twentytwentyone' ); ?></p>
40
-			<p><a href="<?php echo esc_url( __( 'https://wordpress.org/support/article/twenty-twenty-one/#dark-mode-support', 'twentytwentyone' ) ); ?>">
41
-				<?php esc_html_e( 'Learn more about Dark Mode.', 'twentytwentyone' ); ?>
39
+			<p><?php esc_html_e('To access the Dark Mode settings, select a light background color.', 'twentytwentyone'); ?></p>
40
+			<p><a href="<?php echo esc_url(__('https://wordpress.org/support/article/twenty-twenty-one/#dark-mode-support', 'twentytwentyone')); ?>">
41
+				<?php esc_html_e('Learn more about Dark Mode.', 'twentytwentyone'); ?>
42 42
 			</a></p>
43 43
 		</div>
44 44
 		<?php
Please login to merge, or discard this patch.
twentytwentyone/classes/class-twenty-twenty-one-customize-color-control.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@
 block discarded – undo
46 46
 		// Enqueue the script.
47 47
 		wp_enqueue_script(
48 48
 			'twentytwentyone-control-color',
49
-			get_theme_file_uri( 'assets/js/palette-colorpicker.js' ),
50
-			array( 'customize-controls', 'jquery', 'customize-base', 'wp-color-picker' ),
51
-			wp_get_theme()->get( 'Version' ),
49
+			get_theme_file_uri('assets/js/palette-colorpicker.js'),
50
+			array('customize-controls', 'jquery', 'customize-base', 'wp-color-picker'),
51
+			wp_get_theme()->get('Version'),
52 52
 			false
53 53
 		);
54 54
 	}
Please login to merge, or discard this patch.
themes/twentytwentyone/classes/class-twenty-twenty-one-custom-colors.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	public function __construct() {
21 21
 
22 22
 		// Enqueue color variables for customizer & frontend.
23
-		add_action( 'wp_enqueue_scripts', array( $this, 'custom_color_variables' ) );
23
+		add_action('wp_enqueue_scripts', array($this, 'custom_color_variables'));
24 24
 
25 25
 		// Enqueue color variables for editor.
26
-		add_action( 'enqueue_block_editor_assets', array( $this, 'editor_custom_color_variables' ) );
26
+		add_action('enqueue_block_editor_assets', array($this, 'editor_custom_color_variables'));
27 27
 
28 28
 		// Add body-class if needed.
29
-		add_filter( 'body_class', array( $this, 'body_class' ) );
29
+		add_filter('body_class', array($this, 'body_class'));
30 30
 	}
31 31
 
32 32
 	/**
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @param string $background_color The background color.
38 38
 	 * @return string (hex color)
39 39
 	 */
40
-	public function custom_get_readable_color( $background_color ) {
41
-		return ( 127 < self::get_relative_luminance_from_hex( $background_color ) ) ? '#000' : '#fff';
40
+	public function custom_get_readable_color($background_color) {
41
+		return (127 < self::get_relative_luminance_from_hex($background_color)) ? '#000' : '#fff';
42 42
 	}
43 43
 
44 44
 	/**
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
 	 * @param string|null $context Can be "editor" or null.
54 54
 	 * @return string
55 55
 	 */
56
-	public function generate_custom_color_variables( $context = null ) {
56
+	public function generate_custom_color_variables($context = null) {
57 57
 
58 58
 		$theme_css        = 'editor' === $context ? ':root .editor-styles-wrapper{' : ':root{';
59
-		$background_color = get_theme_mod( 'background_color', 'D1E4DD' );
59
+		$background_color = get_theme_mod('background_color', 'D1E4DD');
60 60
 
61
-		if ( 'd1e4dd' !== strtolower( $background_color ) ) {
62
-			$theme_css .= '--global--color-background: #' . $background_color . ';';
63
-			$theme_css .= '--global--color-primary: ' . $this->custom_get_readable_color( $background_color ) . ';';
64
-			$theme_css .= '--global--color-secondary: ' . $this->custom_get_readable_color( $background_color ) . ';';
65
-			$theme_css .= '--button--color-background: ' . $this->custom_get_readable_color( $background_color ) . ';';
66
-			$theme_css .= '--button--color-text-hover: ' . $this->custom_get_readable_color( $background_color ) . ';';
61
+		if ('d1e4dd' !== strtolower($background_color)) {
62
+			$theme_css .= '--global--color-background: #'.$background_color.';';
63
+			$theme_css .= '--global--color-primary: '.$this->custom_get_readable_color($background_color).';';
64
+			$theme_css .= '--global--color-secondary: '.$this->custom_get_readable_color($background_color).';';
65
+			$theme_css .= '--button--color-background: '.$this->custom_get_readable_color($background_color).';';
66
+			$theme_css .= '--button--color-text-hover: '.$this->custom_get_readable_color($background_color).';';
67 67
 
68
-			if ( '#fff' === $this->custom_get_readable_color( $background_color ) ) {
68
+			if ('#fff' === $this->custom_get_readable_color($background_color)) {
69 69
 				$theme_css .= '--table--stripes-border-color: rgba(240, 240, 240, 0.15);';
70 70
 				$theme_css .= '--table--stripes-background-color: rgba(240, 240, 240, 0.15);';
71 71
 			}
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 * @return void
85 85
 	 */
86 86
 	public function custom_color_variables() {
87
-		if ( 'd1e4dd' !== strtolower( get_theme_mod( 'background_color', 'D1E4DD' ) ) ) {
88
-			wp_add_inline_style( 'twenty-twenty-one-style', $this->generate_custom_color_variables() );
87
+		if ('d1e4dd' !== strtolower(get_theme_mod('background_color', 'D1E4DD'))) {
88
+			wp_add_inline_style('twenty-twenty-one-style', $this->generate_custom_color_variables());
89 89
 		}
90 90
 	}
91 91
 
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 	public function editor_custom_color_variables() {
100 100
 		wp_enqueue_style(
101 101
 			'twenty-twenty-one-custom-color-overrides',
102
-			get_theme_file_uri( 'assets/css/custom-color-overrides.css' ),
102
+			get_theme_file_uri('assets/css/custom-color-overrides.css'),
103 103
 			array(),
104
-			wp_get_theme()->get( 'Version' )
104
+			wp_get_theme()->get('Version')
105 105
 		);
106 106
 
107
-		$background_color = get_theme_mod( 'background_color', 'D1E4DD' );
108
-		if ( 'd1e4dd' !== strtolower( $background_color ) ) {
109
-			wp_add_inline_style( 'twenty-twenty-one-custom-color-overrides', $this->generate_custom_color_variables( 'editor' ) );
107
+		$background_color = get_theme_mod('background_color', 'D1E4DD');
108
+		if ('d1e4dd' !== strtolower($background_color)) {
109
+			wp_add_inline_style('twenty-twenty-one-custom-color-overrides', $this->generate_custom_color_variables('editor'));
110 110
 		}
111 111
 	}
112 112
 
@@ -120,24 +120,24 @@  discard block
 block discarded – undo
120 120
 	 * @param string $hex The HEX color.
121 121
 	 * @return int Returns a number (0-255).
122 122
 	 */
123
-	public static function get_relative_luminance_from_hex( $hex ) {
123
+	public static function get_relative_luminance_from_hex($hex) {
124 124
 
125 125
 		// Remove the "#" symbol from the beginning of the color.
126
-		$hex = ltrim( $hex, '#' );
126
+		$hex = ltrim($hex, '#');
127 127
 
128 128
 		// Make sure there are 6 digits for the below calculations.
129
-		if ( 3 === strlen( $hex ) ) {
130
-			$hex = substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) . substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) . substr( $hex, 2, 1 ) . substr( $hex, 2, 1 );
129
+		if (3 === strlen($hex)) {
130
+			$hex = substr($hex, 0, 1).substr($hex, 0, 1).substr($hex, 1, 1).substr($hex, 1, 1).substr($hex, 2, 1).substr($hex, 2, 1);
131 131
 		}
132 132
 
133 133
 		// Get red, green, blue.
134
-		$red   = hexdec( substr( $hex, 0, 2 ) );
135
-		$green = hexdec( substr( $hex, 2, 2 ) );
136
-		$blue  = hexdec( substr( $hex, 4, 2 ) );
134
+		$red   = hexdec(substr($hex, 0, 2));
135
+		$green = hexdec(substr($hex, 2, 2));
136
+		$blue  = hexdec(substr($hex, 4, 2));
137 137
 
138 138
 		// Calculate the luminance.
139
-		$lum = ( 0.2126 * $red ) + ( 0.7152 * $green ) + ( 0.0722 * $blue );
140
-		return (int) round( $lum );
139
+		$lum = (0.2126 * $red) + (0.7152 * $green) + (0.0722 * $blue);
140
+		return (int) round($lum);
141 141
 	}
142 142
 
143 143
 	/**
@@ -148,17 +148,17 @@  discard block
 block discarded – undo
148 148
 	 * @param array $classes The existing body classes.
149 149
 	 * @return array
150 150
 	 */
151
-	public function body_class( $classes ) {
152
-		$background_color = get_theme_mod( 'background_color', 'D1E4DD' );
153
-		$luminance        = self::get_relative_luminance_from_hex( $background_color );
151
+	public function body_class($classes) {
152
+		$background_color = get_theme_mod('background_color', 'D1E4DD');
153
+		$luminance        = self::get_relative_luminance_from_hex($background_color);
154 154
 
155
-		if ( 127 > $luminance ) {
155
+		if (127 > $luminance) {
156 156
 			$classes[] = 'is-dark-theme';
157 157
 		} else {
158 158
 			$classes[] = 'is-light-theme';
159 159
 		}
160 160
 
161
-		if ( 225 <= $luminance ) {
161
+		if (225 <= $luminance) {
162 162
 			$classes[] = 'has-background-white';
163 163
 		}
164 164
 
Please login to merge, or discard this patch.
themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @since Twenty Twenty-One 1.0
8 8
  */
9 9
 
10
-if ( ! class_exists( 'Twenty_Twenty_One_Customize' ) ) {
10
+if ( ! class_exists('Twenty_Twenty_One_Customize')) {
11 11
 	/**
12 12
 	 * Customizer Settings.
13 13
 	 *
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		 * @since Twenty Twenty-One 1.0
22 22
 		 */
23 23
 		public function __construct() {
24
-			add_action( 'customize_register', array( $this, 'register' ) );
24
+			add_action('customize_register', array($this, 'register'));
25 25
 		}
26 26
 
27 27
 		/**
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 		 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
33 33
 		 * @return void
34 34
 		 */
35
-		public function register( $wp_customize ) {
35
+		public function register($wp_customize) {
36 36
 
37 37
 			// Change site-title & description to postMessage.
38
-			$wp_customize->get_setting( 'blogname' )->transport        = 'postMessage'; // @phpstan-ignore-line. Assume that this setting exists.
39
-			$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; // @phpstan-ignore-line. Assume that this setting exists.
38
+			$wp_customize->get_setting('blogname')->transport        = 'postMessage'; // @phpstan-ignore-line. Assume that this setting exists.
39
+			$wp_customize->get_setting('blogdescription')->transport = 'postMessage'; // @phpstan-ignore-line. Assume that this setting exists.
40 40
 
41 41
 			// Add partial for blogname.
42 42
 			$wp_customize->selective_refresh->add_partial(
43 43
 				'blogname',
44 44
 				array(
45 45
 					'selector'        => '.site-title',
46
-					'render_callback' => array( $this, 'partial_blogname' ),
46
+					'render_callback' => array($this, 'partial_blogname'),
47 47
 				)
48 48
 			);
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 				'blogdescription',
53 53
 				array(
54 54
 					'selector'        => '.site-description',
55
-					'render_callback' => array( $this, 'partial_blogdescription' ),
55
+					'render_callback' => array($this, 'partial_blogdescription'),
56 56
 				)
57 57
 			);
58 58
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				array(
63 63
 					'capability'        => 'edit_theme_options',
64 64
 					'default'           => true,
65
-					'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ),
65
+					'sanitize_callback' => array(__CLASS__, 'sanitize_checkbox'),
66 66
 				)
67 67
 			);
68 68
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 				array(
73 73
 					'type'    => 'checkbox',
74 74
 					'section' => 'title_tagline',
75
-					'label'   => esc_html__( 'Display Site Title & Tagline', 'twentytwentyone' ),
75
+					'label'   => esc_html__('Display Site Title & Tagline', 'twentytwentyone'),
76 76
 				)
77 77
 			);
78 78
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			$wp_customize->add_section(
83 83
 				'excerpt_settings',
84 84
 				array(
85
-					'title'    => esc_html__( 'Excerpt Settings', 'twentytwentyone' ),
85
+					'title'    => esc_html__('Excerpt Settings', 'twentytwentyone'),
86 86
 					'priority' => 120,
87 87
 				)
88 88
 			);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				array(
93 93
 					'capability'        => 'edit_theme_options',
94 94
 					'default'           => 'excerpt',
95
-					'sanitize_callback' => static function( $value ) {
95
+					'sanitize_callback' => static function($value) {
96 96
 						return 'excerpt' === $value || 'full' === $value ? $value : 'excerpt';
97 97
 					},
98 98
 				)
@@ -103,28 +103,28 @@  discard block
 block discarded – undo
103 103
 				array(
104 104
 					'type'    => 'radio',
105 105
 					'section' => 'excerpt_settings',
106
-					'label'   => esc_html__( 'On Archive Pages, posts show:', 'twentytwentyone' ),
106
+					'label'   => esc_html__('On Archive Pages, posts show:', 'twentytwentyone'),
107 107
 					'choices' => array(
108
-						'excerpt' => esc_html__( 'Summary', 'twentytwentyone' ),
109
-						'full'    => esc_html__( 'Full text', 'twentytwentyone' ),
108
+						'excerpt' => esc_html__('Summary', 'twentytwentyone'),
109
+						'full'    => esc_html__('Full text', 'twentytwentyone'),
110 110
 					),
111 111
 				)
112 112
 			);
113 113
 
114 114
 			// Background color.
115 115
 			// Include the custom control class.
116
-			include_once get_theme_file_path( 'classes/class-twenty-twenty-one-customize-color-control.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
116
+			include_once get_theme_file_path('classes/class-twenty-twenty-one-customize-color-control.php'); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
117 117
 
118 118
 			// Register the custom control.
119
-			$wp_customize->register_control_type( 'Twenty_Twenty_One_Customize_Color_Control' );
119
+			$wp_customize->register_control_type('Twenty_Twenty_One_Customize_Color_Control');
120 120
 
121 121
 			// Get the palette from theme-supports.
122
-			$palette = get_theme_support( 'editor-color-palette' );
122
+			$palette = get_theme_support('editor-color-palette');
123 123
 
124 124
 			// Build the colors array from theme-support.
125 125
 			$colors = array();
126
-			if ( isset( $palette[0] ) && is_array( $palette[0] ) ) {
127
-				foreach ( $palette[0] as $palette_color ) {
126
+			if (isset($palette[0]) && is_array($palette[0])) {
127
+				foreach ($palette[0] as $palette_color) {
128 128
 					$colors[] = $palette_color['color'];
129 129
 				}
130 130
 			}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 					$wp_customize,
136 136
 					'background_color',
137 137
 					array(
138
-						'label'   => esc_html_x( 'Background color', 'Customizer control', 'twentytwentyone' ),
138
+						'label'   => esc_html_x('Background color', 'Customizer control', 'twentytwentyone'),
139 139
 						'section' => 'colors',
140 140
 						'palette' => $colors,
141 141
 					)
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 		 * @param bool $checked Whether or not a box is checked.
152 152
 		 * @return bool
153 153
 		 */
154
-		public static function sanitize_checkbox( $checked = null ) {
155
-			return (bool) isset( $checked ) && true === $checked;
154
+		public static function sanitize_checkbox($checked = null) {
155
+			return (bool) isset($checked) && true === $checked;
156 156
 		}
157 157
 
158 158
 		/**
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		 * @return void
164 164
 		 */
165 165
 		public function partial_blogname() {
166
-			bloginfo( 'name' );
166
+			bloginfo('name');
167 167
 		}
168 168
 
169 169
 		/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		 * @return void
175 175
 		 */
176 176
 		public function partial_blogdescription() {
177
-			bloginfo( 'description' );
177
+			bloginfo('description');
178 178
 		}
179 179
 	}
180 180
 }
Please login to merge, or discard this patch.
themes/twentytwentyone/classes/class-twenty-twenty-one-svg-icons.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 	 * @param int    $size  The icon-size in pixels.
152 152
 	 * @return string
153 153
 	 */
154
-	public static function get_svg( $group, $icon, $size ) {
154
+	public static function get_svg($group, $icon, $size) {
155 155
 
156
-		if ( 'ui' === $group ) {
156
+		if ('ui' === $group) {
157 157
 			$arr = self::$icons;
158
-		} elseif ( 'social' === $group ) {
158
+		} elseif ('social' === $group) {
159 159
 			$arr = self::$social_icons;
160 160
 		} else {
161 161
 			$arr = array();
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 		 *
172 172
 		 * @param array $arr Array of icons.
173 173
 		 */
174
-		$arr = apply_filters( "twenty_twenty_one_svg_icons_{$group}", $arr );
174
+		$arr = apply_filters("twenty_twenty_one_svg_icons_{$group}", $arr);
175 175
 
176 176
 		$svg = '';
177
-		if ( array_key_exists( $icon, $arr ) ) {
178
-			$repl = sprintf( '<svg class="svg-icon" width="%d" height="%d" aria-hidden="true" role="img" focusable="false" ', $size, $size );
177
+		if (array_key_exists($icon, $arr)) {
178
+			$repl = sprintf('<svg class="svg-icon" width="%d" height="%d" aria-hidden="true" role="img" focusable="false" ', $size, $size);
179 179
 
180
-			$svg = preg_replace( '/^<svg /', $repl, trim( $arr[ $icon ] ) ); // Add extra attributes to SVG code.
180
+			$svg = preg_replace('/^<svg /', $repl, trim($arr[$icon])); // Add extra attributes to SVG code.
181 181
 		}
182 182
 
183 183
 		// @phpstan-ignore-next-line.
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 	 * @param int    $size The icon-size in pixels.
196 196
 	 * @return string|null
197 197
 	 */
198
-	public static function get_social_link_svg( $uri, $size ) {
198
+	public static function get_social_link_svg($uri, $size) {
199 199
 		static $regex_map; // Only compute regex map once, for performance.
200 200
 
201
-		if ( ! isset( $regex_map ) ) {
201
+		if ( ! isset($regex_map)) {
202 202
 			$regex_map = array();
203 203
 
204 204
 			/**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			 *
212 212
 			 * @param array $social_icons_map Array of default social icons.
213 213
 			 */
214
-			$map = apply_filters( 'twenty_twenty_one_social_icons_map', self::$social_icons_map );
214
+			$map = apply_filters('twenty_twenty_one_social_icons_map', self::$social_icons_map);
215 215
 
216 216
 			/**
217 217
 			 * Filters Twenty Twenty-One's array of social icons.
@@ -220,19 +220,19 @@  discard block
 block discarded – undo
220 220
 			 *
221 221
 			 * @param array $social_icons Array of default social icons.
222 222
 			 */
223
-			$social_icons = apply_filters( 'twenty_twenty_one_svg_icons_social', self::$social_icons );
223
+			$social_icons = apply_filters('twenty_twenty_one_svg_icons_social', self::$social_icons);
224 224
 
225
-			foreach ( array_keys( $social_icons ) as $icon ) {
226
-				$domains            = array_key_exists( $icon, $map ) ? $map[ $icon ] : array( sprintf( '%s.com', $icon ) );
227
-				$domains            = array_map( 'trim', $domains ); // Remove leading/trailing spaces, to prevent regex from failing to match.
228
-				$domains            = array_map( 'preg_quote', $domains );
229
-				$regex_map[ $icon ] = sprintf( '/(%s)/i', implode( '|', $domains ) );
225
+			foreach (array_keys($social_icons) as $icon) {
226
+				$domains            = array_key_exists($icon, $map) ? $map[$icon] : array(sprintf('%s.com', $icon));
227
+				$domains            = array_map('trim', $domains); // Remove leading/trailing spaces, to prevent regex from failing to match.
228
+				$domains            = array_map('preg_quote', $domains);
229
+				$regex_map[$icon] = sprintf('/(%s)/i', implode('|', $domains));
230 230
 			}
231 231
 		}
232
-		foreach ( $regex_map as $icon => $regex ) {
233
-			if ( preg_match( $regex, $uri ) ) {
232
+		foreach ($regex_map as $icon => $regex) {
233
+			if (preg_match($regex, $uri)) {
234 234
 
235
-				return self::get_svg( 'social', $icon, $size ) . '<span class="screen-reader-text">';
235
+				return self::get_svg('social', $icon, $size).'<span class="screen-reader-text">';
236 236
 			}
237 237
 		}
238 238
 		return null;
Please login to merge, or discard this patch.
themes/twentytwentyone/classes/class-twenty-twenty-one-dark-mode.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -20,28 +20,28 @@  discard block
 block discarded – undo
20 20
 	public function __construct() {
21 21
 
22 22
 		// Enqueue assets for the block-editor.
23
-		add_action( 'enqueue_block_editor_assets', array( $this, 'editor_custom_color_variables' ) );
23
+		add_action('enqueue_block_editor_assets', array($this, 'editor_custom_color_variables'));
24 24
 
25 25
 		// Add styles for dark-mode.
26
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
26
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
27 27
 
28 28
 		// Add scripts for customizer controls.
29
-		add_action( 'customize_controls_enqueue_scripts', array( $this, 'customize_controls_enqueue_scripts' ) );
29
+		add_action('customize_controls_enqueue_scripts', array($this, 'customize_controls_enqueue_scripts'));
30 30
 
31 31
 		// Add customizer controls.
32
-		add_action( 'customize_register', array( $this, 'customizer_controls' ) );
32
+		add_action('customize_register', array($this, 'customizer_controls'));
33 33
 
34 34
 		// Add HTML classes.
35
-		add_filter( 'twentytwentyone_html_classes', array( $this, 'html_classes' ) );
35
+		add_filter('twentytwentyone_html_classes', array($this, 'html_classes'));
36 36
 
37 37
 		// Add classes to <body> in the dashboard.
38
-		add_filter( 'admin_body_class', array( $this, 'admin_body_classes' ) );
38
+		add_filter('admin_body_class', array($this, 'admin_body_classes'));
39 39
 
40 40
 		// Add the switch on the frontend & customizer.
41
-		add_action( 'wp_footer', array( $this, 'the_switch' ) );
41
+		add_action('wp_footer', array($this, 'the_switch'));
42 42
 
43 43
 		// Add the privacy policy content.
44
-		add_action( 'admin_init', array( $this, 'add_privacy_policy_content' ) );
44
+		add_action('admin_init', array($this, 'add_privacy_policy_content'));
45 45
 	}
46 46
 
47 47
 	/**
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 	 * @return void
53 53
 	 */
54 54
 	public function editor_custom_color_variables() {
55
-		if ( ! $this->switch_should_render() ) {
55
+		if ( ! $this->switch_should_render()) {
56 56
 			return;
57 57
 		}
58
-		$background_color            = get_theme_mod( 'background_color', 'D1E4DD' );
59
-		$should_respect_color_scheme = get_theme_mod( 'respect_user_color_preference', false );
60
-		if ( $should_respect_color_scheme && Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) > 127 ) {
58
+		$background_color            = get_theme_mod('background_color', 'D1E4DD');
59
+		$should_respect_color_scheme = get_theme_mod('respect_user_color_preference', false);
60
+		if ($should_respect_color_scheme && Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex($background_color) > 127) {
61 61
 			// Add Dark Mode variable overrides.
62 62
 			wp_add_inline_style(
63 63
 				'twenty-twenty-one-custom-color-overrides',
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		}
67 67
 		wp_enqueue_script(
68 68
 			'twentytwentyone-dark-mode-support-toggle',
69
-			get_template_directory_uri() . '/assets/js/dark-mode-toggler.js',
69
+			get_template_directory_uri().'/assets/js/dark-mode-toggler.js',
70 70
 			array(),
71 71
 			'1.0.0',
72 72
 			true
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 
75 75
 		wp_enqueue_script(
76 76
 			'twentytwentyone-editor-dark-mode-support',
77
-			get_template_directory_uri() . '/assets/js/editor-dark-mode-support.js',
78
-			array( 'twentytwentyone-dark-mode-support-toggle' ),
77
+			get_template_directory_uri().'/assets/js/editor-dark-mode-support.js',
78
+			array('twentytwentyone-dark-mode-support-toggle'),
79 79
 			'1.0.0',
80 80
 			true
81 81
 		);
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 	 * @return void
90 90
 	 */
91 91
 	public function enqueue_scripts() {
92
-		if ( ! $this->switch_should_render() ) {
92
+		if ( ! $this->switch_should_render()) {
93 93
 			return;
94 94
 		}
95
-		$url = get_template_directory_uri() . '/assets/css/style-dark-mode.css';
96
-		if ( is_rtl() ) {
97
-			$url = get_template_directory_uri() . '/assets/css/style-dark-mode-rtl.css';
95
+		$url = get_template_directory_uri().'/assets/css/style-dark-mode.css';
96
+		if (is_rtl()) {
97
+			$url = get_template_directory_uri().'/assets/css/style-dark-mode-rtl.css';
98 98
 		}
99
-		wp_enqueue_style( 'tt1-dark-mode', $url, array( 'twenty-twenty-one-style' ), wp_get_theme()->get( 'Version' ) ); // @phpstan-ignore-line. Version is always a string.
99
+		wp_enqueue_style('tt1-dark-mode', $url, array('twenty-twenty-one-style'), wp_get_theme()->get('Version')); // @phpstan-ignore-line. Version is always a string.
100 100
 	}
101 101
 
102 102
 	/**
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 	 * @return void
108 108
 	 */
109 109
 	public function customize_controls_enqueue_scripts() {
110
-		if ( ! $this->switch_should_render() ) {
110
+		if ( ! $this->switch_should_render()) {
111 111
 			return;
112 112
 		}
113 113
 		wp_enqueue_script(
114 114
 			'twentytwentyone-customize-controls',
115
-			get_template_directory_uri() . '/assets/js/customize.js',
116
-			array( 'customize-base', 'customize-controls', 'underscore', 'jquery', 'twentytwentyone-customize-helpers' ),
115
+			get_template_directory_uri().'/assets/js/customize.js',
116
+			array('customize-base', 'customize-controls', 'underscore', 'jquery', 'twentytwentyone-customize-helpers'),
117 117
 			'1.0.0',
118 118
 			true
119 119
 		);
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
 	 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
128 128
 	 * @return void
129 129
 	 */
130
-	public function customizer_controls( $wp_customize ) {
130
+	public function customizer_controls($wp_customize) {
131 131
 
132
-		$colors_section = $wp_customize->get_section( 'colors' );
133
-		if ( is_object( $colors_section ) ) {
134
-			$colors_section->title = __( 'Colors & Dark Mode', 'twentytwentyone' );
132
+		$colors_section = $wp_customize->get_section('colors');
133
+		if (is_object($colors_section)) {
134
+			$colors_section->title = __('Colors & Dark Mode', 'twentytwentyone');
135 135
 		}
136 136
 
137 137
 		// Custom notice control.
138
-		include_once get_theme_file_path( 'classes/class-twenty-twenty-one-customize-notice-control.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
138
+		include_once get_theme_file_path('classes/class-twenty-twenty-one-customize-notice-control.php'); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
139 139
 
140 140
 		$wp_customize->add_setting(
141 141
 			'respect_user_color_preference_notice',
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 					'section'         => 'colors',
155 155
 					'priority'        => 100,
156 156
 					'active_callback' => static function() {
157
-						return 127 >= Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( get_theme_mod( 'background_color', 'D1E4DD' ) );
157
+						return 127 >= Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex(get_theme_mod('background_color', 'D1E4DD'));
158 158
 					},
159 159
 				)
160 160
 			)
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			array(
166 166
 				'capability'        => 'edit_theme_options',
167 167
 				'default'           => false,
168
-				'sanitize_callback' => static function( $value ) {
168
+				'sanitize_callback' => static function($value) {
169 169
 					return (bool) $value;
170 170
 				},
171 171
 			)
@@ -174,22 +174,22 @@  discard block
 block discarded – undo
174 174
 		$description  = '<p>';
175 175
 		$description .= sprintf(
176 176
 			/* translators: %s: Twenty Twenty-One support article URL. */
177
-			__( 'Dark Mode is a device setting. If a visitor to your site requests it, your site will be shown with a dark background and light text. <a href="%s">Learn more about Dark Mode.</a>', 'twentytwentyone' ),
178
-			esc_url( __( 'https://wordpress.org/support/article/twenty-twenty-one/#dark-mode-support', 'twentytwentyone' ) )
177
+			__('Dark Mode is a device setting. If a visitor to your site requests it, your site will be shown with a dark background and light text. <a href="%s">Learn more about Dark Mode.</a>', 'twentytwentyone'),
178
+			esc_url(__('https://wordpress.org/support/article/twenty-twenty-one/#dark-mode-support', 'twentytwentyone'))
179 179
 		);
180 180
 		$description .= '</p>';
181
-		$description .= '<p>' . __( 'Dark Mode can also be turned on and off with a button that you can find in the bottom corner of the page.', 'twentytwentyone' ) . '</p>';
181
+		$description .= '<p>'.__('Dark Mode can also be turned on and off with a button that you can find in the bottom corner of the page.', 'twentytwentyone').'</p>';
182 182
 
183 183
 		$wp_customize->add_control(
184 184
 			'respect_user_color_preference',
185 185
 			array(
186 186
 				'type'            => 'checkbox',
187 187
 				'section'         => 'colors',
188
-				'label'           => esc_html__( 'Dark Mode support', 'twentytwentyone' ),
188
+				'label'           => esc_html__('Dark Mode support', 'twentytwentyone'),
189 189
 				'priority'        => 110,
190 190
 				'description'     => $description,
191
-				'active_callback' => static function( $value ) {
192
-					return 127 < Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( get_theme_mod( 'background_color', 'D1E4DD' ) );
191
+				'active_callback' => static function($value) {
192
+					return 127 < Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex(get_theme_mod('background_color', 'D1E4DD'));
193 193
 				},
194 194
 			)
195 195
 		);
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 				'selector'            => '#dark-mode-toggler',
202 202
 				'container_inclusive' => true,
203 203
 				'render_callback'     => function() {
204
-					$attrs = ( $this->switch_should_render() ) ? array() : array( 'style' => 'display:none;' );
205
-					$this->the_html( $attrs );
204
+					$attrs = ($this->switch_should_render()) ? array() : array('style' => 'display:none;');
205
+					$this->the_html($attrs);
206 206
 				},
207 207
 			)
208 208
 		);
@@ -216,15 +216,15 @@  discard block
 block discarded – undo
216 216
 	 * @param string $classes The classes for <html> element.
217 217
 	 * @return string
218 218
 	 */
219
-	public function html_classes( $classes ) {
220
-		if ( ! $this->switch_should_render() ) {
219
+	public function html_classes($classes) {
220
+		if ( ! $this->switch_should_render()) {
221 221
 			return $classes;
222 222
 		}
223 223
 
224
-		$background_color            = get_theme_mod( 'background_color', 'D1E4DD' );
225
-		$should_respect_color_scheme = get_theme_mod( 'respect_user_color_preference', false );
226
-		if ( $should_respect_color_scheme && 127 <= Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) ) {
227
-			return ( $classes ) ? ' respect-color-scheme-preference' : 'respect-color-scheme-preference';
224
+		$background_color            = get_theme_mod('background_color', 'D1E4DD');
225
+		$should_respect_color_scheme = get_theme_mod('respect_user_color_preference', false);
226
+		if ($should_respect_color_scheme && 127 <= Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex($background_color)) {
227
+			return ($classes) ? ' respect-color-scheme-preference' : 'respect-color-scheme-preference';
228 228
 		}
229 229
 
230 230
 		return $classes;
@@ -238,21 +238,21 @@  discard block
 block discarded – undo
238 238
 	 * @param string $classes The admin body-classes.
239 239
 	 * @return string
240 240
 	 */
241
-	public function admin_body_classes( $classes ) {
242
-		if ( ! $this->switch_should_render() ) {
241
+	public function admin_body_classes($classes) {
242
+		if ( ! $this->switch_should_render()) {
243 243
 			return $classes;
244 244
 		}
245 245
 
246 246
 		global $current_screen;
247
-		if ( empty( $current_screen ) ) {
247
+		if (empty($current_screen)) {
248 248
 			set_current_screen();
249 249
 		}
250 250
 
251
-		if ( $current_screen->is_block_editor() ) {
252
-			$should_respect_color_scheme = get_theme_mod( 'respect_user_color_preference', false );
253
-			$background_color            = get_theme_mod( 'background_color', 'D1E4DD' );
251
+		if ($current_screen->is_block_editor()) {
252
+			$should_respect_color_scheme = get_theme_mod('respect_user_color_preference', false);
253
+			$background_color            = get_theme_mod('background_color', 'D1E4DD');
254 254
 
255
-			if ( $should_respect_color_scheme && Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) > 127 ) {
255
+			if ($should_respect_color_scheme && Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex($background_color) > 127) {
256 256
 				$classes .= ' twentytwentyone-supports-dark-theme';
257 257
 			}
258 258
 		}
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 	public function switch_should_render() {
271 271
 		global $is_IE;
272 272
 		return (
273
-			get_theme_mod( 'respect_user_color_preference', false ) &&
273
+			get_theme_mod('respect_user_color_preference', false) &&
274 274
 			! $is_IE &&
275
-			127 <= Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( get_theme_mod( 'background_color', 'D1E4DD' ) )
275
+			127 <= Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex(get_theme_mod('background_color', 'D1E4DD'))
276 276
 		);
277 277
 	}
278 278
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 * @return void
285 285
 	 */
286 286
 	public function the_switch() {
287
-		if ( ! $this->switch_should_render() ) {
287
+		if ( ! $this->switch_should_render()) {
288 288
 			return;
289 289
 		}
290 290
 		$this->the_html();
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	 * @param array $attrs The attributes to add to our <button> element.
302 302
 	 * @return void
303 303
 	 */
304
-	public function the_html( $attrs = array() ) {
304
+	public function the_html($attrs = array()) {
305 305
 		$attrs = wp_parse_args(
306 306
 			$attrs,
307 307
 			array(
@@ -312,13 +312,13 @@  discard block
 block discarded – undo
312 312
 			)
313 313
 		);
314 314
 		echo '<button';
315
-		foreach ( $attrs as $key => $val ) {
316
-			echo ' ' . esc_attr( $key ) . '="' . esc_attr( $val ) . '"';
315
+		foreach ($attrs as $key => $val) {
316
+			echo ' '.esc_attr($key).'="'.esc_attr($val).'"';
317 317
 		}
318 318
 		echo '>';
319 319
 		printf(
320 320
 			/* translators: %s: On/Off */
321
-			esc_html__( 'Dark Mode: %s', 'twentytwentyone' ),
321
+			esc_html__('Dark Mode: %s', 'twentytwentyone'),
322 322
 			'<span aria-hidden="true"></span>'
323 323
 		);
324 324
 		echo '</button>';
@@ -328,12 +328,12 @@  discard block
 block discarded – undo
328 328
 				margin-<?php echo is_rtl() ? 'right' : 'left'; ?>: 5px;
329 329
 			}
330 330
 			#dark-mode-toggler > span::before {
331
-				content: '<?php esc_attr_e( 'Off', 'twentytwentyone' ); ?>';
331
+				content: '<?php esc_attr_e('Off', 'twentytwentyone'); ?>';
332 332
 			}
333 333
 			#dark-mode-toggler[aria-pressed="true"] > span::before {
334
-				content: '<?php esc_attr_e( 'On', 'twentytwentyone' ); ?>';
334
+				content: '<?php esc_attr_e('On', 'twentytwentyone'); ?>';
335 335
 			}
336
-			<?php if ( is_admin() || wp_is_json_request() ) : ?>
336
+			<?php if (is_admin() || wp_is_json_request()) : ?>
337 337
 				.components-editor-notices__pinned ~ .edit-post-visual-editor #dark-mode-toggler {
338 338
 					z-index: 20;
339 339
 				}
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	public function the_script() {
362 362
 		echo '<script>';
363
-		include get_template_directory() . '/assets/js/dark-mode-toggler.js'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
363
+		include get_template_directory().'/assets/js/dark-mode-toggler.js'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
364 364
 		echo '</script>';
365 365
 	}
366 366
 
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
 	 * @return void
373 373
 	 */
374 374
 	public function add_privacy_policy_content() {
375
-		if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
375
+		if ( ! function_exists('wp_add_privacy_policy_content')) {
376 376
 			return;
377 377
 		}
378
-		$content = '<p class="privacy-policy-tutorial">' . __( 'Twenty Twenty-One uses LocalStorage when Dark Mode support is enabled.', 'twentytwentyone' ) . '</p>'
379
-				. '<strong class="privacy-policy-tutorial">' . __( 'Suggested text:', 'twentytwentyone' ) . '</strong> '
380
-				. __( 'This website uses LocalStorage to save the setting when Dark Mode support is turned on or off.<br> LocalStorage is necessary for the setting to work and is only used when a user clicks on the Dark Mode button.<br> No data is saved in the database or transferred.', 'twentytwentyone' );
381
-		wp_add_privacy_policy_content( 'Twenty Twenty-One', wp_kses_post( wpautop( $content, false ) ) );
378
+		$content = '<p class="privacy-policy-tutorial">'.__('Twenty Twenty-One uses LocalStorage when Dark Mode support is enabled.', 'twentytwentyone').'</p>'
379
+				. '<strong class="privacy-policy-tutorial">'.__('Suggested text:', 'twentytwentyone').'</strong> '
380
+				. __('This website uses LocalStorage to save the setting when Dark Mode support is turned on or off.<br> LocalStorage is necessary for the setting to work and is only used when a user clicks on the Dark Mode button.<br> No data is saved in the database or transferred.', 'twentytwentyone');
381
+		wp_add_privacy_policy_content('Twenty Twenty-One', wp_kses_post(wpautop($content, false)));
382 382
 	}
383 383
 
384 384
 }
Please login to merge, or discard this patch.
themes/twentytwentytwo/functions.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 
13
-if ( ! function_exists( 'twentytwentytwo_support' ) ) :
13
+if ( ! function_exists('twentytwentytwo_support')) :
14 14
 
15 15
 	/**
16 16
 	 * Sets up theme defaults and registers support for various WordPress features.
@@ -22,18 +22,18 @@  discard block
 block discarded – undo
22 22
 	function twentytwentytwo_support() {
23 23
 
24 24
 		// Add support for block styles.
25
-		add_theme_support( 'wp-block-styles' );
25
+		add_theme_support('wp-block-styles');
26 26
 
27 27
 		// Enqueue editor styles.
28
-		add_editor_style( 'style.css' );
28
+		add_editor_style('style.css');
29 29
 
30 30
 	}
31 31
 
32 32
 endif;
33 33
 
34
-add_action( 'after_setup_theme', 'twentytwentytwo_support' );
34
+add_action('after_setup_theme', 'twentytwentytwo_support');
35 35
 
36
-if ( ! function_exists( 'twentytwentytwo_styles' ) ) :
36
+if ( ! function_exists('twentytwentytwo_styles')) :
37 37
 
38 38
 	/**
39 39
 	 * Enqueue styles.
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	function twentytwentytwo_styles() {
46 46
 		// Register theme stylesheet.
47
-		$theme_version = wp_get_theme()->get( 'Version' );
47
+		$theme_version = wp_get_theme()->get('Version');
48 48
 
49
-		$version_string = is_string( $theme_version ) ? $theme_version : false;
49
+		$version_string = is_string($theme_version) ? $theme_version : false;
50 50
 		wp_register_style(
51 51
 			'twentytwentytwo-style',
52
-			get_template_directory_uri() . '/style.css',
52
+			get_template_directory_uri().'/style.css',
53 53
 			array(),
54 54
 			$version_string
55 55
 		);
56 56
 
57 57
 		// Enqueue theme stylesheet.
58
-		wp_enqueue_style( 'twentytwentytwo-style' );
58
+		wp_enqueue_style('twentytwentytwo-style');
59 59
 
60 60
 	}
61 61
 
62 62
 endif;
63 63
 
64
-add_action( 'wp_enqueue_scripts', 'twentytwentytwo_styles' );
64
+add_action('wp_enqueue_scripts', 'twentytwentytwo_styles');
65 65
 
66 66
 // Add block patterns
67
-require get_template_directory() . '/inc/block-patterns.php';
67
+require get_template_directory().'/inc/block-patterns.php';
Please login to merge, or discard this patch.
themes/twentytwentytwo/inc/block-patterns.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function twentytwentytwo_register_block_patterns() {
16 16
 	$block_pattern_categories = array(
17
-		'featured' => array( 'label' => __( 'Featured', 'twentytwentytwo' ) ),
18
-		'footer'   => array( 'label' => __( 'Footers', 'twentytwentytwo' ) ),
19
-		'header'   => array( 'label' => __( 'Headers', 'twentytwentytwo' ) ),
20
-		'query'    => array( 'label' => __( 'Query', 'twentytwentytwo' ) ),
21
-		'pages'    => array( 'label' => __( 'Pages', 'twentytwentytwo' ) ),
17
+		'featured' => array('label' => __('Featured', 'twentytwentytwo')),
18
+		'footer'   => array('label' => __('Footers', 'twentytwentytwo')),
19
+		'header'   => array('label' => __('Headers', 'twentytwentytwo')),
20
+		'query'    => array('label' => __('Query', 'twentytwentytwo')),
21
+		'pages'    => array('label' => __('Pages', 'twentytwentytwo')),
22 22
 	);
23 23
 
24 24
 	/**
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	 *     }
37 37
 	 * }
38 38
 	 */
39
-	$block_pattern_categories = apply_filters( 'twentytwentytwo_block_pattern_categories', $block_pattern_categories );
39
+	$block_pattern_categories = apply_filters('twentytwentytwo_block_pattern_categories', $block_pattern_categories);
40 40
 
41
-	foreach ( $block_pattern_categories as $name => $properties ) {
42
-		if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( $name ) ) {
43
-			register_block_pattern_category( $name, $properties );
41
+	foreach ($block_pattern_categories as $name => $properties) {
42
+		if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered($name)) {
43
+			register_block_pattern_category($name, $properties);
44 44
 		}
45 45
 	}
46 46
 
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @param array $block_patterns List of block patterns by name.
123 123
 	 */
124
-	$block_patterns = apply_filters( 'twentytwentytwo_block_patterns', $block_patterns );
124
+	$block_patterns = apply_filters('twentytwentytwo_block_patterns', $block_patterns);
125 125
 
126
-	foreach ( $block_patterns as $block_pattern ) {
127
-		$pattern_file = get_theme_file_path( '/inc/patterns/' . $block_pattern . '.php' );
126
+	foreach ($block_patterns as $block_pattern) {
127
+		$pattern_file = get_theme_file_path('/inc/patterns/'.$block_pattern.'.php');
128 128
 
129 129
 		register_block_pattern(
130
-			'twentytwentytwo/' . $block_pattern,
130
+			'twentytwentytwo/'.$block_pattern,
131 131
 			require $pattern_file
132 132
 		);
133 133
 	}
134 134
 }
135
-add_action( 'init', 'twentytwentytwo_register_block_patterns', 9 );
135
+add_action('init', 'twentytwentytwo_register_block_patterns', 9);
Please login to merge, or discard this patch.
themes/twentytwentytwo/inc/patterns/header-small-dark.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
  * Small header with dark background block pattern
4 4
  */
5 5
 return array(
6
-	'title'      => __( 'Small header with dark background', 'twentytwentytwo' ),
7
-	'categories' => array( 'header' ),
8
-	'blockTypes' => array( 'core/template-part/header' ),
6
+	'title'      => __('Small header with dark background', 'twentytwentytwo'),
7
+	'categories' => array('header'),
8
+	'blockTypes' => array('core/template-part/header'),
9 9
 	'content'    => '<!-- wp:group {"align":"full","style":{"elements":{"link":{"color":{"text":"var:preset|color|background"}}},"spacing":{"padding":{"top":"0px","bottom":"0px"}}},"backgroundColor":"foreground","textColor":"background","layout":{"inherit":true}} -->
10 10
 					<div class="wp-block-group alignfull has-background-color has-foreground-background-color has-text-color has-background has-link-color" style="padding-top:0px;padding-bottom:0px;"><!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"0px","bottom":"0px"}}},"layout":{"inherit":true}} -->
11 11
 					<div class="wp-block-group alignfull" style="padding-top:0px;padding-bottom:0px;"><!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"var(--wp--custom--spacing--small, 1.25rem)","bottom":"var(--wp--custom--spacing--large, 8rem)"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 					<!-- /wp:group -->
23 23
 
24 24
 					<!-- wp:image {"align":"wide","sizeSlug":"full","linkDestination":"none"} -->
25
-					<figure class="wp-block-image alignwide size-full"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/flight-path-on-transparent-d.png" alt="' . esc_attr__( 'Illustration of a bird flying.', 'twentytwentytwo' ) . '"/></figure>
25
+					<figure class="wp-block-image alignwide size-full"><img src="' . esc_url(get_template_directory_uri()).'/assets/images/flight-path-on-transparent-d.png" alt="'.esc_attr__('Illustration of a bird flying.', 'twentytwentytwo').'"/></figure>
26 26
 					<!-- /wp:image --></div>
27 27
 					<!-- /wp:group -->
28 28
 					<!-- wp:spacer {"height":66} -->
Please login to merge, or discard this patch.