@@ -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,144 +85,144 @@ 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 | - break;  | 
                                                        |
| 99 | - case 'Paypal_Pro':  | 
                                                        |
| 100 | - $new_gateway_settings['email'] = $old_gateway_settings['paypal_pro_email'];  | 
                                                        |
| 101 | - $new_gateway_settings['username'] = $old_gateway_settings['paypal_api_username'];  | 
                                                        |
| 102 | - $new_gateway_settings['password'] = $old_gateway_settings['paypal_api_password'];  | 
                                                        |
| 103 | - $new_gateway_settings['signature'] = $old_gateway_settings['paypal_api_signature'];  | 
                                                        |
| 104 | -                $new_gateway_settings['credit_cards'] = explode(",", $old_gateway_settings['paypal_api_credit_cards']); | 
                                                        |
| 105 | - $new_gateway_settings['use_sandbox'] = $old_gateway_settings['paypal_pro_use_sandbox'];  | 
                                                        |
| 106 | - break;  | 
                                                        |
| 107 | - }  | 
                                                        |
| 108 | - return $new_gateway_settings;  | 
                                                        |
| 109 | - }  | 
                                                        |
| 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 | + break;  | 
                                                        |
| 99 | + case 'Paypal_Pro':  | 
                                                        |
| 100 | + $new_gateway_settings['email'] = $old_gateway_settings['paypal_pro_email'];  | 
                                                        |
| 101 | + $new_gateway_settings['username'] = $old_gateway_settings['paypal_api_username'];  | 
                                                        |
| 102 | + $new_gateway_settings['password'] = $old_gateway_settings['paypal_api_password'];  | 
                                                        |
| 103 | + $new_gateway_settings['signature'] = $old_gateway_settings['paypal_api_signature'];  | 
                                                        |
| 104 | +				$new_gateway_settings['credit_cards'] = explode(",", $old_gateway_settings['paypal_api_credit_cards']); | 
                                                        |
| 105 | + $new_gateway_settings['use_sandbox'] = $old_gateway_settings['paypal_pro_use_sandbox'];  | 
                                                        |
| 106 | + break;  | 
                                                        |
| 107 | + }  | 
                                                        |
| 108 | + return $new_gateway_settings;  | 
                                                        |
| 109 | + }  | 
                                                        |
| 110 | 110 | /**  | 
                                                        
| 111 | - * Figures out the correct 3.1 gateway settings option name for the given 4.1 gateway  | 
                                                        |
| 112 | - * @param string $new_gateway_slug  | 
                                                        |
| 113 | - * @return string  | 
                                                        |
| 114 | - */  | 
                                                        |
| 115 | - private function _get_old_gateway_option($new_gateway_slug)  | 
                                                        |
| 116 | -    { | 
                                                        |
| 117 | - $option_name = $this->_get_old_gateway_option_name($new_gateway_slug);  | 
                                                        |
| 118 | - $settings = get_option($option_name, null);  | 
                                                        |
| 119 | -    //  if( ! $settings){ | 
                                                        |
| 120 | -    //      $this->add_error(sprintf(__("There is no wordpress option named %s for gateway %s", "event_espresso"),$option_name,$new_gateway_slug)); | 
                                                        |
| 121 | - // }  | 
                                                        |
| 122 | - return $settings;  | 
                                                        |
| 123 | - }  | 
                                                        |
| 111 | + * Figures out the correct 3.1 gateway settings option name for the given 4.1 gateway  | 
                                                        |
| 112 | + * @param string $new_gateway_slug  | 
                                                        |
| 113 | + * @return string  | 
                                                        |
| 114 | + */  | 
                                                        |
| 115 | + private function _get_old_gateway_option($new_gateway_slug)  | 
                                                        |
| 116 | +	{ | 
                                                        |
| 117 | + $option_name = $this->_get_old_gateway_option_name($new_gateway_slug);  | 
                                                        |
| 118 | + $settings = get_option($option_name, null);  | 
                                                        |
| 119 | +	//  if( ! $settings){ | 
                                                        |
| 120 | +	//      $this->add_error(sprintf(__("There is no wordpress option named %s for gateway %s", "event_espresso"),$option_name,$new_gateway_slug)); | 
                                                        |
| 121 | + // }  | 
                                                        |
| 122 | + return $settings;  | 
                                                        |
| 123 | + }  | 
                                                        |
