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/typography.php +23 -19 2.7.8trunk View file →
@@ -46,39 +46,42 @@
46 46 * @return void
47 47 */
48 48 public function register_setting_fields() {
49 49 // Setting fields.
50 + // phpcs:disable PluginCheck.CodeAnalysis.SettingSanitization.register_settingDynamic
50 51 register_setting(
51 - 'boldblocks',
52 - 'boldblocks_enable_typography',
52 + 'cbb',
53 + 'cbb_enable_typography',
53 54 [
54 - 'type' => 'boolean',
55 - 'show_in_rest' => [
55 + 'type' => 'boolean',
56 + 'sanitize_callback' => 'rest_sanitize_boolean',
57 + 'show_in_rest' => [
56 58 'name' => 'EnableTypography',
57 59 ],
58 - 'default' => false,
60 + 'default' => false,
59 61 ]
60 62 );
61 63
62 64 register_setting(
63 - 'boldblocks',
64 - 'boldblocks_use_bunny_fonts',
65 + 'cbb',
66 + 'cbb_use_bunny_fonts',
65 67 [
66 - 'type' => 'boolean',
67 - 'show_in_rest' => [
68 + 'type' => 'boolean',
69 + 'sanitize_callback' => 'rest_sanitize_boolean',
70 + 'show_in_rest' => [
68 71 'name' => 'UseBunnyFonts',
69 72 ],
70 - 'default' => false,
73 + 'default' => false,
71 74 ]
72 75 );
73 76
74 77 register_setting(
75 - 'boldblocks',
76 - 'boldblocks_typography',
78 + 'cbb',
79 + 'cbb_typography',
77 80 [
78 81 'type' => 'object',
79 82 'show_in_rest' => array(
80 - 'name' => 'BoldBlocksTypography',
83 + 'name' => 'CBBTypography',
81 84 'schema' => array(
82 85 'type' => 'object',
83 86 'properties' => array(
84 87 'fonts' => array(
@@ -91,8 +94,9 @@
91 94 ),
92 95 ),
93 96 ]
94 97 );
98 + // phpcs:enable PluginCheck.CodeAnalysis.SettingSanitization.register_settingDynamic
95 99
96 100 register_meta(
97 101 'post',
98 102 'boldblocks_typography',
@@ -99,9 +103,9 @@
99 103 [
100 104 'single' => true,
101 105 'type' => 'object',
102 106 'show_in_rest' => array(
103 - 'name' => 'BoldBlocksTypography',
107 + 'name' => 'CBBTypography',
104 108 'schema' => array(
105 109 'type' => 'object',
106 110 'additionalProperties' => array(
107 111 'type' => 'string',
@@ -209,9 +213,9 @@
209 213 * @param boolean $is_editor
210 214 * @return void
211 215 */
212 216 private function enqueue_custom_fonts( $post_id, $is_editor = false ) {
213 - $use_bunny_fonts = get_option( 'boldblocks_use_bunny_fonts' );
217 + $use_bunny_fonts = get_option( 'cbb_use_bunny_fonts' );
214 218
215 219 $fonts_url = $this->get_fonts_url( $post_id, $use_bunny_fonts );
216 220 if ( $fonts_url ) {
217 221 $prefix = $is_editor ? 'https:' : '';
@@ -241,9 +245,9 @@
241 245 * @return array $urls URLs to print for resource hints.
242 246 */
243 247 public function preconnect_fonts( $urls, $relation_type ) {
244 248 if ( wp_style_is( 'boldblocks-custom-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
245 - $use_bunny_fonts = get_option( 'boldblocks_use_bunny_fonts' );
249 + $use_bunny_fonts = get_option( 'cbb_use_bunny_fonts' );
246 250
247 251 $urls[] = array(
248 252 'href' => $use_bunny_fonts ? '//fonts.bunny.net' : '//fonts.gstatic.com',
249 253 'crossorigin',
@@ -461,9 +465,9 @@
461 465 * @param int $post_id
462 466 * @return mixed
463 467 */
464 468 private function get_custom_typography( $post_id = 0 ) {
465 - $enable_typography = get_option( 'boldblocks_enable_typography' );
469 + $enable_typography = \get_option( 'cbb_enable_typography' );
466 470
467 471 if ( ! $enable_typography ) {
468 472 return false;
469 473 }
@@ -469,9 +473,9 @@
469 473 }
470 474
471 475 $typography_raw = $post_id > 0 ? get_post_meta( $post_id, 'boldblocks_typography', true ) : false;
472 476 if ( empty( $typography_raw ) || ! is_array( $typography_raw ) || empty( $typography_raw['fonts'] ) ) {
473 - $typography_raw = \get_option( 'boldblocks_typography' );
477 + $typography_raw = \get_option( 'cbb_typography' );
474 478 }
475 479
476 480 if ( ! is_array( $typography_raw ) || empty( $typography_raw['fonts'] ) ) {
477 481 return;
@@ -492,9 +496,9 @@
492 496 * @param array $classes
493 497 * @return string
494 498 */
495 499 public function add_typography_to_body_class( $classes ) {
496 - $enable_typography = get_option( 'boldblocks_enable_typography' );
500 + $enable_typography = get_option( 'cbb_enable_typography' );
497 501
498 502 if ( $enable_typography ) {
499 503 $classes[] = 'has-boldblocks-typography';
500 504 }