Changeset 3202954
- Timestamp:
- 12/05/2024 10:50:06 AM (16 months ago)
- Location:
- ecwid-shopping-cart
- Files:
-
- 8 added
- 12 edited
- 1 copied
-
tags/6.12.23 (copied) (copied from ecwid-shopping-cart/trunk)
-
tags/6.12.23/.wp-env.json (added)
-
tags/6.12.23/ecwid-shopping-cart.php (modified) (4 diffs)
-
tags/6.12.23/includes/class-ec-store-wp-cli.php (modified) (1 diff)
-
tags/6.12.23/includes/importer/class-ecwid-import-page.php (modified) (1 diff)
-
tags/6.12.23/lib/ecwid_api_v3.php (modified) (7 diffs)
-
tags/6.12.23/lib/ecwid_platform.php (modified) (1 diff)
-
tags/6.12.23/package-lock.json (added)
-
tags/6.12.23/package.json (added)
-
tags/6.12.23/readme.txt (modified) (2 diffs)
-
tags/6.12.23/webpack.config.js (added)
-
trunk/.wp-env.json (added)
-
trunk/ecwid-shopping-cart.php (modified) (4 diffs)
-
trunk/includes/class-ec-store-wp-cli.php (modified) (1 diff)
-
trunk/includes/importer/class-ecwid-import-page.php (modified) (1 diff)
-
trunk/lib/ecwid_api_v3.php (modified) (7 diffs)
-
trunk/lib/ecwid_platform.php (modified) (1 diff)
-
trunk/package-lock.json (added)
-
trunk/package.json (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/webpack.config.js (added)
Legend:
- Unmodified
- Added
- Removed
-
ecwid-shopping-cart/tags/6.12.23/ecwid-shopping-cart.php
r3183692 r3202954 6 6 Text Domain: ecwid-shopping-cart 7 7 Author: Ecwid Ecommerce 8 Version: 6.12.2 28 Version: 6.12.23 9 9 Author URI: https://ecwid.to/ecwid-site 10 10 License: GPLv2 or later … … 57 57 add_action( 'wp_ajax_ecwid_hide_message', 'ecwid_ajax_hide_message' ); 58 58 add_action( 'wp_ajax_ecwid_reset_categories_cache', 'ecwid_reset_categories_cache' ); 59 add_action( 'wp_ajax_ecwid_create_store', 'ecwid_ create_store' );59 add_action( 'wp_ajax_ecwid_create_store', 'ecwid_ajax_create_store' ); 60 60 add_action( 'wp_ajax_ecwid_sync_products', 'ecwid_sync_products' ); 61 61 … … 2200 2200 } 2201 2201 2202 function ecwid_create_store( ) {2202 function ecwid_create_store( $params = array() ) { 2203 2203 $api = new Ecwid_Api_V3(); 2204 2204 2205 $result = $api->create_store(); 2206 2207 if ( is_array( $result ) && $result['response']['code'] == 200 ) { 2205 $result = $api->create_store( $params ); 2206 2207 $is_store_created = is_array( $result ) && $result['response']['code'] == 200; 2208 2209 if ( $is_store_created ) { 2208 2210 $data = json_decode( $result['body'] ); 2209 2211 2210 ecwid_update_store_id( $data->id);2212 ecwid_update_store_id( $data->id ); 2211 2213 2212 2214 $api->save_token( $data->token ); … … 2215 2217 2216 2218 update_option( 'ecwid_oauth_scope', 'read_profile ' . Ecwid_OAuth::SCOPE_READ_CATALOG . ' create_catalog update_catalog allow_sso create_customers public_storefront' ); 2217 2219 } 2220 2221 return $result; 2222 } 2223 2224 function ecwid_ajax_create_store() { 2225 $result = ecwid_create_store(); 2226 $is_store_created = is_array( $result ) && $result['response']['code'] == 200; 2227 2228 if( $is_store_created ) { 2218 2229 header( 'HTTP/1.1 200 OK' ); 2219 2230 } elseif ( is_wp_error( $result ) ) { 2231 header( 'HTTP/1.1 409 Error' ); 2220 2232 } else { 2221 2222 if( is_wp_error( $result ) ) {2223 header( 'HTTP/1.1 409 Error' );2224 die();2225 }2226 2227 2233 header( 'HTTP/1.1 ' . $result['response']['code'] . ' ' . $result['response']['message'] ); 2228 die(); 2229 } 2234 } 2235 2236 die(); 2230 2237 } 2231 2238 -
ecwid-shopping-cart/tags/6.12.23/includes/class-ec-store-wp-cli.php
r2514476 r3202954 63 63 } 64 64 65 /** 66 * Create a new store. It will automatically connect to the plugin. 67 * ## OPTIONS 68 * 69 * [--email] 70 * : Client email. Required. 71 * 72 * [--name] 73 * : Client name. Required. 74 * 75 * [--password] 76 * : Client password. Optional, if not set, it will be generated automatically. 77 * 78 * [--channel_id] 79 * : Chanel ID. To bind the client to a channel. Optional. 80 * 81 * [--goods=<goods>] 82 * : Goods. To set the type of demo products. For a list of current options, contact your manager. Optional. 83 * --- 84 * default: apparel 85 * options: 86 * - apparel 87 * - health 88 * - electronics 89 * - jewelry 90 * - food_ecommerce 91 * - food_restaurant 92 * --- 93 * 94 */ 95 function create_store( $args, $assoc_args ) { 96 97 $params = $assoc_args; 98 $is_set_user = ! empty( WP_CLI::get_config( 'user' ) ); 99 100 if ( empty( $params['email'] ) && ! $is_set_user ) { 101 WP_CLI::error( 'Email is required', true ); 102 } 103 104 if ( empty( $params['name'] ) && ! $is_set_user ) { 105 WP_CLI::error( 'Name is required', true ); 106 } 107 108 $result = ecwid_create_store( $params ); 109 110 $data = json_decode( $result['body'] ); 111 $is_store_created = is_array( $result ) && $result['response']['code'] == 200; 112 113 if( $is_store_created ) { 114 WP_CLI::success( 'Store created: ' . $data->id ); 115 } else { 116 WP_CLI::error( 'Store creation failed: [' . $result['response']['code'] . '] ' . $data->errorCode . ' : ' . $data->errorMessage, true ); 117 } 118 } 119 65 120 } 66 121 -
ecwid-shopping-cart/tags/6.12.23/includes/importer/class-ecwid-import-page.php
r3183692 r3202954 105 105 } 106 106 107 public function is_ajax_request() { 108 return ! empty( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) ) == 'xmlhttprequest'; 109 } 110 107 111 public function do_woo_import() { 108 112 check_ajax_referer( self::AJAX_ACTION_DO_WOO_IMPORT ); 113 114 if( ! $this->is_ajax_request() ) { 115 die(); 116 } 109 117 110 118 if ( ! current_user_can( 'manage_options' ) ) { -
ecwid-shopping-cart/tags/6.12.23/lib/ecwid_api_v3.php
r3131402 r3202954 743 743 } 744 744 745 public function create_store( ) {745 public function create_store( $params = array() ) { 746 746 global $current_user; 747 747 $admin_email = $current_user->user_email; … … 751 751 $admin_first = get_user_meta( $current_user->ID, 'nickname', true ); 752 752 } 753 753 754 $admin_last = get_user_meta( $current_user->ID, 'last_name', true ); 754 755 if ( ! $admin_last ) { 755 756 $admin_last = get_user_meta( $current_user->ID, 'nickname', true ); 756 757 } 757 $admin_name = "$admin_first $admin_last"; 758 $admin_n ickname = $current_user->display_name;758 759 $admin_name = implode( ' ', array($admin_first, $admin_last) ); 759 760 $store_url = Ecwid_Store_Page::get_store_url(); 760 761 $site_name = get_bloginfo( 'name' ); … … 762 763 $timezone = get_option( 'timezone_string', 'UTC+0' ); 763 764 764 $params = array( 765 if( !empty( $params['email'] ) ) { 766 $admin_email = $params['email']; 767 } 768 769 if( !empty( $params['name'] ) ) { 770 $admin_name = $params['name']; 771 } 772 773 if( !empty( $params['password'] ) ) { 774 $password = $params['password']; 775 } else { 776 $password = wp_generate_password( 8 ); 777 } 778 779 $data = array( 765 780 'merchant' => array( 766 781 'email' => $admin_email, 767 782 'name' => $admin_name, 768 'password' => wp_generate_password( 8 ),783 'password' => $password, 769 784 ), 770 785 'affiliatePartner' => array( … … 777 792 'account' => array( 778 793 'accountName' => $admin_name, 779 'accountNickName' => $admin_nickname,780 794 'accountEmail' => $admin_email, 781 795 ), … … 793 807 ); 794 808 809 if( !empty( $params['channel_id'] ) ) { 810 $data['merchant']['channelId'] = $params['channel_id']; 811 } 812 813 if( !empty( $params['goods'] ) ) { 814 $data['profile']['registrationAnswers']['goods'] = $params['goods']; 815 } 816 795 817 if ( isset( $_SERVER['REMOTE_ADDR'] ) && ! in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1' ) ) ) { 796 $ params['merchant']['ip'] = sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) );818 $data['merchant']['ip'] = sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ); 797 819 } 798 820 … … 800 822 801 823 if ( $ref ) { 802 $ params['affiliatePartner']['ambassador'] = array(824 $data['affiliatePartner']['ambassador'] = array( 803 825 'ref' => $ref, 804 826 ); … … 814 836 $result = EcwidPlatform::http_post_request( 815 837 $url, 816 json_encode( $ params),838 json_encode( $data ), 817 839 array( 818 840 'timeout' => 20, -
ecwid-shopping-cart/tags/6.12.23/lib/ecwid_platform.php
r3116030 r3202954 257 257 258 258 if ( is_object( $item ) || is_array( $item ) ) { 259 array_walk_recursive( $item, ' self::encode_emoji' );259 array_walk_recursive( $item, 'EcwidPlatform::encode_emoji' ); 260 260 } elseif ( is_string( $item ) ) { 261 261 $item = wp_encode_emoji( $item ); -
ecwid-shopping-cart/tags/6.12.23/readme.txt
r3183712 r3202954 6 6 Requires at least: 4.4 7 7 Tested up to: 6.7 8 Stable tag: 6.12.2 28 Stable tag: 6.12.23 9 9 10 10 Powerful, easy to use ecommerce shopping cart for WordPress. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available. … … 154 154 155 155 == Changelog == 156 = 6.12.23 - Dec 5, 2024 = 157 - Fixed a PHP error message ("Deprecated: Use of "self" in callables is deprecated") for PHP versions since 8.2. 158 - Internal improvements and optimizations. 159 156 160 = 6.12.22 - Nov 7, 2024 = 157 161 - **WordPress 6.7 and Twenty Twenty Five theme compatibility.** The new WordPress version will be released soon. The Ecwid ecommerce shopping cart plugin is ready for the new release — everything works well in your WordPress admin and storefront pages. Feel free to upgrade your site to WordPress 6.7 and try a new theme. -
ecwid-shopping-cart/trunk/ecwid-shopping-cart.php
r3183692 r3202954 6 6 Text Domain: ecwid-shopping-cart 7 7 Author: Ecwid Ecommerce 8 Version: 6.12.2 28 Version: 6.12.23 9 9 Author URI: https://ecwid.to/ecwid-site 10 10 License: GPLv2 or later … … 57 57 add_action( 'wp_ajax_ecwid_hide_message', 'ecwid_ajax_hide_message' ); 58 58 add_action( 'wp_ajax_ecwid_reset_categories_cache', 'ecwid_reset_categories_cache' ); 59 add_action( 'wp_ajax_ecwid_create_store', 'ecwid_ create_store' );59 add_action( 'wp_ajax_ecwid_create_store', 'ecwid_ajax_create_store' ); 60 60 add_action( 'wp_ajax_ecwid_sync_products', 'ecwid_sync_products' ); 61 61 … … 2200 2200 } 2201 2201 2202 function ecwid_create_store( ) {2202 function ecwid_create_store( $params = array() ) { 2203 2203 $api = new Ecwid_Api_V3(); 2204 2204 2205 $result = $api->create_store(); 2206 2207 if ( is_array( $result ) && $result['response']['code'] == 200 ) { 2205 $result = $api->create_store( $params ); 2206 2207 $is_store_created = is_array( $result ) && $result['response']['code'] == 200; 2208 2209 if ( $is_store_created ) { 2208 2210 $data = json_decode( $result['body'] ); 2209 2211 2210 ecwid_update_store_id( $data->id);2212 ecwid_update_store_id( $data->id ); 2211 2213 2212 2214 $api->save_token( $data->token ); … … 2215 2217 2216 2218 update_option( 'ecwid_oauth_scope', 'read_profile ' . Ecwid_OAuth::SCOPE_READ_CATALOG . ' create_catalog update_catalog allow_sso create_customers public_storefront' ); 2217 2219 } 2220 2221 return $result; 2222 } 2223 2224 function ecwid_ajax_create_store() { 2225 $result = ecwid_create_store(); 2226 $is_store_created = is_array( $result ) && $result['response']['code'] == 200; 2227 2228 if( $is_store_created ) { 2218 2229 header( 'HTTP/1.1 200 OK' ); 2219 2230 } elseif ( is_wp_error( $result ) ) { 2231 header( 'HTTP/1.1 409 Error' ); 2220 2232 } else { 2221 2222 if( is_wp_error( $result ) ) {2223 header( 'HTTP/1.1 409 Error' );2224 die();2225 }2226 2227 2233 header( 'HTTP/1.1 ' . $result['response']['code'] . ' ' . $result['response']['message'] ); 2228 die(); 2229 } 2234 } 2235 2236 die(); 2230 2237 } 2231 2238 -
ecwid-shopping-cart/trunk/includes/class-ec-store-wp-cli.php
r2514476 r3202954 63 63 } 64 64 65 /** 66 * Create a new store. It will automatically connect to the plugin. 67 * ## OPTIONS 68 * 69 * [--email] 70 * : Client email. Required. 71 * 72 * [--name] 73 * : Client name. Required. 74 * 75 * [--password] 76 * : Client password. Optional, if not set, it will be generated automatically. 77 * 78 * [--channel_id] 79 * : Chanel ID. To bind the client to a channel. Optional. 80 * 81 * [--goods=<goods>] 82 * : Goods. To set the type of demo products. For a list of current options, contact your manager. Optional. 83 * --- 84 * default: apparel 85 * options: 86 * - apparel 87 * - health 88 * - electronics 89 * - jewelry 90 * - food_ecommerce 91 * - food_restaurant 92 * --- 93 * 94 */ 95 function create_store( $args, $assoc_args ) { 96 97 $params = $assoc_args; 98 $is_set_user = ! empty( WP_CLI::get_config( 'user' ) ); 99 100 if ( empty( $params['email'] ) && ! $is_set_user ) { 101 WP_CLI::error( 'Email is required', true ); 102 } 103 104 if ( empty( $params['name'] ) && ! $is_set_user ) { 105 WP_CLI::error( 'Name is required', true ); 106 } 107 108 $result = ecwid_create_store( $params ); 109 110 $data = json_decode( $result['body'] ); 111 $is_store_created = is_array( $result ) && $result['response']['code'] == 200; 112 113 if( $is_store_created ) { 114 WP_CLI::success( 'Store created: ' . $data->id ); 115 } else { 116 WP_CLI::error( 'Store creation failed: [' . $result['response']['code'] . '] ' . $data->errorCode . ' : ' . $data->errorMessage, true ); 117 } 118 } 119 65 120 } 66 121 -
ecwid-shopping-cart/trunk/includes/importer/class-ecwid-import-page.php
r3183692 r3202954 105 105 } 106 106 107 public function is_ajax_request() { 108 return ! empty( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) ) == 'xmlhttprequest'; 109 } 110 107 111 public function do_woo_import() { 108 112 check_ajax_referer( self::AJAX_ACTION_DO_WOO_IMPORT ); 113 114 if( ! $this->is_ajax_request() ) { 115 die(); 116 } 109 117 110 118 if ( ! current_user_can( 'manage_options' ) ) { -
ecwid-shopping-cart/trunk/lib/ecwid_api_v3.php
r3131402 r3202954 743 743 } 744 744 745 public function create_store( ) {745 public function create_store( $params = array() ) { 746 746 global $current_user; 747 747 $admin_email = $current_user->user_email; … … 751 751 $admin_first = get_user_meta( $current_user->ID, 'nickname', true ); 752 752 } 753 753 754 $admin_last = get_user_meta( $current_user->ID, 'last_name', true ); 754 755 if ( ! $admin_last ) { 755 756 $admin_last = get_user_meta( $current_user->ID, 'nickname', true ); 756 757 } 757 $admin_name = "$admin_first $admin_last"; 758 $admin_n ickname = $current_user->display_name;758 759 $admin_name = implode( ' ', array($admin_first, $admin_last) ); 759 760 $store_url = Ecwid_Store_Page::get_store_url(); 760 761 $site_name = get_bloginfo( 'name' ); … … 762 763 $timezone = get_option( 'timezone_string', 'UTC+0' ); 763 764 764 $params = array( 765 if( !empty( $params['email'] ) ) { 766 $admin_email = $params['email']; 767 } 768 769 if( !empty( $params['name'] ) ) { 770 $admin_name = $params['name']; 771 } 772 773 if( !empty( $params['password'] ) ) { 774 $password = $params['password']; 775 } else { 776 $password = wp_generate_password( 8 ); 777 } 778 779 $data = array( 765 780 'merchant' => array( 766 781 'email' => $admin_email, 767 782 'name' => $admin_name, 768 'password' => wp_generate_password( 8 ),783 'password' => $password, 769 784 ), 770 785 'affiliatePartner' => array( … … 777 792 'account' => array( 778 793 'accountName' => $admin_name, 779 'accountNickName' => $admin_nickname,780 794 'accountEmail' => $admin_email, 781 795 ), … … 793 807 ); 794 808 809 if( !empty( $params['channel_id'] ) ) { 810 $data['merchant']['channelId'] = $params['channel_id']; 811 } 812 813 if( !empty( $params['goods'] ) ) { 814 $data['profile']['registrationAnswers']['goods'] = $params['goods']; 815 } 816 795 817 if ( isset( $_SERVER['REMOTE_ADDR'] ) && ! in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1' ) ) ) { 796 $ params['merchant']['ip'] = sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) );818 $data['merchant']['ip'] = sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ); 797 819 } 798 820 … … 800 822 801 823 if ( $ref ) { 802 $ params['affiliatePartner']['ambassador'] = array(824 $data['affiliatePartner']['ambassador'] = array( 803 825 'ref' => $ref, 804 826 ); … … 814 836 $result = EcwidPlatform::http_post_request( 815 837 $url, 816 json_encode( $ params),838 json_encode( $data ), 817 839 array( 818 840 'timeout' => 20, -
ecwid-shopping-cart/trunk/lib/ecwid_platform.php
r3116030 r3202954 257 257 258 258 if ( is_object( $item ) || is_array( $item ) ) { 259 array_walk_recursive( $item, ' self::encode_emoji' );259 array_walk_recursive( $item, 'EcwidPlatform::encode_emoji' ); 260 260 } elseif ( is_string( $item ) ) { 261 261 $item = wp_encode_emoji( $item ); -
ecwid-shopping-cart/trunk/readme.txt
r3183712 r3202954 6 6 Requires at least: 4.4 7 7 Tested up to: 6.7 8 Stable tag: 6.12.2 28 Stable tag: 6.12.23 9 9 10 10 Powerful, easy to use ecommerce shopping cart for WordPress. Sell on Facebook and Instagram. iPhone & Android apps. Superb support. Free plan available. … … 154 154 155 155 == Changelog == 156 = 6.12.23 - Dec 5, 2024 = 157 - Fixed a PHP error message ("Deprecated: Use of "self" in callables is deprecated") for PHP versions since 8.2. 158 - Internal improvements and optimizations. 159 156 160 = 6.12.22 - Nov 7, 2024 = 157 161 - **WordPress 6.7 and Twenty Twenty Five theme compatibility.** The new WordPress version will be released soon. The Ecwid ecommerce shopping cart plugin is ready for the new release — everything works well in your WordPress admin and storefront pages. Feel free to upgrade your site to WordPress 6.7 and try a new theme.
Note: See TracChangeset
for help on using the changeset viewer.