| 124 | 124 | |
| 125 | 125 | /**  | 
                                                        
| 126 | 126 | * Just gets the old gateways slug  | 
                                                        
| 127 | 127 | * @param string $new_gateway_slug  | 
                                                        
| 128 | 128 | * @return string  | 
                                                        
| 129 | 129 | */  | 
                                                        
| 130 | - private function _get_old_gateway_option_name($new_gateway_slug)  | 
                                                        |
| 131 | -    { | 
                                                        |
| 132 | - $new_gateway_slugs_to_new = array_flip(array_merge($this->_gateways_we_know_how_to_migrate, $this->_gateways_we_leave_alone));  | 
                                                        |
| 133 | - $old_gateway_slug = $new_gateway_slugs_to_new[ $new_gateway_slug ];  | 
                                                        |
| 134 | - $normal_option_prefix = 'event_espresso_';  | 
                                                        |
| 135 | - $normal_option_postfix = '_settings';  | 
                                                        |
| 136 | -        switch ($new_gateway_slug) { | 
                                                        |
| 137 | - case 'Bank':  | 
                                                        |
| 138 | - $option_name = $normal_option_prefix.'bank_deposit'.$normal_option_postfix;  | 
                                                        |
| 139 | - break;  | 
                                                        |
| 140 | - case 'Aim':  | 
                                                        |
| 141 | - $option_name = $normal_option_prefix.'authnet_aim'.$normal_option_postfix;  | 
                                                        |
| 142 | - break;  | 
                                                        |
| 143 | - case 'Check':  | 
                                                        |
| 144 | - $option_name = $normal_option_prefix.'check_payment'.$normal_option_postfix;  | 
                                                        |
| 145 | - break;  | 
                                                        |
| 146 | - case 'Ideal':  | 
                                                        |
| 147 | - $option_name = $normal_option_prefix.'ideal_mollie'.$normal_option_postfix;  | 
                                                        |
| 148 | - break;  | 
                                                        |
| 149 | - case 'Invoice':  | 
                                                        |
| 150 | - $option_name = $normal_option_prefix.'invoice_payment'.$normal_option_postfix;  | 
                                                        |
| 151 | - break;  | 
                                                        |
| 152 | - case 'Purchase_Order':  | 
                                                        |
| 153 | - $option_name = $normal_option_prefix.'purchase_order_payment'.$normal_option_postfix;  | 
                                                        |
| 154 | - break;  | 
                                                        |
| 155 | - case 'USAePay_Offsite':  | 
                                                        |
| 156 | - $option_name = 'espresso_usaepay_offsite'.$normal_option_postfix;  | 
                                                        |
| 157 | - break;  | 
                                                        |
| 158 | - case 'USAePay_Onsite':  | 
                                                        |
| 159 | - $option_name = 'espresso_usaepay_onsite'.$normal_option_postfix;  | 
                                                        |
| 160 | - break;  | 
                                                        |
| 161 | - default:  | 
                                                        |
| 162 | -                $option_name = apply_filters('FHEE__EE_DMS_4_1_0_gateways__get_old_gateway_option', $normal_option_prefix.$old_gateway_slug.$normal_option_postfix); | 
                                                        |
| 163 | - }  | 
                                                        |
| 164 | - return $option_name;  | 
                                                        |
| 165 | - }  | 
                                                        |
| 130 | + private function _get_old_gateway_option_name($new_gateway_slug)  | 
                                                        |
