| @@ -3,13 +3,11 @@ | ||
| 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 | -use ShopEngine\Libs\Rating\Rating; | |
| 12 | 10 | use ShopEngine\Libs\Updater\Init as Updater; |
| 13 | 11 | use ShopEngine\Modules\Manifest as Module_Manifest; |
| 14 | 12 | use ShopEngine\Widgets\Manifest; |
| 15 | 13 | |
| @@ -75,14 +73,12 @@ | ||
| 75 | 73 | |
| 76 | 74 | if($error) { |
| 77 | 75 | return; |
| 78 | 76 | } |
| 79 | - | |
| 77 | + | |
| 80 | 78 | 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 | 79 | |
| 84 | - $custom_links[] = '<a title="' . $free . '" href="'.admin_url('edit.php?post_type=shopengine-template#getting-started').'" target="_blank">' . esc_html__('Settings', 'shopengine') . '</a>'; | |
| 80 | + $custom_links[] = '<a href="'.admin_url('edit.php?post_type=shopengine-template#getting-started').'" target="_blank">' . esc_html__('Settings', 'shopengine') . '</a>'; | |
| 85 | 81 | |
| 86 | 82 | foreach ($custom_links as $custom_link): |
| 87 | 83 | array_unshift($links, $custom_link); |
| 88 | 84 | endforeach; |
| @@ -87,9 +83,9 @@ | ||
| 87 | 83 | array_unshift($links, $custom_link); |
| 88 | 84 | endforeach; |
| 89 | 85 | |
| 90 | 86 | 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>'; | |
| 87 | + $links[] = '<a href="https://wpmet.com/plugin/shopengine/pricing/" style="color:#FCB214;font-weight:700" target="_blank">' . esc_html__('Go Pro', 'shopengine') . '</a>'; | |
| 92 | 88 | } |
| 93 | 89 | return $links; |
| 94 | 90 | }); |
| 95 | 91 | |
| @@ -107,17 +103,16 @@ | ||
| 107 | 103 | add_action('admin_init', function () { |
| 108 | 104 | if(class_exists('ShopEngine_Pro')) { |
| 109 | 105 | new Updater(); |
| 110 | 106 | } |
| 111 | - new \ShopEngine\Compatibility\Migrations\Direct_Checkout; | |
| 112 | 107 | }); |
| 113 | 108 | |
| 114 | 109 | |
| 115 | 110 | add_action('wp_loaded', function () { |
| 116 | - //phpcs:ignore WordPress.Security.NonceVerification.Recommended --It's a fronted user part, not possible to verify nonce here | |
| 111 | + | |
| 117 | 112 | if(isset($_REQUEST['preview']) && $_REQUEST['preview'] == 'true' && !empty($_REQUEST['preview_id'])) { |
| 118 | 113 | |
| 119 | - $pid = (int)$_REQUEST['preview_id']; //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- It's a fronted user part, not possible to verify nonce here | |
| 114 | + $pid = (int)$_REQUEST['preview_id']; | |
| 120 | 115 | |
| 121 | 116 | $po = get_post($pid); |
| 122 | 117 | |
| 123 | 118 | if($po->post_type === Template_Cpt::TYPE) { |
| @@ -133,20 +128,14 @@ | ||
| 133 | 128 | 'preview_nonce' => wp_create_nonce('template_preview_' . $pid), |
| 134 | 129 | 'change_template' => '1', |
| 135 | 130 | ]; |
| 136 | 131 | |
| 137 | - $tem_url = (get_post_meta($pid, 'shopengine_template__post_meta__type' , true) == 'order') ? $po->guid : $template['url']; | |
| 138 | - $url = \ShopEngine\Utils\Helper::add_to_url($tem_url, $param); | |
| 132 | + $url = \ShopEngine\Utils\Helper::add_to_url($template['url'], $param); | |
| 139 | 133 | |
| 140 | 134 | wp_safe_redirect($url); |
| 141 | 135 | exit; |
| 142 | 136 | } |
| 143 | 137 | } |
| 144 | - | |
| 145 | - /** | |
| 146 | - * migrate data | |
| 147 | - */ | |
| 148 | - LangMigration::instance()->init(); | |
| 149 | 138 | }); |
| 150 | 139 | |
| 151 | 140 | // avoid themes for loading woocommerce functions |
| 152 | 141 | $avoid_themes = ['avada', 'avada child']; |
| @@ -179,21 +168,12 @@ | ||
| 179 | 168 | add_theme_support('wc-product-gallery-lightbox'); |
| 180 | 169 | add_theme_support('wc-product-gallery-slider'); |
| 181 | 170 | } |
| 182 | 171 | |
| 172 | + | |
| 183 | 173 | #Registering new post-type & etc |
| 184 | 174 | Base::instance()->init(); |
| 185 | 175 | |
| 186 | - Rating::instance('shopengine') | |
| 187 | - ->set_plugin( 'ShopEngine', 'https://wpmet.com/wordpress.org/rating/shopengine' ) | |
| 188 | - ->set_plugin_logo( 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061', 'width:150px !important' ) | |
| 189 | - ->set_priority( 10 ) | |
| 190 | - ->set_first_appear_day( 7 ) | |
| 191 | - ->set_condition( true ) | |
| 192 | - ->call(); | |
| 193 | - | |
| 194 | - \ShopEngine\Core\MultiLanguage\Language::instance()->init(); | |
| 195 | - | |
| 196 | 176 | \ShopEngine\Core\Settings\Base::instance()->init(); |
| 197 | 177 | |
| 198 | 178 | new Libs\Select_Api\Base(); |
| 199 | 179 | |
| @@ -210,9 +190,9 @@ | ||
| 210 | 190 | add_action('get_header', [$this, 'shopengine_track_product_views']); |
| 211 | 191 | |
| 212 | 192 | // database migrations |
| 213 | 193 | // (new \ShopEngine\Compatibility\Migrations\Migration())->init(); |
| 214 | - // (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init(); | |
| 194 | + (new \ShopEngine\Compatibility\Migrations\Temp_Migration())->init(); | |
| 215 | 195 | |
| 216 | 196 | |
| 217 | 197 | // call service providers |
| 218 | 198 | |
| @@ -226,8 +206,10 @@ | ||
| 226 | 206 | } |
| 227 | 207 | |
| 228 | 208 | } |
| 229 | 209 | |
| 210 | + | |
| 211 | + | |
| 230 | 212 | add_filter('script_loader_tag', [$this, 'filter_load_type'], 99, 3); |
| 231 | 213 | } |
| 232 | 214 | |
| 233 | 215 | |
| @@ -260,9 +242,9 @@ | ||
| 260 | 242 | $cookie_name = "shopengine_recent_viewed_product"; |
| 261 | 243 | |
| 262 | 244 | if(isset($_COOKIE[$cookie_name])) { |
| 263 | 245 | |
| 264 | - $cookie_ids = sanitize_text_field(wp_unslash($_COOKIE[$cookie_name])); | |
| 246 | + $cookie_ids = $_COOKIE[$cookie_name]; | |
| 265 | 247 | $product_ids = explode(',', $cookie_ids); |
| 266 | 248 | |
| 267 | 249 | if(!is_array($product_ids)) { |
| 268 | 250 | $product_ids = [$product_ids]; |
| @@ -298,10 +280,12 @@ | ||
| 298 | 280 | * Include public function |
| 299 | 281 | * |
| 300 | 282 | * @since 1.0.0 |
| 301 | 283 | */ |
| 302 | - public function js_css_public() { | |
| 303 | - wp_register_style('shopengine-public', \ShopEngine::plugin_url() . 'assets/css/shopengine-public.css', false, \ShopEngine::version()); | |
| 284 | + public function js_css_public() { | |
| 285 | + wp_enqueue_style('shopengine-icon', \ShopEngine::plugin_url() . 'assets/css/shopengine-icon.css', false, \ShopEngine::version()); | |
| 286 | + wp_enqueue_style('shopengine-simple-scrollbar-css', \ShopEngine::plugin_url() . 'assets/css/simple-scrollbar.css', false, \ShopEngine::version()); | |
| 287 | + wp_enqueue_style('shopengine-public-css', \ShopEngine::plugin_url() . 'assets/css/public-style.css', false, \ShopEngine::version()); | |
| 304 | 288 | |
| 305 | 289 | // Modal Stylesheet |
| 306 | 290 | wp_register_style('shopengine-modal-styles', \ShopEngine::plugin_url() . 'assets/css/shopengine-modal.css', false, \ShopEngine::version()); |
| 307 | 291 | |
| @@ -350,8 +334,12 @@ | ||
| 350 | 334 | |
| 351 | 335 | |
| 352 | 336 | public function missing_woocommerce() { |
| 353 | 337 | |
| 338 | + if(isset($_GET['activate'])) { | |
| 339 | + unset($_GET['activate']); | |
| 340 | + } | |
| 341 | + | |
| 354 | 342 | if(file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php')) { |
| 355 | 343 | |
| 356 | 344 | $btn['label'] = esc_html__('Activate WooCommerce', 'shopengine'); |
| 357 | 345 | $btn['url'] = wp_nonce_url('plugins.php?action=activate&plugin=woocommerce/woocommerce.php&plugin_status=all&paged=1', 'activate-plugin_woocommerce/woocommerce.php'); |
| @@ -374,8 +362,12 @@ | ||
| 374 | 362 | } |
| 375 | 363 | |
| 376 | 364 | |
| 377 | 365 | public function missing_elementor() { |
| 366 | + | |
| 367 | + if(isset($_GET['activate'])) { | |
| 368 | + unset($_GET['activate']); | |
| 369 | + } | |
| 378 | 370 | |
| 379 | 371 | if(file_exists(WP_PLUGIN_DIR . '/elementor/elementor.php')) { |
| 380 | 372 | |
| 381 | 373 | $btn['label'] = esc_html__('Activate Elementor', 'shopengine'); |