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