| @@ -1,233 +1,246 @@ | ||
| 1 | -<?php | |
| 2 | -/* | |
| 3 | -Plugin Name: UiCore Elements | |
| 4 | -Plugin URI: https://elements.uicore.co | |
| 5 | -Description: Elementor Widgets and Theme Builder Elements | |
| 6 | -Version: 1.0.12 | |
| 7 | -Author: UiCore | |
| 8 | -Author URI: https://uicore.co | |
| 9 | -License: GPL3 | |
| 10 | -Text Domain: uicore-elements | |
| 11 | -Domain Path: /languages | |
| 12 | - * Elementor requires at least: 3.19.2 | |
| 13 | - * Elementor tested up to: 3.25.10 | |
| 14 | -*/ | |
| 15 | -namespace UiCoreElements; | |
| 16 | - | |
| 17 | -// don't call the file directly | |
| 18 | -if ( !defined( 'ABSPATH' ) ) exit; | |
| 19 | - | |
| 20 | -/** | |
| 21 | - * Base class | |
| 22 | - * | |
| 23 | - * @class Base The class that holds the entire plugin | |
| 24 | - */ | |
| 25 | -final class Base { | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * Plugin version | |
| 29 | - * | |
| 30 | - * @var string | |
| 31 | - */ | |
| 32 | - public $version = '1.0.12'; | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * Holds various class instances | |
| 36 | - * | |
| 37 | - * @var array | |
| 38 | - */ | |
| 39 | - private $container = array(); | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * Constructor for the Base class | |
| 43 | - * | |
| 44 | - * Sets up all the appropriate hooks and actions | |
| 45 | - * within our plugin. | |
| 46 | - */ | |
| 47 | - public function __construct() { | |
| 48 | - | |
| 49 | - $this->define_constants(); | |
| 50 | - | |
| 51 | - register_activation_hook( __FILE__, array( $this, 'activate' ) ); | |
| 52 | - register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); | |
| 53 | - | |
| 54 | - add_action( 'plugins_loaded', array( $this, 'init_plugin' ) ); | |
| 55 | - } | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * Initializes the Base() class | |
| 59 | - * | |
| 60 | - * Checks for an existing Base() instance | |
| 61 | - * and if it doesn't find one, creates it. | |
| 62 | - */ | |
| 63 | - public static function init() { | |
| 64 | - static $instance = false; | |
| 65 | - | |
| 66 | - if ( ! $instance ) { | |
| 67 | - $instance = new Base(); | |
| 68 | - } | |
| 69 | - | |
| 70 | - return $instance; | |
| 71 | - } | |
| 72 | - | |
| 73 | - /** | |
| 74 | - * Magic getter to bypass referencing plugin. | |
| 75 | - * | |
| 76 | - * @param $prop | |
| 77 | - * | |
| 78 | - * @return mixed | |
| 79 | - */ | |
| 80 | - public function __get( $prop ) { | |
| 81 | - if ( array_key_exists( $prop, $this->container ) ) { | |
| 82 | - return $this->container[ $prop ]; | |
| 83 | - } | |
| 84 | - | |
| 85 | - return $this->{$prop}; | |
| 86 | - } | |
| 87 | - | |
| 88 | - /** | |
| 89 | - * Magic isset to bypass referencing plugin. | |
| 90 | - * | |
| 91 | - * @param $prop | |
| 92 | - * | |
| 93 | - * @return mixed | |
| 94 | - */ | |
| 95 | - public function __isset( $prop ) { | |
| 96 | - return isset( $this->{$prop} ) || isset( $this->container[ $prop ] ); | |
| 97 | - } | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * Define the constants | |
| 101 | - * | |
| 102 | - * @return void | |
| 103 | - */ | |
| 104 | - public function define_constants() { | |
| 105 | - define( 'UICORE_ELEMENTS_VERSION', $this->version ); | |
| 106 | - define( 'UICORE_ELEMENTS_FILE', __FILE__ ); | |
| 107 | - define( 'UICORE_ELEMENTS_PATH', dirname( UICORE_ELEMENTS_FILE ) ); | |
| 108 | - define( 'UICORE_ELEMENTS_INCLUDES', UICORE_ELEMENTS_PATH . '/includes' ); | |
| 109 | - define( 'UICORE_ELEMENTS_URL', plugins_url( '', UICORE_ELEMENTS_FILE ) ); | |
| 110 | - define( 'UICORE_ELEMENTS_ASSETS', UICORE_ELEMENTS_URL . '/assets' ); | |
| 111 | - } | |
| 112 | - | |
| 113 | - /** | |
| 114 | - * Load the plugin after all plugis are loaded | |
| 115 | - * | |
| 116 | - * @return void | |
| 117 | - */ | |
| 118 | - public function init_plugin() { | |
| 119 | - if(\class_exists('Elementor\Plugin')){ | |
| 120 | - $this->includes(); | |
| 121 | - $this->init_hooks(); | |
| 122 | - } | |
| 123 | - } | |
| 124 | - | |
| 125 | - /** | |
| 126 | - * Placeholder for activation function | |
| 127 | - * | |
| 128 | - * Nothing being called here yet. | |
| 129 | - */ | |
| 130 | - public function activate() { | |
| 131 | - | |
| 132 | - $installed = get_option( 'uicore_elements_installed' ); | |
| 133 | - | |
| 134 | - if ( ! $installed ) { | |
| 135 | - update_option( 'uicore_elements_installed', time() ); | |
| 136 | - } | |
| 137 | - | |
| 138 | - update_option( 'uicore_elements_version', UICORE_ELEMENTS_VERSION ); | |
| 139 | - } | |
| 140 | - | |
| 141 | - /** | |
| 142 | - * Placeholder for deactivation function | |
| 143 | - * | |
| 144 | - * Nothing being called here yet. | |
| 145 | - */ | |
| 146 | - public function deactivate() { | |
| 147 | - | |
| 148 | - } | |
| 149 | - | |
| 150 | - /** | |
| 151 | - * Include the required files | |
| 152 | - * | |
| 153 | - * @return void | |
| 154 | - */ | |
| 155 | - public function includes() { | |
| 156 | - | |
| 157 | - require_once UICORE_ELEMENTS_INCLUDES . '/class-assets.php'; | |
| 158 | - require_once UICORE_ELEMENTS_INCLUDES . '/class-elementor.php'; | |
| 159 | - require_once UICORE_ELEMENTS_INCLUDES . '/class-rest-api.php'; | |
| 160 | - require_once UICORE_ELEMENTS_INCLUDES . '/class-helper.php'; | |
| 161 | - | |
| 162 | - if ( $this->is_request( 'admin' ) ) { | |
| 163 | - require_once UICORE_ELEMENTS_INCLUDES . '/class-admin.php'; | |
| 164 | - } | |
| 165 | - | |
| 166 | - if ( $this->is_request( 'frontend' ) ) { | |
| 167 | - require_once UICORE_ELEMENTS_INCLUDES . '/class-frontend.php'; | |
| 168 | - } | |
| 169 | - | |
| 170 | - } | |
| 171 | - | |
| 172 | - /** | |
| 173 | - * Initialize the hooks | |
| 174 | - * | |
| 175 | - * @return void | |
| 176 | - */ | |
| 177 | - public function init_hooks() { | |
| 178 | - | |
| 179 | - add_action( 'init', array( $this, 'init_classes' ) ); | |
| 180 | - | |
| 181 | - // Localize our plugin | |
| 182 | - add_action( 'init', array( $this, 'localization_setup' ) ); | |
| 183 | - } | |
| 184 | - | |
| 185 | - /** | |
| 186 | - * Instantiate the required classes | |
| 187 | - * | |
| 188 | - * @return void | |
| 189 | - */ | |
| 190 | - public function init_classes() { | |
| 191 | - | |
| 192 | - new REST_API(); | |
| 193 | - new Elementor(); | |
| 194 | - if ( $this->is_request( 'admin' ) ) { | |
| 195 | - $this->container['admin'] = new Admin(); | |
| 196 | - } | |
| 197 | - | |
| 198 | - if ( $this->is_request( 'frontend' ) ) { | |
| 199 | - $this->container['frontend'] = new Frontend(); | |
| 200 | - } | |
| 201 | - | |
| 202 | - $this->container['assets'] = new Assets(); | |
| 203 | - } | |
| 204 | - | |
| 205 | - /** | |
| 206 | - * Initialize plugin for localization | |
| 207 | - * | |
| 208 | - * @uses load_plugin_textdomain() | |
| 209 | - */ | |
| 210 | - public function localization_setup() { | |
| 211 | - load_plugin_textdomain( 'uicore-elements', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); | |
| 212 | - } | |
| 213 | - | |
| 214 | - /** | |
| 215 | - * What type of request is this? | |
| 216 | - * | |
| 217 | - * @param string $type admin, ajax, cron or frontend. | |
| 218 | - * | |
| 219 | - * @return bool | |
| 220 | - */ | |
| 221 | - private function is_request( $type ) { | |
| 222 | - switch ( $type ) { | |
| 223 | - case 'admin' : | |
| 224 | - return is_admin(); | |
| 225 | - | |
| 226 | - case 'frontend' : | |
| 227 | - return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' ); | |
| 228 | - } | |
| 229 | - } | |
| 230 | - | |
| 231 | -} // Base | |
| 232 | - | |
| 233 | -$uicore_elements = Base::init(); | |
| 1 | +<?php | |
| 2 | +/* | |
| 3 | +Plugin Name: UiCore Elements | |
| 4 | +Plugin URI: https://elements.uicore.co | |
| 5 | +Description: Free widgets and templates for Elementor | |
| 6 | +Version: 1.3.18 | |
| 7 | +Author: UiCore | |
| 8 | +Author URI: https://uicore.co | |
| 9 | +License: GPL3 | |
| 10 | +Text Domain: uicore-elements | |
| 11 | +Domain Path: /languages | |
| 12 | + * Elementor requires at least: 3.19.2 | |
| 13 | + * Elementor tested up to: 4.3.1 | |
| 14 | +*/ | |
| 15 | + | |
| 16 | +namespace UiCoreElements; | |
| 17 | + | |
| 18 | +// don't call the file directly | |
| 19 | +if (!defined('ABSPATH')) exit; | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Base class | |
| 23 | + * | |
| 24 | + * @class Base The class that holds the entire plugin | |
| 25 | + */ | |
| 26 | +final class Base | |
| 27 | +{ | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * Plugin version | |
| 31 | + * | |
| 32 | + * @var string | |
| 33 | + */ | |
| 34 | + public $version = '1.3.18'; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * Holds various class instances | |
| 38 | + * | |
| 39 | + * @var array | |
| 40 | + */ | |
| 41 | + private $container = array(); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * Constructor for the Base class | |
| 45 | + * | |
| 46 | + * Sets up all the appropriate hooks and actions | |
| 47 | + * within our plugin. | |
| 48 | + */ | |
| 49 | + public function __construct() | |
| 50 | + { | |
| 51 | + | |
| 52 | + $this->define_constants(); | |
| 53 | + | |
| 54 | + register_activation_hook(__FILE__, array($this, 'activate')); | |
| 55 | + register_deactivation_hook(__FILE__, array($this, 'deactivate')); | |
| 56 | + | |
| 57 | + add_action('plugins_loaded', array($this, 'init_plugin')); | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Initializes the Base() class | |
| 62 | + * | |
| 63 | + * Checks for an existing Base() instance | |
| 64 | + * and if it doesn't find one, creates it. | |
| 65 | + */ | |
| 66 | + public static function init() | |
| 67 | + { | |
| 68 | + static $instance = false; | |
| 69 | + | |
| 70 | + if (! $instance) { | |
| 71 | + $instance = new Base(); | |
| 72 | + } | |
| 73 | + | |
| 74 | + return $instance; | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * Magic getter to bypass referencing plugin. | |
| 79 | + * | |
| 80 | + * @param $prop | |
| 81 | + * | |
| 82 | + * @return mixed | |
| 83 | + */ | |
| 84 | + public function __get($prop) | |
| 85 | + { | |
| 86 | + if (array_key_exists($prop, $this->container)) { | |
| 87 | + return $this->container[$prop]; | |
| 88 | + } | |
| 89 | + | |
| 90 | + return $this->{$prop}; | |
| 91 | + } | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * Magic isset to bypass referencing plugin. | |
| 95 | + * | |
| 96 | + * @param $prop | |
| 97 | + * | |
| 98 | + * @return mixed | |
| 99 | + */ | |
| 100 | + public function __isset($prop) | |
| 101 | + { | |
| 102 | + return isset($this->{$prop}) || isset($this->container[$prop]); | |
| 103 | + } | |
| 104 | + | |
| 105 | + /** | |
| 106 | + * Define the constants | |
| 107 | + * | |
| 108 | + * @return void | |
| 109 | + */ | |
| 110 | + public function define_constants() | |
| 111 | + { | |
| 112 | + define('UICORE_ELEMENTS_VERSION', $this->version); | |
| 113 | + define('UICORE_ELEMENTS_FILE', __FILE__); | |
| 114 | + define('UICORE_ELEMENTS_PATH', dirname(UICORE_ELEMENTS_FILE)); | |
| 115 | + define('UICORE_ELEMENTS_INCLUDES', UICORE_ELEMENTS_PATH . '/includes'); | |
| 116 | + define('UICORE_ELEMENTS_URL', plugins_url('', UICORE_ELEMENTS_FILE)); | |
| 117 | + define('UICORE_ELEMENTS_ASSETS', UICORE_ELEMENTS_URL . '/assets'); | |
| 118 | + define('UICORE_ELEMENTS_BADGE', '<span title="Powered by UiCore Elements" style="font-size:10px;font-weight:500;background:#5dbad8;color:black;padding:2px 5px;border-radius:3px;margin-right:4px;">UiCore</span> '); | |
| 119 | + define('UICORE_ELEMENTS_NEW_OPTION', '<span title="New" style="font-size:10px;font-weight:500;background:#532df5;color:white;padding:2px 5px;border-radius:3px;margin-left:4px;line-height: 2em;">New</span> '); | |
| 120 | + } | |
| 121 | + | |
| 122 | + /** | |
| 123 | + * Load the plugin after all plugis are loaded | |
| 124 | + * | |
| 125 | + * @return void | |
| 126 | + */ | |
| 127 | + public function init_plugin() | |
| 128 | + { | |
| 129 | + if (\class_exists('Elementor\Plugin')) { | |
| 130 | + $this->includes(); | |
| 131 | + $this->init_hooks(); | |
| 132 | + } | |
| 133 | + } | |
| 134 | + | |
| 135 | + /** | |
| 136 | + * Placeholder for activation function | |
| 137 | + * | |
| 138 | + * Nothing being called here yet. | |
| 139 | + */ | |
| 140 | + public function activate() | |
| 141 | + { | |
| 142 | + | |
| 143 | + $installed = get_option('uicore_elements_installed'); | |
| 144 | + | |
| 145 | + if (! $installed) { | |
| 146 | + update_option('uicore_elements_installed', time()); | |
| 147 | + } | |
| 148 | + | |
| 149 | + update_option('uicore_elements_version', UICORE_ELEMENTS_VERSION); | |
| 150 | + } | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * Placeholder for deactivation function | |
| 154 | + * | |
| 155 | + * Nothing being called here yet. | |
| 156 | + */ | |
| 157 | + public function deactivate() {} | |
| 158 | + | |
| 159 | + /** | |
| 160 | + * Include the required files | |
| 161 | + * | |
| 162 | + * @return void | |
| 163 | + */ | |
| 164 | + public function includes() | |
| 165 | + { | |
| 166 | + | |
| 167 | + require_once UICORE_ELEMENTS_INCLUDES . '/class-assets.php'; | |
| 168 | + require_once UICORE_ELEMENTS_INCLUDES . '/class-elementor.php'; | |
| 169 | + require_once UICORE_ELEMENTS_INCLUDES . '/class-design-cloud.php'; | |
| 170 | + require_once UICORE_ELEMENTS_INCLUDES . '/class-rest-api.php'; | |
| 171 | + require_once UICORE_ELEMENTS_INCLUDES . '/class-helper.php'; | |
| 172 | + | |
| 173 | + if ($this->is_request('admin')) { | |
| 174 | + require_once UICORE_ELEMENTS_INCLUDES . '/class-admin.php'; | |
| 175 | + } | |
| 176 | + | |
| 177 | + if ($this->is_request('frontend')) { | |
| 178 | + require_once UICORE_ELEMENTS_INCLUDES . '/class-frontend.php'; | |
| 179 | + } | |
| 180 | + } | |
| 181 | + | |
| 182 | + /** | |
| 183 | + * Initialize the hooks | |
| 184 | + * | |
| 185 | + * @return void | |
| 186 | + */ | |
| 187 | + public function init_hooks() | |
| 188 | + { | |
| 189 | + | |
| 190 | + add_action('init', array($this, 'init_classes')); | |
| 191 | + | |
| 192 | + // Localize our plugin | |
| 193 | + add_action('init', array($this, 'localization_setup')); | |
| 194 | + } | |
| 195 | + | |
| 196 | + /** | |
| 197 | + * Instantiate the required classes | |
| 198 | + * | |
| 199 | + * @return void | |
| 200 | + */ | |
| 201 | + public function init_classes() | |
| 202 | + { | |
| 203 | + | |
| 204 | + new REST_API(); | |
| 205 | + new Elementor(); | |
| 206 | + if ($this->is_request('admin')) { | |
| 207 | + $this->container['admin'] = new Admin(); | |
| 208 | + } | |
| 209 | + | |
| 210 | + if ($this->is_request('frontend')) { | |
| 211 | + $this->container['frontend'] = new Frontend(); | |
| 212 | + } | |
| 213 | + | |
| 214 | + $this->container['assets'] = new Assets(); | |
| 215 | + } | |
| 216 | + | |
| 217 | + /** | |
| 218 | + * Initialize plugin for localization | |
| 219 | + * | |
| 220 | + * @uses load_plugin_textdomain() | |
| 221 | + */ | |
| 222 | + public function localization_setup() | |
| 223 | + { | |
| 224 | + load_plugin_textdomain('uicore-elements', false, dirname(plugin_basename(__FILE__)) . '/languages/'); | |
| 225 | + } | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * What type of request is this? | |
| 229 | + * | |
| 230 | + * @param string $type admin, ajax, cron or frontend. | |
| 231 | + * | |
| 232 | + * @return bool | |
| 233 | + */ | |
| 234 | + private function is_request($type) | |
| 235 | + { | |
| 236 | + switch ($type) { | |
| 237 | + case 'admin': | |
| 238 | + return is_admin(); | |
| 239 | + | |
| 240 | + case 'frontend': | |
| 241 | + return (! is_admin() || defined('DOING_AJAX')) && ! defined('DOING_CRON'); | |
| 242 | + } | |
| 243 | + } | |
| 244 | +} // Base | |
| 245 | + | |
| 246 | +$uicore_elements = Base::init(); | |