PluginProbe
Content Blocks Builder – Create blocks, repeater blocks with carousel, grid, popup layouts / trunk
Content Blocks Builder – Create blocks, repeater blocks with carousel, grid, popup layouts vtrunk
2.8.14 2.8.13 2.8.12 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.10 2.8.11 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 trunk 1.0.1 1.0.2 1.1.0 1.1.1 All 147 releases
← All changes | includes/maintenance.php +36 -21 2.7.5trunk View file →
@@ -38,17 +38,19 @@
38 38 *
39 39 * @return void
40 40 */
41 41 public function register_settings() {
42 + // phpcs:disable PluginCheck.CodeAnalysis.SettingSanitization.register_settingDynamic
42 43 register_setting(
43 44 'cbb',
44 45 'cbb_is_maintenance',
45 46 [
46 - 'type' => 'boolean',
47 - 'show_in_rest' => [
47 + 'type' => 'boolean',
48 + 'sanitize_callback' => 'rest_sanitize_boolean',
49 + 'show_in_rest' => [
48 50 'name' => 'IsMaintenance',
49 51 ],
50 - 'default' => false,
52 + 'default' => false,
51 53 ]
52 54 );
53 55
54 56 register_setting(
@@ -54,13 +56,14 @@
54 56 register_setting(
55 57 'cbb',
56 58 'cbb_maintenance_ignore_slug',
57 59 [
58 - 'type' => 'string',
59 - 'show_in_rest' => [
60 + 'type' => 'string',
61 + 'sanitize_callback' => 'sanitize_text_field',
62 + 'show_in_rest' => [
60 63 'name' => 'MaintenanceSlug',
61 64 ],
62 - 'default' => 'wp-login.php',
65 + 'default' => 'wp-login.php',
63 66 ]
64 67 );
65 68
66 69 register_setting(
@@ -66,13 +69,14 @@
66 69 register_setting(
67 70 'cbb',
68 71 'cbb_maintenance_enable_custom_page',
69 72 [
70 - 'type' => 'boolean',
71 - 'show_in_rest' => [
73 + 'type' => 'boolean',
74 + 'sanitize_callback' => 'rest_sanitize_boolean',
75 + 'show_in_rest' => [
72 76 'name' => 'MaintananceEnableCustomPage',
73 77 ],
74 - 'default' => false,
78 + 'default' => false,
75 79 ]
76 80 );
77 81
78 82 register_setting(
@@ -78,15 +82,17 @@
78 82 register_setting(
79 83 'cbb',
80 84 'cbb_maintenance_page_id',
81 85 [
82 - 'type' => 'integer',
83 - 'show_in_rest' => [
86 + 'type' => 'integer',
87 + 'sanitize_callback' => 'absint',
88 + 'show_in_rest' => [
84 89 'name' => 'MaintanancePageId',
85 90 ],
86 - 'default' => 0,
91 + 'default' => 0,
87 92 ]
88 93 );
94 + // phpcs:enable PluginCheck.CodeAnalysis.SettingSanitization.register_settingDynamic
89 95 }
90 96
91 97 /**
92 98 * Starting point
@@ -138,13 +144,14 @@
138 144 }
139 145 }
140 146 }
141 147
142 - $page_title = __( 'Maintenance' );
148 + $page_title = __( 'Maintenance', 'content-blocks-builder' );
143 149 $page_content = __( 'The site is currently under maintenance. <br/>Please check back in a few minutes!', 'content-blocks-builder' );
144 150
145 151 $site_icon = get_site_icon_url( 64 );
146 152 if ( $site_icon ) {
153 + // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
147 154 $site_icon = sprintf( '<img class="site-icon" width="64" src="%1$s" alt="%2$s"/>', $site_icon, get_bloginfo( 'name' ) );
148 155 } else {
149 156 $site_icon = sprintf( '<h1 class="site-icon site-title">%s</h1>', get_bloginfo( 'name' ) );
150 157 }
@@ -159,10 +166,8 @@
159 166 if ( function_exists( 'is_rtl' ) && is_rtl() ) {
160 167 $text_direction = 'rtl';
161 168 }
162 169
163 - $dir_attr = "dir='$text_direction'";
164 -
165 170 if ( $enable_custom_page && $page_id ) {
166 171 $custom_page_url = get_permalink( $page_id );
167 172 if ( $custom_page_url ) {
168 173 wp_safe_redirect( $custom_page_url );
@@ -172,9 +177,9 @@
172 177
173 178 ob_start();
174 179 ?>
175 180 <!DOCTYPE html>
176 -<html <?php echo $dir_attr; ?>>
181 +<html dir="<?php echo esc_attr( $text_direction ); ?>">
177 182 <head>
178 183 <meta charset="utf-8">
179 184 <?php
180 185 if ( function_exists( 'wp_robots' ) && function_exists( 'wp_robots_no_robots' ) && function_exists( 'add_filter' ) ) {
@@ -181,9 +186,9 @@
181 186 add_filter( 'wp_robots', 'wp_robots_no_robots' );
182 187 wp_robots();
183 188 }
184 189 ?>
185 - <title><?php esc_html_e( $page_title ); ?></title>
190 + <title><?php echo esc_html( $page_title ); ?></title>
186 191 <style>
187 192 body { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; font-size:1.25rem; color: #333; text-align:center; }
188 193 .site-icon { margin-bottom: 1rem; }
189 194 .container { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 600px; width:clamp(320px,50vw,600px); margin: auto; }
@@ -196,17 +201,26 @@
196 201 </style>
197 202 </head>
198 203 <body class="maintenance">
199 204 <div class="container">
200 - <?php echo $site_icon; ?>
205 + <?php
206 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
207 + echo $site_icon;
208 + ?>
201 209 <div class="message">
202 - <h1><?php esc_html_e( $page_title ); ?></h1>
203 - <div><?php echo $page_content; ?></div>
210 + <h1><?php echo esc_html( $page_title ); ?></h1>
211 + <div>
212 + <?php
213 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
214 + echo $page_content;
215 + ?>
216 + </div>
204 217 </div>
205 218 </div>
206 219 </body>
207 220 </html>
208 221 <?php
222 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
209 223 die( ob_get_clean() );
210 224 }
211 225
212 226 /**
@@ -230,10 +244,11 @@
230 244 if ( ! ( in_array( $screen->base, [ 'dashboard', 'plugins', 'themes' ], true ) || 'edit.php?post_type=boldblocks_block' === $screen->parent_file ) ) {
231 245 return;
232 246 }
233 247
234 - $settings_link = sprintf( '<a href="%1$s">%2$s</a>', admin_url( '/edit.php?post_type=boldblocks_block&page=cbb-settings&tab=developer' ), __( 'Turn it off.', 'content-blocks-buider' ) );
248 + $settings_link = sprintf( '<a href="%1$s">%2$s</a>', admin_url( '/edit.php?post_type=boldblocks_block&page=cbb-settings&tab=developer' ), __( 'Turn it off.', 'content-blocks-builder' ) );
235 249
250 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
236 251 echo '<div class="notice notice-warning is-dismissible"><p>' . __( 'The site is currently under maintenance. Please remember to turn off this mode when the site is ready. You can do this from the settings page.', 'content-blocks-builder' ) . ' ' . $settings_link . '</p></div>';
237 252 }
238 253 }
239 254 endif;