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