PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.8
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.8
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / admin / class-smart-post-show-element-shortcode-addons.php

class-smart-post-show-element-shortcode-addons.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.8, at admin/class-smart-post-show-element-shortcode-addons.php

191 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Elementor shortcode block.
4 *
5 * @since 2.2.5
6 * @package Smart_Post_Show
7 * @subpackage Smart_Post_Show/admin
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly.
12 }
13
14 use SmartPostShow\Blocks\Helper;
15
16 /**
17 * Smart_Post_Show_Free_Element_Shortcode_Addons main class.
18 */
19 class Smart_Post_Show_Free_Element_Shortcode_Addons {
20 /**
21 * Instance
22 *
23 * @since 2.2.5
24 *
25 * @access private
26 * @static
27 *
28 * @var Smart_Post_Show_Free_Element_Shortcode_Addons The single instance of the class.
29 */
30 private static $instance = null;
31
32 /**
33 * Script and style suffix
34 *
35 * @since 2.0.0
36 * @access protected
37 * @var string
38 */
39 protected $suffix;
40
41 /**
42 * Instance
43 *
44 * Ensures only one instance of the class is loaded or can be loaded.
45 *
46 * @since 2.2.5
47 *
48 * @access public
49 * @static
50 *
51 * @return Elementor_Test_Extension An instance of the class.
52 */
53 public static function instance() {
54
55 if ( is_null( self::$instance ) ) {
56 self::$instance = new self();
57 }
58 return self::$instance;
59 }
60
61 /**
62 * Constructor
63 *
64 * @since 2.2.5
65 *
66 * @access public
67 */
68 public function __construct() {
69 $this->on_plugins_loaded();
70 add_action( 'elementor/preview/enqueue_styles', array( $this, 'smart_post_show_free_addons_enqueue_style' ) );
71 add_action( 'elementor/preview/enqueue_scripts', array( $this, 'smart_post_show_free_addons_enqueue_scripts' ) );
72 add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'smart_post_show_free_addons_icon' ) );
73 }
74
75 /**
76 * Elementor block icon.
77 *
78 * @since 2.2.5
79 * @return void
80 */
81 public function smart_post_show_free_addons_icon() {
82 wp_enqueue_style( 'smart_post_show_free_elementor_addons_icon', SP_PC_URL . 'admin/assets/css/fontello.min.css', array(), SP_PC_VERSION, 'all' );
83 }
84
85 /**
86 * Enqueue the JavaScript for the elementor block area.
87 *
88 * @since 2.2.5
89 */
90 public function smart_post_show_free_addons_enqueue_scripts() {
91
92 /**
93 * This function is provided for demonstration purposes only.
94 *
95 * An instance of this class should be passed to the run() function
96 * defined in Smart_Post_Show_Free_Loader as all of the hooks are defined
97 * in that particular class.
98 *
99 * The Smart_Post_Show_Free_Loader will then create the relationship
100 * between the defined hooks and the functions defined in this
101 * class.
102 */
103
104 wp_enqueue_script( 'pcp_swiper' );
105 wp_enqueue_script( 'pcp_script' );
106 wp_enqueue_script( 'sp_smart_post_build_script' );
107 }
108 /**
109 * Enqueue styles for the elementor block area.
110 *
111 * @since 2.2.5
112 */
113 public function smart_post_show_free_addons_enqueue_style() {
114
115 /**
116 * This function is provided for demonstration purposes only.
117 *
118 * An instance of this class should be passed to the run() function
119 * defined in Smart_Post_Show_Free_Loader as all of the hooks are defined
120 * in that particular class.
121 *
122 * The Smart_Post_Show_Free_Loader will then create the relationship
123 * between the defined hooks and the functions defined in this
124 * class.
125 */
126 wp_enqueue_style( 'font-awesome' );
127 wp_enqueue_style( 'pcp_swiper' );
128 wp_enqueue_style( 'pcp_fonttello_icon' );
129 wp_enqueue_style( 'pcp-style' );
130 }
131
132 /**
133 * On Plugins Loaded
134 *
135 * Checks if Elementor has loaded, and performs some compatibility checks.
136 * If All checks pass, inits the plugin.
137 *
138 * Fired by `plugins_loaded` action hook.
139 *
140 * @since 2.2.5
141 *
142 * @access public
143 */
144 public function on_plugins_loaded() {
145 add_action( 'elementor/init', array( $this, 'init' ) );
146 }
147
148 /**
149 * Initialize the plugin
150 *
151 * Load the plugin only after Elementor (and other plugins) are loaded.
152 * Load the files required to run the plugin.
153 *
154 * Fired by `plugins_loaded` action hook.
155 *
156 * @since 2.2.5
157 *
158 * @access public
159 */
160 public function init() {
161 // Add Plugin actions.
162 add_action( 'elementor/widgets/register', array( $this, 'init_widgets' ) );
163 }
164
165 /**
166 * Init Widgets
167 *
168 * Include widgets files and register them
169 *
170 * @since 2.2.5
171 *
172 * @access public
173 */
174 public function init_widgets() {
175 // Register widget.
176 require_once SP_PC_PATH . 'admin/ElementAddons/Shortcode_Widget.php';
177 \Elementor\Plugin::instance()->widgets_manager->register( new Shortcode_Widget() );
178
179 $integration_options = Helper::get_integration_options();
180
181 $elementor_integration = $integration_options['elementor'] ?? false;
182
183 if ( $elementor_integration ) {
184 require_once SP_PC_PATH . 'admin/ElementAddons/Smart_Post_Show_Template_Widget.php';
185 \Elementor\Plugin::instance()->widgets_manager->register( new Smart_Post_Show_Template_Widget() );
186 }
187 }
188 }
189
190 Smart_Post_Show_Free_Element_Shortcode_Addons::instance();
191