| @@ -77,7 +77,7 @@ | ||
| 77 | 77 | * Takes the old array of 3.1 gateway settings for this gateway and converts it | 
| 78 | 78 | * into an array with all the 4.1 gateway setting array keys (often the keys were | 
| 79 | 79 | * changed from 3.1 to 4.1) | 
| 80 | - * @param array $old_gateway_settings | |
| 80 | + * @param string $old_gateway_settings | |
| 81 | 81 | * @param string $new_gateway_slug | 
| 82 | 82 | * @return array | 
| 83 | 83 | */ | 
| @@ -14,68 +14,68 @@ discard block | ||
| 14 | 14 | class EE_DMS_4_1_0_gateways extends EE_Data_Migration_Script_Stage | 
| 15 | 15 |  { | 
| 16 | 16 | |
| 17 | - private $_converted_active_gateways = false; | |
| 17 | + private $_converted_active_gateways = false; | |
| 18 | 18 | |
| 19 | - public function _migration_step($num_items = 50) | |
| 20 | -    { | |
| 21 | - // loads existing EE_CONfig from DB, if it exists | |
| 22 | - $new_gateway_config_obj = EE_Config::instance()->gateway; | |
| 23 | - $items_actually_migrated = 0; | |
| 24 | - // convert settings | |
| 25 | - $gateways_to_deal_with = array_merge($this->_gateways_we_know_how_to_migrate, $this->_gateways_we_leave_alone); | |
| 26 | - // just do a part of them on this request | |
| 27 | - $gateways_to_deal_with = array_slice($gateways_to_deal_with, $this->count_records_migrated(), $num_items);// $this->_gateways_we_know_how_to_migrate; | |
| 28 | -        foreach ($gateways_to_deal_with as $old_gateway_slug => $new_gateway_slug) { | |
| 29 | - $old_gateway_wp_option_name = $this->_get_old_gateway_option_name($new_gateway_slug); | |
| 30 | -            if (isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) { | |
| 31 | - // determine the old option's name | |
| 32 | - $old_gateway_settings = $this->_get_old_gateway_option($new_gateway_slug); | |
| 33 | -                if (! $old_gateway_settings) { | |
| 34 | - // no settings existed for this gateway anyways... weird... | |
| 35 | - $items_actually_migrated++; | |
| 36 | - continue; | |
| 37 | - } | |
| 38 | - // now prepare the settings to make sure they're in the 4.1 format | |
| 39 | - $new_gateway_settings = $this->_convert_gateway_settings($old_gateway_settings, $new_gateway_slug); | |
| 40 | - $new_gateway_config_obj->payment_settings[ $new_gateway_slug ] = $new_gateway_settings; | |
| 41 | - // and when we're done, remove the old option. Sometimes we'd prefer to do this in a different stage, but | |
| 42 | - // I think it's ok to do right away this time (we wont need gateway settings elsewhere) | |
| 43 | - delete_option($old_gateway_wp_option_name); | |
| 44 | -            } else {// it must be one of the ones we mostly leave alone | |
| 45 | - global $wpdb; | |
| 46 | - // yeah we could do this all in one query... and if you're reading this and would liek to, go ahead. Although you'll | |
| 47 | - // only be saving users 50 milliseconds the one time this runs... | |
| 48 | -                $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->options . " SET autoload='no' WHERE option_name=%s", $old_gateway_wp_option_name)); | |
| 49 | - } | |
| 19 | + public function _migration_step($num_items = 50) | |
| 20 | +	{ | |
| 21 | + // loads existing EE_CONfig from DB, if it exists | |
| 22 | + $new_gateway_config_obj = EE_Config::instance()->gateway; | |
| 23 | + $items_actually_migrated = 0; | |
| 24 | + // convert settings | |
| 25 | + $gateways_to_deal_with = array_merge($this->_gateways_we_know_how_to_migrate, $this->_gateways_we_leave_alone); | |
| 26 | + // just do a part of them on this request | |
| 27 | + $gateways_to_deal_with = array_slice($gateways_to_deal_with, $this->count_records_migrated(), $num_items);// $this->_gateways_we_know_how_to_migrate; | |
| 28 | +		foreach ($gateways_to_deal_with as $old_gateway_slug => $new_gateway_slug) { | |
| 29 | + $old_gateway_wp_option_name = $this->_get_old_gateway_option_name($new_gateway_slug); | |
| 30 | +			if (isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) { | |
| 31 | + // determine the old option's name | |
| 32 | + $old_gateway_settings = $this->_get_old_gateway_option($new_gateway_slug); | |
| 33 | +				if (! $old_gateway_settings) { | |
| 34 | + // no settings existed for this gateway anyways... weird... | |
| 35 | + $items_actually_migrated++; | |
| 36 | + continue; | |
| 37 | + } | |
| 38 | + // now prepare the settings to make sure they're in the 4.1 format | |
| 39 | + $new_gateway_settings = $this->_convert_gateway_settings($old_gateway_settings, $new_gateway_slug); | |
| 40 | + $new_gateway_config_obj->payment_settings[ $new_gateway_slug ] = $new_gateway_settings; | |
| 41 | + // and when we're done, remove the old option. Sometimes we'd prefer to do this in a different stage, but | |
| 42 | + // I think it's ok to do right away this time (we wont need gateway settings elsewhere) | |
| 43 | + delete_option($old_gateway_wp_option_name); | |
| 44 | +			} else {// it must be one of the ones we mostly leave alone | |
| 45 | + global $wpdb; | |
| 46 | + // yeah we could do this all in one query... and if you're reading this and would liek to, go ahead. Although you'll | |
| 47 | + // only be saving users 50 milliseconds the one time this runs... | |
| 48 | +				$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->options . " SET autoload='no' WHERE option_name=%s", $old_gateway_wp_option_name)); | |
| 49 | + } | |
| 50 | 50 | |
| 51 | - $items_actually_migrated++; | |
| 52 | - } | |
| 53 | - // if we can keep going, and it hasn' tbeen done yet, convert active gateways | |
| 54 | -        if ($items_actually_migrated < $num_items &&  ! $this->_converted_active_gateways) { | |
| 55 | - $this->_convert_active_gateways(); | |
| 56 | - $this->_converted_active_gateways = true; | |
| 57 | - $items_actually_migrated++; | |
| 58 | - } | |
| 51 | + $items_actually_migrated++; | |
| 52 | + } | |
| 53 | + // if we can keep going, and it hasn' tbeen done yet, convert active gateways | |
| 54 | +		if ($items_actually_migrated < $num_items &&  ! $this->_converted_active_gateways) { | |
| 55 | + $this->_convert_active_gateways(); | |
| 56 | + $this->_converted_active_gateways = true; | |
| 57 | + $items_actually_migrated++; | |
| 58 | + } | |
| 59 | 59 | |
| 60 | - EE_Config::instance()->update_espresso_config(false, false); | |
| 61 | -        if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { | |
| 62 | - $this->set_completed(); | |
| 63 | - } | |
| 64 | - return $items_actually_migrated; | |
| 65 | - } | |
| 66 | - public function _count_records_to_migrate() | |
| 67 | -    { | |
| 68 | - $count_of_gateways_to_convert = count($this->_gateways_we_know_how_to_migrate); | |
| 69 | - $step_of_setting_active_gateways = 1; | |
| 70 | - $count_of_gateways_to_leave_alone = count($this->_gateways_we_leave_alone); | |
| 71 | - // $button_images_to_update = | |
| 72 | - return $count_of_gateways_to_convert + $step_of_setting_active_gateways + $count_of_gateways_to_leave_alone; | |
| 73 | - } | |
| 74 | - public function __construct() | |
| 75 | -    { | |
| 76 | -        $this->_pretty_name = __("Gateways", "event_espresso"); | |
| 77 | - parent::__construct(); | |
| 78 | - } | |
| 60 | + EE_Config::instance()->update_espresso_config(false, false); | |
| 61 | +		if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { | |
| 62 | + $this->set_completed(); | |
| 63 | + } | |
| 64 | + return $items_actually_migrated; | |
| 65 | + } | |
| 66 | + public function _count_records_to_migrate() | |
| 67 | +	{ | |
| 68 | + $count_of_gateways_to_convert = count($this->_gateways_we_know_how_to_migrate); | |
| 69 | + $step_of_setting_active_gateways = 1; | |
| 70 | + $count_of_gateways_to_leave_alone = count($this->_gateways_we_leave_alone); | |
| 71 | + // $button_images_to_update = | |
| 72 | + return $count_of_gateways_to_convert + $step_of_setting_active_gateways + $count_of_gateways_to_leave_alone; | |
| 73 | + } | |
| 74 | + public function __construct() | |
| 75 | +	{ | |
| 76 | +		$this->_pretty_name = __("Gateways", "event_espresso"); | |
| 77 | + parent::__construct(); | |
| 78 | + } | |
| 79 | 79 | |
| 80 | 80 | /** | 
| 81 | 81 | * Takes the old array of 3.1 gateway settings for this gateway and converts it | 
| @@ -85,148 +85,148 @@ discard block | ||
| 85 | 85 | * @param string $new_gateway_slug | 
| 86 | 86 | * @return array | 
| 87 | 87 | */ | 
| 88 | - private function _convert_gateway_settings($old_gateway_settings, $new_gateway_slug) | |
| 89 | -    { | |
| 90 | - $new_gateway_settings = $old_gateway_settings; | |
| 91 | -        switch ($new_gateway_slug) { | |
| 92 | - case 'Bank': | |
| 93 | - $new_gateway_settings['account_number'] = $old_gateway_settings['bank_account']; | |
| 94 | - $new_gateway_settings['page_title'] = $old_gateway_settings['bank_title']; | |
| 95 | - break; | |
| 96 | - case 'Invoice': | |
| 97 | - $new_gateway_settings['invoice_logo_url'] = $old_gateway_settings['image_url']; | |
| 98 | - // Dont' migrate the old invoice payee address. It was usually given dummy data. And in EE4 | |
| 99 | - // it gets used in the receipts which are available to everyone. So usually it's best to not | |
| 100 | - // migrate this. | |
| 101 | - unset($new_gateway_settings['payment_address']); | |
| 102 | - break; | |
| 103 | - case 'Paypal_Pro': | |
| 104 | - $new_gateway_settings['email'] = $old_gateway_settings['paypal_pro_email']; | |
| 105 | - $new_gateway_settings['username'] = $old_gateway_settings['paypal_api_username']; | |
| 106 | - $new_gateway_settings['password'] = $old_gateway_settings['paypal_api_password']; | |
| 107 | - $new_gateway_settings['signature'] = $old_gateway_settings['paypal_api_signature']; | |
| 108 | -                $new_gateway_settings['credit_cards'] = explode(",", $old_gateway_settings['paypal_api_credit_cards']); | |
| 109 | - $new_gateway_settings['use_sandbox'] = $old_gateway_settings['paypal_pro_use_sandbox']; | |
| 110 | - break; | |
| 111 | - } | |
| 112 | - return $new_gateway_settings; | |
| 113 | - } | |
| 88 | + private function _convert_gateway_settings($old_gateway_settings, $new_gateway_slug) | |
| 89 | +	{ | |
| 90 | + $new_gateway_settings = $old_gateway_settings; | |
| 91 | +		switch ($new_gateway_slug) { | |
| 92 | + case 'Bank': | |
| 93 | + $new_gateway_settings['account_number'] = $old_gateway_settings['bank_account']; | |
| 94 | + $new_gateway_settings['page_title'] = $old_gateway_settings['bank_title']; | |
| 95 | + break; | |
| 96 | + case 'Invoice': | |
| 97 | + $new_gateway_settings['invoice_logo_url'] = $old_gateway_settings['image_url']; | |
| 98 | + // Dont' migrate the old invoice payee address. It was usually given dummy data. And in EE4 | |
| 99 | + // it gets used in the receipts which are available to everyone. So usually it's best to not | |
| 100 | + // migrate this. | |
| 101 | + unset($new_gateway_settings['payment_address']); | |
| 102 | + break; | |
| 103 | + case 'Paypal_Pro': | |
| 104 | + $new_gateway_settings['email'] = $old_gateway_settings['paypal_pro_email']; | |
| 105 | + $new_gateway_settings['username'] = $old_gateway_settings['paypal_api_username']; | |
| 106 | + $new_gateway_settings['password'] = $old_gateway_settings['paypal_api_password']; | |
| 107 | + $new_gateway_settings['signature'] = $old_gateway_settings['paypal_api_signature']; | |
| 108 | +				$new_gateway_settings['credit_cards'] = explode(",", $old_gateway_settings['paypal_api_credit_cards']); | |
| 109 | + $new_gateway_settings['use_sandbox'] = $old_gateway_settings['paypal_pro_use_sandbox']; | |
| 110 | + break; | |
| 111 | + } | |
| 112 | + return $new_gateway_settings; | |
| 113 | + } | |
| 114 | 114 | /** | 
| 115 | - * Figures out the correct 3.1 gateway settings option name for the given 4.1 gateway | |
| 116 | - * @param string $new_gateway_slug | |
| 117 | - * @return string | |
| 118 | - */ | |
| 119 | - private function _get_old_gateway_option($new_gateway_slug) | |
| 120 | -    { | |
| 121 | - $option_name = $this->_get_old_gateway_option_name($new_gateway_slug); | |
| 122 | - $settings = get_option($option_name, null); | |
| 123 | -    //  if( ! $settings){ | |
| 124 | -    //      $this->add_error(sprintf(__("There is no wordpress option named %s for gateway %s", "event_espresso"),$option_name,$new_gateway_slug)); | |
| 125 | - // } | |
| 126 | - return $settings; | |
| 127 | - } | |
| 115 | + * Figures out the correct 3.1 gateway settings option name for the given 4.1 gateway | |
| 116 | + * @param string $new_gateway_slug | |
| 117 | + * @return string | |
| 118 | + */ | |
| 119 | + private function _get_old_gateway_option($new_gateway_slug) | |
| 120 | +	{ | |
| 121 | + $option_name = $this->_get_old_gateway_option_name($new_gateway_slug); | |
| 122 | + $settings = get_option($option_name, null); | |
| 123 | +	//  if( ! $settings){ | |
| 124 | +	//      $this->add_error(sprintf(__("There is no wordpress option named %s for gateway %s", "event_espresso"),$option_name,$new_gateway_slug)); | |
| 125 | + // } | |
| 126 | + return $settings; | |
| 127 | + } | |
| 128 | 128 | |
| 129 | 129 | /** | 
| 130 | 130 | * Just gets the old gateways slug | 
| 131 | 131 | * @param string $new_gateway_slug | 
| 132 | 132 | * @return string | 
| 133 | 133 | */ | 
| 134 | - private function _get_old_gateway_option_name($new_gateway_slug) | |
| 135 | -    { | |
| 136 | - $new_gateway_slugs_to_new = array_flip(array_merge($this->_gateways_we_know_how_to_migrate, $this->_gateways_we_leave_alone)); | |
| 137 | - $old_gateway_slug = $new_gateway_slugs_to_new[ $new_gateway_slug ]; | |
| 138 | - $normal_option_prefix = 'event_espresso_'; | |
| 139 | - $normal_option_postfix = '_settings'; | |
| 140 | -        switch ($new_gateway_slug) { | |
| 141 | - case 'Bank': | |
| 142 | - $option_name = $normal_option_prefix . 'bank_deposit' . $normal_option_postfix; | |
| 143 | - break; | |
| 144 | - case 'Aim': | |
| 145 | - $option_name = $normal_option_prefix . 'authnet_aim' . $normal_option_postfix; | |
| 146 | - break; | |
| 147 | - case 'Check': | |
| 148 | - $option_name = $normal_option_prefix . 'check_payment' . $normal_option_postfix; | |
| 149 | - break; | |
| 150 | - case 'Ideal': | |
| 151 | - $option_name = $normal_option_prefix . 'ideal_mollie' . $normal_option_postfix; | |
| 152 | - break; | |
| 153 | - case 'Invoice': | |
| 154 | - $option_name = $normal_option_prefix . 'invoice_payment' . $normal_option_postfix; | |
| 155 | - break; | |
| 156 | - case 'Purchase_Order': | |
| 157 | - $option_name = $normal_option_prefix . 'purchase_order_payment' . $normal_option_postfix; | |
| 158 | - break; | |
| 159 | - case 'USAePay_Offsite': | |
| 160 | - $option_name = 'espresso_usaepay_offsite' . $normal_option_postfix; | |
| 161 | - break; | |
| 162 | - case 'USAePay_Onsite': | |
| 163 | - $option_name = 'espresso_usaepay_onsite' . $normal_option_postfix; | |
| 164 | - break; | |
| 165 | - default: | |
| 166 | -                $option_name = apply_filters('FHEE__EE_DMS_4_1_0_gateways__get_old_gateway_option', $normal_option_prefix . $old_gateway_slug . $normal_option_postfix); | |
| 167 | - } | |
| 168 | - return $option_name; | |
| 169 | - } | |
| 134 | + private function _get_old_gateway_option_name($new_gateway_slug) | |
| 135 | +	{ | |
| 136 | + $new_gateway_slugs_to_new = array_flip(array_merge($this->_gateways_we_know_how_to_migrate, $this->_gateways_we_leave_alone)); | |
| 137 | + $old_gateway_slug = $new_gateway_slugs_to_new[ $new_gateway_slug ]; | |
| 138 | + $normal_option_prefix = 'event_espresso_'; | |
| 139 | + $normal_option_postfix = '_settings'; | |
| 140 | +		switch ($new_gateway_slug) { | |
| 141 | + case 'Bank': | |
| 142 | + $option_name = $normal_option_prefix . 'bank_deposit' . $normal_option_postfix; | |
| 143 | + break; | |
| 144 | + case 'Aim': | |
| 145 | + $option_name = $normal_option_prefix . 'authnet_aim' . $normal_option_postfix; | |
| 146 | + break; | |
| 147 | + case 'Check': | |
| 148 | + $option_name = $normal_option_prefix . 'check_payment' . $normal_option_postfix; | |
| 149 | + break; | |
| 150 | + case 'Ideal': | |
| 151 | + $option_name = $normal_option_prefix . 'ideal_mollie' . $normal_option_postfix; | |
| 152 | + break; | |
| 153 | + case 'Invoice': | |
| 154 | + $option_name = $normal_option_prefix . 'invoice_payment' . $normal_option_postfix; | |
| 155 | + break; | |
| 156 | + case 'Purchase_Order': | |
| 157 | + $option_name = $normal_option_prefix . 'purchase_order_payment' . $normal_option_postfix; | |
| 158 | + break; | |
| 159 | + case 'USAePay_Offsite': | |
| 160 | + $option_name = 'espresso_usaepay_offsite' . $normal_option_postfix; | |
| 161 | + break; | |
| 162 | + case 'USAePay_Onsite': | |
| 163 | + $option_name = 'espresso_usaepay_onsite' . $normal_option_postfix; | |
| 164 | + break; | |
| 165 | + default: | |
| 166 | +				$option_name = apply_filters('FHEE__EE_DMS_4_1_0_gateways__get_old_gateway_option', $normal_option_prefix . $old_gateway_slug . $normal_option_postfix); | |
| 167 | + } | |
| 168 | + return $option_name; | |
| 169 | + } | |
| 170 | 170 | |
| 171 | - private function _convert_active_gateways() | |
| 172 | -    { | |
| 173 | - // just does it all one big swoop | |
| 174 | -        $old_active_gateways = get_option('event_espresso_active_gateways'); | |
| 175 | - $new_active_gateways = EE_Config::instance()->gateway->active_gateways; | |
| 176 | -        foreach ($old_active_gateways as $old_gateway_slug => $filepath) { | |
| 177 | -            if (! isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) { | |
| 178 | -                $this->add_error(sprintf(__("The %s gateway does not exist in EE 4.1", "event_espresso"), $old_gateway_slug)); | |
| 179 | - continue; | |
| 180 | - } | |
| 181 | - $new_gateway_slug = $this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ]; | |
| 171 | + private function _convert_active_gateways() | |
| 172 | +	{ | |
| 173 | + // just does it all one big swoop | |
| 174 | +		$old_active_gateways = get_option('event_espresso_active_gateways'); | |
| 175 | + $new_active_gateways = EE_Config::instance()->gateway->active_gateways; | |
| 176 | +		foreach ($old_active_gateways as $old_gateway_slug => $filepath) { | |
| 177 | +			if (! isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) { | |
| 178 | +				$this->add_error(sprintf(__("The %s gateway does not exist in EE 4.1", "event_espresso"), $old_gateway_slug)); | |
| 179 | + continue; | |
| 180 | + } | |
| 181 | + $new_gateway_slug = $this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ]; | |
| 182 | 182 | |
| 183 | - // in the new format we can also upload gateways to the uploads directory and | |
| 184 | - $new_active_gateways[ $new_gateway_slug ] = false; | |
| 185 | - } | |
| 186 | - EE_Config::instance()->gateway->active_gateways = $new_active_gateways; | |
| 187 | - } | |
| 183 | + // in the new format we can also upload gateways to the uploads directory and | |
| 184 | + $new_active_gateways[ $new_gateway_slug ] = false; | |
| 185 | + } | |
| 186 | + EE_Config::instance()->gateway->active_gateways = $new_active_gateways; | |
| 187 | + } | |
| 188 | 188 | |
| 189 | - protected $_gateways_we_know_how_to_migrate = array( | |
| 190 | - 'aim' => 'Aim', | |
| 191 | - 'bank' => 'Bank', | |
| 192 | - 'check' => 'Check', | |
| 193 | - 'invoice' => 'Invoice', | |
| 194 | - 'paypal' => 'Paypal_Standard', | |
| 195 | - 'paypal_pro' => 'Paypal_Pro', | |
| 189 | + protected $_gateways_we_know_how_to_migrate = array( | |
| 190 | + 'aim' => 'Aim', | |
| 191 | + 'bank' => 'Bank', | |
| 192 | + 'check' => 'Check', | |
| 193 | + 'invoice' => 'Invoice', | |
| 194 | + 'paypal' => 'Paypal_Standard', | |
| 195 | + 'paypal_pro' => 'Paypal_Pro', | |
| 196 | 196 | |
| 197 | - ); | |
| 197 | + ); | |
| 198 | 198 | |
| 199 | - protected $_gateways_we_leave_alone = array( | |
| 200 | - '2checkout' => '2checkout', | |
| 201 | - 'anz' => 'Anz', | |
| 202 | - 'atos' => 'Atos', | |
| 203 | - 'authnet' => 'Authnet', | |
| 204 | - 'beanstream' => 'Beanstream', | |
| 205 | - 'evertec' => 'Evertec', | |
| 206 | - 'eway' => 'Eway', | |
| 207 | - 'eway_rapid3' => 'Eway_Rapid3', | |
| 208 | - 'exact' => 'Exact', | |
| 209 | - 'firstdata' => 'Firstdata', | |
| 210 | - 'firstdat_e4' => 'Firstdata_E4', | |
| 211 | - 'ideal' => 'Ideal', | |
| 212 | - 'infusion_payment' => 'InfusionSoft', | |
| 213 | - 'luottokunta' => 'Luottokunta', | |
| 214 | - 'megasoft' => 'Megasoft', | |
| 215 | - 'moneris_hpp' => 'Moneris_HPP', | |
| 216 | - 'mwarrior' => 'Mwarrior', | |
| 217 | - 'nab' => 'NAB', | |
| 218 | - 'paychoice' => 'Paychoice', | |
| 219 | - 'paytrace' => 'Paytrace', | |
| 220 | - 'psigate' => 'Psigate', | |
| 221 | - 'purchase_order' => 'Purchase_Order', | |
| 222 | - 'qbms' => 'QBMS', | |
| 223 | - 'quickpay' => 'Quickpay', | |
| 224 | - 'realauth' => 'Realauth', | |
| 225 | - 'securepay_aus' => 'Securepay_Aus', | |
| 226 | - 'stripe' => 'Stripe', | |
| 227 | - 'usaepay_offsite' => 'USAePay_Offsite', | |
| 228 | - 'usaepay_onsite' => 'USAePay_Onsite', | |
| 229 | - 'wepay' => 'Wepay', | |
| 230 | - 'worldpay' => 'Worldpay' | |
| 231 | - ); | |
| 199 | + protected $_gateways_we_leave_alone = array( | |
| 200 | + '2checkout' => '2checkout', | |
| 201 | + 'anz' => 'Anz', | |
| 202 | + 'atos' => 'Atos', | |
| 203 | + 'authnet' => 'Authnet', | |
| 204 | + 'beanstream' => 'Beanstream', | |
| 205 | + 'evertec' => 'Evertec', | |
| 206 | + 'eway' => 'Eway', | |
| 207 | + 'eway_rapid3' => 'Eway_Rapid3', | |
| 208 | + 'exact' => 'Exact', | |
| 209 | + 'firstdata' => 'Firstdata', | |
| 210 | + 'firstdat_e4' => 'Firstdata_E4', | |
| 211 | + 'ideal' => 'Ideal', | |
| 212 | + 'infusion_payment' => 'InfusionSoft', | |
| 213 | + 'luottokunta' => 'Luottokunta', | |
| 214 | + 'megasoft' => 'Megasoft', | |
| 215 | + 'moneris_hpp' => 'Moneris_HPP', | |
| 216 | + 'mwarrior' => 'Mwarrior', | |
| 217 | + 'nab' => 'NAB', | |
| 218 | + 'paychoice' => 'Paychoice', | |
| 219 | + 'paytrace' => 'Paytrace', | |
| 220 | + 'psigate' => 'Psigate', | |
| 221 | + 'purchase_order' => 'Purchase_Order', | |
| 222 | + 'qbms' => 'QBMS', | |
| 223 | + 'quickpay' => 'Quickpay', | |
| 224 | + 'realauth' => 'Realauth', | |
| 225 | + 'securepay_aus' => 'Securepay_Aus', | |
| 226 | + 'stripe' => 'Stripe', | |
| 227 | + 'usaepay_offsite' => 'USAePay_Offsite', | |
| 228 | + 'usaepay_onsite' => 'USAePay_Onsite', | |
| 229 | + 'wepay' => 'Wepay', | |
| 230 | + 'worldpay' => 'Worldpay' | |
| 231 | + ); | |
| 232 | 232 | } | 
| @@ -24,20 +24,20 @@ discard block | ||
| 24 | 24 | // convert settings | 
| 25 | 25 | $gateways_to_deal_with = array_merge($this->_gateways_we_know_how_to_migrate, $this->_gateways_we_leave_alone); | 
| 26 | 26 | // just do a part of them on this request | 
| 27 | - $gateways_to_deal_with = array_slice($gateways_to_deal_with, $this->count_records_migrated(), $num_items);// $this->_gateways_we_know_how_to_migrate; | |
| 27 | + $gateways_to_deal_with = array_slice($gateways_to_deal_with, $this->count_records_migrated(), $num_items); // $this->_gateways_we_know_how_to_migrate; | |
| 28 | 28 |          foreach ($gateways_to_deal_with as $old_gateway_slug => $new_gateway_slug) { | 
| 29 | 29 | $old_gateway_wp_option_name = $this->_get_old_gateway_option_name($new_gateway_slug); | 
| 30 | -            if (isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) { | |
| 30 | +            if (isset($this->_gateways_we_know_how_to_migrate[$old_gateway_slug])) { | |
| 31 | 31 | // determine the old option's name | 
| 32 | 32 | $old_gateway_settings = $this->_get_old_gateway_option($new_gateway_slug); | 
| 33 | -                if (! $old_gateway_settings) { | |
| 33 | +                if ( ! $old_gateway_settings) { | |
| 34 | 34 | // no settings existed for this gateway anyways... weird... | 
| 35 | 35 | $items_actually_migrated++; | 
| 36 | 36 | continue; | 
| 37 | 37 | } | 
| 38 | 38 | // now prepare the settings to make sure they're in the 4.1 format | 
| 39 | 39 | $new_gateway_settings = $this->_convert_gateway_settings($old_gateway_settings, $new_gateway_slug); | 
| 40 | - $new_gateway_config_obj->payment_settings[ $new_gateway_slug ] = $new_gateway_settings; | |
| 40 | + $new_gateway_config_obj->payment_settings[$new_gateway_slug] = $new_gateway_settings; | |
| 41 | 41 | // and when we're done, remove the old option. Sometimes we'd prefer to do this in a different stage, but | 
| 42 | 42 | // I think it's ok to do right away this time (we wont need gateway settings elsewhere) | 
| 43 | 43 | delete_option($old_gateway_wp_option_name); | 
| @@ -45,13 +45,13 @@ discard block | ||
| 45 | 45 | global $wpdb; | 
| 46 | 46 | // yeah we could do this all in one query... and if you're reading this and would liek to, go ahead. Although you'll | 
| 47 | 47 | // only be saving users 50 milliseconds the one time this runs... | 
| 48 | -                $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->options . " SET autoload='no' WHERE option_name=%s", $old_gateway_wp_option_name)); | |
| 48 | +                $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->options." SET autoload='no' WHERE option_name=%s", $old_gateway_wp_option_name)); | |
| 49 | 49 | } | 
| 50 | 50 | |
| 51 | 51 | $items_actually_migrated++; | 
| 52 | 52 | } | 
| 53 | 53 | // if we can keep going, and it hasn' tbeen done yet, convert active gateways | 
| 54 | -        if ($items_actually_migrated < $num_items &&  ! $this->_converted_active_gateways) { | |
| 54 | +        if ($items_actually_migrated < $num_items && ! $this->_converted_active_gateways) { | |
| 55 | 55 | $this->_convert_active_gateways(); | 
| 56 | 56 | $this->_converted_active_gateways = true; | 
| 57 | 57 | $items_actually_migrated++; | 
| @@ -69,7 +69,7 @@ discard block | ||
| 69 | 69 | $step_of_setting_active_gateways = 1; | 
| 70 | 70 | $count_of_gateways_to_leave_alone = count($this->_gateways_we_leave_alone); | 
| 71 | 71 | // $button_images_to_update = | 
| 72 | - return $count_of_gateways_to_convert + $step_of_setting_active_gateways + $count_of_gateways_to_leave_alone; | |
| 72 | + return $count_of_gateways_to_convert + $step_of_setting_active_gateways + $count_of_gateways_to_leave_alone; | |
| 73 | 73 | } | 
| 74 | 74 | public function __construct() | 
| 75 | 75 |      { | 
| @@ -119,7 +119,7 @@ discard block | ||
| 119 | 119 | private function _get_old_gateway_option($new_gateway_slug) | 
| 120 | 120 |      { | 
| 121 | 121 | $option_name = $this->_get_old_gateway_option_name($new_gateway_slug); | 
| 122 | - $settings = get_option($option_name, null); | |
| 122 | + $settings = get_option($option_name, null); | |
| 123 | 123 |      //  if( ! $settings){ | 
| 124 | 124 |      //      $this->add_error(sprintf(__("There is no wordpress option named %s for gateway %s", "event_espresso"),$option_name,$new_gateway_slug)); | 
| 125 | 125 | // } | 
| @@ -134,36 +134,36 @@ discard block | ||
| 134 | 134 | private function _get_old_gateway_option_name($new_gateway_slug) | 
| 135 | 135 |      { | 
| 136 | 136 | $new_gateway_slugs_to_new = array_flip(array_merge($this->_gateways_we_know_how_to_migrate, $this->_gateways_we_leave_alone)); | 
| 137 | - $old_gateway_slug = $new_gateway_slugs_to_new[ $new_gateway_slug ]; | |
| 137 | + $old_gateway_slug = $new_gateway_slugs_to_new[$new_gateway_slug]; | |
| 138 | 138 | $normal_option_prefix = 'event_espresso_'; | 
| 139 | 139 | $normal_option_postfix = '_settings'; | 
| 140 | 140 |          switch ($new_gateway_slug) { | 
| 141 | 141 | case 'Bank': | 
| 142 | - $option_name = $normal_option_prefix . 'bank_deposit' . $normal_option_postfix; | |
| 142 | + $option_name = $normal_option_prefix.'bank_deposit'.$normal_option_postfix; | |
| 143 | 143 | break; | 
| 144 | 144 | case 'Aim': | 
| 145 | - $option_name = $normal_option_prefix . 'authnet_aim' . $normal_option_postfix; | |
| 145 | + $option_name = $normal_option_prefix.'authnet_aim'.$normal_option_postfix; | |
| 146 | 146 | break; | 
| 147 | 147 | case 'Check': | 
| 148 | - $option_name = $normal_option_prefix . 'check_payment' . $normal_option_postfix; | |
| 148 | + $option_name = $normal_option_prefix.'check_payment'.$normal_option_postfix; | |
| 149 | 149 | break; | 
| 150 | 150 | case 'Ideal': | 
| 151 | - $option_name = $normal_option_prefix . 'ideal_mollie' . $normal_option_postfix; | |
| 151 | + $option_name = $normal_option_prefix.'ideal_mollie'.$normal_option_postfix; | |
| 152 | 152 | break; | 
| 153 | 153 | case 'Invoice': | 
| 154 | - $option_name = $normal_option_prefix . 'invoice_payment' . $normal_option_postfix; | |
| 154 | + $option_name = $normal_option_prefix.'invoice_payment'.$normal_option_postfix; | |
| 155 | 155 | break; | 
| 156 | 156 | case 'Purchase_Order': | 
| 157 | - $option_name = $normal_option_prefix . 'purchase_order_payment' . $normal_option_postfix; | |
| 157 | + $option_name = $normal_option_prefix.'purchase_order_payment'.$normal_option_postfix; | |
| 158 | 158 | break; | 
| 159 | 159 | case 'USAePay_Offsite': | 
| 160 | - $option_name = 'espresso_usaepay_offsite' . $normal_option_postfix; | |
| 160 | + $option_name = 'espresso_usaepay_offsite'.$normal_option_postfix; | |
| 161 | 161 | break; | 
| 162 | 162 | case 'USAePay_Onsite': | 
| 163 | - $option_name = 'espresso_usaepay_onsite' . $normal_option_postfix; | |
| 163 | + $option_name = 'espresso_usaepay_onsite'.$normal_option_postfix; | |
| 164 | 164 | break; | 
| 165 | 165 | default: | 
| 166 | -                $option_name = apply_filters('FHEE__EE_DMS_4_1_0_gateways__get_old_gateway_option', $normal_option_prefix . $old_gateway_slug . $normal_option_postfix); | |
| 166 | +                $option_name = apply_filters('FHEE__EE_DMS_4_1_0_gateways__get_old_gateway_option', $normal_option_prefix.$old_gateway_slug.$normal_option_postfix); | |
| 167 | 167 | } | 
| 168 | 168 | return $option_name; | 
| 169 | 169 | } | 
| @@ -174,14 +174,14 @@ discard block | ||
| 174 | 174 |          $old_active_gateways = get_option('event_espresso_active_gateways'); | 
| 175 | 175 | $new_active_gateways = EE_Config::instance()->gateway->active_gateways; | 
| 176 | 176 |          foreach ($old_active_gateways as $old_gateway_slug => $filepath) { | 
| 177 | -            if (! isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) { | |
| 177 | +            if ( ! isset($this->_gateways_we_know_how_to_migrate[$old_gateway_slug])) { | |
| 178 | 178 |                  $this->add_error(sprintf(__("The %s gateway does not exist in EE 4.1", "event_espresso"), $old_gateway_slug)); | 
| 179 | 179 | continue; | 
| 180 | 180 | } | 
| 181 | - $new_gateway_slug = $this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ]; | |
| 181 | + $new_gateway_slug = $this->_gateways_we_know_how_to_migrate[$old_gateway_slug]; | |
| 182 | 182 | |
| 183 | 183 | // in the new format we can also upload gateways to the uploads directory and | 
| 184 | - $new_active_gateways[ $new_gateway_slug ] = false; | |
| 184 | + $new_active_gateways[$new_gateway_slug] = false; | |
| 185 | 185 | } | 
| 186 | 186 | EE_Config::instance()->gateway->active_gateways = $new_active_gateways; | 
| 187 | 187 | } | 
| @@ -31,67 +31,67 @@ | ||
| 31 | 31 | */ | 
| 32 | 32 | class ReCaptcha | 
| 33 | 33 |  { | 
| 34 | - /** | |
| 35 | - * Version of this client library. | |
| 36 | - * @const string | |
| 37 | - */ | |
| 38 | - const VERSION = 'php_1.1.1'; | |
| 34 | + /** | |
| 35 | + * Version of this client library. | |
| 36 | + * @const string | |
| 37 | + */ | |
| 38 | + const VERSION = 'php_1.1.1'; | |
| 39 | 39 | |
| 40 | - /** | |
| 41 | - * Shared secret for the site. | |
| 42 | - * @var type string | |
| 43 | - */ | |
| 44 | - private $secret; | |
| 40 | + /** | |
| 41 | + * Shared secret for the site. | |
| 42 | + * @var type string | |
| 43 | + */ | |
| 44 | + private $secret; | |
| 45 | 45 | |
| 46 | - /** | |
| 47 | - * Method used to communicate with service. Defaults to POST request. | |
| 48 | - * @var RequestMethod | |
| 49 | - */ | |
| 50 | - private $requestMethod; | |
| 46 | + /** | |
| 47 | + * Method used to communicate with service. Defaults to POST request. | |
| 48 | + * @var RequestMethod | |
| 49 | + */ | |
| 50 | + private $requestMethod; | |
| 51 | 51 | |
| 52 | - /** | |
| 53 | - * Create a configured instance to use the reCAPTCHA service. | |
| 54 | - * | |
| 55 | - * @param string $secret shared secret between site and reCAPTCHA server. | |
| 56 | - * @param RequestMethod $requestMethod method used to send the request. Defaults to POST. | |
| 57 | - */ | |
| 58 | - public function __construct($secret, RequestMethod $requestMethod = null) | |
| 59 | -    { | |
| 60 | -        if (empty($secret)) { | |
| 61 | -            throw new \RuntimeException('No secret provided'); | |
| 62 | - } | |
| 52 | + /** | |
| 53 | + * Create a configured instance to use the reCAPTCHA service. | |
| 54 | + * | |
| 55 | + * @param string $secret shared secret between site and reCAPTCHA server. | |
| 56 | + * @param RequestMethod $requestMethod method used to send the request. Defaults to POST. | |
| 57 | + */ | |
| 58 | + public function __construct($secret, RequestMethod $requestMethod = null) | |
| 59 | +	{ | |
| 60 | +		if (empty($secret)) { | |
| 61 | +			throw new \RuntimeException('No secret provided'); | |
| 62 | + } | |
| 63 | 63 | |
| 64 | -        if (!is_string($secret)) { | |
| 65 | -            throw new \RuntimeException('The provided secret must be a string'); | |
| 66 | - } | |
| 64 | +		if (!is_string($secret)) { | |
| 65 | +			throw new \RuntimeException('The provided secret must be a string'); | |
| 66 | + } | |
| 67 | 67 | |
| 68 | - $this->secret = $secret; | |
| 68 | + $this->secret = $secret; | |
| 69 | 69 | |
| 70 | -        if (!is_null($requestMethod)) { | |
| 71 | - $this->requestMethod = $requestMethod; | |
| 72 | -        } else { | |
| 73 | - $this->requestMethod = new RequestMethod\Post(); | |
| 74 | - } | |
| 75 | - } | |
| 70 | +		if (!is_null($requestMethod)) { | |
| 71 | + $this->requestMethod = $requestMethod; | |
| 72 | +		} else { | |
| 73 | + $this->requestMethod = new RequestMethod\Post(); | |
| 74 | + } | |
| 75 | + } | |
| 76 | 76 | |
| 77 | - /** | |
| 78 | - * Calls the reCAPTCHA siteverify API to verify whether the user passes | |
| 79 | - * CAPTCHA test. | |
| 80 | - * | |
| 81 | - * @param string $response The value of 'g-recaptcha-response' in the submitted form. | |
| 82 | - * @param string $remoteIp The end user's IP address. | |
| 83 | - * @return Response Response from the service. | |
| 84 | - */ | |
| 85 | - public function verify($response, $remoteIp = null) | |
| 86 | -    { | |
| 87 | - // Discard empty solution submissions | |
| 88 | -        if (empty($response)) { | |
| 89 | -            $recaptchaResponse = new Response(false, array('missing-input-response')); | |
| 90 | - return $recaptchaResponse; | |
| 91 | - } | |
| 77 | + /** | |
| 78 | + * Calls the reCAPTCHA siteverify API to verify whether the user passes | |
| 79 | + * CAPTCHA test. | |
| 80 | + * | |
| 81 | + * @param string $response The value of 'g-recaptcha-response' in the submitted form. | |
| 82 | + * @param string $remoteIp The end user's IP address. | |
| 83 | + * @return Response Response from the service. | |
| 84 | + */ | |
| 85 | + public function verify($response, $remoteIp = null) | |
| 86 | +	{ | |
| 87 | + // Discard empty solution submissions | |
| 88 | +		if (empty($response)) { | |
| 89 | +			$recaptchaResponse = new Response(false, array('missing-input-response')); | |
| 90 | + return $recaptchaResponse; | |
| 91 | + } | |
| 92 | 92 | |
| 93 | - $params = new RequestParameters($this->secret, $response, $remoteIp, self::VERSION); | |
| 94 | - $rawResponse = $this->requestMethod->submit($params); | |
| 95 | - return Response::fromJson($rawResponse); | |
| 96 | - } | |
| 93 | + $params = new RequestParameters($this->secret, $response, $remoteIp, self::VERSION); | |
| 94 | + $rawResponse = $this->requestMethod->submit($params); | |
| 95 | + return Response::fromJson($rawResponse); | |
| 96 | + } | |
| 97 | 97 | } | 
| @@ -61,13 +61,13 @@ | ||
| 61 | 61 |              throw new \RuntimeException('No secret provided'); | 
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | -        if (!is_string($secret)) { | |
| 64 | +        if ( ! is_string($secret)) { | |
| 65 | 65 |              throw new \RuntimeException('The provided secret must be a string'); | 
| 66 | 66 | } | 
| 67 | 67 | |
| 68 | 68 | $this->secret = $secret; | 
| 69 | 69 | |
| 70 | -        if (!is_null($requestMethod)) { | |
| 70 | +        if ( ! is_null($requestMethod)) { | |
| 71 | 71 | $this->requestMethod = $requestMethod; | 
| 72 | 72 |          } else { | 
| 73 | 73 | $this->requestMethod = new RequestMethod\Post(); | 
| @@ -10,38 +10,38 @@ | ||
| 10 | 10 | */ | 
| 11 | 11 | class Curl implements RequestMethod | 
| 12 | 12 |  { | 
| 13 | - /** | |
| 14 | - * URL to which requests are sent via cURL. | |
| 15 | - * @const string | |
| 16 | - */ | |
| 17 | - const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; | |
| 13 | + /** | |
| 14 | + * URL to which requests are sent via cURL. | |
| 15 | + * @const string | |
| 16 | + */ | |
| 17 | + const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; | |
| 18 | 18 | |
| 19 | - /** | |
| 20 | - * Submit the cURL request with the specified parameters. | |
| 21 | - * | |
| 22 | - * @param RequestParameters $params Request parameters | |
| 23 | - * @return string Body of the reCAPTCHA response | |
| 24 | - */ | |
| 25 | - public function submit(RequestParameters $params) | |
| 26 | -    { | |
| 27 | - $handle = curl_init(self::SITE_VERIFY_URL); | |
| 19 | + /** | |
| 20 | + * Submit the cURL request with the specified parameters. | |
| 21 | + * | |
| 22 | + * @param RequestParameters $params Request parameters | |
| 23 | + * @return string Body of the reCAPTCHA response | |
| 24 | + */ | |
| 25 | + public function submit(RequestParameters $params) | |
| 26 | +	{ | |
| 27 | + $handle = curl_init(self::SITE_VERIFY_URL); | |
| 28 | 28 | |
| 29 | - $options = array( | |
| 30 | - CURLOPT_POST => true, | |
| 31 | - CURLOPT_POSTFIELDS => $params->toQueryString(), | |
| 32 | - CURLOPT_HTTPHEADER => array( | |
| 33 | - 'Content-Type: application/x-www-form-urlencoded' | |
| 34 | - ), | |
| 35 | - CURLINFO_HEADER_OUT => false, | |
| 36 | - CURLOPT_HEADER => false, | |
| 37 | - CURLOPT_RETURNTRANSFER => true, | |
| 38 | - CURLOPT_SSL_VERIFYPEER => true | |
| 39 | - ); | |
| 40 | - curl_setopt_array($handle, $options); | |
| 29 | + $options = array( | |
| 30 | + CURLOPT_POST => true, | |
| 31 | + CURLOPT_POSTFIELDS => $params->toQueryString(), | |
| 32 | + CURLOPT_HTTPHEADER => array( | |
| 33 | + 'Content-Type: application/x-www-form-urlencoded' | |
| 34 | + ), | |
| 35 | + CURLINFO_HEADER_OUT => false, | |
| 36 | + CURLOPT_HEADER => false, | |
| 37 | + CURLOPT_RETURNTRANSFER => true, | |
| 38 | + CURLOPT_SSL_VERIFYPEER => true | |
| 39 | + ); | |
| 40 | + curl_setopt_array($handle, $options); | |
| 41 | 41 | |
| 42 | - $response = curl_exec($handle); | |
| 43 | - curl_close($handle); | |
| 42 | + $response = curl_exec($handle); | |
| 43 | + curl_close($handle); | |
| 44 | 44 | |
| 45 | - return $response; | |
| 46 | - } | |
| 45 | + return $response; | |
| 46 | + } | |
| 47 | 47 | } | 
| @@ -80,11 +80,11 @@ | ||
| 80 | 80 |      { | 
| 81 | 81 |          $params = array('secret' => $this->secret, 'response' => $this->response); | 
| 82 | 82 | |
| 83 | -        if (!is_null($this->remoteIp)) { | |
| 83 | +        if ( ! is_null($this->remoteIp)) { | |
| 84 | 84 | $params['remoteip'] = $this->remoteIp; | 
| 85 | 85 | } | 
| 86 | 86 | |
| 87 | -        if (!is_null($this->version)) { | |
| 87 | +        if ( ! is_null($this->version)) { | |
| 88 | 88 | $params['version'] = $this->version; | 
| 89 | 89 | } | 
| 90 | 90 | |
| @@ -31,73 +31,73 @@ | ||
| 31 | 31 | */ | 
| 32 | 32 | class RequestParameters | 
| 33 | 33 |  { | 
| 34 | - /** | |
| 35 | - * Site secret. | |
| 36 | - * @var string | |
| 37 | - */ | |
| 38 | - private $secret; | |
| 34 | + /** | |
| 35 | + * Site secret. | |
| 36 | + * @var string | |
| 37 | + */ | |
| 38 | + private $secret; | |
| 39 | 39 | |
| 40 | - /** | |
| 41 | - * Form response. | |
| 42 | - * @var string | |
| 43 | - */ | |
| 44 | - private $response; | |
| 40 | + /** | |
| 41 | + * Form response. | |
| 42 | + * @var string | |
| 43 | + */ | |
| 44 | + private $response; | |
| 45 | 45 | |
| 46 | - /** | |
| 47 | - * Remote user's IP address. | |
| 48 | - * @var string | |
| 49 | - */ | |
| 50 | - private $remoteIp; | |
| 46 | + /** | |
| 47 | + * Remote user's IP address. | |
| 48 | + * @var string | |
| 49 | + */ | |
| 50 | + private $remoteIp; | |
| 51 | 51 | |
| 52 | - /** | |
| 53 | - * Client version. | |
| 54 | - * @var string | |
| 55 | - */ | |
| 56 | - private $version; | |
| 52 | + /** | |
| 53 | + * Client version. | |
| 54 | + * @var string | |
| 55 | + */ | |
| 56 | + private $version; | |
| 57 | 57 | |
| 58 | - /** | |
| 59 | - * Initialise parameters. | |
| 60 | - * | |
| 61 | - * @param string $secret Site secret. | |
| 62 | - * @param string $response Value from g-captcha-response form field. | |
| 63 | - * @param string $remoteIp User's IP address. | |
| 64 | - * @param string $version Version of this client library. | |
| 65 | - */ | |
| 66 | - public function __construct($secret, $response, $remoteIp = null, $version = null) | |
| 67 | -    { | |
| 68 | - $this->secret = $secret; | |
| 69 | - $this->response = $response; | |
| 70 | - $this->remoteIp = $remoteIp; | |
| 71 | - $this->version = $version; | |
| 72 | - } | |
| 58 | + /** | |
| 59 | + * Initialise parameters. | |
| 60 | + * | |
| 61 | + * @param string $secret Site secret. | |
| 62 | + * @param string $response Value from g-captcha-response form field. | |
| 63 | + * @param string $remoteIp User's IP address. | |
| 64 | + * @param string $version Version of this client library. | |
| 65 | + */ | |
| 66 | + public function __construct($secret, $response, $remoteIp = null, $version = null) | |
| 67 | +	{ | |
| 68 | + $this->secret = $secret; | |
| 69 | + $this->response = $response; | |
| 70 | + $this->remoteIp = $remoteIp; | |
| 71 | + $this->version = $version; | |
| 72 | + } | |
| 73 | 73 | |
| 74 | - /** | |
| 75 | - * Array representation. | |
| 76 | - * | |
| 77 | - * @return array Array formatted parameters. | |
| 78 | - */ | |
| 79 | - public function toArray() | |
| 80 | -    { | |
| 81 | -        $params = array('secret' => $this->secret, 'response' => $this->response); | |
| 74 | + /** | |
| 75 | + * Array representation. | |
| 76 | + * | |
| 77 | + * @return array Array formatted parameters. | |
| 78 | + */ | |
| 79 | + public function toArray() | |
| 80 | +	{ | |
| 81 | +		$params = array('secret' => $this->secret, 'response' => $this->response); | |
| 82 | 82 | |
| 83 | -        if (!is_null($this->remoteIp)) { | |
| 84 | - $params['remoteip'] = $this->remoteIp; | |
| 85 | - } | |
| 83 | +		if (!is_null($this->remoteIp)) { | |
| 84 | + $params['remoteip'] = $this->remoteIp; | |
| 85 | + } | |
| 86 | 86 | |
| 87 | -        if (!is_null($this->version)) { | |
| 88 | - $params['version'] = $this->version; | |
| 89 | - } | |
| 87 | +		if (!is_null($this->version)) { | |
| 88 | + $params['version'] = $this->version; | |
| 89 | + } | |
| 90 | 90 | |
| 91 | - return $params; | |
| 92 | - } | |
| 91 | + return $params; | |
| 92 | + } | |
| 93 | 93 | |
| 94 | - /** | |
| 95 | - * Query string representation for HTTP request. | |
| 96 | - * | |
| 97 | - * @return string Query string formatted parameters. | |
| 98 | - */ | |
| 99 | - public function toQueryString() | |
| 100 | -    { | |
| 101 | - return http_build_query($this->toArray(), '', '&'); | |
| 102 | - } | |
| 94 | + /** | |
| 95 | + * Query string representation for HTTP request. | |
| 96 | + * | |
| 97 | + * @return string Query string formatted parameters. | |
| 98 | + */ | |
| 99 | + public function toQueryString() | |
| 100 | +	{ | |
| 101 | + return http_build_query($this->toArray(), '', '&'); | |
| 102 | + } | |
| 103 | 103 | } | 
| @@ -16,11 +16,11 @@ | ||
| 16 | 16 | |
| 17 | 17 | <section id="primary" class="content-area"> | 
| 18 | 18 | <div id="content" class="site-content" role="main"> | 
| 19 | - <?php espresso_get_template_part( 'loop', 'espresso_events' ); ?> | |
| 19 | +			<?php espresso_get_template_part('loop', 'espresso_events'); ?>			 | |
| 20 | 20 | </div><!-- #content --> | 
| 21 | 21 | </section><!-- #primary --> | 
| 22 | 22 | |
| 23 | 23 | <?php | 
| 24 | -get_sidebar( 'content' ); | |
| 24 | +get_sidebar('content'); | |
| 25 | 25 | get_sidebar(); | 
| 26 | 26 | get_footer(); | 
| @@ -18,11 +18,11 @@ | ||
| 18 | 18 | |
| 19 | 19 | <section id="primary" class="content-area"> | 
| 20 | 20 | <div id="content" class="site-content" role="main"> | 
| 21 | - <?php espresso_get_template_part( 'loop', 'espresso_venues' ); ?> | |
| 21 | +			<?php espresso_get_template_part('loop', 'espresso_venues'); ?>			 | |
| 22 | 22 | </div><!-- #content --> | 
| 23 | 23 | </section><!-- #primary --> | 
| 24 | 24 | |
| 25 | 25 | <?php | 
| 26 | -get_sidebar( 'content' ); | |
| 26 | +get_sidebar('content'); | |
| 27 | 27 | get_sidebar(); | 
| 28 | 28 | get_footer(); | 
| 29 | 29 | \ No newline at end of file | 
| @@ -11,14 +11,14 @@ | ||
| 11 | 11 | * @type EE_Attendee $contact | 
| 12 | 12 | * @type bool $show_gravatar whether to show gravatar or not. | 
| 13 | 13 | */ | 
| 14 | -if ( $show_gravatar ) { | |
| 15 | - $gravatar = get_avatar( $contact->email(), | |
| 16 | - (int) apply_filters( 'FHEE__loop-espresso_attendees-shortcode__template__avatar_size', 32 ) | |
| 14 | +if ($show_gravatar) { | |
| 15 | + $gravatar = get_avatar($contact->email(), | |
| 16 | +		(int) apply_filters('FHEE__loop-espresso_attendees-shortcode__template__avatar_size', 32) | |
| 17 | 17 | ); | 
| 18 | 18 |  } else { | 
| 19 | 19 | $gravatar = ''; | 
| 20 | 20 | } | 
| 21 | 21 | ?> | 
| 22 | -<?php do_action( 'AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar ); ?> | |
| 23 | -<li><?php echo $gravatar . ' ' . $contact->full_name(); ?></li> | |
| 24 | -<?php do_action( 'AHEE__content-espresso_event_attendees__after', $contact, $show_gravatar ); ?> | |
| 25 | 22 | \ No newline at end of file | 
| 23 | +<?php do_action('AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar); ?> | |
| 24 | +<li><?php echo $gravatar.' '.$contact->full_name(); ?></li> | |
| 25 | +<?php do_action('AHEE__content-espresso_event_attendees__after', $contact, $show_gravatar); ?> | |
| 26 | 26 | \ No newline at end of file | 
| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . '   <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>'; | 
| 3 | 3 | global $post; | 
| 4 | -if ( espresso_display_ticket_selector( $post->ID ) && ( is_single() || ( is_archive() && espresso_display_ticket_selector_in_event_list() ))) : | |
| 4 | +if (espresso_display_ticket_selector($post->ID) && (is_single() || (is_archive() && espresso_display_ticket_selector_in_event_list()))) : | |
| 5 | 5 | ?> | 
| 6 | 6 | <div class="event-tickets" style="clear: both;"> | 
| 7 | - <?php espresso_ticket_selector( $post ); ?> | |
| 7 | + <?php espresso_ticket_selector($post); ?> | |
| 8 | 8 | </div> | 
| 9 | 9 | <!-- .event-tickets --> | 
| 10 | -<?php elseif ( ! is_single() ) : ?> | |
| 11 | -<?php espresso_view_details_btn( $post ); ?> | |
| 10 | +<?php elseif ( ! is_single()) : ?> | |
| 11 | +<?php espresso_view_details_btn($post); ?> | |
| 12 | 12 | <?php endif; ?> | 
| 13 | 13 | \ No newline at end of file | 
| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | <?php //echo '<h1>' . __FILE__ . '</h1>'; ?> | 
| 2 | 2 | <?php global $post; | 
| 3 | -$wrap_class = has_excerpt( $post->ID ) ? ' has-excerpt' : ''; | |
| 3 | +$wrap_class = has_excerpt($post->ID) ? ' has-excerpt' : ''; | |
| 4 | 4 | ?> | 
| 5 | -<header class="venue-header<?php echo $wrap_class;?>"> | |
| 5 | +<header class="venue-header<?php echo $wrap_class; ?>"> | |
| 6 | 6 | <h1 id="venue-details-h1" class="entry-title"> | 
| 7 | 7 | <a class="" href="<?php the_permalink(); ?>"><?php the_title(); ?></a> | 
| 8 | 8 | </h1> | 
| 9 | -	<?php if ( has_excerpt( $post->ID )) { the_excerpt(); } ?> | |
| 9 | +	<?php if (has_excerpt($post->ID)) { the_excerpt(); } ?> | |
| 10 | 10 | </header> | 
| 11 | 11 | <!-- .venue-content --> |