MS_Gateway

Gateway parent model.

Defined (1)

The class is defined in the following location(s).

/app/class-ms-gateway.php  
  1. class MS_Gateway extends MS_Model_Option { 
  2.  
  3. /** 
  4. * Gateway opertaion mode contants. 
  5. * @since 1.0.0 
  6. * @see $mode 
  7. * @var string The operation mode. 
  8. */ 
  9. const MODE_SANDBOX = 'sandbox'; 
  10. const MODE_LIVE = 'live'; 
  11.  
  12. /** 
  13. * Singleton object. 
  14. * @since 1.0.0 
  15. * @see $type 
  16. * @var string The singleton object. 
  17. */ 
  18. public static $instance; 
  19.  
  20. /** 
  21. * Gateway group. 
  22. * This is a label that is used to group settings together on the Payment 
  23. * Settings page. 
  24. * @since 1.0.0 
  25. * @var string 
  26. */ 
  27. protected $group = ''; 
  28.  
  29. /** 
  30. * Gateway ID. 
  31. * @since 1.0.0 
  32. * @var int $id 
  33. */ 
  34. protected $id = 'admin'; 
  35.  
  36. /** 
  37. * Gateway name. 
  38. * @since 1.0.0 
  39. * @var string $name 
  40. */ 
  41. protected $name = ''; 
  42.  
  43. /** 
  44. * Gateway description. 
  45. * @since 1.0.0 
  46. * @var string $description 
  47. */ 
  48. protected $description = ''; 
  49.  
  50. /** 
  51. * Gateway active status. 
  52. * @since 1.0.0 
  53. * @var string $active 
  54. */ 
  55. protected $active = false; 
  56.  
  57. /** 
  58. * Manual payment indicator. 
  59. * True: Recurring payments need to be made manually. 
  60. * False: Gateway is capable of automatic recurring payments. 
  61. * @since 1.0.0 
  62. * @var bool $manual_payment 
  63. */ 
  64. protected $manual_payment = true; 
  65.  
  66. /** 
  67. * List of payment_type IDs that are not supported by this gateway. 
  68. * @since 1.0.0 
  69. * @var array $unsupported_payment_types 
  70. */ 
  71. protected $unsupported_payment_types = array(); 
  72.  
  73. /** 
  74. * Gateway allows Pro rating. 
  75. * Pro rating means that a user will get a discount for a new subscription 
  76. * when he upgrades from another subscription that is not fully consumed 
  77. * yet. 
  78. * @since 1.0.0 
  79. * @var bool 
  80. */ 
  81. protected $pro_rate = false; 
  82.  
  83. /** 
  84. * Custom payment button text or url. 
  85. * Overrides default purchase button. 
  86. * @since 1.0.0 
  87. * @var string $pay_button_url The url or button label (text). 
  88. */ 
  89. protected $pay_button_url; 
  90.  
  91. /** 
  92. * Custom cancel button text or url. 
  93. * Overrides default cancel button. 
  94. * @since 1.0.0 
  95. * @var string $cancel_button_url The url or button label (text). 
  96. */ 
  97. protected $cancel_button_url; 
  98.  
  99. /** 
  100. * Gateway operation mode. 
  101. * Live or sandbox (test) mode. 
  102. * @since 1.0.0 
  103. * @var string $mode 
  104. */ 
  105. protected $mode; 
  106.  
  107. /** 
  108. * Hook to process gateway returns (IPN). 
  109. * @see MS_Controller_Gateway: handle_payment_return() 
  110. * @since 1.0.0 
  111. */ 
  112. public function after_load() { 
  113. do_action( 'ms_gateway_after_load', $this ); 
  114.  
  115. if ( $this->active ) { 
  116. $this->add_action( 
  117. 'ms_gateway_handle_payment_return_' . $this->id,  
  118. 'handle_return' 
  119. ); 
  120.  
  121. $this->add_filter( 'ms_model_gateway_register', 'register' ); 
  122.  
  123. /** 
  124. * Registers the Gateway 
  125. * @since 1.0.0 
  126. * @param array $list The gateway list. 
  127. * @return array The updated gateway list. 
  128. */ 
  129. public function register( $list ) { 
  130. $class = get_class( $this ); 
  131. $id = constant( $class . '::ID' ); 
  132.  
  133. $list[$id] = $class; 
  134.  
  135. return $list; 
  136.  
  137. /** 
  138. * Checks if the specified payment type is supported by the current gateway. 
  139. * @since 1.0.0 
  140. * @param string|MS_Model_Membership $payment_type Either a payment type 
  141. * identifier or a membership model object. 
  142. * @return bool 
  143. */ 
  144. public function payment_type_supported( $payment_type ) { 
  145. if ( is_object( $payment_type ) ) { 
  146. $payment_type = $payment_type->payment_type; 
  147.  
  148. $types = $this->supported_payment_types(); 
  149. $result = isset( $types[$payment_type] ); 
  150.  
  151. return $result; 
  152.  
  153. /** 
  154. * Returns a list of supported payment types. 
  155. * @since 1.0.0 
  156. * @return array Payment types, index is the type-key / value the label. 
  157. */ 
  158. public function supported_payment_types() { 
  159. static $Payment_Types = array(); 
  160.  
  161. if ( ! isset( $Payment_Types[$this->id] ) ) { 
  162. $Payment_Types[$this->id] = MS_Model_Membership::get_payment_types(); 
  163.  
  164. foreach ( $this->unsupported_payment_types as $remove ) { 
  165. unset( $Payment_Types[$this->id][$remove] ); 
  166.  
  167. return $Payment_Types[$this->id]; 
  168.  
  169. /** 
  170. * Processes gateway IPN return. 
  171. * Overridden in child gateway classes. 
  172. * @since 1.0.0 
  173. * @param MS_Model_Transactionlog $log Optional. A transaction log item 
  174. * that will be updated instead of creating a new log entry. 
  175. */ 
  176. public function handle_return( $log = false ) { 
  177. do_action( 
  178. 'ms_gateway_handle_return',  
  179. $this,  
  180. $log 
  181. ); 
  182.  
  183. /** 
  184. * Processes purchase action. 
  185. * This function is called when a payment was made: We check if the 
  186. * transaction was successful. If it was we call `$invoice->changed()` which 
  187. * will update the membership status accordingly. 
  188. * Overridden in child classes. 
  189. * This parent method only covers free purchases. 
  190. * @since 1.0.0 
  191. * @param MS_Model_Relationship $ms_relationship The related membership relationship. 
  192. */ 
  193. public function process_purchase( $subscription ) { 
  194. do_action( 
  195. 'ms_gateway_process_purchase_before',  
  196. $subscription,  
  197. $this 
  198. ); 
  199.  
  200. $invoice = $subscription->get_current_invoice(); 
  201. $invoice->gateway_id = $this->id; 
  202. $invoice->save(); 
  203.  
  204. // The default handler only processes free subscriptions. 
  205. if ( 0 == $invoice->total ) { 
  206. $invoice->changed(); 
  207.  
  208. return apply_filters( 
  209. 'ms_gateway_process_purchase',  
  210. $invoice 
  211. ); 
  212.  
  213. /** 
  214. * Propagate membership cancelation to the gateway. 
  215. * Overridden in child classes. 
  216. * @since 1.0.0 
  217. * @param MS_Model_Relationship $subscription The membership relationship. 
  218. */ 
  219. public function cancel_membership( $subscription ) { 
  220. do_action( 
  221. 'ms_gateway_cancel_membership',  
  222. $subscription,  
  223. $this 
  224. ); 
  225.  
  226. /** 
  227. * Request automatic payment to the gateway. 
  228. * Overridden in child gateway classes. 
  229. * @since 1.0.0 
  230. * @param MS_Model_Relationship $subscription The membership relationship. 
  231. * @return bool True on success. 
  232. */ 
  233. public function request_payment( $subscription ) { 
  234. do_action( 
  235. 'ms_gateway_request_payment',  
  236. $subscription,  
  237. $this 
  238. ); 
  239.  
  240. // Default to "Payment successful" 
  241. return true; 
  242.  
  243. /** 
  244. * Check for card expiration date. 
  245. * Save event for card expire soon. 
  246. * @since 1.0.0 
  247. * @access protected 
  248. * @param MS_Model_Relationship $subscription The membership relationship. 
  249. */ 
  250. public function check_card_expiration( $subscription ) { 
  251. do_action( 'ms_gateway_check_card_expiration_before', $this ); 
  252.  
  253. $member = MS_Factory::load( 'MS_Model_Member', $subscription->user_id ); 
  254. $card_exp = $member->get_gateway_profile( $this->id, 'card_exp' ); 
  255.  
  256. if ( ! empty( $card_exp ) ) { 
  257. $comm = MS_Model_Communication::get_communication( 
  258. MS_Model_Communication::COMM_TYPE_CREDIT_CARD_EXPIRE 
  259. ); 
  260.  
  261. $days = MS_Helper_Period::get_period_in_days( 
  262. $comm->period['period_unit'],  
  263. $comm->period['period_type'] 
  264. ); 
  265. $card_expire_days = MS_Helper_Period::subtract_dates( 
  266. $card_exp,  
  267. MS_Helper_Period::current_date() 
  268. ); 
  269. if ( $card_expire_days < 0 || ( $days == $card_expire_days ) ) { 
  270. MS_Model_Event::save_event( 
  271. MS_Model_Event::TYPE_CREDIT_CARD_EXPIRE,  
  272. $subscription 
  273. ); 
  274.  
  275. do_action( 
  276. 'ms_gateway_check_card_expiration_after',  
  277. $this,  
  278. $subscription 
  279. ); 
  280.  
  281. /** 
  282. * Url that fires handle_return of this gateway (IPN). 
  283. * @since 1.0.0 
  284. * @return string The return url. 
  285. */ 
  286. public function get_return_url() { 
  287. $url = MS_Helper_Utility::home_url( '/ms-payment-return/' . $this->id ); 
  288.  
  289. return apply_filters( 
  290. 'ms_gateway_get_return_url',  
  291. $url,  
  292. $this 
  293. ); 
  294.  
  295. /** 
  296. * Get gateway mode types. 
  297. * @since 1.0.0 
  298. * @return array { 
  299. * Returns array of ( $mode_type => $description ). 
  300. * @type string $mode_type The mode type. 
  301. * @type string $description The mode type description. 
  302. * } 
  303. */ 
  304. public function get_mode_types() { 
  305. $mode_types = array( 
  306. self::MODE_LIVE => __( 'Live Site', 'membership2' ),  
  307. self::MODE_SANDBOX => __( 'Sandbox Mode (test)', 'membership2' ),  
  308. ); 
  309.  
  310. return apply_filters( 
  311. 'ms_gateway_get_mode_types',  
  312. $mode_types,  
  313. $this 
  314. ); 
  315.  
  316. /** 
  317. * Return if is live mode. 
  318. * @since 1.0.0 
  319. * @return boolean True if is in live mode. 
  320. */ 
  321. public function is_live_mode() { 
  322. $is_live_mode = ( self::MODE_SANDBOX !== $this->mode ); 
  323.  
  324. return apply_filters( 
  325. 'ms_gateway_is_live_mode',  
  326. $is_live_mode 
  327. ); 
  328.  
  329. /** 
  330. * Verify required fields. 
  331. * To be overridden in children classes. 
  332. * @since 1.0.0 
  333. * @return boolean 
  334. */ 
  335. public function is_configured() { 
  336. MS_Helper_Debug::log( 
  337. sprintf( 
  338. __( 'Override the is_configured method of the %s-gateway', 'membership2' ),  
  339. $this->id 
  340. ); 
  341.  
  342. return false; 
  343.  
  344. /** 
  345. * Validate specific property before set. 
  346. * @since 1.0.0 
  347. * @param string $property The name of a property to associate. 
  348. * @param mixed $value The value of a property. 
  349. */ 
  350. public function __set( $property, $value ) { 
  351. if ( property_exists( $this, $property ) ) { 
  352. switch ( $property ) { 
  353. case 'id': 
  354. case 'name': 
  355. break; 
  356.  
  357. case 'description': 
  358. case 'pay_button_url': 
  359. case 'upgrade_button_url': 
  360. case 'cancel_button_url': 
  361. $this->$property = trim( sanitize_text_field( $value ) ); 
  362. break; 
  363.  
  364. case 'active': 
  365. case 'manual_payment': 
  366. $this->$property = ( ! empty( $value ) ? true : false ); 
  367. break; 
  368.  
  369. default: 
  370. if ( is_string( $value ) ) { 
  371. $this->$property = trim( $value ); 
  372. break; 
  373.  
  374. do_action( 
  375. 'ms_gateway__set_after',  
  376. $property,  
  377. $value,  
  378. $this 
  379. ); 
  380.  
  381. /** 
  382. * Return a property value 
  383. * @since 1.0.0 
  384. * @access public 
  385. * @param string $name The name of a property to associate. 
  386. * @return mixed The value of a property. 
  387. */ 
  388. public function __get( $property ) { 
  389. $value = null; 
  390.  
  391. if ( property_exists( $this, $property ) ) { 
  392. switch ( $property ) { 
  393. case 'active': 
  394. case 'manual_payment': 
  395. return ( ! empty( $this->$property ) ? true : false ); 
  396. break; 
  397.  
  398. case 'id': 
  399. case 'name': 
  400. case 'description': 
  401. case 'pay_button_url': 
  402. case 'upgrade_button_url': 
  403. case 'cancel_button_url': 
  404. case 'mode': 
  405. $value = trim( $this->$property ); 
  406. break; 
  407.  
  408. default: 
  409. $value = $this->$property; 
  410. break; 
  411.  
  412. return apply_filters( 
  413. 'ms_gateway__get',  
  414. $value,  
  415. $property,  
  416. $this 
  417. ); 
  418.  
  419. /** 
  420. * Get countries code and names. 
  421. * @since 1.0.0 
  422. * @return array { 
  423. * Returns array of ( $code => $name ). 
  424. * @type string $code The country code. 
  425. * @type string $name The country name. 
  426. * } 
  427. */ 
  428. static public function get_country_codes() { 
  429. static $Countries = null; 
  430.  
  431. if ( is_null( $Countries ) ) { 
  432. $Countries = array( 
  433. '' => '- ' . __( 'Select country', 'membership2' ) . ' -',  
  434. 'AX' => __( 'Aland Islands', 'membership2' ),  
  435. 'AL' => __( 'Albania', 'membership2' ),  
  436. 'DZ' => __( 'Algeria', 'membership2' ),  
  437. 'AS' => __( 'American Samoa', 'membership2' ),  
  438. 'AD' => __( 'Andorra', 'membership2' ),  
  439. 'AI' => __( 'Anguilla', 'membership2' ),  
  440. 'AQ' => __( 'Antarctica', 'membership2' ),  
  441. 'AG' => __( 'Antigua And Barbuda', 'membership2' ),  
  442. 'AR' => __( 'Argentina', 'membership2' ),  
  443. 'AM' => __( 'Armenia', 'membership2' ),  
  444. 'AW' => __( 'Aruba', 'membership2' ),  
  445. 'AU' => __( 'Australia', 'membership2' ),  
  446. 'AT' => __( 'Austria', 'membership2' ),  
  447. 'AZ' => __( 'Azerbaijan', 'membership2' ),  
  448. 'BS' => __( 'Bahamas', 'membership2' ),  
  449. 'BH' => __( 'Bahrain', 'membership2' ),  
  450. 'BD' => __( 'Bangladesh', 'membership2' ),  
  451. 'BB' => __( 'Barbados', 'membership2' ),  
  452. 'BE' => __( 'Belgium', 'membership2' ),  
  453. 'BZ' => __( 'Belize', 'membership2' ),  
  454. 'BJ' => __( 'Benin', 'membership2' ),  
  455. 'BM' => __( 'Bermuda', 'membership2' ),  
  456. 'BT' => __( 'Bhutan', 'membership2' ),  
  457. 'BA' => __( 'Bosnia-herzegovina', 'membership2' ),  
  458. 'BW' => __( 'Botswana', 'membership2' ),  
  459. 'BV' => __( 'Bouvet Island', 'membership2' ),  
  460. 'BR' => __( 'Brazil', 'membership2' ),  
  461. 'IO' => __( 'British Indian Ocean Territory', 'membership2' ),  
  462. 'BN' => __( 'Brunei Darussalam', 'membership2' ),  
  463. 'BG' => __( 'Bulgaria', 'membership2' ),  
  464. 'BF' => __( 'Burkina Faso', 'membership2' ),  
  465. 'CA' => __( 'Canada', 'membership2' ),  
  466. 'CV' => __( 'Cape Verde', 'membership2' ),  
  467. 'KY' => __( 'Cayman Islands', 'membership2' ),  
  468. 'CF' => __( 'Central African Republic', 'membership2' ),  
  469. 'CL' => __( 'Chile', 'membership2' ),  
  470. 'CN' => __( 'China', 'membership2' ),  
  471. 'CX' => __( 'Christmas Island', 'membership2' ),  
  472. 'CC' => __( 'Cocos (keeling) Islands', 'membership2' ),  
  473. 'CO' => __( 'Colombia', 'membership2' ),  
  474. 'CK' => __( 'Cook Islands', 'membership2' ),  
  475. 'CR' => __( 'Costa Rica', 'membership2' ),  
  476. 'CY' => __( 'Cyprus', 'membership2' ),  
  477. 'CZ' => __( 'Czech Republic', 'membership2' ),  
  478. 'DK' => __( 'Denmark', 'membership2' ),  
  479. 'DJ' => __( 'Djibouti', 'membership2' ),  
  480. 'DM' => __( 'Dominica', 'membership2' ),  
  481. 'DO' => __( 'Dominican Republic', 'membership2' ),  
  482. 'EC' => __( 'Ecuador', 'membership2' ),  
  483. 'EG' => __( 'Egypt', 'membership2' ),  
  484. 'SV' => __( 'El Salvador', 'membership2' ),  
  485. 'EE' => __( 'Estonia', 'membership2' ),  
  486. 'FK' => __( 'Falkland Islands (malvinas)', 'membership2' ),  
  487. 'FO' => __( 'Faroe Islands', 'membership2' ),  
  488. 'FJ' => __( 'Fiji', 'membership2' ),  
  489. 'FI' => __( 'Finland', 'membership2' ),  
  490. 'FR' => __( 'France', 'membership2' ),  
  491. 'GF' => __( 'French Guiana', 'membership2' ),  
  492. 'PF' => __( 'French Polynesia', 'membership2' ),  
  493. 'TF' => __( 'French Southern Territories', 'membership2' ),  
  494. 'GA' => __( 'Gabon', 'membership2' ),  
  495. 'GM' => __( 'Gambia', 'membership2' ),  
  496. 'GE' => __( 'Georgia', 'membership2' ),  
  497. 'DE' => __( 'Germany', 'membership2' ),  
  498. 'GH' => __( 'Ghana', 'membership2' ),  
  499. 'GI' => __( 'Gibraltar', 'membership2' ),  
  500. 'GR' => __( 'Greece', 'membership2' ),  
  501. 'GL' => __( 'Greenland', 'membership2' ),  
  502. 'GD' => __( 'Grenada', 'membership2' ),  
  503. 'GP' => __( 'Guadeloupe', 'membership2' ),  
  504. 'GU' => __( 'Guam', 'membership2' ),  
  505. 'GG' => __( 'Guernsey', 'membership2' ),  
  506. 'GY' => __( 'Guyana', 'membership2' ),  
  507. 'HM' => __( 'Heard Island And Mcdonald Islands', 'membership2' ),  
  508. 'VA' => __( 'Holy See (vatican City State)', 'membership2' ),  
  509. 'HN' => __( 'Honduras', 'membership2' ),  
  510. 'HK' => __( 'Hong Kong', 'membership2' ),  
  511. 'HU' => __( 'Hungary', 'membership2' ),  
  512. 'IS' => __( 'Iceland', 'membership2' ),  
  513. 'IN' => __( 'India', 'membership2' ),  
  514. 'ID' => __( 'Indonesia', 'membership2' ),  
  515. 'IE' => __( 'Ireland', 'membership2' ),  
  516. 'IM' => __( 'Isle Of Man', 'membership2' ),  
  517. 'IL' => __( 'Israel', 'membership2' ),  
  518. 'IT' => __( 'Italy', 'membership2' ),  
  519. 'JM' => __( 'Jamaica', 'membership2' ),  
  520. 'JP' => __( 'Japan', 'membership2' ),  
  521. 'JE' => __( 'Jersey', 'membership2' ),  
  522. 'JO' => __( 'Jordan', 'membership2' ),  
  523. 'KZ' => __( 'Kazakhstan', 'membership2' ),  
  524. 'KI' => __( 'Kiribati', 'membership2' ),  
  525. 'KR' => __( 'Korea, Republic Of', 'membership2' ),  
  526. 'KW' => __( 'Kuwait', 'membership2' ),  
  527. 'KG' => __( 'Kyrgyzstan', 'membership2' ),  
  528. 'LV' => __( 'Latvia', 'membership2' ),  
  529. 'LS' => __( 'Lesotho', 'membership2' ),  
  530. 'LI' => __( 'Liechtenstein', 'membership2' ),  
  531. 'LT' => __( 'Lithuania', 'membership2' ),  
  532. 'LU' => __( 'Luxembourg', 'membership2' ),  
  533. 'MO' => __( 'Macao', 'membership2' ),  
  534. 'MK' => __( 'Macedonia', 'membership2' ),  
  535. 'MG' => __( 'Madagascar', 'membership2' ),  
  536. 'MW' => __( 'Malawi', 'membership2' ),  
  537. 'MY' => __( 'Malaysia', 'membership2' ),  
  538. 'MT' => __( 'Malta', 'membership2' ),  
  539. 'MH' => __( 'Marshall Islands', 'membership2' ),  
  540. 'MQ' => __( 'Martinique', 'membership2' ),  
  541. 'MR' => __( 'Mauritania', 'membership2' ),  
  542. 'MU' => __( 'Mauritius', 'membership2' ),  
  543. 'YT' => __( 'Mayotte', 'membership2' ),  
  544. 'MX' => __( 'Mexico', 'membership2' ),  
  545. 'FM' => __( 'Micronesia, Federated States Of', 'membership2' ),  
  546. 'MD' => __( 'Moldova, Republic Of', 'membership2' ),  
  547. 'MC' => __( 'Monaco', 'membership2' ),  
  548. 'MN' => __( 'Mongolia', 'membership2' ),  
  549. 'ME' => __( 'Montenegro', 'membership2' ),  
  550. 'MS' => __( 'Montserrat', 'membership2' ),  
  551. 'MA' => __( 'Morocco', 'membership2' ),  
  552. 'MZ' => __( 'Mozambique', 'membership2' ),  
  553. 'NA' => __( 'Namibia', 'membership2' ),  
  554. 'NR' => __( 'Nauru', 'membership2' ),  
  555. 'NP' => __( 'Nepal', 'membership2' ),  
  556. 'NL' => __( 'Netherlands', 'membership2' ),  
  557. 'AN' => __( 'Netherlands Antilles', 'membership2' ),  
  558. 'NC' => __( 'New Caledonia', 'membership2' ),  
  559. 'NZ' => __( 'New Zealand', 'membership2' ),  
  560. 'NI' => __( 'Nicaragua', 'membership2' ),  
  561. 'NE' => __( 'Niger', 'membership2' ),  
  562. 'NU' => __( 'Niue', 'membership2' ),  
  563. 'NF' => __( 'Norfolk Island', 'membership2' ),  
  564. 'MP' => __( 'Northern Mariana Islands', 'membership2' ),  
  565. 'NO' => __( 'Norway', 'membership2' ),  
  566. 'OM' => __( 'Oman', 'membership2' ),  
  567. 'PW' => __( 'Palau', 'membership2' ),  
  568. 'PS' => __( 'Palestine', 'membership2' ),  
  569. 'PA' => __( 'Panama', 'membership2' ),  
  570. 'PY' => __( 'Paraguay', 'membership2' ),  
  571. 'PE' => __( 'Peru', 'membership2' ),  
  572. 'PH' => __( 'Philippines', 'membership2' ),  
  573. 'PN' => __( 'Pitcairn', 'membership2' ),  
  574. 'PL' => __( 'Poland', 'membership2' ),  
  575. 'PT' => __( 'Portugal', 'membership2' ),  
  576. 'PR' => __( 'Puerto Rico', 'membership2' ),  
  577. 'QA' => __( 'Qatar', 'membership2' ),  
  578. 'RE' => __( 'Reunion', 'membership2' ),  
  579. 'RO' => __( 'Romania', 'membership2' ),  
  580. 'RU' => __( 'Russian Federation', 'membership2' ),  
  581. 'RW' => __( 'Rwanda', 'membership2' ),  
  582. 'SH' => __( 'Saint Helena', 'membership2' ),  
  583. 'KN' => __( 'Saint Kitts And Nevis', 'membership2' ),  
  584. 'LC' => __( 'Saint Lucia', 'membership2' ),  
  585. 'PM' => __( 'Saint Pierre And Miquelon', 'membership2' ),  
  586. 'VC' => __( 'Saint Vincent And The Grenadines', 'membership2' ),  
  587. 'WS' => __( 'Samoa', 'membership2' ),  
  588. 'SM' => __( 'San Marino', 'membership2' ),  
  589. 'ST' => __( 'Sao Tome And Principe', 'membership2' ),  
  590. 'SA' => __( 'Saudi Arabia', 'membership2' ),  
  591. 'SN' => __( 'Senegal', 'membership2' ),  
  592. 'RS' => __( 'Serbia', 'membership2' ),  
  593. 'SC' => __( 'Seychelles', 'membership2' ),  
  594. 'SG' => __( 'Singapore', 'membership2' ),  
  595. 'SK' => __( 'Slovakia', 'membership2' ),  
  596. 'SI' => __( 'Slovenia', 'membership2' ),  
  597. 'SB' => __( 'Solomon Islands', 'membership2' ),  
  598. 'ZA' => __( 'South Africa', 'membership2' ),  
  599. 'GS' => __( 'South Georgia And The South Sandwich Islands', 'membership2' ),  
  600. 'ES' => __( 'Spain', 'membership2' ),  
  601. 'SR' => __( 'Suriname', 'membership2' ),  
  602. 'SJ' => __( 'Svalbard And Jan Mayen', 'membership2' ),  
  603. 'SZ' => __( 'Swaziland', 'membership2' ),  
  604. 'SE' => __( 'Sweden', 'membership2' ),  
  605. 'CH' => __( 'Switzerland', 'membership2' ),  
  606. 'TW' => __( 'Taiwan, Province Of China', 'membership2' ),  
  607. 'TZ' => __( 'Tanzania, United Republic Of', 'membership2' ),  
  608. 'TH' => __( 'Thailand', 'membership2' ),  
  609. 'TL' => __( 'Timor-leste', 'membership2' ),  
  610. 'TG' => __( 'Togo', 'membership2' ),  
  611. 'TK' => __( 'Tokelau', 'membership2' ),  
  612. 'TO' => __( 'Tonga', 'membership2' ),  
  613. 'TT' => __( 'Trinidad And Tobago', 'membership2' ),  
  614. 'TN' => __( 'Tunisia', 'membership2' ),  
  615. 'TR' => __( 'Turkey', 'membership2' ),  
  616. 'TM' => __( 'Turkmenistan', 'membership2' ),  
  617. 'TC' => __( 'Turks And Caicos Islands', 'membership2' ),  
  618. 'TV' => __( 'Tuvalu', 'membership2' ),  
  619. 'UG' => __( 'Uganda', 'membership2' ),  
  620. 'UA' => __( 'Ukraine', 'membership2' ),  
  621. 'AE' => __( 'United Arab Emirates', 'membership2' ),  
  622. 'GB' => __( 'United Kingdom', 'membership2' ),  
  623. 'US' => __( 'United States', 'membership2' ),  
  624. 'UM' => __( 'United States Minor Outlying Islands', 'membership2' ),  
  625. 'UY' => __( 'Uruguay', 'membership2' ),  
  626. 'UZ' => __( 'Uzbekistan', 'membership2' ),  
  627. 'VU' => __( 'Vanuatu', 'membership2' ),  
  628. 'VE' => __( 'Venezuela', 'membership2' ),  
  629. 'VN' => __( 'Viet Nam', 'membership2' ),  
  630. 'VG' => __( 'Virgin Islands, British', 'membership2' ),  
  631. 'VI' => __( 'Virgin Islands, U.s.', 'membership2' ),  
  632. 'WF' => __( 'Wallis And Futuna', 'membership2' ),  
  633. 'EH' => __( 'Western Sahara', 'membership2' ),  
  634. 'ZM' => __( 'Zambia', 'membership2' ),  
  635. ); 
  636.  
  637. $Countries = apply_filters( 
  638. 'ms_gateway_get_country_codes',  
  639. $Countries 
  640. ); 
  641.  
  642. return $Countries;