| 131 | +	{ | 
                                                        |
| 132 | + $new_gateway_slugs_to_new = array_flip(array_merge($this->_gateways_we_know_how_to_migrate, $this->_gateways_we_leave_alone));  | 
                                                        |
| 133 | + $old_gateway_slug = $new_gateway_slugs_to_new[ $new_gateway_slug ];  | 
                                                        |
| 134 | + $normal_option_prefix = 'event_espresso_';  | 
                                                        |
| 135 | + $normal_option_postfix = '_settings';  | 
                                                        |
| 136 | +		switch ($new_gateway_slug) { | 
                                                        |
| 137 | + case 'Bank':  | 
                                                        |
| 138 | + $option_name = $normal_option_prefix.'bank_deposit'.$normal_option_postfix;  | 
                                                        |
| 139 | + break;  | 
                                                        |
| 140 | + case 'Aim':  | 
                                                        |
| 141 | + $option_name = $normal_option_prefix.'authnet_aim'.$normal_option_postfix;  | 
                                                        |
| 142 | + break;  | 
                                                        |
| 143 | + case 'Check':  | 
                                                        |
| 144 | + $option_name = $normal_option_prefix.'check_payment'.$normal_option_postfix;  | 
                                                        |
| 145 | + break;  | 
                                                        |
| 146 | + case 'Ideal':  | 
                                                        |
| 147 | + $option_name = $normal_option_prefix.'ideal_mollie'.$normal_option_postfix;  | 
                                                        |
| 148 | + break;  | 
                                                        |
| 149 | + case 'Invoice':  | 
                                                        |
| 150 | + $option_name = $normal_option_prefix.'invoice_payment'.$normal_option_postfix;  | 
                                                        |
| 151 | + break;  | 
                                                        |
| 152 | + case 'Purchase_Order':  | 
                                                        |
| 153 | + $option_name = $normal_option_prefix.'purchase_order_payment'.$normal_option_postfix;  | 
                                                        |
| 154 | + break;  | 
                                                        |
| 155 | + case 'USAePay_Offsite':  | 
                                                        |
| 156 | + $option_name = 'espresso_usaepay_offsite'.$normal_option_postfix;  | 
                                                        |
| 157 | + break;  | 
                                                        |
| 158 | + case 'USAePay_Onsite':  | 
                                                        |
| 159 | + $option_name = 'espresso_usaepay_onsite'.$normal_option_postfix;  | 
                                                        |
| 160 | + break;  | 
                                                        |
| 161 | + default:  | 
                                                        |
| 162 | +				$option_name = apply_filters('FHEE__EE_DMS_4_1_0_gateways__get_old_gateway_option', $normal_option_prefix.$old_gateway_slug.$normal_option_postfix); | 
                                                        |
| 163 | + }  | 
                                                        |
| 164 | + return $option_name;  | 
                                                        |
| 165 | + }  | 
                                                        |
| 166 | 166 | |
| 167 | - private function _convert_active_gateways()  | 
                                                        |
| 168 | -    { | 
                                                        |
| 169 | - // just does it all one big swoop  | 
                                                        |
| 170 | -        $old_active_gateways = get_option('event_espresso_active_gateways'); | 
                                                        |
| 171 | - $new_active_gateways = EE_Config::instance()->gateway->active_gateways;  | 
                                                        |
| 172 | -        foreach ($old_active_gateways as $old_gateway_slug => $filepath) { | 
                                                        |
| 173 | -            if (! isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) { | 
                                                        |
| 174 | -                $this->add_error(sprintf(__("The %s gateway does not exist in EE 4.1", "event_espresso"), $old_gateway_slug)); | 
                                                        |
| 175 | - continue;  | 
                                                        |
| 176 | - }  | 
                                                        |
| 177 | - $new_gateway_slug = $this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ];  | 
                                                        |
| 167 | + private function _convert_active_gateways()  | 
                                                        |
| 168 | +	{ | 
                                                        |
| 169 | + // just does it all one big swoop  | 
                                                        |
| 170 | +		$old_active_gateways = get_option('event_espresso_active_gateways'); | 
                                                        |
| 171 | + $new_active_gateways = EE_Config::instance()->gateway->active_gateways;  | 
                                                        |
| 172 | +		foreach ($old_active_gateways as $old_gateway_slug => $filepath) { | 
                                                        |
| 173 | +			if (! isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) { | 
                                                        |
| 174 | +				$this->add_error(sprintf(__("The %s gateway does not exist in EE 4.1", "event_espresso"), $old_gateway_slug)); | 
                                                        |
| 175 | + continue;  | 
                                                        |
| 176 | + }  | 
                                                        |
| 177 | + $new_gateway_slug = $this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ];  | 
                                                        |
| 178 | 178 | |
| 179 | - // in the new format we can also upload gateways to the uploads directory and  | 
                                                        |
| 180 | - $new_active_gateways[ $new_gateway_slug ] = false;  | 
                                                        |
| 181 | - }  | 
                                                        |
| 182 | - EE_Config::instance()->gateway->active_gateways = $new_active_gateways;  | 
                                                        |
| 183 | - }  | 
                                                        |
