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