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