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