PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 0.0.10
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v0.0.10
2.12.8 2.12.7 2.12.6 2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 All 98 releases
sureforms / modules / gutenberg / classes / class-spec-spectra-compatibility.php

class-spec-spectra-compatibility.php in SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz 0.0.10, at modules/gutenberg/classes/class-spec-spectra-compatibility.php

102 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Spectra theme compatibility
4 *
5 * @package Sureforms
6 */
7
8 // Exit if accessed directly.
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12 if ( ! class_exists( 'Spec_Spectra_Compatibility' ) ) :
13
14 /**
15 * Class for Spectra compatibility
16 */
17 class Spec_Spectra_Compatibility {
18
19 /**
20 * Member Variable
21 *
22 * @var instance
23 */
24 private static $instance;
25
26 /**
27 * Initiator
28 *
29 * @since 0.0.1
30 */
31 public static function get_instance() {
32 if ( ! isset( self::$instance ) ) {
33 self::$instance = new self();
34 }
35 return self::$instance;
36 }
37
38 /**
39 * Constructor
40 *
41 * @since 0.0.1
42 */
43 public function __construct() {
44
45 // Hook: Editor assets.
46 add_action( 'enqueue_block_editor_assets', [ $this, 'spectra_editor_assets' ] );
47 }
48
49 /**
50 * Clear theme cached CSS if required.
51 */
52 public function spectra_editor_assets() {
53
54 wp_localize_script(
55 'srfm-spec-block-js',
56 'srfm_spec_blocks_info',
57 [
58 'number_of_icon_chunks' => Spec_Gb_Helper::$number_of_icon_chunks,
59 'collapse_panels' => 'enabled',
60 'load_font_awesome_5' => 'disabled',
61 'uag_select_font_globally' => [],
62 'uag_load_select_font_globally' => [],
63 'font_awesome_5_polyfill' => [],
64 'spectra_custom_fonts' => apply_filters( 'srfm_system_fonts', [] ),
65 'tablet_breakpoint' => SRFM_TABLET_BREAKPOINT,
66 'mobile_breakpoint' => SRFM_TABLET_BREAKPOINT,
67 'category' => 'sureforms',
68 'srfm_url' => SRFM_URL,
69 ]
70 );
71
72 // Add svg icons in chunks.
73 $this->add_svg_icon_assets();
74 }
75
76 /**
77 * Localize SVG icon scripts in chunks.
78 * Ex - if 1800 icons available so we will localize 4 variables for it.
79 *
80 * @since 0.0.1
81 * @return void
82 */
83 public function add_svg_icon_assets() {
84 $localize_icon_chunks = Spec_Gb_Helper::backend_load_font_awesome_icons();
85
86 if ( ! $localize_icon_chunks ) {
87 return;
88 }
89
90 foreach ( $localize_icon_chunks as $chunk_index => $value ) {
91 wp_localize_script( 'srfm-spec-block-js', "uagb_svg_icons_{$chunk_index}", $value );
92 }
93 }
94
95 }
96 /**
97 * Kicking this off by calling 'get_instance()' method
98 */
99 Spec_Spectra_Compatibility::get_instance();
100
101 endif;
102