| 179 | + // in the new format we can also upload gateways to the uploads directory and  | 
                                                        |
| 180 | + $new_active_gateways[ $new_gateway_slug ] = false;  | 
                                                        |
| 181 | + }  | 
                                                        |
| 182 | + EE_Config::instance()->gateway->active_gateways = $new_active_gateways;  | 
                                                        |
| 183 | + }  | 
                                                        |
| 184 | 184 | |
| 185 | - protected $_gateways_we_know_how_to_migrate = array(  | 
                                                        |
| 186 | - 'aim'=>'Aim',  | 
                                                        |
| 187 | - 'bank'=>'Bank',  | 
                                                        |
| 188 | - 'check'=>'Check',  | 
                                                        |
| 189 | - 'invoice'=>'Invoice',  | 
                                                        |
| 190 | - 'paypal'=>'Paypal_Standard',  | 
                                                        |
| 191 | - 'paypal_pro'=>'Paypal_Pro',  | 
                                                        |
| 185 | + protected $_gateways_we_know_how_to_migrate = array(  | 
                                                        |
| 186 | + 'aim'=>'Aim',  | 
                                                        |
| 187 | + 'bank'=>'Bank',  | 
                                                        |
| 188 | + 'check'=>'Check',  | 
                                                        |
| 189 | + 'invoice'=>'Invoice',  | 
                                                        |
| 190 | + 'paypal'=>'Paypal_Standard',  | 
                                                        |
| 191 | + 'paypal_pro'=>'Paypal_Pro',  | 
                                                        |
| 192 | 192 | |
| 193 | - );  | 
                                                        |
| 193 | + );  | 
                                                        |
| 194 | 194 | |
| 195 | - protected $_gateways_we_leave_alone = array(  | 
                                                        |
| 196 | - '2checkout'=>'2checkout',  | 
                                                        |
| 197 | - 'anz'=>'Anz',  | 
                                                        |
| 198 | - 'atos'=>'Atos',  | 
                                                        |
| 199 | - 'authnet'=>'Authnet',  | 
                                                        |
| 200 | - 'beanstream'=>'Beanstream',  | 
                                                        |
| 201 | - 'evertec'=>'Evertec',  | 
                                                        |
| 202 | - 'eway'=>'Eway',  | 
                                                        |
| 203 | - 'eway_rapid3'=>'Eway_Rapid3',  | 
                                                        |
| 204 | - 'exact'=>'Exact',  | 
                                                        |
| 205 | - 'firstdata'=>'Firstdata',  | 
                                                        |
| 206 | - 'firstdat_e4'=>'Firstdata_E4',  | 
                                                        |
| 207 | - 'ideal'=>'Ideal',  | 
                                                        |
| 208 | - 'infusion_payment'=>'InfusionSoft',  | 
                                                        |
| 209 | - 'luottokunta'=>'Luottokunta',  | 
                                                        |
| 210 | - 'megasoft'=>'Megasoft',  | 
                                                        |
| 211 | - 'moneris_hpp'=>'Moneris_HPP',  | 
                                                        |
| 212 | - 'mwarrior'=>'Mwarrior',  | 
                                                        |
| 213 | - 'nab'=>'NAB',  | 
                                                        |
| 214 | - 'paychoice'=>'Paychoice',  | 
                                                        |
| 215 | - 'paytrace'=>'Paytrace',  | 
                                                        |
| 216 | - 'psigate'=>'Psigate',  | 
                                                        |
| 217 | - 'purchase_order'=>'Purchase_Order',  | 
                                                        |
| 218 | - 'qbms'=>'QBMS',  | 
                                                        |
| 219 | - 'quickpay'=>'Quickpay',  | 
                                                        |
| 220 | - 'realauth'=>'Realauth',  | 
                                                        |
| 221 | - 'securepay_aus'=>'Securepay_Aus',  | 
                                                        |
| 222 | - 'stripe'=>'Stripe',  | 
                                                        |
| 223 | - 'usaepay_offsite'=>'USAePay_Offsite',  | 
                                                        |
| 224 | - 'usaepay_onsite'=>'USAePay_Onsite',  | 
                                                        |
| 225 | - 'wepay'=>'Wepay',  | 
                                                        |
| 226 | - 'worldpay'=>'Worldpay'  | 
                                                        |
| 227 | - );  | 
                                                        |
