| @@ -3,9 +3,8 @@ | ||
| 3 | 3 | namespace ShopEngine; |
| 4 | 4 | |
| 5 | 5 | use ShopEngine\Compatibility\Conflicts\Manifest as Conflict_Manifest; |
| 6 | 6 | use ShopEngine\Core\Builders\Base; |
| 7 | -use ShopEngine\Compatibility\Migrations\LangMigration; | |
| 8 | 7 | use ShopEngine\Core\Query_Modifier; |
| 9 | 8 | use ShopEngine\Core\Template_Cpt; |
| 10 | 9 | use ShopEngine\Libs\License\License_Route; |
| 11 | 10 | use ShopEngine\Libs\Rating\Rating; |
| @@ -75,14 +74,12 @@ | ||
| 75 | 74 | |
| 76 | 75 | if($error) { |
| 77 | 76 | return; |
| 78 | 77 | } |
| 79 | - | |
| 78 | + | |
| 80 | 79 | add_filter("plugin_action_links_shopengine/shopengine.php", function ($links) { |
| 81 | - $free = esc_html__("Go To Shopengine","shopengine"); | |
| 82 | - $pro = esc_html__("Go To ShopenginePro","shopengine"); | |
| 83 | 80 | |
| 84 | - $custom_links[] = '<a title="' . $free . '" href="'.admin_url('edit.php?post_type=shopengine-template#getting-started').'" target="_blank">' . esc_html__('Settings', 'shopengine') . '</a>'; | |
| 81 | + $custom_links[] = '<a href="'.admin_url('edit.php?post_type=shopengine-template#getting-started').'" target="_blank">' . esc_html__('Settings', 'shopengine') . '</a>'; | |
| 85 | 82 | |
| 86 | 83 | foreach ($custom_links as $custom_link): |
| 87 | 84 | array_unshift($links, $custom_link); |
| 88 | 85 | endforeach; |
| @@ -87,9 +84,9 @@ | ||
| 87 | 84 | array_unshift($links, $custom_link); |
| 88 | 85 | endforeach; |
| 89 | 86 | |
| 90 | 87 | if (!is_plugin_active('shopengine-pro/shopengine-pro.php')) { |
| 91 | - $links[] = '<a title="' . $pro . '" href="https://wpmet.com/plugin/shopengine/pricing/" style="color:#FCB214;font-weight:700" target="_blank" rel="noopener">' . esc_html__('Go Pro', 'shopengine') . '</a>'; | |
| 88 | + $links[] = '<a href="https://wpmet.com/plugin/shopengine/pricing/" style="color:#FCB214;font-weight:700" target="_blank">' . esc_html__('Go Pro', 'shopengine') . '</a>'; | |
| 92 | 89 | } |
| 93 | 90 | return $links; |
| 94 | 91 | }); |
| 95 | 92 | |
| @@ -107,17 +104,39 @@ | ||
| 107 | 104 | add_action('admin_init', function () { |
| 108 | 105 | if(class_exists('ShopEngine_Pro')) { |
| 109 | 106 | new Updater(); |
| 110 | 107 | } |
| 111 | - new \ShopEngine\Compatibility\Migrations\Direct_Checkout; | |
| 112 | 108 | }); |
| 113 | 109 | |
| 114 | 110 | |
| 115 | 111 | add_action('wp_loaded', function () { |
| 116 | - /** | |
| 117 | - * migrate data | |
| 118 | - */ | |
| 119 | - LangMigration::instance()->init(); | |
| 112 | + | |
| 113 | + if(isset($_REQUEST['preview']) && $_REQUEST['preview'] == 'true' && !empty($_REQUEST['preview_id'])) { | |
| 114 | + | |
| 115 | + $pid = (int)$_REQUEST['preview_id']; | |
| 116 | + | |
| 117 | + $po = get_post($pid); | |
| 118 | + | |
| 119 | + if($po->post_type === Template_Cpt::TYPE) { | |
| 120 | + | |
| 121 | + $template = \ShopEngine\Core\Builders\Templates::get_registered_template_data($pid); | |
| 122 | + | |
| 123 | + if(empty($template) || !isset($template['url'])) { | |
| 124 | + return; | |
| 125 | + } | |
| 126 | + | |
| 127 | + $param = [ | |
| 128 | + 'shopengine_template_id' => $pid, | |
| 129 | + 'preview_nonce' => wp_create_nonce('template_preview_' . $pid), | |
| 130 | + 'change_template' => '1', | |
| 131 | + ]; | |
| 132 | + | |
| 133 | + $url = \ShopEngine\Utils\Helper::add_to_url($template['url'], $param); | |
| 134 | + | |
| 135 | + wp_safe_redirect($url); | |
| 136 | + exit; | |
| 137 | + } | |
| 138 | + } | |
| 120 | 139 | }); |
| 121 | 140 | |
| 122 | 141 | // avoid themes for loading woocommerce functions |
| 123 | 142 | $avoid_themes = ['avada', 'avada child']; |
| @@ -161,10 +180,8 @@ | ||
| 161 | 180 | ->set_first_appear_day( 7 ) |
| 162 | 181 | ->set_condition( true ) |
| 163 | 182 | ->call(); |
| 164 | 183 | |
| 165 | - \ShopEngine\Core\MultiLanguage\Language::instance()->init(); | |
| 166 | - | |
| 167 | 184 | \ShopEngine\Core\Settings\Base::instance()->init(); |
| 168 | 185 | |
| 169 | 186 | new Libs\Select_Api\Base(); |
| 170 | 187 | |
| @@ -181,9 +198,9 @@ | ||
| 181 | 198 | add_action('get_header', [$this, 'shopengine_track_product_views']); |
| 182 | 199 | |
| 183 | 200 | // database migrations |
| 184 | 201 | // (new \ShopEngine\Compatibility\Migrations\Migration())->init(); |
| 185 | - // (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init(); | |
| 202 | + (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init(); | |
| 186 | 203 | |
| 187 | 204 | |
| 188 | 205 | // call service providers |
| 189 | 206 | |
| @@ -197,8 +214,10 @@ | ||
| 197 | 214 | } |
| 198 | 215 | |
| 199 | 216 | } |
| 200 | 217 | |
| 218 | + | |
| 219 | + | |
| 201 | 220 | add_filter('script_loader_tag', [$this, 'filter_load_type'], 99, 3); |
| 202 | 221 | } |
| 203 | 222 | |
| 204 | 223 | |
| @@ -231,9 +250,9 @@ | ||
| 231 | 250 | $cookie_name = "shopengine_recent_viewed_product"; |
| 232 | 251 | |
| 233 | 252 | if(isset($_COOKIE[$cookie_name])) { |
| 234 | 253 | |
| 235 | - $cookie_ids = sanitize_text_field(wp_unslash($_COOKIE[$cookie_name])); | |
| 254 | + $cookie_ids = $_COOKIE[$cookie_name]; | |
| 236 | 255 | $product_ids = explode(',', $cookie_ids); |
| 237 | 256 | |
| 238 | 257 | if(!is_array($product_ids)) { |
| 239 | 258 | $product_ids = [$product_ids]; |
| @@ -269,10 +288,12 @@ | ||
| 269 | 288 | * Include public function |
| 270 | 289 | * |
| 271 | 290 | * @since 1.0.0 |
| 272 | 291 | */ |
| 273 | - public function js_css_public() { | |
| 274 | - wp_register_style('shopengine-public', \ShopEngine::plugin_url() . 'assets/css/shopengine-public.css', false, \ShopEngine::version()); | |
| 292 | + public function js_css_public() { | |
| 293 | + wp_enqueue_style('shopengine-icon', \ShopEngine::plugin_url() . 'assets/css/shopengine-icon.css', false, \ShopEngine::version()); | |
| 294 | + wp_enqueue_style('shopengine-simple-scrollbar-css', \ShopEngine::plugin_url() . 'assets/css/simple-scrollbar.css', false, \ShopEngine::version()); | |
| 295 | + wp_enqueue_style('shopengine-public-css', \ShopEngine::plugin_url() . 'assets/css/public-style.css', false, \ShopEngine::version()); | |
| 275 | 296 | |
| 276 | 297 | // Modal Stylesheet |
| 277 | 298 | wp_register_style('shopengine-modal-styles', \ShopEngine::plugin_url() . 'assets/css/shopengine-modal.css', false, \ShopEngine::version()); |
| 278 | 299 | |
| @@ -321,8 +342,12 @@ | ||
| 321 | 342 | |
| 322 | 343 | |
| 323 | 344 | public function missing_woocommerce() { |
| 324 | 345 | |
| 346 | + if(isset($_GET['activate'])) { | |
| 347 | + unset($_GET['activate']); | |
| 348 | + } | |
| 349 | + | |
| 325 | 350 | if(file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php')) { |
| 326 | 351 | |
| 327 | 352 | $btn['label'] = esc_html__('Activate WooCommerce', 'shopengine'); |
| 328 | 353 | $btn['url'] = wp_nonce_url('plugins.php?action=activate&plugin=woocommerce/woocommerce.php&plugin_status=all&paged=1', 'activate-plugin_woocommerce/woocommerce.php'); |
| @@ -345,8 +370,12 @@ | ||
| 345 | 370 | } |
| 346 | 371 | |
| 347 | 372 | |
| 348 | 373 | public function missing_elementor() { |
| 374 | + | |
| 375 | + if(isset($_GET['activate'])) { | |
| 376 | + unset($_GET['activate']); | |
| 377 | + } | |
| 349 | 378 | |
| 350 | 379 | if(file_exists(WP_PLUGIN_DIR . '/elementor/elementor.php')) { |
| 351 | 380 | |
| 352 | 381 | $btn['label'] = esc_html__('Activate Elementor', 'shopengine'); |