Version Description
Download this release
Release Info
Developer | Ecwid |
Plugin | Ecwid Ecommerce Shopping Cart |
Version | 5.0.8 |
Comparing to | |
See all releases |
Code changes from version 5.0.7 to 5.0.8
- ecwid-shopping-cart.php +44 -92
- includes/class-ecwid-integration-aiosp.php +1 -1
- includes/class-ecwid-integration-wpseo.php +1 -1
- includes/class-ecwid-message-manager.php +0 -19
- includes/class-ecwid-products.php +13 -3
- includes/class-ecwid-seo-links.php +34 -18
- includes/class-ecwid-store-page.php +157 -11
- includes/shortcodes/class-ecwid-shortcode-productbrowser.php +2 -0
- includes/themes/class-ecwid-theme-central.php +1 -1
- includes/themes/class-ecwid-theme-genesis.php +1 -1
- includes/themes/class-ecwid-theme-responsive.php +1 -1
- includes/themes/class-ecwid-theme-twentyfifteen.php +1 -1
- includes/themes/class-ecwid-theme-twentysixteen.php +1 -1
- includes/widgets/class-ecwid-widget-floating-shopping-cart.php +1 -1
- templates/advanced-settings.php +6 -32
- templates/debug.php +10 -0
- templates/sync.php +2 -2
ecwid-shopping-cart.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.ecwid.com?source=wporg
|
|
5 |
Description: Ecwid is a free full-featured shopping cart. It can be easily integrated with any Wordpress blog and takes less than 5 minutes to set up.
|
6 |
Text Domain: ecwid-shopping-cart
|
7 |
Author: Ecwid Team
|
8 |
-
Version: 5.0.
|
9 |
Author URI: http://www.ecwid.com?source=wporg
|
10 |
*/
|
11 |
|
@@ -221,7 +221,7 @@ if (is_admin()) {
|
|
221 |
|
222 |
function ecwid_body_class($classes)
|
223 |
{
|
224 |
-
if (
|
225 |
$classes[] = 'ecwid-shopping-cart';
|
226 |
}
|
227 |
|
@@ -245,7 +245,7 @@ function ecwid_redirect_canonical($redirect_url, $requested_url) {
|
|
245 |
return $redirect_url;
|
246 |
}
|
247 |
|
248 |
-
if (!
|
249 |
return $redirect_url;
|
250 |
}
|
251 |
|
@@ -331,17 +331,26 @@ function ecwid_enqueue_frontend() {
|
|
331 |
}
|
332 |
|
333 |
function ecwid_print_inline_js_config() {
|
|
|
|
|
|
|
|
|
334 |
echo <<<HTML
|
335 |
<script type="text/javascript">
|
336 |
window.ec = window.ec || Object();
|
337 |
window.ec.config = window.ec.config || Object();
|
338 |
window.ec.config.enable_canonical_urls = true;
|
|
|
339 |
HTML;
|
340 |
|
341 |
do_action('ecwid_print_inline_js_config');
|
342 |
echo '</script>';
|
343 |
}
|
344 |
|
|
|
|
|
|
|
|
|
345 |
add_action( 'ecwid_print_inline_js_config', 'ecwid_add_chameleon' );
|
346 |
function ecwid_add_chameleon() {
|
347 |
|
@@ -530,6 +539,9 @@ function ecwid_check_version()
|
|
530 |
|
531 |
add_option('ecwid_use_new_horizontal_categories', 'Y');
|
532 |
|
|
|
|
|
|
|
533 |
} elseif ($upgrade) {
|
534 |
|
535 |
ecwid_plugin_add_oauth();
|
@@ -537,6 +549,8 @@ function ecwid_check_version()
|
|
537 |
update_option('ecwid_plugin_version', $current_version);
|
538 |
|
539 |
add_option('ecwid_use_new_horizontal_categories', '');
|
|
|
|
|
540 |
}
|
541 |
|
542 |
if ($fresh_install || $upgrade || @$_GET['ecwid_reinit']) {
|
@@ -568,6 +582,23 @@ function ecwid_check_version()
|
|
568 |
add_option(Ecwid_Widget_Floating_Shopping_Cart::OPTION_DISPLAY_POSITION, '');
|
569 |
|
570 |
update_option('ecwid_use_new_search', 'Y');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
}
|
572 |
}
|
573 |
|
@@ -669,7 +700,7 @@ function ecwid_seo_ultimate_compatibility()
|
|
669 |
{
|
670 |
global $seo_ultimate;
|
671 |
|
672 |
-
if ($seo_ultimate &&
|
673 |
remove_action('template_redirect', array($seo_ultimate->modules['titles'], 'before_header'), 0);
|
674 |
remove_action('wp_head', array($seo_ultimate->modules['titles'], 'after_header'), 1000);
|
675 |
remove_action('su_head', array($seo_ultimate->modules['meta-descriptions'], 'head_tag_output'));
|
@@ -680,14 +711,14 @@ function ecwid_seo_ultimate_compatibility()
|
|
680 |
|
681 |
function ecwid_remove_default_canonical()
|
682 |
{
|
683 |
-
if (
|
684 |
remove_action( 'wp_head','rel_canonical');
|
685 |
}
|
686 |
}
|
687 |
|
688 |
function ecwid_seo_compatibility_init($title)
|
689 |
{
|
690 |
-
if (!array_key_exists('_escaped_fragment_', $_GET) || !
|
691 |
return $title;
|
692 |
}
|
693 |
|
@@ -715,7 +746,7 @@ function ecwid_amt_remove_description($params)
|
|
715 |
|
716 |
function ecwid_seo_compatibility_restore()
|
717 |
{
|
718 |
-
if (!array_key_exists('_escaped_fragment_', $_GET) || !
|
719 |
return;
|
720 |
}
|
721 |
|
@@ -834,43 +865,19 @@ function ecwid_content_has_productbrowser($content) {
|
|
834 |
return $result;
|
835 |
}
|
836 |
|
837 |
-
function ecwid_page_has_productbrowser($post_id = null)
|
838 |
-
{
|
839 |
-
static $results = null;
|
840 |
-
|
841 |
-
if (is_null($post_id)) {
|
842 |
-
if (is_admin()) return;
|
843 |
-
$post_id = get_the_ID();
|
844 |
-
}
|
845 |
-
|
846 |
-
if (!isset($results[$post_id])) {
|
847 |
-
$post = get_post($post_id);
|
848 |
-
|
849 |
-
if ($post) {
|
850 |
-
$post_content = get_post($post_id)->post_content;
|
851 |
-
|
852 |
-
$results[$post_id] = ecwid_content_has_productbrowser($post_content);
|
853 |
-
$results[$post_id] = apply_filters( 'ecwid_page_has_product_browser', $results[$post_id] );
|
854 |
-
}
|
855 |
-
}
|
856 |
-
|
857 |
-
|
858 |
-
return $results[$post_id];
|
859 |
-
}
|
860 |
-
|
861 |
function ecwid_ajax_crawling_fragment() {
|
862 |
|
863 |
if ( !ecwid_is_api_enabled() ) return;
|
864 |
|
865 |
if ( isset( $_GET['_escaped_fragment_'] ) ) return;
|
866 |
|
867 |
-
if ( !
|
868 |
|
869 |
global $wp, $ecwid_seo_links;
|
870 |
|
871 |
$slug = ltrim( strrchr( $wp->request, '/' ), '/' );
|
872 |
|
873 |
-
if ( Ecwid_Seo_Links::is_enabled()
|
874 |
|
875 |
echo '<meta name="fragment" content="!">' . PHP_EOL;
|
876 |
}
|
@@ -884,7 +891,7 @@ function ecwid_meta() {
|
|
884 |
echo '<link rel="dns-prefetch" href="//ecwid-static-ru.r.worldssl.net">' . PHP_EOL;
|
885 |
echo '<link rel="dns-prefetch" href="//ecwid-images-ru.r.worldssl.net">' . PHP_EOL;
|
886 |
|
887 |
-
if (!
|
888 |
$page_url = Ecwid_Store_Page::get_store_url();
|
889 |
echo '<link rel="prefetch" href="' . $page_url . '" />' . PHP_EOL;
|
890 |
echo '<link rel="prerender" href="' . $page_url . '" />' . PHP_EOL;
|
@@ -1146,7 +1153,7 @@ function ecwid_wrap_shortcode_content($content, $name, $attrs)
|
|
1146 |
function ecwid_get_scriptjs_code($force_lang = null) {
|
1147 |
global $ecwid_script_rendered;
|
1148 |
|
1149 |
-
if (!$ecwid_script_rendered) {
|
1150 |
$store_id = get_ecwid_store_id();
|
1151 |
$params = ecwid_get_scriptjs_params( $force_lang );
|
1152 |
|
@@ -1391,7 +1398,6 @@ function ecwid_store_activate() {
|
|
1391 |
[ecwid widgets="productbrowser minicart categories search" grid="$defaults[grid_rows],$defaults[grid_columns]" list="$defaults[list_rows]" table="$defaults[table_rows]" default_category_id="0" category_view="grid" search_view="grid" minicart_layout="MiniAttachToProductBrowser" ]
|
1392 |
EOT;
|
1393 |
add_option("ecwid_store_page_id", '', '', 'yes');
|
1394 |
-
add_option("ecwid_store_page_id_auto", '', '', 'yes');
|
1395 |
|
1396 |
add_option("ecwid_store_id", ECWID_DEMO_STORE_ID, '', 'yes');
|
1397 |
|
@@ -1559,28 +1565,6 @@ function ecwid_uninstall() {
|
|
1559 |
delete_option("ecwid_use_chameleon");
|
1560 |
}
|
1561 |
|
1562 |
-
function ecwid_is_old_cats_widget_used()
|
1563 |
-
{
|
1564 |
-
if (get_option('ecwid_use_new_horizontal_categories')) {
|
1565 |
-
return false;
|
1566 |
-
}
|
1567 |
-
|
1568 |
-
$widgets = ecwid_get_store_shortcode_widgets();
|
1569 |
-
if ($widgets && in_array('categories', $widgets)) {
|
1570 |
-
return true;
|
1571 |
-
}
|
1572 |
-
|
1573 |
-
$post = get_post(Ecwid_Store_Page::get_current_store_page_id());
|
1574 |
-
if ($post && !is_wp_error($post)) {
|
1575 |
-
$shortcodes = ecwid_find_shortcodes( $post->post_content, 'ecwid_categories');
|
1576 |
-
|
1577 |
-
if ($shortcodes) return true;
|
1578 |
-
}
|
1579 |
-
|
1580 |
-
return false;
|
1581 |
-
}
|
1582 |
-
|
1583 |
-
|
1584 |
function ecwid_get_store_shortcode_widgets()
|
1585 |
{
|
1586 |
if (get_option('ecwid_use_new_horizontal_categories')) return false;
|
@@ -1818,7 +1802,6 @@ function ecwid_settings_api_init() {
|
|
1818 |
register_setting( 'ecwid_options_page', 'ecwid_default_category_id', 'ecwid_abs_intval' );
|
1819 |
register_setting( 'ecwid_options_page', 'ecwid_sso_secret_key' );
|
1820 |
register_setting( 'ecwid_options_page', 'ecwid_use_chameleon' );
|
1821 |
-
register_setting( 'ecwid_options_page', 'ecwid_use_new_horizontal_categories' );
|
1822 |
register_setting( 'ecwid_options_page', 'ecwid_is_sso_enabled' );
|
1823 |
register_setting( 'ecwid_options_page', Ecwid_Seo_Links::OPTION_ENABLED );
|
1824 |
break;
|
@@ -2282,11 +2265,9 @@ function ecwid_appearance_settings_do_page() {
|
|
2282 |
|
2283 |
function ecwid_debug_do_page() {
|
2284 |
|
2285 |
-
|
2286 |
-
$remote_get_results = wp_remote_get( 'http://app.ecwid.com/api/v1/' . get_ecwid_store_id() . '/profile' );
|
2287 |
|
2288 |
-
|
2289 |
-
}
|
2290 |
|
2291 |
global $ecwid_oauth;
|
2292 |
|
@@ -2472,35 +2453,6 @@ function ecwid_add_dashboard_widgets() {
|
|
2472 |
}
|
2473 |
}
|
2474 |
|
2475 |
-
function ecwid_save_post($post_id)
|
2476 |
-
{
|
2477 |
-
|
2478 |
-
// If primary or auto store page gets updated
|
2479 |
-
if ($post_id == get_option('ecwid_store_page_id') || $post_id == get_option('ecwid_store_page_id_auto')) {
|
2480 |
-
$new_status = get_post_status($post_id);
|
2481 |
-
|
2482 |
-
// and the update either disables the page or removes product browser
|
2483 |
-
if (!in_array($new_status, array('publish', 'private')) || !ecwid_page_has_productbrowser($post_id)) {
|
2484 |
-
|
2485 |
-
// then look for another enabled page that has a product browser in it
|
2486 |
-
$pages = get_pages(array('post_status' => 'publish,private'));
|
2487 |
-
|
2488 |
-
foreach ($pages as $page) {
|
2489 |
-
if (ecwid_page_has_productbrowser($page->ID)) {
|
2490 |
-
update_option('ecwid_store_page_id_auto', $page->ID);
|
2491 |
-
return;
|
2492 |
-
}
|
2493 |
-
}
|
2494 |
-
}
|
2495 |
-
}
|
2496 |
-
|
2497 |
-
// if there is no current store page and this new page has a product browser
|
2498 |
-
if ( ecwid_page_has_productbrowser($post_id) && !Ecwid_Store_Page::get_current_store_page_id() ) {
|
2499 |
-
// then this page becomes a new store page
|
2500 |
-
update_option('ecwid_store_page_id_auto', $post_id);
|
2501 |
-
}
|
2502 |
-
}
|
2503 |
-
|
2504 |
function ecwid_get_store_page_base_url( $page = 0 ) {
|
2505 |
|
2506 |
$url = parse_url( get_permalink( $page ) );
|
5 |
Description: Ecwid is a free full-featured shopping cart. It can be easily integrated with any Wordpress blog and takes less than 5 minutes to set up.
|
6 |
Text Domain: ecwid-shopping-cart
|
7 |
Author: Ecwid Team
|
8 |
+
Version: 5.0.8
|
9 |
Author URI: http://www.ecwid.com?source=wporg
|
10 |
*/
|
11 |
|
221 |
|
222 |
function ecwid_body_class($classes)
|
223 |
{
|
224 |
+
if ( Ecwid_Store_Page::is_store_page() ) {
|
225 |
$classes[] = 'ecwid-shopping-cart';
|
226 |
}
|
227 |
|
245 |
return $redirect_url;
|
246 |
}
|
247 |
|
248 |
+
if (! Ecwid_Store_Page::is_store_page() ) {
|
249 |
return $redirect_url;
|
250 |
}
|
251 |
|
331 |
}
|
332 |
|
333 |
function ecwid_print_inline_js_config() {
|
334 |
+
if ( is_plugin_active( 'shiftnav-pro/shiftnav.php' ) ) {
|
335 |
+
add_action ('ecwid_print_inline_js_config', 'ecwid_disable_interactive' );
|
336 |
+
}
|
337 |
+
|
338 |
echo <<<HTML
|
339 |
<script type="text/javascript">
|
340 |
window.ec = window.ec || Object();
|
341 |
window.ec.config = window.ec.config || Object();
|
342 |
window.ec.config.enable_canonical_urls = true;
|
343 |
+
|
344 |
HTML;
|
345 |
|
346 |
do_action('ecwid_print_inline_js_config');
|
347 |
echo '</script>';
|
348 |
}
|
349 |
|
350 |
+
function ecwid_disable_interactive() {
|
351 |
+
echo "window.ec.config.interactive = false;\n";
|
352 |
+
}
|
353 |
+
|
354 |
add_action( 'ecwid_print_inline_js_config', 'ecwid_add_chameleon' );
|
355 |
function ecwid_add_chameleon() {
|
356 |
|
539 |
|
540 |
add_option('ecwid_use_new_horizontal_categories', 'Y');
|
541 |
|
542 |
+
// Called in Ecwid_Seo_Links->on_fresh_install
|
543 |
+
do_action( 'ecwid_on_fresh_install' );
|
544 |
+
|
545 |
} elseif ($upgrade) {
|
546 |
|
547 |
ecwid_plugin_add_oauth();
|
549 |
update_option('ecwid_plugin_version', $current_version);
|
550 |
|
551 |
add_option('ecwid_use_new_horizontal_categories', '');
|
552 |
+
|
553 |
+
do_action( 'ecwid_on_plugin_upgrade' );
|
554 |
}
|
555 |
|
556 |
if ($fresh_install || $upgrade || @$_GET['ecwid_reinit']) {
|
582 |
add_option(Ecwid_Widget_Floating_Shopping_Cart::OPTION_DISPLAY_POSITION, '');
|
583 |
|
584 |
update_option('ecwid_use_new_search', 'Y');
|
585 |
+
update_option('ecwid_use_new_categories', 'Y');
|
586 |
+
|
587 |
+
add_option( 'force_scriptjs_render', false );
|
588 |
+
|
589 |
+
do_action( 'ecwid_on_plugin_update' );
|
590 |
+
|
591 |
+
Ecwid_Store_Page::add_store_page(
|
592 |
+
array(
|
593 |
+
get_option('ecwid_store_page_id'), get_option('ecwid_store_page_id_auto')
|
594 |
+
)
|
595 |
+
);
|
596 |
+
|
597 |
+
if (Ecwid_Store_Page::get_current_store_page_id()) {
|
598 |
+
delete_option('ecwid_store_page_id_auto');
|
599 |
+
}
|
600 |
+
|
601 |
+
flush_rewrite_rules();
|
602 |
}
|
603 |
}
|
604 |
|
700 |
{
|
701 |
global $seo_ultimate;
|
702 |
|
703 |
+
if ($seo_ultimate && Ecwid_Store_Page::is_store_page()) {
|
704 |
remove_action('template_redirect', array($seo_ultimate->modules['titles'], 'before_header'), 0);
|
705 |
remove_action('wp_head', array($seo_ultimate->modules['titles'], 'after_header'), 1000);
|
706 |
remove_action('su_head', array($seo_ultimate->modules['meta-descriptions'], 'head_tag_output'));
|
711 |
|
712 |
function ecwid_remove_default_canonical()
|
713 |
{
|
714 |
+
if ( Ecwid_Store_Page::is_store_page() ) {
|
715 |
remove_action( 'wp_head','rel_canonical');
|
716 |
}
|
717 |
}
|
718 |
|
719 |
function ecwid_seo_compatibility_init($title)
|
720 |
{
|
721 |
+
if ( !array_key_exists('_escaped_fragment_', $_GET) || !Ecwid_Store_Page::is_store_page() ) {
|
722 |
return $title;
|
723 |
}
|
724 |
|
746 |
|
747 |
function ecwid_seo_compatibility_restore()
|
748 |
{
|
749 |
+
if (!array_key_exists('_escaped_fragment_', $_GET) || !Ecwid_Store_Page::is_store_page()) {
|
750 |
return;
|
751 |
}
|
752 |
|
865 |
return $result;
|
866 |
}
|
867 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
868 |
function ecwid_ajax_crawling_fragment() {
|
869 |
|
870 |
if ( !ecwid_is_api_enabled() ) return;
|
871 |
|
872 |
if ( isset( $_GET['_escaped_fragment_'] ) ) return;
|
873 |
|
874 |
+
if ( ! Ecwid_Store_Page::is_store_page() ) return;
|
875 |
|
876 |
global $wp, $ecwid_seo_links;
|
877 |
|
878 |
$slug = ltrim( strrchr( $wp->request, '/' ), '/' );
|
879 |
|
880 |
+
if ( Ecwid_Seo_Links::is_enabled() ) return;
|
881 |
|
882 |
echo '<meta name="fragment" content="!">' . PHP_EOL;
|
883 |
}
|
891 |
echo '<link rel="dns-prefetch" href="//ecwid-static-ru.r.worldssl.net">' . PHP_EOL;
|
892 |
echo '<link rel="dns-prefetch" href="//ecwid-images-ru.r.worldssl.net">' . PHP_EOL;
|
893 |
|
894 |
+
if (!Ecwid_Store_Page::is_store_page() && ecwid_is_store_page_available()) {
|
895 |
$page_url = Ecwid_Store_Page::get_store_url();
|
896 |
echo '<link rel="prefetch" href="' . $page_url . '" />' . PHP_EOL;
|
897 |
echo '<link rel="prerender" href="' . $page_url . '" />' . PHP_EOL;
|
1153 |
function ecwid_get_scriptjs_code($force_lang = null) {
|
1154 |
global $ecwid_script_rendered;
|
1155 |
|
1156 |
+
if ( !$ecwid_script_rendered || get_option( 'force_scriptjs_render' ) ) {
|
1157 |
$store_id = get_ecwid_store_id();
|
1158 |
$params = ecwid_get_scriptjs_params( $force_lang );
|
1159 |
|
1398 |
[ecwid widgets="productbrowser minicart categories search" grid="$defaults[grid_rows],$defaults[grid_columns]" list="$defaults[list_rows]" table="$defaults[table_rows]" default_category_id="0" category_view="grid" search_view="grid" minicart_layout="MiniAttachToProductBrowser" ]
|
1399 |
EOT;
|
1400 |
add_option("ecwid_store_page_id", '', '', 'yes');
|
|
|
1401 |
|
1402 |
add_option("ecwid_store_id", ECWID_DEMO_STORE_ID, '', 'yes');
|
1403 |
|
1565 |
delete_option("ecwid_use_chameleon");
|
1566 |
}
|
1567 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1568 |
function ecwid_get_store_shortcode_widgets()
|
1569 |
{
|
1570 |
if (get_option('ecwid_use_new_horizontal_categories')) return false;
|
1802 |
register_setting( 'ecwid_options_page', 'ecwid_default_category_id', 'ecwid_abs_intval' );
|
1803 |
register_setting( 'ecwid_options_page', 'ecwid_sso_secret_key' );
|
1804 |
register_setting( 'ecwid_options_page', 'ecwid_use_chameleon' );
|
|
|
1805 |
register_setting( 'ecwid_options_page', 'ecwid_is_sso_enabled' );
|
1806 |
register_setting( 'ecwid_options_page', Ecwid_Seo_Links::OPTION_ENABLED );
|
1807 |
break;
|
2265 |
|
2266 |
function ecwid_debug_do_page() {
|
2267 |
|
2268 |
+
$remote_get_results = wp_remote_get( 'http://app.ecwid.com/api/v1/' . get_ecwid_store_id() . '/profile' );
|
|
|
2269 |
|
2270 |
+
$api_v3_profile_results = wp_remote_get( 'https://app.ecwid.com/api/v3/' . get_ecwid_store_id() . '/profile?token=' . Ecwid_Api_V3::get_token() );
|
|
|
2271 |
|
2272 |
global $ecwid_oauth;
|
2273 |
|
2453 |
}
|
2454 |
}
|
2455 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2456 |
function ecwid_get_store_page_base_url( $page = 0 ) {
|
2457 |
|
2458 |
$url = parse_url( get_permalink( $page ) );
|
includes/class-ecwid-integration-aiosp.php
CHANGED
@@ -16,7 +16,7 @@ class Ecwid_Integration_All_In_One_SEO_Pack
|
|
16 |
// Disable titles, descriptions and canonical link on ecwid _escaped_fragment_ pages
|
17 |
public function disable_seo_on_escaped_fragment()
|
18 |
{
|
19 |
-
if (!array_key_exists('_escaped_fragment_', $_GET) || !
|
20 |
return;
|
21 |
}
|
22 |
|
16 |
// Disable titles, descriptions and canonical link on ecwid _escaped_fragment_ pages
|
17 |
public function disable_seo_on_escaped_fragment()
|
18 |
{
|
19 |
+
if (!array_key_exists('_escaped_fragment_', $_GET) || !Ecwid_Store_Page::is_store_page()) {
|
20 |
return;
|
21 |
}
|
22 |
|
includes/class-ecwid-integration-wpseo.php
CHANGED
@@ -25,7 +25,7 @@ class Ecwid_Integration_WordPress_SEO_By_Yoast
|
|
25 |
// Disable titles, descriptions and canonical link on ecwid _escaped_fragment_ pages
|
26 |
public function disable_seo_on_escaped_fragment()
|
27 |
{
|
28 |
-
if (!array_key_exists('_escaped_fragment_', $_GET) || !
|
29 |
return;
|
30 |
}
|
31 |
|
25 |
// Disable titles, descriptions and canonical link on ecwid _escaped_fragment_ pages
|
26 |
public function disable_seo_on_escaped_fragment()
|
27 |
{
|
28 |
+
if (!array_key_exists('_escaped_fragment_', $_GET) || !Ecwid_Store_Page::is_store_page()) {
|
29 |
return;
|
30 |
}
|
31 |
|
includes/class-ecwid-message-manager.php
CHANGED
@@ -54,15 +54,6 @@ TXT
|
|
54 |
return $message;
|
55 |
}
|
56 |
|
57 |
-
public static function get_upgrade_cats_message() {
|
58 |
-
|
59 |
-
$main_message = __( 'Updated %s widgets are available for your Ecwid store. They are more mobile friendly and look better. Please enable them on the plugin settings page and check how they work in your store. The new widgets will be enabled automatically for all users in one of the upcoming plugin versions.', 'ecwid-shopping-cart' );
|
60 |
-
|
61 |
-
$widgets = _x( 'Categories', 'upgrade widgets message', 'ecwid-shopping-cart' );
|
62 |
-
|
63 |
-
return sprintf($main_message, $widgets);
|
64 |
-
}
|
65 |
-
|
66 |
public static function show_message($name, $params = array())
|
67 |
{
|
68 |
$mm = self::get_instance();
|
@@ -248,13 +239,6 @@ TXT
|
|
248 |
'primary_url' => 'admin.php?page=ecwid-install-theme',
|
249 |
'hideable' => true
|
250 |
),
|
251 |
-
|
252 |
-
'upgrade_cats' => array(
|
253 |
-
'message' => Ecwid_Message_Manager::get_upgrade_cats_message(),
|
254 |
-
'hideable' => true,
|
255 |
-
'primary_title' => __ ( 'Open Ecwid store settings', 'ecwid-shopping-cart' ),
|
256 |
-
'primary_url' => 'admin.php?page=ecwid-advanced'
|
257 |
-
)
|
258 |
);
|
259 |
}
|
260 |
|
@@ -310,9 +294,6 @@ TXT
|
|
310 |
|
311 |
return $result;
|
312 |
|
313 |
-
case "upgrade_cats":
|
314 |
-
return ecwid_is_old_cats_widget_used();
|
315 |
-
|
316 |
case "install_ecwid_theme":
|
317 |
return false;
|
318 |
$install_date = ecwid_get_wp_install_date();
|
54 |
return $message;
|
55 |
}
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
public static function show_message($name, $params = array())
|
58 |
{
|
59 |
$mm = self::get_instance();
|
239 |
'primary_url' => 'admin.php?page=ecwid-install-theme',
|
240 |
'hideable' => true
|
241 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
);
|
243 |
}
|
244 |
|
294 |
|
295 |
return $result;
|
296 |
|
|
|
|
|
|
|
297 |
case "install_ecwid_theme":
|
298 |
return false;
|
299 |
$install_date = ecwid_get_wp_install_date();
|
includes/class-ecwid-products.php
CHANGED
@@ -12,6 +12,8 @@ class Ecwid_Products {
|
|
12 |
const POST_TYPE_PRODUCT = 'ec-product';
|
13 |
const DB_ALIAS_OUT_OF_STOCK = 'ecwid_out_of_stock';
|
14 |
const OPTION_ENABLED = 'ecwid_local_base_enabled';
|
|
|
|
|
15 |
|
16 |
public function __construct() {
|
17 |
|
@@ -34,6 +36,7 @@ class Ecwid_Products {
|
|
34 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_frontend' ) );
|
35 |
add_filter( 'post_type_link', array( $this, 'replace_product_page_url_on_search' ), 10, 3 );
|
36 |
add_action( 'template_redirect', array( $this, 'redirect_to_store_page' ) );
|
|
|
37 |
|
38 |
if (EcwidPlatform::get('hide_out_of_stock')) {
|
39 |
add_filter( 'posts_where_paged', array( $this, 'where_out_of_stock' ) );
|
@@ -43,6 +46,11 @@ class Ecwid_Products {
|
|
43 |
$this->_sync_progress_callback = '__return_false';
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
46 |
public function enqueue_frontend() {
|
47 |
wp_enqueue_script('ecwid-product-page', ECWID_PLUGIN_URL . 'js/product.js', array('jquery'), get_option('ecwid_plugin_version'));
|
48 |
wp_localize_script('ecwid-product-page', 'ecwidProduct', array(
|
@@ -496,10 +504,12 @@ class Ecwid_Products {
|
|
496 |
add_post_meta($post_id, $key, $value, true);
|
497 |
}
|
498 |
|
499 |
-
|
|
|
500 |
|
501 |
-
|
502 |
-
|
|
|
503 |
}
|
504 |
|
505 |
$this->_status->update_last_updated($product->updateTimestamp);
|
12 |
const POST_TYPE_PRODUCT = 'ec-product';
|
13 |
const DB_ALIAS_OUT_OF_STOCK = 'ecwid_out_of_stock';
|
14 |
const OPTION_ENABLED = 'ecwid_local_base_enabled';
|
15 |
+
const OPTION_NO_SSE = 'ecwid_local_base_no_sse';
|
16 |
+
const OPTION_NO_IMAGES = 'ecwid_local_base_no_images';
|
17 |
|
18 |
public function __construct() {
|
19 |
|
36 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_frontend' ) );
|
37 |
add_filter( 'post_type_link', array( $this, 'replace_product_page_url_on_search' ), 10, 3 );
|
38 |
add_action( 'template_redirect', array( $this, 'redirect_to_store_page' ) );
|
39 |
+
add_action( 'ecwid_on_plugin_update', array( $this, 'on_plugin_update' ) );
|
40 |
|
41 |
if (EcwidPlatform::get('hide_out_of_stock')) {
|
42 |
add_filter( 'posts_where_paged', array( $this, 'where_out_of_stock' ) );
|
46 |
$this->_sync_progress_callback = '__return_false';
|
47 |
}
|
48 |
|
49 |
+
public function on_plugin_update() {
|
50 |
+
add_option( self::OPTION_NO_SSE, false );
|
51 |
+
add_option( self::OPTION_NO_IMAGES, false );
|
52 |
+
}
|
53 |
+
|
54 |
public function enqueue_frontend() {
|
55 |
wp_enqueue_script('ecwid-product-page', ECWID_PLUGIN_URL . 'js/product.js', array('jquery'), get_option('ecwid_plugin_version'));
|
56 |
wp_localize_script('ecwid-product-page', 'ecwidProduct', array(
|
504 |
add_post_meta($post_id, $key, $value, true);
|
505 |
}
|
506 |
|
507 |
+
if (! get_option(self::OPTION_NO_IMAGES ) ) {
|
508 |
+
$image_id = get_post_meta( $post_id, '_thumbnail_id' );
|
509 |
|
510 |
+
if ( ! $image_id ) {
|
511 |
+
$this->_upload_product_thumbnail( $product, $post_id );
|
512 |
+
}
|
513 |
}
|
514 |
|
515 |
$this->_status->update_last_updated($product->updateTimestamp);
|
includes/class-ecwid-seo-links.php
CHANGED
@@ -12,6 +12,7 @@ class Ecwid_Seo_Links {
|
|
12 |
add_action( 'rewrite_rules_array', array( $this, 'build_rewrite_rules' ), 1, 1 );
|
13 |
|
14 |
add_action( 'init', array( $this, 'init' ) );
|
|
|
15 |
}
|
16 |
|
17 |
public function init() {
|
@@ -29,13 +30,15 @@ class Ecwid_Seo_Links {
|
|
29 |
}
|
30 |
}
|
31 |
|
32 |
-
public function
|
33 |
-
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
39 |
|
40 |
if ($this->is_store_on_home_page() && get_queried_object_id() == get_option('page_on_front')) {
|
41 |
return false;
|
@@ -123,7 +126,7 @@ class Ecwid_Seo_Links {
|
|
123 |
global $wp_query;
|
124 |
$page_id = $wp_query->get( 'page_id' );
|
125 |
|
126 |
-
$has_store =
|
127 |
|
128 |
if ( !$has_store ) return;
|
129 |
|
@@ -142,8 +145,6 @@ JS;
|
|
142 |
|
143 |
$rules = array();
|
144 |
|
145 |
-
$page_id = get_option( 'ecwid_store_page_id' );
|
146 |
-
|
147 |
if ( $this->is_store_on_home_page() ) {
|
148 |
$patterns = $this->get_seo_links_patterns();
|
149 |
foreach ($patterns as $pattern) {
|
@@ -151,19 +152,29 @@ JS;
|
|
151 |
}
|
152 |
}
|
153 |
|
154 |
-
|
155 |
-
$link = get_page_uri( $page_id );
|
156 |
-
|
157 |
|
|
|
|
|
158 |
$rules['^' . $link . '/.*'] = 'index.php?page_id=' . $page_id;
|
159 |
}
|
160 |
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
}
|
168 |
|
169 |
return array_merge( $rules, $original_rules );
|
@@ -189,6 +200,11 @@ JS;
|
|
189 |
|
190 |
return $permalink != '';
|
191 |
}
|
|
|
|
|
|
|
|
|
|
|
192 |
}
|
193 |
|
194 |
$ecwid_seo_links = new Ecwid_Seo_Links();
|
12 |
add_action( 'rewrite_rules_array', array( $this, 'build_rewrite_rules' ), 1, 1 );
|
13 |
|
14 |
add_action( 'init', array( $this, 'init' ) );
|
15 |
+
add_action( 'ecwid_on_fresh_install', array( $this, 'on_fresh_install' ) );
|
16 |
}
|
17 |
|
18 |
public function init() {
|
30 |
}
|
31 |
}
|
32 |
|
33 |
+
public function on_fresh_install() {
|
34 |
+
add_option( self::OPTION_ENABLED, 'Y' );
|
35 |
+
}
|
36 |
|
37 |
+
public function on_plugin_update() {
|
38 |
+
add_option( self::OPTION_ENABLED, '' );
|
39 |
+
}
|
40 |
+
|
41 |
+
public function redirect_canonical( $redir, $req ) {
|
42 |
|
43 |
if ($this->is_store_on_home_page() && get_queried_object_id() == get_option('page_on_front')) {
|
44 |
return false;
|
126 |
global $wp_query;
|
127 |
$page_id = $wp_query->get( 'page_id' );
|
128 |
|
129 |
+
$has_store = Ecwid_Store_Page::is_store_page( $page_id );
|
130 |
|
131 |
if ( !$has_store ) return;
|
132 |
|
145 |
|
146 |
$rules = array();
|
147 |
|
|
|
|
|
148 |
if ( $this->is_store_on_home_page() ) {
|
149 |
$patterns = $this->get_seo_links_patterns();
|
150 |
foreach ($patterns as $pattern) {
|
152 |
}
|
153 |
}
|
154 |
|
155 |
+
$pages = Ecwid_Store_Page::get_store_pages_array();
|
|
|
|
|
156 |
|
157 |
+
foreach ( $pages as $page_id ) {
|
158 |
+
$link = get_page_uri( $page_id );
|
159 |
$rules['^' . $link . '/.*'] = 'index.php?page_id=' . $page_id;
|
160 |
}
|
161 |
|
162 |
+
if (
|
163 |
+
is_plugin_active( 'polylang/polylang.php' )
|
164 |
+
&& function_exists( 'pll_get_post_language' )
|
165 |
+
&& class_exists( 'PLL_Model' )
|
166 |
+
&& method_exists( 'PLL_Model', 'get_links_model' )
|
167 |
+
) {
|
168 |
+
$options = get_option( 'polylang' );
|
169 |
+
$model = new PLL_Model( $options );
|
170 |
+
$links_model = $model->get_links_model();
|
171 |
+
if ( $links_model instanceof PLL_Links_Directory ) {
|
172 |
+
foreach ( $pages as $page_id ) {
|
173 |
+
$link = get_page_uri( $page_id );
|
174 |
+
$language = pll_get_post_language( $page_id );
|
175 |
+
$rules['^' . $language . '/' . $link . '/.*'] = 'index.php?page_id=' . $page_id;
|
176 |
+
}
|
177 |
+
}
|
178 |
}
|
179 |
|
180 |
return array_merge( $rules, $original_rules );
|
200 |
|
201 |
return $permalink != '';
|
202 |
}
|
203 |
+
|
204 |
+
public static function should_display_option() {
|
205 |
+
return ecwid_migrations_is_original_plugin_version_older_than( '5.0.8' );
|
206 |
+
}
|
207 |
+
|
208 |
}
|
209 |
|
210 |
$ecwid_seo_links = new Ecwid_Seo_Links();
|
includes/class-ecwid-store-page.php
CHANGED
@@ -1,6 +1,13 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Ecwid_Store_Page {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
public static function get_product_url( $id )
|
5 |
{
|
6 |
if ( Ecwid_Products::is_enabled() ) {
|
@@ -99,15 +106,13 @@ class Ecwid_Store_Page {
|
|
99 |
|
100 |
if ( is_null( $page_id ) ) {
|
101 |
$page_id = false;
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
break;
|
110 |
-
}
|
111 |
}
|
112 |
}
|
113 |
}
|
@@ -121,7 +126,148 @@ class Ecwid_Store_Page {
|
|
121 |
$page_id = get_the_ID();
|
122 |
}
|
123 |
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
|
3 |
class Ecwid_Store_Page {
|
4 |
+
|
5 |
+
const OPTION_STORE_PAGES = 'ecwid_store_pages';
|
6 |
+
const OPTION_MAIN_STORE_PAGE_ID = 'ecwid_store_page_id';
|
7 |
+
const OPTION_FLUSH_REWRITES = 'ecwid_flush_rewrites';
|
8 |
+
|
9 |
+
protected static $_store_pages = false;
|
10 |
+
|
11 |
public static function get_product_url( $id )
|
12 |
{
|
13 |
if ( Ecwid_Products::is_enabled() ) {
|
106 |
|
107 |
if ( is_null( $page_id ) ) {
|
108 |
$page_id = false;
|
109 |
+
|
110 |
+
$id = get_option( self::OPTION_MAIN_STORE_PAGE_ID );
|
111 |
+
if ( $id ) {
|
112 |
+
$status = get_post_status( $id );
|
113 |
+
|
114 |
+
if ( $status == 'publish' || $status == 'private' ) {
|
115 |
+
$page_id = $id;
|
|
|
|
|
116 |
}
|
117 |
}
|
118 |
}
|
126 |
$page_id = get_the_ID();
|
127 |
}
|
128 |
|
129 |
+
$pages = self::get_store_pages_array();
|
130 |
+
|
131 |
+
return in_array( $page_id, $pages );
|
132 |
+
}
|
133 |
+
|
134 |
+
public static function add_store_page( $page_id = 0 ) {
|
135 |
+
|
136 |
+
$pages = self::get_store_pages_array();
|
137 |
+
if ( in_array( $page_id, $pages ) ) {
|
138 |
+
return;
|
139 |
+
}
|
140 |
+
|
141 |
+
$pages[] = $page_id;
|
142 |
+
|
143 |
+
if ( count( $pages ) == 1 || ! get_option( self::OPTION_MAIN_STORE_PAGE_ID ) ) {
|
144 |
+
update_option( self::OPTION_MAIN_STORE_PAGE_ID, $page_id );
|
145 |
+
}
|
146 |
+
|
147 |
+
self::_set_store_pages( $pages );
|
148 |
+
self::_schedule_flush_rewrite();
|
149 |
+
}
|
150 |
+
|
151 |
+
public static function reset_store_page( $page_id ) {
|
152 |
+
|
153 |
+
$pages = self::get_store_pages_array();
|
154 |
+
|
155 |
+
$index = array_search( $page_id, $pages );
|
156 |
+
if ( $index === false ) {
|
157 |
+
return;
|
158 |
+
}
|
159 |
+
|
160 |
+
unset( $pages[$index] );
|
161 |
+
|
162 |
+
$pages = self::_set_store_pages( $pages );
|
163 |
+
|
164 |
+
if ( $page_id == get_option( self::OPTION_MAIN_STORE_PAGE_ID ) ) {
|
165 |
+
|
166 |
+
if ( isset( $pages[0] ) ) {
|
167 |
+
update_option( self::OPTION_MAIN_STORE_PAGE_ID, $pages[0] );
|
168 |
+
} else {
|
169 |
+
update_option( self::OPTION_MAIN_STORE_PAGE_ID, '' );
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
public function get_store_pages_array() {
|
175 |
+
|
176 |
+
if ( self::$_store_pages ) {
|
177 |
+
return self::$_store_pages;
|
178 |
+
}
|
179 |
+
|
180 |
+
$pages = get_option( self::OPTION_STORE_PAGES );
|
181 |
+
if ( !$pages || !is_string( $pages ) ) {
|
182 |
+
$pages = '';
|
183 |
+
}
|
184 |
+
|
185 |
+
self::$_store_pages = explode( ',', $pages );
|
186 |
+
self::$_store_pages[] = get_option( self::OPTION_MAIN_STORE_PAGE_ID );
|
187 |
+
self::$_store_pages = array_values(
|
188 |
+
array_filter(
|
189 |
+
array_unique(
|
190 |
+
self::$_store_pages
|
191 |
+
)
|
192 |
+
)
|
193 |
+
);
|
194 |
+
|
195 |
+
|
196 |
+
return self::$_store_pages;
|
197 |
+
}
|
198 |
+
|
199 |
+
protected static function _schedule_flush_rewrite() {
|
200 |
+
update_option( self::OPTION_FLUSH_REWRITES, 1 );
|
201 |
+
}
|
202 |
+
|
203 |
+
public static function flush_rewrites() {
|
204 |
+
flush_rewrite_rules();
|
205 |
+
|
206 |
+
update_option( self::OPTION_FLUSH_REWRITES, 0 );
|
207 |
+
}
|
208 |
+
|
209 |
+
protected static function _set_store_pages( $pages ) {
|
210 |
+
|
211 |
+
self::$_store_pages = array_values(
|
212 |
+
array_filter(
|
213 |
+
$pages
|
214 |
+
)
|
215 |
+
);
|
216 |
+
|
217 |
+
$option_value = implode( ',', $pages );
|
218 |
+
|
219 |
+
update_option( self::OPTION_STORE_PAGES, $option_value );
|
220 |
+
|
221 |
+
return self::$_store_pages;
|
222 |
+
}
|
223 |
+
|
224 |
+
public static function post_content_has_productbrowser( $post_id = null ) {
|
225 |
+
|
226 |
+
if ( is_null( $post_id ) ) {
|
227 |
+
if ( is_admin() ) return false;
|
228 |
+
$post_id = get_the_ID();
|
229 |
+
}
|
230 |
+
|
231 |
+
$post = get_post($post_id);
|
232 |
+
|
233 |
+
if ( $post ) {
|
234 |
+
$post_content = get_post( $post_id )->post_content;
|
235 |
+
|
236 |
+
$result = ecwid_content_has_productbrowser( $post_content );
|
237 |
+
$result = apply_filters( 'ecwid_page_has_product_browser', $result );
|
238 |
+
}
|
239 |
+
|
240 |
+
|
241 |
+
return $result;
|
242 |
}
|
243 |
|
244 |
+
public static function on_save_post( $post_id ) {
|
245 |
+
|
246 |
+
if ( wp_is_post_revision( $post_id ) )
|
247 |
+
return;
|
248 |
+
|
249 |
+
$has_pb = self::post_content_has_productbrowser( $post_id );
|
250 |
+
|
251 |
+
if ( self::is_store_page( $post_id ) ) {
|
252 |
+
|
253 |
+
$is_disabled = !in_array( get_post_status( $post_id ), array('publish', 'private' ) );
|
254 |
+
|
255 |
+
|
256 |
+
if ( $is_disabled || !$has_pb ) {
|
257 |
+
self::reset_store_page( $post_id );
|
258 |
+
}
|
259 |
+
}
|
260 |
+
|
261 |
+
if ( $has_pb && in_array( get_post_status( $post_id ), array('publish', 'private' ) ) ) {
|
262 |
+
self::add_store_page( $post_id );
|
263 |
+
} else if ( get_option( self::OPTION_MAIN_STORE_PAGE_ID ) == $post_id ) {
|
264 |
+
update_option( self::OPTION_MAIN_STORE_PAGE_ID, '' );
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
public static function on_frontend_rendered() {}
|
269 |
+
}
|
270 |
+
|
271 |
+
add_action( 'init', array( 'Ecwid_Store_Page', 'flush_rewrites' ) );
|
272 |
+
add_action( 'shutdown', array( 'Ecwid_Store_Page', 'on_frontend_rendered' ) );
|
273 |
+
add_action( 'save_post', array( 'Ecwid_Store_Page', 'on_save_post' ) );
|
includes/shortcodes/class-ecwid-shortcode-productbrowser.php
CHANGED
@@ -21,6 +21,8 @@ class Ecwid_Shortcode_ProductBrowser extends Ecwid_Shortcode_Base {
|
|
21 |
}
|
22 |
|
23 |
public function render() {
|
|
|
|
|
24 |
return parent::render();
|
25 |
}
|
26 |
|
21 |
}
|
22 |
|
23 |
public function render() {
|
24 |
+
Ecwid_Store_Page::add_store_page( get_the_ID() );
|
25 |
+
|
26 |
return parent::render();
|
27 |
}
|
28 |
|
includes/themes/class-ecwid-theme-central.php
CHANGED
@@ -17,7 +17,7 @@ class Ecwid_Theme_Central extends Ecwid_Theme_Base
|
|
17 |
|
18 |
public function body_class($classes) {
|
19 |
// Yeah, we have to to turn off these ajax click handling routines that break our links
|
20 |
-
if (
|
21 |
$classes[] = 'woocommerce';
|
22 |
}
|
23 |
|
17 |
|
18 |
public function body_class($classes) {
|
19 |
// Yeah, we have to to turn off these ajax click handling routines that break our links
|
20 |
+
if ( Ecwid_Store_Page::is_store_page() ) {
|
21 |
$classes[] = 'woocommerce';
|
22 |
}
|
23 |
|
includes/themes/class-ecwid-theme-genesis.php
CHANGED
@@ -10,7 +10,7 @@ class Ecwid_Theme_Genesis extends Ecwid_Theme_Base
|
|
10 |
{
|
11 |
parent::__construct();
|
12 |
|
13 |
-
if (array_key_exists('_escaped_fragment_', $_GET) &&
|
14 |
remove_action( 'wp_head', 'genesis_canonical', 5 );
|
15 |
}
|
16 |
}
|
10 |
{
|
11 |
parent::__construct();
|
12 |
|
13 |
+
if ( array_key_exists( '_escaped_fragment_', $_GET ) && Ecwid_Store_Page::is_store_page() ) {
|
14 |
remove_action( 'wp_head', 'genesis_canonical', 5 );
|
15 |
}
|
16 |
}
|
includes/themes/class-ecwid-theme-responsive.php
CHANGED
@@ -43,7 +43,7 @@ class Ecwid_Theme_Responsive extends Ecwid_Theme_Base
|
|
43 |
public function minicart_shortcode_content( $content )
|
44 |
{
|
45 |
|
46 |
-
if (
|
47 |
$content = '<script data-cfasync="false" type="text/javascript"> xMinicart("style=","layout=Mini"); </script>';
|
48 |
}
|
49 |
|
43 |
public function minicart_shortcode_content( $content )
|
44 |
{
|
45 |
|
46 |
+
if ( Ecwid_Store_Page::is_store_page() ) {
|
47 |
$content = '<script data-cfasync="false" type="text/javascript"> xMinicart("style=","layout=Mini"); </script>';
|
48 |
}
|
49 |
|
includes/themes/class-ecwid-theme-twentyfifteen.php
CHANGED
@@ -10,7 +10,7 @@ class Ecwid_Theme_2015 extends Ecwid_Theme_Base
|
|
10 |
{
|
11 |
parent::__construct();
|
12 |
|
13 |
-
if (
|
14 |
wp_enqueue_style( 'ecwid-theme', ECWID_PLUGIN_URL . 'css/themes/2015.css', array('twentyfifteen-style'), get_option('ecwid_plugin_version') );
|
15 |
}
|
16 |
|
10 |
{
|
11 |
parent::__construct();
|
12 |
|
13 |
+
if ( Ecwid_Store_Page::is_store_page() ) {
|
14 |
wp_enqueue_style( 'ecwid-theme', ECWID_PLUGIN_URL . 'css/themes/2015.css', array('twentyfifteen-style'), get_option('ecwid_plugin_version') );
|
15 |
}
|
16 |
|
includes/themes/class-ecwid-theme-twentysixteen.php
CHANGED
@@ -12,7 +12,7 @@ class Ecwid_Theme_2016 extends Ecwid_Theme_Base
|
|
12 |
{
|
13 |
parent::__construct();
|
14 |
|
15 |
-
if (
|
16 |
wp_enqueue_style( 'ecwid-theme', ECWID_PLUGIN_URL . 'css/themes/2016.css', array('twentysixteen-style'), get_option('ecwid_plugin_version') );
|
17 |
}
|
18 |
add_action('ecwid_plugin_installed', array($this, 'on_ecwid_plugin_installed'));
|
12 |
{
|
13 |
parent::__construct();
|
14 |
|
15 |
+
if ( Ecwid_Store_Page::is_store_page() ) {
|
16 |
wp_enqueue_style( 'ecwid-theme', ECWID_PLUGIN_URL . 'css/themes/2016.css', array('twentysixteen-style'), get_option('ecwid_plugin_version') );
|
17 |
}
|
18 |
add_action('ecwid_plugin_installed', array($this, 'on_ecwid_plugin_installed'));
|
includes/widgets/class-ecwid-widget-floating-shopping-cart.php
CHANGED
@@ -64,7 +64,7 @@ class Ecwid_Widget_Floating_Shopping_Cart extends WP_Widget {
|
|
64 |
}
|
65 |
$position = in_array($position, self::$positions) ? $position : self::$default_position;
|
66 |
|
67 |
-
if (
|
68 |
$cart_url = '#!/~/cart';
|
69 |
} else {
|
70 |
$cart_url = Ecwid_Store_Page::get_cart_url();
|
64 |
}
|
65 |
$position = in_array($position, self::$positions) ? $position : self::$default_position;
|
66 |
|
67 |
+
if ( Ecwid_Store_Page::is_store_page() ) {
|
68 |
$cart_url = '#!/~/cart';
|
69 |
} else {
|
70 |
$cart_url = Ecwid_Store_Page::get_cart_url();
|
templates/advanced-settings.php
CHANGED
@@ -8,7 +8,9 @@
|
|
8 |
<input type="hidden" name="settings_section" value="advanced" />
|
9 |
|
10 |
<fieldset>
|
11 |
-
|
|
|
|
|
12 |
<div class="label">
|
13 |
<label for="<?php echo Ecwid_Seo_Links::OPTION_ENABLED; ?>">
|
14 |
|
@@ -43,6 +45,8 @@
|
|
43 |
</div>
|
44 |
</div>
|
45 |
</div>
|
|
|
|
|
46 |
|
47 |
<?php if (get_option('ecwid_hide_appearance_menu') != 'Y'): ?>
|
48 |
<div class="pure-control-group bottom-border">
|
@@ -149,36 +153,6 @@
|
|
149 |
</div>
|
150 |
<?php endif; ?>
|
151 |
|
152 |
-
|
153 |
-
<?php $show_categories = ecwid_migrations_is_original_plugin_version_older_than('3.3') || get_option('ecwid_use_new_horizontal_categories') != 'Y'; ?>
|
154 |
-
|
155 |
-
<hr <?php echo $show_categories ? '' : ' hidden'; ?> />
|
156 |
-
|
157 |
-
<div class="pure-control-group checkbox<?php echo $show_categories ? '' : ' hidden'; ?>">
|
158 |
-
<div class="label">
|
159 |
-
<label for="ecwid_use_new_horizontal_categories">
|
160 |
-
|
161 |
-
<input
|
162 |
-
id="ecwid_use_new_horizontal_categories"
|
163 |
-
name="ecwid_use_new_horizontal_categories"
|
164 |
-
type="checkbox"
|
165 |
-
<?php if (get_option('ecwid_use_new_horizontal_categories') == 'Y'): ?>
|
166 |
-
checked="checked"
|
167 |
-
<?php endif; ?>
|
168 |
-
value="Y"
|
169 |
-
/>
|
170 |
-
<?php _e('Enable the new category menu', 'ecwid-shopping-cart'); ?>
|
171 |
-
</label>
|
172 |
-
|
173 |
-
<div class="note">
|
174 |
-
<?php echo sprintf(
|
175 |
-
__('The new category menu looks better and is more mobile-friendly. If you haven\'t yet added category menu to your store page, you can do that in the <a %s>store page editor</a> (enable the "Show categories" option)', 'ecwid-shopping-cart'),
|
176 |
-
'href="post.php?post=' . Ecwid_Store_Page::get_current_store_page_id() . '&action=edit&show-ecwid=true"'
|
177 |
-
); ?>
|
178 |
-
</div>
|
179 |
-
</div>
|
180 |
-
</div>
|
181 |
-
|
182 |
<hr />
|
183 |
|
184 |
<div class="pure-control-group checkbox">
|
@@ -223,4 +197,4 @@
|
|
223 |
</div>
|
224 |
</fieldset>
|
225 |
</form>
|
226 |
-
</div>
|
8 |
<input type="hidden" name="settings_section" value="advanced" />
|
9 |
|
10 |
<fieldset>
|
11 |
+
|
12 |
+
<?php if ( Ecwid_Seo_Links::should_display_option() ): ?>
|
13 |
+
<div class="pure-control-group checkbox">
|
14 |
<div class="label">
|
15 |
<label for="<?php echo Ecwid_Seo_Links::OPTION_ENABLED; ?>">
|
16 |
|
45 |
</div>
|
46 |
</div>
|
47 |
</div>
|
48 |
+
<?php endif; ?>
|
49 |
+
|
50 |
|
51 |
<?php if (get_option('ecwid_hide_appearance_menu') != 'Y'): ?>
|
52 |
<div class="pure-control-group bottom-border">
|
153 |
</div>
|
154 |
<?php endif; ?>
|
155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
<hr />
|
157 |
|
158 |
<div class="pure-control-group checkbox">
|
197 |
</div>
|
198 |
</fieldset>
|
199 |
</form>
|
200 |
+
</div>
|
templates/debug.php
CHANGED
@@ -91,6 +91,16 @@
|
|
91 |
<?php endforeach; ?>
|
92 |
</div>
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
<h2>PhpInfo</h2>
|
95 |
|
96 |
<div>
|
91 |
<?php endforeach; ?>
|
92 |
</div>
|
93 |
|
94 |
+
<h2>Store pages</h2>
|
95 |
+
<?php foreach (Ecwid_Store_Page::get_store_pages_array() as $page_id): ?>
|
96 |
+
<div>
|
97 |
+
<a target="_blank" href="post.php?post=<?php echo $page_id; ?>&action=edit"><?php echo get_post($page_id)->post_name; ?></a>
|
98 |
+
<?php if ( $page_id == get_option( Ecwid_Store_Page::OPTION_MAIN_STORE_PAGE_ID ) ): ?>
|
99 |
+
<b> - main</b>
|
100 |
+
<?php endif ;?>
|
101 |
+
|
102 |
+
</div>
|
103 |
+
<?php endforeach; ?>
|
104 |
<h2>PhpInfo</h2>
|
105 |
|
106 |
<div>
|
templates/sync.php
CHANGED
@@ -13,7 +13,7 @@ if (set_time_limit_available && typeof(EventSource) != 'undefined') {
|
|
13 |
sse_available = true;
|
14 |
}
|
15 |
|
16 |
-
if (sse_available) {
|
17 |
jQuery('#sse_on').html('YES');
|
18 |
} else {
|
19 |
jQuery('#sse_on').html('NO');
|
@@ -105,7 +105,7 @@ function process_no_sse_sync(data) {
|
|
105 |
} else {
|
106 |
jQuery('#current_item').text('Deleting products...');
|
107 |
}
|
108 |
-
|
109 |
}
|
110 |
|
111 |
function update_no_sse_stuff(data) {
|
13 |
sse_available = true;
|
14 |
}
|
15 |
|
16 |
+
if (sse_available && <?php echo ( get_option( Ecwid_Products::OPTION_NO_SSE ) ? '0' : '1') ?>) {
|
17 |
jQuery('#sse_on').html('YES');
|
18 |
} else {
|
19 |
jQuery('#sse_on').html('NO');
|
105 |
} else {
|
106 |
jQuery('#current_item').text('Deleting products...');
|
107 |
}
|
108 |
+
do_no_sse_sync(mode, offset, limit, updatedFrom);
|
109 |
}
|
110 |
|
111 |
function update_no_sse_stuff(data) {
|