| 195 | + protected $_gateways_we_leave_alone = array(  | 
                                                        |
| 196 | + '2checkout'=>'2checkout',  | 
                                                        |
| 197 | + 'anz'=>'Anz',  | 
                                                        |
| 198 | + 'atos'=>'Atos',  | 
                                                        |
| 199 | + 'authnet'=>'Authnet',  | 
                                                        |
| 200 | + 'beanstream'=>'Beanstream',  | 
                                                        |
| 201 | + 'evertec'=>'Evertec',  | 
                                                        |
| 202 | + 'eway'=>'Eway',  | 
                                                        |
| 203 | + 'eway_rapid3'=>'Eway_Rapid3',  | 
                                                        |
| 204 | + 'exact'=>'Exact',  | 
                                                        |
| 205 | + 'firstdata'=>'Firstdata',  | 
                                                        |
| 206 | + 'firstdat_e4'=>'Firstdata_E4',  | 
                                                        |
| 207 | + 'ideal'=>'Ideal',  | 
                                                        |
| 208 | + 'infusion_payment'=>'InfusionSoft',  | 
                                                        |
| 209 | + 'luottokunta'=>'Luottokunta',  | 
                                                        |
| 210 | + 'megasoft'=>'Megasoft',  | 
                                                        |
| 211 | + 'moneris_hpp'=>'Moneris_HPP',  | 
                                                        |
| 212 | + 'mwarrior'=>'Mwarrior',  | 
                                                        |
| 213 | + 'nab'=>'NAB',  | 
                                                        |
| 214 | + 'paychoice'=>'Paychoice',  | 
                                                        |
| 215 | + 'paytrace'=>'Paytrace',  | 
                                                        |
| 216 | + 'psigate'=>'Psigate',  | 
                                                        |
| 217 | + 'purchase_order'=>'Purchase_Order',  | 
                                                        |
| 218 | + 'qbms'=>'QBMS',  | 
                                                        |
| 219 | + 'quickpay'=>'Quickpay',  | 
                                                        |
| 220 | + 'realauth'=>'Realauth',  | 
                                                        |
| 221 | + 'securepay_aus'=>'Securepay_Aus',  | 
                                                        |
| 222 | + 'stripe'=>'Stripe',  | 
                                                        |
| 223 | + 'usaepay_offsite'=>'USAePay_Offsite',  | 
                                                        |
| 224 | + 'usaepay_onsite'=>'USAePay_Onsite',  | 
                                                        |
| 225 | + 'wepay'=>'Wepay',  | 
                                                        |
| 226 | + 'worldpay'=>'Worldpay'  | 
                                                        |
| 227 | + );  | 
                                                        |
| 228 | 228 | }  | 
                                                        
@@ -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);  | 
                                                        
@@ -51,7 +51,7 @@ discard block  | 
                                                    ||
