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