Changeset 2337209
- Timestamp:
- 07/08/2020 09:54:02 AM (6 years ago)
- Location:
- mobile-builder/trunk
- Files:
-
- 6 edited
-
README.txt (modified) (1 diff)
-
api/class-mobile-builder-cart.php (modified) (11 diffs)
-
includes/libraries/class-mobile-builder-public-key.php (modified) (6 diffs)
-
mobile-builder.php (modified) (1 diff)
-
product/class-mobile-builder-product.php (modified) (4 diffs)
-
public/class-mobile-builder-public.php (modified) (48 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mobile-builder/trunk/README.txt
r2249631 r2337209 45 45 = 1.0 = 46 46 * Initial release. 47 48 = 1.0.6 = 49 * Add wc validation in the add_to_cart function (Thanks @raaquino) 50 * Get checkout user location config -
mobile-builder/trunk/api/class-mobile-builder-cart.php
r2332656 r2337209 132 132 133 133 register_rest_route( $this->namespace, 'analytic', array( 134 'methods' => WP_REST_Server::CREATABLE,135 'callback' => array( $this, 'analytic' ),134 'methods' => WP_REST_Server::CREATABLE, 135 'callback' => array( $this, 'analytic' ), 136 136 ) ); 137 137 … … 142 142 143 143 $data = array( 144 "authStatus" => false,145 "WooCommerce" => false,146 "wcfm" => class_exists( 'WCFM' ),147 "jwtAuthKey" => defined('MOBILE_BUILDER_JWT_SECRET_KEY'),148 "googleMapApiKey" => defined('MOBILE_BUILDER_GOOGLE_API_KEY'),149 "facebookAppId" => defined('MOBILE_BUILDER_FB_APP_ID'),150 "facebookAppSecret" => defined( 'MOBILE_BUILDER_FB_APP_SECRET'),151 "oneSignalId" => defined('MOBILE_BUILDER_ONESIGNAL_APP_ID'),152 "oneSignalApiKey" => defined('MOBILE_BUILDER_ONESIGNAL_API_KEY'),144 "authStatus" => false, 145 "WooCommerce" => false, 146 "wcfm" => class_exists( 'WCFM' ), 147 "jwtAuthKey" => defined( 'MOBILE_BUILDER_JWT_SECRET_KEY' ), 148 "googleMapApiKey" => defined( 'MOBILE_BUILDER_GOOGLE_API_KEY' ), 149 "facebookAppId" => defined( 'MOBILE_BUILDER_FB_APP_ID' ), 150 "facebookAppSecret" => defined( 'MOBILE_BUILDER_FB_APP_SECRET' ), 151 "oneSignalId" => defined( 'MOBILE_BUILDER_ONESIGNAL_APP_ID' ), 152 "oneSignalApiKey" => defined( 'MOBILE_BUILDER_ONESIGNAL_API_KEY' ), 153 153 ); 154 154 … … 166 166 public function auto_login( $request ) { 167 167 168 $theme = $request->get_param( 'theme' );168 $theme = $request->get_param( 'theme' ); 169 169 $currency = $request->get_param( 'currency' ); 170 170 … … 299 299 $variation = $request->get_param( 'variation' ); 300 300 $cart_item_data = $request->get_param( 'cart_item_data' ); 301 302 $cart_item_key = WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variation, $cart_item_data ); 303 304 if ( ! $cart_item_key ) { 305 return new WP_Error( 'add_to_cart', "Can't add product item to cart.", array( 306 'status' => 403, 307 ) ); 308 } 309 310 return WC()->cart->get_cart_item( $cart_item_key ); 301 $passed_validation = false; 302 303 $passed_validation = apply_filters('woocommerce_add_to_cart_validation', true, $product_id, $quantity); 304 305 if($passed_validation){ 306 307 $cart_item_key = WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variation, $cart_item_data ); 308 309 } 310 311 if (! $passed_validation || ! $cart_item_key ){ 312 //if validation failed or add to cart failed, return response from woocommerce 313 return new WP_Error( 'add_to_cart', htmlspecialchars_decode(strip_tags(wc_print_notices(true))), array( 314 'status' => 403, 315 ) ); 316 } 317 318 319 return WC()->cart->get_cart_item( $cart_item_key ); 320 311 321 } catch ( \Exception $e ) { 312 322 //do something when exception is thrown … … 362 372 363 373 if ( WC()->cart->is_empty() && ! is_customize_preview() && apply_filters( 'woocommerce_checkout_update_order_review_expired', true ) ) { 364 return new WP_Error( 404, 'Sorry, your session has expired.');374 return new WP_Error( 404, __( 'Sorry, your session has expired.', "mobile-builder" ) ); 365 375 } 366 376 … … 556 566 return new WP_Error( 557 567 'set_quantity_error', 558 'Cart item key not exist.'568 __( 'Cart item key not exist.', "mobile-builder" ) 559 569 ); 560 570 } … … 563 573 return new WP_Error( 564 574 'set_quantity_error', 565 'The quantity not validate'575 __( 'The quantity not validate', "mobile-builder" ) 566 576 ); 567 577 } … … 595 605 return new WP_Error( 596 606 'remove_cart_item', 597 'Cart item key not exist.'607 __( 'Cart item key not exist.', "mobile-builder" ) 598 608 ); 599 609 } … … 629 639 return new WP_Error( 630 640 'add_discount', 631 'Coupon not exist.'641 __( 'Coupon not exist.', "mobile-builder" ) 632 642 ); 633 643 } … … 662 672 return new WP_Error( 663 673 'remove_coupon', 664 'Coupon not exist.'674 __( 'Coupon not exist.', "mobile-builder" ) 665 675 ); 666 676 } … … 695 705 696 706 if ( ! $isLogin ) { 697 return new WP_Error( 'mobile_builder_can_not_add_to_cart', __( 'Sorry, you need login to add to cart.', 'mobile _builder' ) );707 return new WP_Error( 'mobile_builder_can_not_add_to_cart', __( 'Sorry, you need login to add to cart.', 'mobile-builder' ) ); 698 708 } 699 709 -
mobile-builder/trunk/includes/libraries/class-mobile-builder-public-key.php
r2303204 r2337209 21 21 22 22 if ( ! isset( $decodedPublicKeys['keys'] ) || count( $decodedPublicKeys['keys'] ) < 1 ) { 23 throw new Exception( 'Invalid key format.');23 throw new Exception( __('Invalid key format.', "mobile-builder") ); 24 24 } 25 25 … … 27 27 28 28 if ( $key === false ) { 29 throw new UnexpectedValueException( '"kid" empty, unable to lookup correct key');29 throw new UnexpectedValueException( __('"kid" empty, unable to lookup correct key', "mobile-builder") ); 30 30 } 31 31 … … 35 35 36 36 if ( ! isset( $publicKeyDetails['key'] ) ) { 37 throw new Exception( 'Invalid public key details.');37 throw new Exception( __('Invalid public key details.', "mobile-builder") ); 38 38 } 39 39 … … 60 60 private static function parseKey( array $jwk ) { 61 61 if ( empty( $jwk ) ) { 62 throw new InvalidArgumentException( 'JWK must not be empty');62 throw new InvalidArgumentException( __('JWK must not be empty', "mobile-builder") ); 63 63 } 64 64 if ( ! isset( $jwk['kty'] ) ) { 65 throw new UnexpectedValueException( 'JWK must contain a "kty" parameter');65 throw new UnexpectedValueException( __('JWK must contain a "kty" parameter', "mobile-builder") ); 66 66 } 67 67 … … 69 69 case 'RSA': 70 70 if ( \array_key_exists( 'd', $jwk ) ) { 71 throw new UnexpectedValueException( 'RSA private keys are not supported');71 throw new UnexpectedValueException( __('RSA private keys are not supported', "mobile-builder") ); 72 72 } 73 73 if ( ! isset( $jwk['n'] ) || ! isset( $jwk['e'] ) ) { 74 throw new UnexpectedValueException( 'RSA keys must contain values for both "n" and "e"');74 throw new UnexpectedValueException( __('RSA keys must contain values for both "n" and "e"', "mobile-builder") ); 75 75 } 76 76 … … 79 79 if ( false === $publicKey ) { 80 80 throw new DomainException( 81 'OpenSSL error: '. \openssl_error_string()81 __('OpenSSL error: ', "mobile-builder") . \openssl_error_string() 82 82 ); 83 83 } -
mobile-builder/trunk/mobile-builder.php
r2333323 r2337209 11 11 * Plugin URI: https://doc-oreo.rnlab.io 12 12 * Description: The most advanced drag & drop app builder. Create multi templates and app controls. 13 * Version: 1.0. 513 * Version: 1.0.6 14 14 * Author: Rnlab.io 15 15 * Author URI: https://rnlab.io -
mobile-builder/trunk/product/class-mobile-builder-product.php
r2332301 r2337209 124 124 $data = []; 125 125 foreach ( $response->data as $key => $item ) { 126 $index = array_search( $item['id'], array_column( $gmw_locations, 'object_id') );126 $index = array_search( $item['id'], array_column( $gmw_locations, 'object_id' ) ); 127 127 $item['distance_matrix'] = $distance_matrix[ $index ]; 128 128 $data[] = $item; … … 208 208 return new WP_Error( 209 209 "product_id", 210 "Product ID not provider.",210 __( "Product ID not provider.", "mobile-builder" ), 211 211 array( 212 212 'status' => 403, … … 227 227 // echo $request->get_param('lat'); die; 228 228 229 $type = $response->data['type'];230 231 if ( $type == 'variable' ){232 $price_min = $object->get_variation_price();233 $price_max = $object->get_variation_price('max');229 $type = $response->data['type']; 230 231 if ( $type == 'variable' ) { 232 $price_min = $object->get_variation_price(); 233 $price_max = $object->get_variation_price( 'max' ); 234 234 $response->data['price_min'] = $price_min; 235 235 $response->data['price_max'] = $price_max; … … 242 242 243 243 if ( $type == 'grouped' || $type == 'variable' ) { 244 244 245 245 foreach ( $woocommerce_wpml->settings['currencies_order'] as $currency ) { 246 246 -
mobile-builder/trunk/public/class-mobile-builder-public.php
r2333323 r2337209 294 294 if ( count( $users ) > 0 ) { 295 295 $error = new WP_Error(); 296 $error->add( 403, "Your phone number already exist in database!", array( 'status' => 400 ) );296 $error->add( 403, __( "Your phone number already exist in database!", "mobile-builder" ), array( 'status' => 400 ) ); 297 297 298 298 return $error; 299 299 } 300 300 301 return new WP_REST_Response( array( "data" => "Phone number not exits!"), 200 );301 return new WP_REST_Response( array( "data" => __( "Phone number not exits!", "mobile-builder" ) ), 200 ); 302 302 } 303 303 … … 305 305 if ( count( $users ) == 0 ) { 306 306 $error = new WP_Error(); 307 $error->add( 403, "Your phone number not exist in database!", array( 'status' => 400 ) );307 $error->add( 403, __( "Your phone number not exist in database!", "mobile-builder" ), array( 'status' => 400 ) ); 308 308 309 309 return $error; 310 310 } 311 311 312 return new WP_REST_Response( array( "data" => "Phone number number exist!"), 200 );312 return new WP_REST_Response( array( "data" => __( "Phone number number exist!", "mobile-builder" ) ), 200 ); 313 313 } 314 314 … … 331 331 wp_send_json_error( new WP_Error( 332 332 404, 333 'Something wrong!.',333 __( 'Something wrong!.', "mobile-builder" ), 334 334 array( 335 335 'status' => 403, … … 438 438 // Perform Pre Checks 439 439 if ( ! class_exists( 'WooCommerce' ) ) { 440 $error->add( 400, __( "Failed to process payment. WooCommerce either missing or deactivated.", ' rnlab-rest-payment' ), array( 'status' => 400 ) );440 $error->add( 400, __( "Failed to process payment. WooCommerce either missing or deactivated.", 'mobile-builder' ), array( 'status' => 400 ) ); 441 441 442 442 return $error; 443 443 } 444 444 if ( empty( $order_id ) ) { 445 $error->add( 401, __( "Order ID 'order_id' is required.", ' rnlab-rest-payment' ), array( 'status' => 400 ) );445 $error->add( 401, __( "Order ID 'order_id' is required.", 'mobile-builder' ), array( 'status' => 400 ) ); 446 446 447 447 return $error; 448 448 } else if ( wc_get_order( $order_id ) == false ) { 449 $error->add( 402, __( "Order ID 'order_id' is invalid. Order does not exist.", ' rnlab-rest-payment' ), array( 'status' => 400 ) );449 $error->add( 402, __( "Order ID 'order_id' is invalid. Order does not exist.", 'mobile-builder' ), array( 'status' => 400 ) ); 450 450 451 451 return $error; 452 452 } else if ( wc_get_order( $order_id )->get_status() !== 'pending' && wc_get_order( $order_id )->get_status() !== 'failed' ) { 453 $error->add( 403, __( "Order status is '" . wc_get_order( $order_id )->get_status() . "', meaning it had already received a successful payment. Duplicate payments to the order is not allowed. The allow status it is either 'pending' or 'failed'. ", ' rnlab-rest-payment' ), array( 'status' => 400 ) );453 $error->add( 403, __( "Order status is '" . wc_get_order( $order_id )->get_status() . "', meaning it had already received a successful payment. Duplicate payments to the order is not allowed. The allow status it is either 'pending' or 'failed'. ", 'mobile-builder' ), array( 'status' => 400 ) ); 454 454 455 455 return $error; 456 456 } 457 457 if ( empty( $payment_method ) ) { 458 $error->add( 404, __( "Payment Method 'payment_method' is required.", ' rnlab-rest-payment' ), array( 'status' => 400 ) );458 $error->add( 404, __( "Payment Method 'payment_method' is required.", 'mobile-builder' ), array( 'status' => 400 ) ); 459 459 460 460 return $error; … … 470 470 471 471 if ( empty( $gateway ) ) { 472 $error->add( 405, __( "Failed to process payment. WooCommerce Gateway '" . $payment_method . "' is missing.", ' rnlab-rest-payment' ), array( 'status' => 400 ) );472 $error->add( 405, __( "Failed to process payment. WooCommerce Gateway '" . $payment_method . "' is missing.", 'mobile-builder' ), array( 'status' => 400 ) ); 473 473 474 474 return $error; 475 475 } else { 476 $error->add( 406, __( "Failed to process payment. WooCommerce Gateway '" . $payment_method . "' exists, but is not available.", ' rnlab-rest-payment' ), array( 'status' => 400 ) );476 $error->add( 406, __( "Failed to process payment. WooCommerce Gateway '" . $payment_method . "' exists, but is not available.", 'mobile-builder' ), array( 'status' => 400 ) ); 477 477 478 478 return $error; 479 479 } 480 480 } else if ( ! has_filter( 'rnlab_pre_process_' . $payment_method . '_payment' ) ) { 481 $error->add( 407, __( "Failed to process payment. WooCommerce Gateway '" . $payment_method . "' exists, but 'REST Payment - " . $payment_method . "' is not available.", ' rnlab-rest-payment' ), array( 'status' => 400 ) );481 $error->add( 407, __( "Failed to process payment. WooCommerce Gateway '" . $payment_method . "' exists, but 'REST Payment - " . $payment_method . "' is not available.", 'mobile-builder' ), array( 'status' => 400 ) ); 482 482 483 483 return $error; … … 496 496 if ( $payment_result['result'] === "success" ) { 497 497 $response['code'] = 200; 498 $response['message'] = __( "Payment Successful.", " rnlab-rest-payment" );498 $response['message'] = __( "Payment Successful.", "mobile-builder" ); 499 499 $response['data'] = $payment_result; 500 500 … … 502 502 return new WP_REST_Response( $response, 200 ); 503 503 } else { 504 return new WP_Error( 500, 'Payment Failed, Check WooCommerce Status Log for further information.', $payment_result );504 return new WP_Error( 500, __( 'Payment Failed, Check WooCommerce Status Log for further information.', "mobile-builder" ), $payment_result ); 505 505 } 506 506 } else { 507 return new WP_Error( 408, 'Payment Failed, Pre Process Failed.', $parameters['pre_process_result'] );507 return new WP_Error( 408, __( 'Payment Failed, Pre Process Failed.', "mobile-builder" ), $parameters['pre_process_result'] ); 508 508 } 509 509 … … 526 526 if ( $payment_result['result'] === "success" ) { 527 527 $response['code'] = 200; 528 $response['message'] = __( "Your Payment was Successful", " rnlab-rest-payment" );528 $response['message'] = __( "Your Payment was Successful", "mobile-builder" ); 529 529 $response['redirect'] = $payment_result['redirect']; 530 530 } else { 531 531 $response['code'] = 401; 532 $response['message'] = __( "Please enter valid card details", " rnlab-rest-payment" );532 $response['message'] = __( "Please enter valid card details", "mobile-builder" ); 533 533 } 534 534 … … 545 545 546 546 if ( empty( $order_id ) ) { 547 $error->add( 401, __( "Order ID 'order_id' is required.", ' rnlab-rest-payment' ), array( 'status' => 400 ) );547 $error->add( 401, __( "Order ID 'order_id' is required.", 'mobile-builder' ), array( 'status' => 400 ) ); 548 548 549 549 return $error; 550 550 } else if ( wc_get_order( $order_id ) == false ) { 551 $error->add( 402, __( "Order ID 'order_id' is invalid. Order does not exist.", ' rnlab-rest-payment' ),551 $error->add( 402, __( "Order ID 'order_id' is invalid. Order does not exist.", 'mobile-builder' ), 552 552 array( 'status' => 400 ) ); 553 553 … … 556 556 557 557 if ( empty( $stripe_source ) ) { 558 $error->add( 404, __( "Payment source 'stripe_source' is required.", ' rnlab-rest-payment' ),558 $error->add( 404, __( "Payment source 'stripe_source' is required.", 'mobile-builder' ), 559 559 array( 'status' => 400 ) ); 560 560 … … 577 577 if ( $payment_result['result'] === "success" ) { 578 578 $response['code'] = 200; 579 $response['message'] = __( "Your Payment was Successful", " rnlab-rest-payment" );579 $response['message'] = __( "Your Payment was Successful", "mobile-builder" ); 580 580 581 581 // $order = wc_get_order( $order_id ); … … 588 588 } else { 589 589 $response['code'] = 401; 590 $response['message'] = __( "Please enter valid card details", " rnlab-rest-payment" );590 $response['message'] = __( "Please enter valid card details", "mobile-builder" ); 591 591 } 592 592 … … 643 643 return new WP_Error( 644 644 'user_not_login', 645 'Please login first.',645 __( 'Please login first.', "mobile-builder" ), 646 646 array( 647 647 'status' => 403, … … 691 691 return new WP_Error( 692 692 'user_not_login', 693 'Please login first.',693 __( 'Please login first.', "mobile-builder" ), 694 694 array( 695 695 'status' => 403, … … 752 752 753 753 $result = array( 754 'language' => $default_lang, 755 'languages' => $languages, 756 'currencies' => $currencies, 757 'currency' => $currency, 758 'enable_guest_checkout' => get_option( 'woocommerce_enable_guest_checkout', true ), 759 'timezone_string' => get_option( 'timezone_string' ) ? get_option( 'timezone_string' ) : wc_timezone_string(), 760 'date_format' => get_option( 'date_format' ), 761 'time_format' => get_option( 'time_format' ), 762 'configs' => maybe_unserialize( $configs ), 763 'default_location' => $gmw['post_types_settings'], 764 'templates' => $decode ? $templates : $templates_data, 765 ); 754 'language' => $default_lang, 755 'languages' => $languages, 756 'currencies' => $currencies, 757 'currency' => $currency, 758 'enable_guest_checkout' => get_option( 'woocommerce_enable_guest_checkout', true ), 759 'timezone_string' => get_option( 'timezone_string' ) ? get_option( 'timezone_string' ) : wc_timezone_string(), 760 'date_format' => get_option( 'date_format' ), 761 'time_format' => get_option( 'time_format' ), 762 'configs' => maybe_unserialize( $configs ), 763 'default_location' => $gmw['post_types_settings'], 764 'templates' => $decode ? $templates : $templates_data, 765 'checkout_user_location' => apply_filters( 'wcfmmp_is_allow_checkout_user_location', true ), 766 ); 766 767 767 768 wp_cache_set( 'settings_' . $decode, $result, 'rnlab' ); … … 771 772 return new WP_Error( 772 773 'error_setting', 773 'Some thing wrong.',774 __( 'Some thing wrong.', "mobile-builder" ), 774 775 array( 775 776 'status' => 403, … … 799 800 return new WP_Error( 800 801 'create_token_error', 801 'You did not create user wp_auth_user',802 __( 'You did not create user wp_auth_user', "mobile-builder" ), 802 803 array( 803 804 'status' => 403, … … 820 821 821 822 if ( empty( $user_login ) || ! is_string( $user_login ) ) { 822 $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Enter a username or email address.' ) );823 $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Enter a username or email address.', "mobile-builder" ) ); 823 824 } elseif ( strpos( $user_login, '@' ) ) { 824 825 $user_data = get_user_by( 'email', trim( wp_unslash( $user_login ) ) ); 825 826 if ( empty( $user_data ) ) { 826 827 $errors->add( 'invalid_email', 827 __( '<strong>ERROR</strong>: There is no account with that username or email address.' ) );828 __( '<strong>ERROR</strong>: There is no account with that username or email address.', "mobile-builder" ) ); 828 829 } 829 830 } else { … … 838 839 if ( ! $user_data ) { 839 840 $errors->add( 'invalidcombo', 840 __( '<strong>ERROR</strong>: There is no account with that username or email address.' ) );841 __( '<strong>ERROR</strong>: There is no account with that username or email address.', "mobile-builder" ) ); 841 842 842 843 return $errors; … … 862 863 } 863 864 864 $message = __( 'Someone has requested a password reset for the following account:' ) . "\r\n\r\n";865 $message = __( 'Someone has requested a password reset for the following account:', "mobile-builder" ) . "\r\n\r\n"; 865 866 /* translators: %s: site name */ 866 $message .= sprintf( __( 'Site Name: %s' ), $site_name ) . "\r\n\r\n";867 $message .= sprintf( __( 'Site Name: %s', "mobile-builder" ), $site_name ) . "\r\n\r\n"; 867 868 /* translators: %s: user login */ 868 $message .= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n\r\n";869 $message .= __( 'If this was a mistake, just ignore this email and nothing will happen.' ) . "\r\n\r\n";870 $message .= __( 'To reset your password, visit the following address:' ) . "\r\n\r\n";869 $message .= sprintf( __( 'Username: %s', "mobile-builder" ), $user_login ) . "\r\n\r\n"; 870 $message .= __( 'If this was a mistake, just ignore this email and nothing will happen.', "mobile-builder" ) . "\r\n\r\n"; 871 $message .= __( 'To reset your password, visit the following address:', "mobile-builder" ) . "\r\n\r\n"; 871 872 $message .= '<' . network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 872 873 'login' ) . ">\r\n"; 873 874 874 875 /* translators: Password reset notification email subject. %s: Site title */ 875 $title = sprintf( __( '[%s] Password Reset' ), $site_name );876 $title = sprintf( __( '[%s] Password Reset', "mobile-builder" ), $site_name ); 876 877 877 878 /** … … 907 908 return new WP_Error( 908 909 'send_email', 909 'Possible reason: your host may have disabled the mail() function.',910 __( 'Possible reason: your host may have disabled the mail() function.', "mobile-builder" ), 910 911 array( 911 912 'status' => 403, … … 946 947 return new WP_Error( 947 948 "email", 948 "Your input email not valid or exist in database.",949 __( "Your input email not valid or exist in database.", "mobile-builder" ), 949 950 array( 950 951 'status' => 403, … … 957 958 return new WP_Error( 958 959 "name", 959 "Your username exist.",960 __( "Your username exist.", "mobile-builder" ), 960 961 array( 961 962 'status' => 403, … … 964 965 } 965 966 966 return array( "message" => "success!");967 return array( "message" => __( "success!", "mobile-builder" ) ); 967 968 } 968 969 … … 988 989 return new WP_Error( 989 990 "email", 990 "Your input email not valid or exist in database.",991 __( "Your input email not valid or exist in database.", "mobile-builder" ), 991 992 array( 992 993 'status' => 403, … … 999 1000 return new WP_Error( 1000 1001 "name", 1001 "Your username exist.",1002 __( "Your username exist.", "mobile-builder" ), 1002 1003 array( 1003 1004 'status' => 403, … … 1010 1011 return new WP_Error( 1011 1012 "first_name", 1012 "First name not valid.",1013 __( "First name not valid.", "mobile-builder" ), 1013 1014 array( 1014 1015 'status' => 403, … … 1021 1022 return new WP_Error( 1022 1023 "last_name", 1023 "Last name not valid.",1024 __( "Last name not valid.", "mobile-builder" ), 1024 1025 array( 1025 1026 'status' => 403, … … 1032 1033 return new WP_Error( 1033 1034 "password", 1034 "Password is required.",1035 __( "Password is required.", "mobile-builder" ), 1035 1036 array( 1036 1037 'status' => 403, … … 1073 1074 return new WP_Error( 1074 1075 'number_not_validate', 1075 'Your phone number not validate',1076 __( 'Your phone number not validate', "mobile-builder" ), 1076 1077 array( 1077 1078 'status' => 403, … … 1092 1093 return new WP_Error( 1093 1094 'phone_number_exist', 1094 "Your phone number already exist in database!",1095 __( "Your phone number already exist in database!", "mobile-builder" ), 1095 1096 array( 'status' => 400 ) 1096 1097 ); … … 1167 1168 if ( $result === false ) { 1168 1169 $error = new WP_Error(); 1169 $error->add( 403, "Get Firebase user info error!", array( 'status' => 400 ) );1170 $error->add( 403, __( "Get Firebase user info error!", "mobile-builder" ), array( 'status' => 400 ) ); 1170 1171 1171 1172 return $error; … … 1177 1178 return new WP_Error( 1178 1179 'email_not_exist', 1179 'User not provider email',1180 __( 'User not provider email', "mobile-builder" ), 1180 1181 array( 1181 1182 'status' => 403, … … 1253 1254 return new WP_Error( 1254 1255 'error_login_apple', 1255 'Wrong number of segments',1256 __( 'Wrong number of segments', "mobile-builder" ), 1256 1257 array( 1257 1258 'status' => 403, … … 1265 1266 return new WP_Error( 1266 1267 'error_login_apple', 1267 'Invalid header encoding',1268 __( 'Invalid header encoding', "mobile-builder" ), 1268 1269 array( 1269 1270 'status' => 403, … … 1275 1276 return new WP_Error( 1276 1277 'error_login_apple', 1277 '"kid" empty, unable to lookup correct key',1278 __( '"kid" empty, unable to lookup correct key', "mobile-builder" ), 1278 1279 array( 1279 1280 'status' => 403, … … 1291 1292 return new WP_Error( 1292 1293 'validate-user', 1293 'User not validate',1294 __( 'User not validate', "mobile-builder" ), 1294 1295 array( 1295 1296 'status' => 403, … … 1381 1382 } catch ( \Facebook\Exceptions\FacebookResponseException $e ) { 1382 1383 // When Graph returns an error 1383 echo 'Graph returned an error: '. $e->getMessage();1384 echo __( 'Graph returned an error: ', "mobile-builder" ) . $e->getMessage(); 1384 1385 exit; 1385 1386 } catch ( \Facebook\Exceptions\FacebookSDKException $e ) { 1386 1387 // When validation fails or other local issues 1387 echo 'Facebook SDK returned an error: '. $e->getMessage();1388 echo __( 'Facebook SDK returned an error: ', "mobile-builder" ) . $e->getMessage(); 1388 1389 exit; 1389 1390 } … … 1396 1397 return new WP_Error( 1397 1398 'email_not_exist', 1398 'User not provider email',1399 __( 'User not provider email', "mobile-builder" ), 1399 1400 array( 1400 1401 'status' => 403, … … 1511 1512 return new WP_Error( 1512 1513 'not_exist_firebase_server_key', 1513 'The MOBILE_BUILDER_FIREBASE_SERVER_KEY not define in wp-config.php',1514 __( 'The MOBILE_BUILDER_FIREBASE_SERVER_KEY not define in wp-config.php', "mobile-builder" ), 1514 1515 array( 1515 1516 'status' => 403, … … 1538 1539 if ( $result === false ) { 1539 1540 $error = new WP_Error(); 1540 $error->add( 403, "Get Firebase user info error!", array( 'status' => 400 ) );1541 $error->add( 403, __( "Get Firebase user info error!", "mobile-builder" ), array( 'status' => 400 ) ); 1541 1542 1542 1543 return $error; … … 1546 1547 return new WP_Error( 1547 1548 'not_exist_firebase_user', 1548 'The user not exist.',1549 __( 'The user not exist.', "mobile-builder" ), 1549 1550 array( 1550 1551 'status' => 403, … … 1563 1564 if ( count( $users ) == 0 ) { 1564 1565 $error = new WP_Error(); 1565 $error->add( 403, "Did not find any members matching the phone number!", array( 'status' => 400 ) );1566 $error->add( 403, __( "Did not find any members matching the phone number!", "mobile-builder" ), array( 'status' => 400 ) ); 1566 1567 1567 1568 return $error; … … 1655 1656 return new WP_Error( 1656 1657 'no_auth_header', 1657 'Authorization header not found.',1658 __( 'Authorization header not found.', "mobile-builder" ), 1658 1659 array( 1659 1660 'status' => 403, … … 1667 1668 return new WP_Error( 1668 1669 'token_not_validate', 1669 'Token not validate format.',1670 __( 'Token not validate format.', "mobile-builder" ), 1670 1671 array( 1671 1672 'status' => 403, … … 1685 1686 return new WP_Error( 1686 1687 'bad_iss', 1687 'The iss do not match with this server',1688 __( 'The iss do not match with this server', "mobile-builder" ), 1688 1689 array( 1689 1690 'status' => 403, … … 1694 1695 return new WP_Error( 1695 1696 'id_not_found', 1696 'User ID not found in the token',1697 __( 'User ID not found in the token', "mobile-builder" ), 1697 1698 array( 1698 1699 'status' => 403, … … 1834 1835 1835 1836 if ( get_current_user_id() != $id ) { 1836 return new WP_Error( 'mobile_builder', __( 'Sorry, you cannot change info.', 'rnlab'), array( 'status' => rest_authorization_required_code() ) );1837 return new WP_Error( 'mobile_builder', __( 'Sorry, you cannot change info.', "mobile-builder" ), array( 'status' => rest_authorization_required_code() ) ); 1837 1838 } 1838 1839
Note: See TracChangeset
for help on using the changeset viewer.