| 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 |      { | 
                                                        
@@ -115,7 +115,7 @@ discard block  | 
                                                    ||
| 115 | 115 | private function _get_old_gateway_option($new_gateway_slug)  | 
                                                        
| 116 | 116 |      { | 
                                                        
| 117 | 117 | $option_name = $this->_get_old_gateway_option_name($new_gateway_slug);  | 
                                                        
| 118 | - $settings = get_option($option_name, null);  | 
                                                        |
| 118 | + $settings = get_option($option_name, null);  | 
                                                        |
| 119 | 119 |      //  if( ! $settings){ | 
                                                        
| 120 | 120 |      //      $this->add_error(sprintf(__("There is no wordpress option named %s for gateway %s", "event_espresso"),$option_name,$new_gateway_slug)); | 
                                                        
| 121 | 121 | // }  | 
                                                        
@@ -130,7 +130,7 @@ discard block  | 
                                                    ||
| 130 | 130 | private function _get_old_gateway_option_name($new_gateway_slug)  | 
                                                        
| 131 | 131 |      { | 
                                                        
| 132 | 132 | $new_gateway_slugs_to_new = array_flip(array_merge($this->_gateways_we_know_how_to_migrate, $this->_gateways_we_leave_alone));  | 
                                                        
| 133 | - $old_gateway_slug = $new_gateway_slugs_to_new[ $new_gateway_slug ];  | 
                                                        |
| 133 | + $old_gateway_slug = $new_gateway_slugs_to_new[$new_gateway_slug];  | 
                                                        |
| 134 | 134 | $normal_option_prefix = 'event_espresso_';  | 
                                                        
| 135 | 135 | $normal_option_postfix = '_settings';  | 
                                                        
| 136 | 136 |          switch ($new_gateway_slug) { | 
                                                        
@@ -170,14 +170,14 @@ discard block  | 
                                                    ||
| 170 | 170 |          $old_active_gateways = get_option('event_espresso_active_gateways'); | 
                                                        
| 171 | 171 | $new_active_gateways = EE_Config::instance()->gateway->active_gateways;  | 
                                                        
| 172 | 172 |          foreach ($old_active_gateways as $old_gateway_slug => $filepath) { | 
                                                        
| 173 | -            if (! isset($this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ])) { | 
                                                        |
| 173 | +            if ( ! isset($this->_gateways_we_know_how_to_migrate[$old_gateway_slug])) { | 
                                                        |
| 174 | 174 |                  $this->add_error(sprintf(__("The %s gateway does not exist in EE 4.1", "event_espresso"), $old_gateway_slug)); | 
                                                        
| 175 | 175 | continue;  | 
                                                        
| 176 | 176 | }  | 
                                                        
| 177 | - $new_gateway_slug = $this->_gateways_we_know_how_to_migrate[ $old_gateway_slug ];  | 
                                                        |
| 177 | + $new_gateway_slug = $this->_gateways_we_know_how_to_migrate[$old_gateway_slug];  | 
                                                        |
| 178 | 178 | |
| 179 | 179 | // in the new format we can also upload gateways to the uploads directory and  | 
                                                        
| 180 | - $new_active_gateways[ $new_gateway_slug ] = false;  | 
                                                        |
| 180 | + $new_active_gateways[$new_gateway_slug] = false;  | 
                                                        |
| 181 | 181 | }  | 
                                                        
| 182 | 182 | EE_Config::instance()->gateway->active_gateways = $new_active_gateways;  | 
                                                        
| 183 | 183 | }  | 
                                                        
@@ -26,8 +26,8 @@  | 
                                                    ||
| 26 | 26 |  <?php _e('This shows the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', 'event_espresso'); ?> | 
                                                        
| 27 | 27 | </li>  | 
                                                        
| 28 | 28 | <li>  | 
                                                        
| 29 | -<strong><?php _e('Answer Options (for applicable question types)', 'event_espresso');?></strong><br/> | 
                                                        |
| 30 | -<?php _e('Values do not allow any HTML, however, descriptions do allow HTML.', 'event_espresso');?> | 
                                                        |
| 29 | +<strong><?php _e('Answer Options (for applicable question types)', 'event_espresso'); ?></strong><br/> | 
                                                        |
| 30 | +<?php _e('Values do not allow any HTML, however, descriptions do allow HTML.', 'event_espresso'); ?> | 
                                                        |
| 31 | 31 | </li>  | 
                                                        
| 32 | 32 | <li>  | 
                                                        
| 33 | 33 |  <strong><?php _e('Required Question', 'event_espresso'); ?></strong><br /> | 
                                                        
@@ -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  |