Ecwid Ecommerce Shopping Cart - Version 0.7

Version Description

  • [+] The "Inline SEO catalog" feature didn't work correctly with WP permalinks. Fixed.
Download this release

Release Info

Developer Ecwid
Plugin Icon 128x128 Ecwid Ecommerce Shopping Cart
Version 0.7
Comparing to
See all releases

Code changes from version 0.6 to 0.7

Files changed (3) hide show
  1. ecwid-shopping-cart.php +13 -9
  2. lib/ecwid_catalog.php +45 -25
  3. readme.txt +8 -4
ecwid-shopping-cart.php CHANGED
@@ -4,13 +4,17 @@ Plugin Name: Ecwid Shopping Cart
4
  Plugin URI: http://www.ecwid.com/
5
  Description: Ecwid is a free full-featured shopping cart. It can be easily integreted with any Wordpress blog and takes less than 5 minutes to set up.
6
  Author: Ecwid Team
7
- Version: 0.6
8
  Author URI: http://www.ecwid.com/
9
  */
10
 
11
  register_activation_hook( __FILE__, 'ecwid_store_activate' );
12
  register_deactivation_hook( __FILE__, 'ecwid_store_deactivate' );
13
 
 
 
 
 
14
  define("APP_ECWID_COM","app.ecwid.com");
15
 
