PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 2.12.7
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v2.12.7
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 0.0.2 All 97 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 2.12.7, at modules/gutenberg/classes/class-spec-spectra-compatibility.php

103 lines 2.3 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 add_action( 'enqueue_block_assets', [ $this, 'spectra_editor_assets' ] );
48 }
49
50 /**
51 * Clear theme cached CSS if required.
52 */
53 public function spectra_editor_assets() {
54
55 wp_localize_script(
56 'srfm-spec-block-js',
57 'srfm_spec_blocks_info',
58 [
59 'number_of_icon_chunks' => Spec_Gb_Helper::$number_of_icon_chunks,
60 'collapse_panels' => 'enabled',
61 'load_font_awesome_5' => 'disabled',
62 'uag_select_font_globally' => [],
63 'uag_load_select_font_globally' => [],
64 'font_awesome_5_polyfill' => [],
65 'spectra_custom_fonts' => apply_filters( 'srfm_system_fonts', [] ),
66 'tablet_breakpoint' => SRFM_TABLET_BREAKPOINT,
67 'mobile_breakpoint' => SRFM_TABLET_BREAKPOINT,
68 'category' => 'sureforms',
69 'srfm_url' => SRFM_URL,
70 ]
71 );
72
73 // Add svg icons in chunks.
74 $this->add_svg_icon_assets();
75 }
76
77 /**
78 * Localize SVG icon scripts in chunks.
79 * Ex - if 1800 icons available so we will localize 4 variables for it.
80 *
81 * @since 0.0.1
82 * @return void
83 */
84 public function add_svg_icon_assets() {
85 $localize_icon_chunks = Spec_Gb_Helper::backend_load_font_awesome_icons();
86
87 if ( ! $localize_icon_chunks ) {
88 return;
89 }
90
91 foreach ( $localize_icon_chunks as $chunk_index => $value ) {
92 wp_localize_script( 'srfm-spec-block-js', "uagb_svg_icons_{$chunk_index}", $value );
93 }
94 }
95
96 }
97 /**
98 * Kicking this off by calling 'get_instance()' method
99 */
100 Spec_Spectra_Compatibility::get_instance();
101
102 endif;
103