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