16
  if ( is_admin() ){
@@ -127,7 +131,7 @@ function ecwid_productbrowser_shortcode() {
127
  if (!empty($ecwid_noscript_seo_catalog)) {
128
 
129
  if (!empty($_GET['ecwid_product_id'])) {
130
- $ecwid_open_product = '<script>document.location.hash = "ecwid:category=0&mode=product&product='. intval($_GET['ecwid_product_id']) .'";</script>';
131
  } elseif (!empty($_GET['ecwid_category_id'])) {
132
  $ecwid_default_category_str = ',"defaultCategoryId='. intval($_GET['ecwid_category_id']) .'"';
133
  }
@@ -287,7 +291,7 @@ function ecwid_options_do_page() {
287
 
288
  if ($store_id == 1003) {
289
  $ecwid_noscript_seo_catalog_disabled = true;
290
- $ecwid_noscript_seo_catalog_message = 'This option requires using Ecwid Product API. In order to enable it, please set up your Store ID first. Please note, that API is available for the paid Ecwid accounts only.';
291
  if (!empty($ecwid_noscript_seo_catalog)) {
292
  update_option('ecwid_noscript_seo_catalog', '');
293
  $ecwid_noscript_seo_catalog = '';
@@ -295,7 +299,7 @@ function ecwid_options_do_page() {
295
  } # demo store id
296
 
297
  else if ($store_id != 1003 && empty($ecwid_noscript_seo_catalog)) {
298
- $ecwid_noscript_seo_catalog_message = '<a href="http://kb.ecwid.com/Inline-SEO-Catalog" target="_blank">How Inline Seo Catalog works</a>. This option requires using Ecwid API which is available for the paid accounts only.';
299
  }
300
  else if ($store_id != 1003 && !empty($ecwid_noscript_seo_catalog)) {
301
 
@@ -307,10 +311,10 @@ function ecwid_options_do_page() {
307
  if ($api->error_code == 403) {
308
  #free account, consider upgrade
309
  $ecwid_noscript_seo_catalog_disabled = true;
310
- $ecwid_noscript_seo_catalog_message = 'This option requires using Ecwid API which is available for the paid accounts only. Please consider upgrading your account to use it.';
311
  update_option('ecwid_noscript_seo_catalog', '');
312
  $ecwid_noscript_seo_catalog = '';
313
- $ecwid_settings_message = 'The "Inline HTML catalog" option requires using Ecwid API which is available for the paid accounts only. Please consider upgrading your account to use it.';
314
 
315
  }
316
  else if ($api->error_code == 404) {
@@ -620,7 +624,7 @@ class EcwidMinicartWidget extends WP_Widget {
620
  $page_url = get_page_link($ecwid_page_id);
621
  $_tmp_page = get_page($ecwid_page_id);
622
  if (!empty($page_url) && $_tmp_page != null)
623
- echo "<script>var ecwid_ProductBrowserURL = \"$page_url\";</script>";
624
  echo <<<EOT
625
  <script type="text/javascript"> xMinicart("style="); </script>
626
  </div>
@@ -669,7 +673,7 @@ class EcwidSearchWidget extends WP_Widget {
669
  $page_url = get_page_link($ecwid_page_id);
670
  $_tmp_page = get_page($ecwid_page_id);
671
  if (!empty($page_url) && $_tmp_page != null)
672
- echo "<script>var ecwid_ProductBrowserURL = \"$page_url\";</script>";
673
  echo <<<EOT
674
  <script type="text/javascript"> xSearchPanel("style="); </script>
675
  </div>
@@ -718,7 +722,7 @@ class EcwidVCategoriesWidget extends WP_Widget {
718
  $page_url = get_page_link($ecwid_page_id);
719
  $_tmp_page = get_page($ecwid_page_id);
720
  if (!empty($page_url) && $_tmp_page != null)
721
- echo "<script>var ecwid_ProductBrowserURL = \"$page_url\";</script>";
722
  echo <<<EOT
723
  <script type="text/javascript"> xVCategories("style="); </script>
724
  </div>
4
  Plugin URI: http://www.ecwid.com/
5
  Description: Ecwid is a free full-featured shopping cart. It can be easily integreted with any Wordpress blog and takes less than 5 minutes to set up.
6
  Author: Ecwid Team
7
+ Version: 0.7
8
  Author URI: http://www.ecwid.com/
9
  */
10
 
11
  register_activation_hook( __FILE__, 'ecwid_store_activate' );
12
  register_deactivation_hook( __FILE__, 'ecwid_store_deactivate' );
13
 
14
+ if (!empty($_GET['ecwid_product_id']) || !empty($_GET['ecwid_category_id'])) {
15
+ remove_action( 'wp_head','rel_canonical');
16
+ }
17
+
18
  define("APP_ECWID_COM","app.ecwid.com");
19
 
20
  if ( is_admin() ){
131
  if (!empty($ecwid_noscript_seo_catalog)) {
132
 
133
  if (!empty($_GET['ecwid_product_id'])) {
134
+ $ecwid_open_product = '<script type="text/javascript"> if (!document.location.hash) document.location.hash = "ecwid:category=0&mode=product&product='. intval($_GET['ecwid_product_id']) .'";</script>';
135
  } elseif (!empty($_GET['ecwid_category_id'])) {
136
  $ecwid_default_category_str = ',"defaultCategoryId='. intval($_GET['ecwid_category_id']) .'"';
137
  }
291
 
292
  if ($store_id == 1003) {
293
  $ecwid_noscript_seo_catalog_disabled = true;
294
+ $ecwid_noscript_seo_catalog_message = 'This option requires using Ecwid Product API. In order to enable it, please set up your Store ID first. Please note, that API is available for the <a href="http://www.ecwid.com/compare-plans.html" target="_blank">paid Ecwid accounts</a> only.';
295
  if (!empty($ecwid_noscript_seo_catalog)) {
296
  update_option('ecwid_noscript_seo_catalog', '');
297
  $ecwid_noscript_seo_catalog = '';
299
  } # demo store id
300
 
301
  else if ($store_id != 1003 && empty($ecwid_noscript_seo_catalog)) {
302
+ $ecwid_noscript_seo_catalog_message = '<a href="http://kb.ecwid.com/Inline-SEO-Catalog" target="_blank">How Inline Seo Catalog works</a>. This option requires using Ecwid API which is available for the <a href="http://www.ecwid.com/compare-plans.html" target="_blank">paid accounts</a> only.';
303
  }
304
  else if ($store_id != 1003 && !empty($ecwid_noscript_seo_catalog)) {
305
 
311
  if ($api->error_code == 403) {
312
  #free account, consider upgrade
313
  $ecwid_noscript_seo_catalog_disabled = true;
314
+ $ecwid_noscript_seo_catalog_message = 'This option requires using Ecwid API which is available for the <a href="http://www.ecwid.com/compare-plans.html" target="_blank">paid accounts</a> only. Please consider upgrading your account to use it.';
315
  update_option('ecwid_noscript_seo_catalog', '');
316
  $ecwid_noscript_seo_catalog = '';
317
+ $ecwid_settings_message = 'The "Inline HTML catalog" option requires using Ecwid API which is available for the <a href="http://www.ecwid.com/compare-plans.html" target="_blank">paid accounts</a> only. Please consider upgrading your account to use it.';
318
 
319
  }
320
  else if ($api->error_code == 404) {
624
  $page_url = get_page_link($ecwid_page_id);
625
  $_tmp_page = get_page($ecwid_page_id);
626
  if (!empty($page_url) && $_tmp_page != null)
627
+ echo "<script type=\"text/javascript\">var ecwid_ProductBrowserURL = \"$page_url\";</script>";
628
  echo <<<EOT
629
  <script type="text/javascript"> xMinicart("style="); </script>
630
  </div>
673
  $page_url = get_page_link($ecwid_page_id);
674
  $_tmp_page = get_page($ecwid_page_id);
675
  if (!empty($page_url) && $_tmp_page != null)
676
+ echo "<script type=\"text/javascript\">var ecwid_ProductBrowserURL = \"$page_url\";</script>";
677
  echo <<<EOT
678
  <script type="text/javascript"> xSearchPanel("style="); </script>
679
  </div>
722
  $page_url = get_page_link($ecwid_page_id);
723
  $_tmp_page = get_page($ecwid_page_id);
724
  if (!empty($page_url) && $_tmp_page != null)
725
+ echo "<script type=\"text/javascript\">var ecwid_ProductBrowserURL = \"$page_url\";</script>";
726
  echo <<<EOT
727
  <script type="text/javascript"> xVCategories("style="); </script>
728
  </div>
lib/ecwid_catalog.php CHANGED
@@ -180,11 +180,52 @@ function ecwid_is_api_enabled($ecwid_store_id) {
180
  return $api->is_api_enabled();
181
  }
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  function ecwid_internal_construct_url($url_with_anchor, $additional_get_params) {
184
- $is_https = ($_SERVER["HTTPS"] == "on");
185
- $port = $_SERVER["SERVER_PORT"];
186
- $host = $_SERVER["HTTP_HOST"];
187
- $path = $_SERVER["SCRIPT_NAME"];
188
  // extract anchor
189
  $url_fragments = parse_url($url_with_anchor);
190
  $anchor = $url_fragments["fragment"];
@@ -194,27 +235,6 @@ function ecwid_internal_construct_url($url_with_anchor, $additional_get_params)
194
  unset ($get_params["ecwid_product_id"]);
195
  $get_params = array_merge($get_params, $additional_get_params);
196
 
197
- // construct url
198
-
199
- // add schema
200
- $base_url = "";
201
- if (!$is_https) {
202
- $base_url = "http://";
203
- } else {
204
- $base_url = "https://";
205
- }
206
-
207
- // add hostname
208
- $base_url .= $host;
209
-
210
- // add port (if needed)
211
- if (($is_https && ($port != 443)) || (!$is_https && ($port != 80))) {
212
- $base_url .= ":" . $port;
213
- }
214
-
215
- // add path
216
- $base_url .= $path;
217
-
218
  // add GET parameters
219
  if (count($get_params) > 0) {
220
  $base_url .= "?";
180
  return $api->is_api_enabled();
181
  }
182
 
183
+ function ecwid_zerolen() {
184
+ foreach (func_get_args() as $arg) {
185
+ if (strlen($arg) == 0) return true;
186
+ }
187
+ return false;
188
+ }
189
+
190
+ function ecwid_get_request_uri() {
191
+ static $request_uri = null;
192
+
193
+ if (is_null($request_uri)) {
194
+ if (isset($_SERVER['REQUEST_URI'])) {
195
+ $request_uri = $_SERVER['REQUEST_URI'];
196
+ return $request_uri;
197
+ }
198
+ if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
199
+ $request_uri = $_SERVER['HTTP_X_ORIGINAL_URL'];
200
+ return $request_uri;
201
+ } else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
202
+ $request_uri = $_SERVER['HTTP_X_REWRITE_URL'];
203
+ return $request_uri;
204
+ }
205
+
206
+ if (isset($_SERVER['PATH_INFO']) && !ecwid_zerolen($_SERVER['PATH_INFO'])) {
207
+ if ($_SERVER['PATH_INFO'] == $_SERVER['PHP_SELF']) {
208
+ $request_uri = $_SERVER['PHP_SELF'];
209
+ } else {
210
+ $request_uri = $_SERVER['PHP_SELF'] . $_SERVER['PATH_INFO'];
211
+ }
212
+ } else {
213
+ $request_uri = $_SERVER['PHP_SELF'];
214
+ }
215
+ # Append query string
216
+ if (isset($_SERVER['argv']) && isset($_SERVER['argv'][0]) && !ecwid_zerolen($_SERVER['argv'][0])) {
217
+ $request_uri .= '?' . $_SERVER['argv'][0];
218
+ } else if (isset($_SERVER['QUERY_STRING']) && !ecwid_zerolen($_SERVER['QUERY_STRING'])) {
219
+ $request_uri .= '?' . $_SERVER['QUERY_STRING'];
220
+ }
221
+ }
222
+ return $request_uri;
223
+ }
224
+
225
  function ecwid_internal_construct_url($url_with_anchor, $additional_get_params) {
226
+ $request_uri = parse_url(ecwid_get_request_uri());
227
+ $base_url = $request_uri['path'];
228
+
 
229
  // extract anchor
230
  $url_fragments = parse_url($url_with_anchor);
231
  $anchor = $url_fragments["fragment"];
235
  unset ($get_params["ecwid_product_id"]);
236
  $get_params = array_merge($get_params, $additional_get_params);
237
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  // add GET parameters
239
  if (count($get_params) > 0) {
240
  $base_url .= "?";
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: Ecwid Team
3
  Tags: shopping cart, ecommerce, e-commerce, paypal, google checkout, 2checkout, store, shop, product catalog, inventory
4
  Requires at least: 2.8
5
- Tested up to: 3.0
6
- Stable tag: 0.6
7
 
8
  Ecwid is a free full-featured shopping cart that can easily be added to any blog
9
  and takes less than 5 minutes to set up.
@@ -38,10 +38,14 @@ Links
38
 
39
  == Frequently Asked Questions ==
40
 
41
- - [http://www.ecwid.com/faq.html](http://www.ecwid.com/faq.html)
42
- - [http://kb.ecwid.com](http://kb.ecwid.com)
43
 
44
  == Changelog ==
 
 
 
 
45
  = 0.6 =
46
  - [+] The "Inline SEO catalog" option was added.
47
 
2
  Contributors: Ecwid Team
3
  Tags: shopping cart, ecommerce, e-commerce, paypal, google checkout, 2checkout, store, shop, product catalog, inventory
4
  Requires at least: 2.8
5
+ Tested up to: 3.2
6
+ Stable tag: 0.7
7
 
8
  Ecwid is a free full-featured shopping cart that can easily be added to any blog
9
  and takes less than 5 minutes to set up.
38
 
39
  == Frequently Asked Questions ==
40
 
41
+ - FAQ: [http://www.ecwid.com/faq.html](http://www.ecwid.com/faq.html)
42
+ - Knowledge Base: [http://kb.ecwid.com](http://kb.ecwid.com)
43
 
44
  == Changelog ==
45
+ = 0.7 =
46
+ - [+] The "Inline SEO catalog" feature didn't work correctly with WP
47
+ permalinks. Fixed.
48
+
49
  = 0.6 =
50
  - [+] The "Inline SEO catalog" option was added.
51