shopengine
Last commit date
assets
4 years ago
base
4 years ago
compatibility
4 years ago
core
4 years ago
languages
4 years ago
modules
4 years ago
traits
5 years ago
utils
4 years ago
widgets
4 years ago
autoloader.php
5 years ago
plugin.php
4 years ago
readme.txt
4 years ago
shopengine.php
4 years ago
shopengine.php
300 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Plugin Name: ShopEngine |
| 5 | * Plugin URI: https://wpmet.com/plugin/shopengine |
| 6 | * Description: ShopEngine is the most-complete WooCommerce template builder for Elementor. It helps you build and customize the single product page, cart page, archive page, checkout page, order page, my account page, and thank-you page from scratch. It also packed with product comparison, wishlist, quick view, and variation swatches etc. |
| 7 | * Version: 1.1.1 |
| 8 | * Author: Wpmet |
| 9 | * Author URI: https://wpmet.com |
| 10 | * Text Domain: shopengine |
| 11 | * Domain Path: /languages |
| 12 | * License: GPLv3 |
| 13 | * License URI: https://www.gnu.org/licenses/gpl-3.0.txt |
| 14 | */ |
| 15 | |
| 16 | |
| 17 | defined('ABSPATH') || exit; |
| 18 | |
| 19 | |
| 20 | require_once __DIR__ . '/autoloader.php'; |
| 21 | |
| 22 | |
| 23 | final class ShopEngine |
| 24 | { |
| 25 | |
| 26 | const SHOPENGINE_PREFIX = 'shopengine-builder'; |
| 27 | |
| 28 | /** |
| 29 | * Plugin Version |
| 30 | * |
| 31 | * @since 1.0.0 |
| 32 | * |
| 33 | * @return string |
| 34 | */ |
| 35 | public static function version() { |
| 36 | return '1.1.1'; |
| 37 | } |
| 38 | |
| 39 | |
| 40 | /** |
| 41 | * Package type |
| 42 | * |
| 43 | * @since 1.0.0 |
| 44 | * |
| 45 | * @return string |
| 46 | */ |
| 47 | public static function package_type() { |
| 48 | return apply_filters('shopengine/core/package_type', 'free'); |
| 49 | } |
| 50 | |
| 51 | |
| 52 | static function license_status(){ |
| 53 | if(!class_exists('ShopEngine_Pro\Libs\License\Helper')){ |
| 54 | return 'invalid'; |
| 55 | } |
| 56 | if(ShopEngine_Pro\Libs\License\Helper::instance()->status() != 'valid'){ |
| 57 | return 'invalid'; |
| 58 | } |
| 59 | |
| 60 | return 'valid'; |
| 61 | } |
| 62 | |
| 63 | public static function license_data(){ |
| 64 | if(!class_exists('\ElementsKit_Lite\Libs\Framework\Classes\Utils')){ |
| 65 | return [ |
| 66 | 'key' => '', |
| 67 | 'checksum' => '', |
| 68 | 'plugin_package' => self::package_type() |
| 69 | ]; |
| 70 | } |
| 71 | |
| 72 | return array_merge( |
| 73 | ShopEngine_Pro\Libs\License\Helper::instance()->get_license(), |
| 74 | [ 'plugin_package' => self::package_type() ] |
| 75 | ); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | /** |
| 80 | * Product ID |
| 81 | * |
| 82 | * @since 1.0.0 |
| 83 | * |
| 84 | * @return string |
| 85 | */ |
| 86 | static function product_id() { |
| 87 | return '0'; |
| 88 | } |
| 89 | |
| 90 | |
| 91 | /** |
| 92 | * Plugin Author Name |
| 93 | * |
| 94 | * @since 1.0.0 |
| 95 | * |
| 96 | * @return string |
| 97 | */ |
| 98 | static function author_name() { |
| 99 | return 'Wpmet'; |
| 100 | } |
| 101 | |
| 102 | |
| 103 | /** |
| 104 | * Minimum Elementor Version required to run the plugin. |
| 105 | * |
| 106 | * @since 1.0.0 |
| 107 | * |
| 108 | * @return string |
| 109 | */ |
| 110 | public static function min_el_version() { |
| 111 | return '3.0.0'; |
| 112 | } |
| 113 | |
| 114 | |
| 115 | /** |
| 116 | * Minimum PHP Version required to run the plugin |
| 117 | * |
| 118 | * @since 1.0.0 |
| 119 | * |
| 120 | * @return string |
| 121 | */ |
| 122 | public static function min_php_version() { |
| 123 | return '7.0'; |
| 124 | } |
| 125 | |
| 126 | |
| 127 | /** |
| 128 | * Minimum Woocommerce version required to run the plugin. |
| 129 | * |
| 130 | * @since 1.0.0 |
| 131 | * |
| 132 | * @return string |
| 133 | */ |
| 134 | public static function min_woo_version() { |
| 135 | return '4.1'; |
| 136 | } |
| 137 | |
| 138 | |
| 139 | /** |
| 140 | * Plugin file plugins's root file. |
| 141 | * |
| 142 | * @since 1.0.0 |
| 143 | * |
| 144 | * @return string |
| 145 | */ |
| 146 | public static function plugin_file() { |
| 147 | return __FILE__; |
| 148 | } |
| 149 | |
| 150 | |
| 151 | /** |
| 152 | * Plugin url |
| 153 | * |
| 154 | * @since 1.0.0 |
| 155 | * @return mixed |
| 156 | */ |
| 157 | public static function plugin_url() { |
| 158 | return trailingslashit(plugin_dir_url(__FILE__)); |
| 159 | } |
| 160 | |
| 161 | |
| 162 | /** |
| 163 | * Plugin dir |
| 164 | * |
| 165 | * @since 1.0.0 |
| 166 | * @return mixed |
| 167 | */ |
| 168 | public static function plugin_dir() { |
| 169 | return trailingslashit(plugin_dir_path(__FILE__)); |
| 170 | } |
| 171 | |
| 172 | |
| 173 | /** |
| 174 | * Plugin's widget directory. |
| 175 | * |
| 176 | * @since 1.0.0 |
| 177 | * @return string |
| 178 | */ |
| 179 | public static function widget_dir() { |
| 180 | return self::plugin_dir() . 'widgets/'; |
| 181 | } |
| 182 | |
| 183 | |
| 184 | /** |
| 185 | * Plugin's widget url. |
| 186 | * |
| 187 | * @since 1.0.0 |
| 188 | * @return string |
| 189 | */ |
| 190 | public static function widget_url() { |
| 191 | return self::plugin_url() . 'widgets/'; |
| 192 | } |
| 193 | /** |
| 194 | * Plugin's widget directory. |
| 195 | * |
| 196 | * @since 1.0.0 |
| 197 | * @return string |
| 198 | */ |
| 199 | public static function module_dir() { |
| 200 | return self::plugin_dir() . 'modules/'; |
| 201 | } |
| 202 | |
| 203 | |
| 204 | /** |
| 205 | * Plugin's widget url. |
| 206 | * |
| 207 | * @since 1.0.0 |
| 208 | * @return string |
| 209 | */ |
| 210 | public static function module_url() { |
| 211 | return self::plugin_url() . 'modules/'; |
| 212 | } |
| 213 | |
| 214 | |
| 215 | /** |
| 216 | * Plugin core directory |
| 217 | * |
| 218 | * @since 1.0.0 |
| 219 | * @return string |
| 220 | */ |
| 221 | public static function core_dir() { |
| 222 | return self::plugin_dir() . 'core/'; |
| 223 | } |
| 224 | |
| 225 | /** |
| 226 | * Plugin core url |
| 227 | * |
| 228 | * @since 1.0.0 |
| 229 | * @return string |
| 230 | */ |
| 231 | public static function core_url() { |
| 232 | return self::plugin_url() . 'core/'; |
| 233 | } |
| 234 | |
| 235 | |
| 236 | /** |
| 237 | * |
| 238 | * @since 1.0.0 |
| 239 | * @return string |
| 240 | */ |
| 241 | public static function views_dir() { |
| 242 | return self::plugin_dir() . 'views/'; |
| 243 | } |
| 244 | |
| 245 | |
| 246 | /** |
| 247 | * Constructor |
| 248 | * |
| 249 | * @since 1.0.0 |
| 250 | * @access public |
| 251 | */ |
| 252 | public function __construct() { |
| 253 | add_action('init', [$this, 'i18n']); |
| 254 | add_action('plugins_loaded', [$this, 'init'], 100); |
| 255 | } |
| 256 | |
| 257 | |
| 258 | /** |
| 259 | * Load text domain |
| 260 | * |
| 261 | * Load plugin localization files. |
| 262 | * Fired by `init` action hook. |
| 263 | * |
| 264 | * @since 1.0.0 |
| 265 | * @access public |
| 266 | */ |
| 267 | public function i18n() { |
| 268 | |
| 269 | load_plugin_textdomain('shopengine', false, self::plugin_dir() . 'languages/'); |
| 270 | } |
| 271 | |
| 272 | |
| 273 | public function init() { |
| 274 | do_action('shopengine/before_loaded'); |
| 275 | ShopEngine\Plugin::instance()->init(); |
| 276 | do_action('shopengine/after_loaded'); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | |
| 281 | new ShopEngine(); |
| 282 | |
| 283 | |
| 284 | function activate_shopengine() { |
| 285 | |
| 286 | \ShopEngine\Core\Template_Cpt::instance()->init(); |
| 287 | |
| 288 | flush_rewrite_rules(); |
| 289 | } |
| 290 | |
| 291 | |
| 292 | function deactivate_shopengine() { |
| 293 | |
| 294 | } |
| 295 | |
| 296 | register_activation_hook(__FILE__, 'activate_shopengine'); |
| 297 | |
| 298 | register_deactivation_hook(__FILE__, 'deactivate_shopengine'); |
| 299 | |
| 300 |