Completed
Branch BUG-8866-category-permalink (0af2d2)
by
unknown
28:48 queued 12:15
created
core/libraries/payment_methods/EE_Gateway.lib.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@
 block discarded – undo
214 214
 		if($payment instanceof EEI_Payment){
215 215
 			$type='Payment';
216 216
 			$id = $payment->ID();
217
-		}else{
217
+		} else{
218 218
 			$type = 'Payment_Method';
219 219
 			$id = $this->_ID;
220 220
 		}
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * needed helpers and models (see all the methods starting with "set_", eg seg_line_item_helper which should be passed an object
31 31
  * which implements EEHI_Line_Item_Helper; etc).
32 32
  */
33
-abstract class EE_Gateway{
33
+abstract class EE_Gateway {
34 34
 	/**
35 35
 	 * a constant used as a possible value for $_currencies_supported to indicate
36 36
 	 * that ALL currencies are supported by this gateway
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	/**
109 109
 	 * @return EE_Gateway
110 110
 	 */
111
-	public function __construct(){
111
+	public function __construct() {
112 112
 	}
113 113
 
114 114
 	/**
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 	 * beginning again)
121 121
 	 * @return array
122 122
 	 */
123
-	public function __sleep(){
123
+	public function __sleep() {
124 124
 		$properties = get_object_vars($this);
125
-		unset( $properties[ '_pay_model' ] );
126
-		unset( $properties[ '_pay_log' ] );
125
+		unset($properties['_pay_model']);
126
+		unset($properties['_pay_log']);
127 127
 		return array_keys($properties);
128 128
 	}
129 129
 	/**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * see $_supports_sending_refunds
132 132
 	 * @return boolean
133 133
 	 */
134
-	public function supports_sending_refunds(){
134
+	public function supports_sending_refunds() {
135 135
 		return $this->_supports_sending_refunds;
136 136
 	}
137 137
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * see $_supports_receiving_refunds
140 140
 	 * @return boolean
141 141
 	 */
142
-	public function supports_receiving_refunds(){
142
+	public function supports_receiving_refunds() {
143 143
 		return $this->_supports_receiving_refunds;
144 144
 	}
145 145
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @return EE_Payment for the refund
155 155
 	 * @throws EE_Error
156 156
 	 */
157
-	public function do_direct_refund( EE_Payment $payment, $refund_info = null ) {
157
+	public function do_direct_refund(EE_Payment $payment, $refund_info = null) {
158 158
 		return NULL;
159 159
 	}
160 160
 
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 	 * etc
166 166
 	 * @param array $settings_array
167 167
 	 */
168
-	public function set_settings($settings_array){
169
-		foreach($settings_array as $name => $value){
168
+	public function set_settings($settings_array) {
169
+		foreach ($settings_array as $name => $value) {
170 170
 			$property_name = "_".$name;
171 171
 			$this->$property_name = $value;
172 172
 		}
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
 	 * See this class description
176 176
 	 * @param EEMI_Payment $payment_model
177 177
 	 */
178
-	public function set_payment_model($payment_model){
178
+	public function set_payment_model($payment_model) {
179 179
 		$this->_pay_model = $payment_model;
180 180
 	}
181 181
 	/**
182 182
 	 * See this class description
183 183
 	 * @param EEMI_Payment_Log $payment_log_model
184 184
 	 */
185
-	public function set_payment_log($payment_log_model){
185
+	public function set_payment_log($payment_log_model) {
186 186
 		$this->_pay_log = $payment_log_model;
187 187
 	}
188 188
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 * See this class description
191 191
 	 * @param EEHI_Template $template_helper
192 192
 	 */
193
-	public function set_template_helper($template_helper){
193
+	public function set_template_helper($template_helper) {
194 194
 		$this->_template = $template_helper;
195 195
 	}
196 196
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * See this class description
199 199
 	 * @param EEHI_Line_Item $line_item_helper
200 200
 	 */
201
-	public function set_line_item_helper( $line_item_helper ){
201
+	public function set_line_item_helper($line_item_helper) {
202 202
 		$this->_line_item = $line_item_helper;
203 203
 	}
204 204
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 * See this class description
207 207
 	 * @param EEHI_Money $money_helper
208 208
 	 */
209
-	public function set_money_helper( $money_helper ){
209
+	public function set_money_helper($money_helper) {
210 210
 		$this->_money = $money_helper;
211 211
 	}
212 212
 
@@ -215,23 +215,23 @@  discard block
 block discarded – undo
215 215
 	 * @param $message
216 216
 	 * @param $payment
217 217
 	 */
218
-	public function log($message,$payment){
219
-		if($payment instanceof EEI_Payment){
220
-			$type='Payment';
218
+	public function log($message, $payment) {
219
+		if ($payment instanceof EEI_Payment) {
220
+			$type = 'Payment';
221 221
 			$id = $payment->ID();
222
-		}else{
222
+		} else {
223 223
 			$type = 'Payment_Method';
224 224
 			$id = $this->_ID;
225 225
 		}
226
-		$this->_pay_log->gateway_log($message,$id,$type);
226
+		$this->_pay_log->gateway_log($message, $id, $type);
227 227
 	}
228 228
 	/**
229 229
 	 * Formats the amount so it can generally be sent to gateways
230 230
 	 * @param float $amount
231 231
 	 * @return string
232 232
 	 */
233
-	public function format_currency($amount){
234
-		return number_format( $amount, 2, '.', '' );
233
+	public function format_currency($amount) {
234
+		return number_format($amount, 2, '.', '');
235 235
 //		return $this->_template->format_currency($amount, true);
236 236
 	}
237 237
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * or a string indicating they're all supported (EE_gateway::all_currencies_supported)
241 241
 	 * @return mixed array or string
242 242
 	 */
243
-	public function currencies_supported(){
243
+	public function currencies_supported() {
244 244
 		return $this->_currencies_supported;
245 245
 	}
246 246
 
@@ -252,14 +252,14 @@  discard block
 block discarded – undo
252 252
 	 * @param EE_Transaction  $transaction
253 253
 	 * @return float
254 254
 	 */
255
-	protected function _sum_items_and_taxes( EE_Transaction  $transaction){
255
+	protected function _sum_items_and_taxes(EE_Transaction  $transaction) {
256 256
 		$total_line_item = $transaction->total_line_item();
257 257
 		$total = 0;
258
-		foreach($total_line_item->get_items() as $item_line_item ){
259
-			$total += max( $item_line_item->total(), 0 );
258
+		foreach ($total_line_item->get_items() as $item_line_item) {
259
+			$total += max($item_line_item->total(), 0);
260 260
 		}
261
-		foreach($total_line_item->tax_descendants() as $tax_line_item ){
262
-			$total += max( $tax_line_item->total(), 0 );
261
+		foreach ($total_line_item->tax_descendants() as $tax_line_item) {
262
+			$total += max($tax_line_item->total(), 0);
263 263
 		}
264 264
 		return $total;
265 265
 	}
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 	 * @param EEI_Payment $payment
271 271
 	 * @return boolean
272 272
 	 */
273
-	protected function _can_easily_itemize_transaction_for( EEI_Payment $payment ){
273
+	protected function _can_easily_itemize_transaction_for(EEI_Payment $payment) {
274 274
 		return  $this->_money->compare_floats(
275
-					$this->_sum_items_and_taxes( $payment->transaction() ),
275
+					$this->_sum_items_and_taxes($payment->transaction()),
276 276
 					$payment->transaction()->total() ) &&
277 277
 				$this->_money->compare_floats(
278 278
 					$payment->amount(),
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 * @param EE_Payment $payment
291 291
 	 * @return void
292 292
 	 */
293
-	public function update_txn_based_on_payment( $payment ){
293
+	public function update_txn_based_on_payment($payment) {
294 294
 		//maybe update the transaction or line items or registrations
295 295
 		//but most gateways don't need to do this, because they only update the payment
296 296
 	}
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Addon.lib.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@
 block discarded – undo
275 275
 				//we know it was just activated and the request will end soon
276 276
 			}
277 277
 			return;
278
-		}else{
278
+		} else{
279 279
 			// make sure this was called in the right place!
280 280
 			if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System___detect_if_activation_or_upgrade__begin' )) {
281 281
 				EE_Error::doing_it_wrong(
Please login to merge, or discard this patch.
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -66,23 +66,23 @@  discard block
 block discarded – undo
66 66
 	 * @param string $min_core_version
67 67
 	 * @return string always like '4.3.0.rc.000'
68 68
 	 */
69
-	protected static function _effective_version( $min_core_version ) {
69
+	protected static function _effective_version($min_core_version) {
70 70
 		// versions: 4 . 3 . 1 . p . 123
71 71
 		// offsets:    0 . 1 . 2 . 3 . 4
72
-		$version_parts = explode( '.', $min_core_version );
72
+		$version_parts = explode('.', $min_core_version);
73 73
 		//check they specified the micro version (after 2nd period)
74
-		if( ! isset( $version_parts[ 2 ] ) ) {
75
-			$version_parts[ 2] = '0';
74
+		if ( ! isset($version_parts[2])) {
75
+			$version_parts[2] = '0';
76 76
 		}
77 77
 		//if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
78 78
 		//soon we can assume that's 'rc', but this current version is 'alpha'
79
-		if( ! isset( $version_parts[ 3 ] ) ) {
80
-			$version_parts[ 3 ] = 'dev';
79
+		if ( ! isset($version_parts[3])) {
80
+			$version_parts[3] = 'dev';
81 81
 		}
82
-		if( ! isset( $version_parts[ 4 ] ) ) {
83
-			$version_parts[ 4 ] = '000';
82
+		if ( ! isset($version_parts[4])) {
83
+			$version_parts[4] = '000';
84 84
 		}
85
-		return implode( '.', $version_parts );
85
+		return implode('.', $version_parts);
86 86
 
87 87
 	}
88 88
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 * @param string $actual_core_version the actual core version, optional
93 93
 	 * @return boolean
94 94
 	 */
95
-	public static  function _meets_min_core_version_requirement( $min_core_version, $actual_core_version = EVENT_ESPRESSO_VERSION ) {
96
-		return version_compare( self::_effective_version( $actual_core_version ), self::_effective_version( $min_core_version ), '>=' );
95
+	public static  function _meets_min_core_version_requirement($min_core_version, $actual_core_version = EVENT_ESPRESSO_VERSION) {
96
+		return version_compare(self::_effective_version($actual_core_version), self::_effective_version($min_core_version), '>=');
97 97
 	}
98 98
 
99 99
 
@@ -155,235 +155,235 @@  discard block
 block discarded – undo
155 155
 	 * @throws EE_Error
156 156
 	 * @return void
157 157
 	 */
158
-	public static function register( $addon_name = '', $setup_args = array()  ) {
158
+	public static function register($addon_name = '', $setup_args = array()) {
159 159
 		// required fields MUST be present, so let's make sure they are.
160
-		if ( empty( $addon_name ) || ! is_array( $setup_args )) {
161
-			throw new EE_Error( __( 'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', 'event_espresso' ));
160
+		if (empty($addon_name) || ! is_array($setup_args)) {
161
+			throw new EE_Error(__('In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', 'event_espresso'));
162 162
 		}
163
-		if ( ! isset($setup_args[ 'main_file_path' ]) || empty( $setup_args[ 'main_file_path' ] ) ){
164
-			throw new EE_Error( sprintf( __( 'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', 'event_espresso' ), implode(",", array_keys( $setup_args ) ) ) );
163
+		if ( ! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
164
+			throw new EE_Error(sprintf(__('When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', 'event_espresso'), implode(",", array_keys($setup_args))));
165 165
 		}
166 166
 		// check that addon has not already been registered with that name
167
-		if ( isset( self::$_settings[ $addon_name ] ) && ! did_action( 'activate_plugin' ) ) {
168
-			throw new EE_Error( sprintf( __( 'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', 'event_espresso' ), $addon_name ));
167
+		if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) {
168
+			throw new EE_Error(sprintf(__('An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', 'event_espresso'), $addon_name));
169 169
 		}
170 170
 
171 171
 
172 172
 		// no class name for addon?
173
-		if ( empty( $setup_args['class_name'] )) {
173
+		if (empty($setup_args['class_name'])) {
174 174
 			// generate one by first separating name with spaces
175
-			$class_name = str_replace( array( '-', '_' ), ' ', trim( $addon_name ));
175
+			$class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
176 176
 			//capitalize, then replace spaces with underscores
177
-			$class_name = str_replace( ' ', '_', ucwords( $class_name ));
177
+			$class_name = str_replace(' ', '_', ucwords($class_name));
178 178
 		} else {
179 179
 			$class_name = $setup_args['class_name'];
180 180
 		}
181
-		$class_name = strpos( $class_name, 'EE_' ) === 0 ? $class_name : 'EE_' . $class_name;
181
+		$class_name = strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_'.$class_name;
182 182
 		//setup $_settings array from incoming values.
183 183
 		$addon_settings = array(
184 184
 			// generated from the addon name, changes something like "calendar" to "EE_Calendar"
185 185
 			'class_name' 						=> $class_name,
186 186
 			// the addon slug for use in URLs, etc
187
-			'plugin_slug' 						=> isset( $setup_args['plugin_slug'] ) ? (string)$setup_args['plugin_slug'] : '',
187
+			'plugin_slug' 						=> isset($setup_args['plugin_slug']) ? (string) $setup_args['plugin_slug'] : '',
188 188
 			// page slug to be used when generating the "Settings" link on the WP plugin page
189
-			'plugin_action_slug' 			=> isset( $setup_args[ 'plugin_action_slug' ] ) ? (string)$setup_args[ 'plugin_action_slug' ] : '',
189
+			'plugin_action_slug' 			=> isset($setup_args['plugin_action_slug']) ? (string) $setup_args['plugin_action_slug'] : '',
190 190
 			// the "software" version for the addon
191
-			'version' 								=> isset( $setup_args['version'] ) ? (string)$setup_args['version'] : '',
191
+			'version' 								=> isset($setup_args['version']) ? (string) $setup_args['version'] : '',
192 192
 			// the minimum version of EE Core that the addon will work with
193
-			'min_core_version' 			=> isset( $setup_args['min_core_version'] ) ? (string)$setup_args['min_core_version'] : '',
193
+			'min_core_version' 			=> isset($setup_args['min_core_version']) ? (string) $setup_args['min_core_version'] : '',
194 194
 			// full server path to main file (file loaded directly by WP)
195
-			'main_file_path' 					=> isset( $setup_args['main_file_path'] ) ? (string)$setup_args['main_file_path'] : '',
195
+			'main_file_path' 					=> isset($setup_args['main_file_path']) ? (string) $setup_args['main_file_path'] : '',
196 196
 			// path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
197
-			'admin_path' 						=> isset( $setup_args['admin_path'] ) ? (string)$setup_args['admin_path'] : '',
197
+			'admin_path' 						=> isset($setup_args['admin_path']) ? (string) $setup_args['admin_path'] : '',
198 198
 			// a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
199
-			'admin_callback' 				=> isset( $setup_args['admin_callback'] ) ? (string)$setup_args['admin_callback'] : '',
199
+			'admin_callback' 				=> isset($setup_args['admin_callback']) ? (string) $setup_args['admin_callback'] : '',
200 200
 			// the section name for this addon's configuration settings section (defaults to "addons")
201
-			'config_section' 					=> isset( $setup_args['config_section'] ) ? (string)$setup_args['config_section'] : 'addons',
201
+			'config_section' 					=> isset($setup_args['config_section']) ? (string) $setup_args['config_section'] : 'addons',
202 202
 			// the class name for this addon's configuration settings object
203
-			'config_class' 						=> isset( $setup_args['config_class'] ) ? (string)$setup_args['config_class'] : '',
203
+			'config_class' 						=> isset($setup_args['config_class']) ? (string) $setup_args['config_class'] : '',
204 204
 			//the name given to the config for this addons' configuration settings object (optional)
205
-			'config_name' 					=> isset( $setup_args['config_name'] ) ? (string) $setup_args['config_name']: '',
205
+			'config_name' 					=> isset($setup_args['config_name']) ? (string) $setup_args['config_name'] : '',
206 206
 			// an array of "class names" => "full server paths" for any classes that might be invoked by the addon
207
-			'autoloader_paths' 			=> isset( $setup_args['autoloader_paths'] ) ? (array)$setup_args['autoloader_paths'] : array(),
207
+			'autoloader_paths' 			=> isset($setup_args['autoloader_paths']) ? (array) $setup_args['autoloader_paths'] : array(),
208 208
 			// an array of  "full server paths" for any folders containing classes that might be invoked by the addon
209
-			'autoloader_folders' 			=> isset( $setup_args['autoloader_folders'] ) ? (array)$setup_args['autoloader_folders'] : array(),
209
+			'autoloader_folders' 			=> isset($setup_args['autoloader_folders']) ? (array) $setup_args['autoloader_folders'] : array(),
210 210
 			// array of full server paths to any EE_DMS data migration scripts used by the addon
211
-			'dms_paths' 						=> isset( $setup_args['dms_paths'] ) ? (array)$setup_args['dms_paths'] : array(),
211
+			'dms_paths' 						=> isset($setup_args['dms_paths']) ? (array) $setup_args['dms_paths'] : array(),
212 212
 			// array of full server paths to any EED_Modules used by the addon
213
-			'module_paths' 					=> isset( $setup_args['module_paths'] ) ? (array)$setup_args['module_paths'] : array(),
213
+			'module_paths' 					=> isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : array(),
214 214
 			// array of full server paths to any EES_Shortcodes used by the addon
215
-			'shortcode_paths'			 	=> isset( $setup_args['shortcode_paths'] ) ? (array)$setup_args['shortcode_paths'] : array(),
215
+			'shortcode_paths'			 	=> isset($setup_args['shortcode_paths']) ? (array) $setup_args['shortcode_paths'] : array(),
216 216
 			// array of full server paths to any WP_Widgets used by the addon
217
-			'widget_paths' 					=> isset( $setup_args['widget_paths'] ) ? (array)$setup_args['widget_paths'] : array(),
217
+			'widget_paths' 					=> isset($setup_args['widget_paths']) ? (array) $setup_args['widget_paths'] : array(),
218 218
 			// array of PUE options used by the addon
219
-			'pue_options' 						=> isset( $setup_args['pue_options'] ) ? (array)$setup_args['pue_options'] : array(),
220
-			'message_types' 				=> isset( $setup_args['message_types'] ) ? (array) $setup_args['message_types'] : array(),
221
-			'capabilities' 						=> isset( $setup_args['capabilities'] ) ? (array) $setup_args['capabilities'] : array(),
222
-			'capability_maps' 				=> isset( $setup_args['capability_maps'] ) ? (array) $setup_args['capability_maps'] : array(),
223
-			'model_paths' 					=> isset( $setup_args['model_paths'] ) ? (array) $setup_args['model_paths'] : array(),
224
-			'class_paths' 						=> isset( $setup_args['class_paths'] ) ? (array) $setup_args['class_paths'] : array(),
225
-			'model_extension_paths' 	=> isset( $setup_args['model_extension_paths'] ) ? (array) $setup_args['model_extension_paths'] : array(),
226
-			'class_extension_paths' 		=> isset( $setup_args['class_extension_paths'] ) ? (array) $setup_args['class_extension_paths'] : array(),
227
-			'custom_post_types' 			=> isset( $setup_args['custom_post_types'] ) ? (array) $setup_args['custom_post_types'] : array(),
228
-			'custom_taxonomies' 		=> isset( $setup_args['custom_taxonomies'] ) ? (array) $setup_args['custom_taxonomies'] : array(),
229
-			'payment_method_paths'	=> isset( $setup_args[ 'payment_method_paths' ] ) ? (array) $setup_args[ 'payment_method_paths' ] : array(),
230
-			'default_terms' 					=> isset( $setup_args['default_terms'] ) ? (array) $setup_args['default_terms'] : array(),
219
+			'pue_options' 						=> isset($setup_args['pue_options']) ? (array) $setup_args['pue_options'] : array(),
220
+			'message_types' 				=> isset($setup_args['message_types']) ? (array) $setup_args['message_types'] : array(),
221
+			'capabilities' 						=> isset($setup_args['capabilities']) ? (array) $setup_args['capabilities'] : array(),
222
+			'capability_maps' 				=> isset($setup_args['capability_maps']) ? (array) $setup_args['capability_maps'] : array(),
223
+			'model_paths' 					=> isset($setup_args['model_paths']) ? (array) $setup_args['model_paths'] : array(),
224
+			'class_paths' 						=> isset($setup_args['class_paths']) ? (array) $setup_args['class_paths'] : array(),
225
+			'model_extension_paths' 	=> isset($setup_args['model_extension_paths']) ? (array) $setup_args['model_extension_paths'] : array(),
226
+			'class_extension_paths' 		=> isset($setup_args['class_extension_paths']) ? (array) $setup_args['class_extension_paths'] : array(),
227
+			'custom_post_types' 			=> isset($setup_args['custom_post_types']) ? (array) $setup_args['custom_post_types'] : array(),
228
+			'custom_taxonomies' 		=> isset($setup_args['custom_taxonomies']) ? (array) $setup_args['custom_taxonomies'] : array(),
229
+			'payment_method_paths'	=> isset($setup_args['payment_method_paths']) ? (array) $setup_args['payment_method_paths'] : array(),
230
+			'default_terms' 					=> isset($setup_args['default_terms']) ? (array) $setup_args['default_terms'] : array(),
231 231
 			// if not empty, inserts a new table row after this plugin's row on the WP Plugins page that can be used for adding upgrading/marketing info
232
-			'plugins_page_row' 			=> isset( $setup_args['plugins_page_row'] ) ? $setup_args['plugins_page_row'] : '',
232
+			'plugins_page_row' 			=> isset($setup_args['plugins_page_row']) ? $setup_args['plugins_page_row'] : '',
233 233
 		);
234 234
 
235 235
 		// if plugin_action_slug is NOT set, but an admin page path IS set, then let's just use the plugin_slug since that will be used for linking to the admin page
236
-		$addon_settings[ 'plugin_action_slug' ] = empty( $addon_settings[ 'plugin_action_slug' ] ) && ! empty( $addon_settings[ 'admin_path' ] ) ? $addon_settings[ 'plugin_slug' ] : $addon_settings[ 'plugin_action_slug' ];
236
+		$addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug']) && ! empty($addon_settings['admin_path']) ? $addon_settings['plugin_slug'] : $addon_settings['plugin_action_slug'];
237 237
 		// full server path to main file (file loaded directly by WP)
238
-		$addon_settings['plugin_basename'] = plugin_basename( $addon_settings[ 'main_file_path' ] );
238
+		$addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
239 239
 
240 240
 		//check whether this addon version is compatible with EE core
241
-		if ( isset( EE_Register_Addon::$_incompatible_addons[ $addon_name ] ) &&
242
-				! self::_meets_min_core_version_requirement( EE_Register_Addon::$_incompatible_addons[ $addon_name ], $addon_settings[ 'version' ] ) ) {
241
+		if (isset(EE_Register_Addon::$_incompatible_addons[$addon_name]) &&
242
+				! self::_meets_min_core_version_requirement(EE_Register_Addon::$_incompatible_addons[$addon_name], $addon_settings['version'])) {
243 243
 			$incompatibility_message = sprintf(
244
-				__( 'The Event Espresso "%1$s" addon was deactivated because it is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon, then re-attempt activating it.', 'event_espresso' ),
244
+				__('The Event Espresso "%1$s" addon was deactivated because it is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon, then re-attempt activating it.', 'event_espresso'),
245 245
 				$addon_name,
246 246
 				'<br />',
247
-				EE_Register_Addon::$_incompatible_addons[ $addon_name ]
247
+				EE_Register_Addon::$_incompatible_addons[$addon_name]
248 248
 			);
249
-		} else if ( ! self::_meets_min_core_version_requirement( $setup_args[ 'min_core_version' ], espresso_version() ) ) {
249
+		} else if ( ! self::_meets_min_core_version_requirement($setup_args['min_core_version'], espresso_version())) {
250 250
 			$incompatibility_message = sprintf(
251
-				__( 'The Event Espresso "%1$s" addon could not be activated because it requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-attempt activating "%1$s".', 'event_espresso' ),
251
+				__('The Event Espresso "%1$s" addon could not be activated because it requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-attempt activating "%1$s".', 'event_espresso'),
252 252
 				$addon_name,
253
-				self::_effective_version( $setup_args[ 'min_core_version' ] ),
254
-				self::_effective_version( espresso_version() ),
253
+				self::_effective_version($setup_args['min_core_version']),
254
+				self::_effective_version(espresso_version()),
255 255
 				'<br />'
256 256
 			);
257 257
 		} else {
258 258
 			$incompatibility_message = '';
259 259
 		}
260
-		if ( ! empty( $incompatibility_message ) ) {
260
+		if ( ! empty($incompatibility_message)) {
261 261
 			//remove 'activate' from the REQUEST so WP doesn't erroneously tell the user the
262 262
 			//plugin activated fine when it didn't
263
-			if( isset( $_GET[ 'activate' ]) ) {
264
-				unset( $_GET[ 'activate' ] );
263
+			if (isset($_GET['activate'])) {
264
+				unset($_GET['activate']);
265 265
 			}
266
-			if( isset( $_REQUEST[ 'activate' ] ) ){
267
-				unset( $_REQUEST[ 'activate' ] );
266
+			if (isset($_REQUEST['activate'])) {
267
+				unset($_REQUEST['activate']);
268 268
 			}
269 269
 			//and show an error message indicating the plugin didn't activate properly
270
-			EE_Error::add_error( $incompatibility_message, __FILE__, __FUNCTION__, __LINE__ );
271
-			if ( current_user_can( 'activate_plugins' )) {
272
-				require_once( ABSPATH.'wp-admin/includes/plugin.php' );
273
-				deactivate_plugins( plugin_basename( $addon_settings[ 'main_file_path' ] ), TRUE );
270
+			EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
271
+			if (current_user_can('activate_plugins')) {
272
+				require_once(ABSPATH.'wp-admin/includes/plugin.php');
273
+				deactivate_plugins(plugin_basename($addon_settings['main_file_path']), TRUE);
274 274
 			}
275 275
 			return;
276 276
 		}
277 277
 		//this is an activation request
278
-		if( did_action( 'activate_plugin' ) ){
278
+		if (did_action('activate_plugin')) {
279 279
 			//to find if THIS is the addon that was activated,
280 280
 			//just check if we have already registered it or not
281 281
 			//(as the newly-activated addon wasn't around the first time addons were registered)
282
-			if( ! isset( self::$_settings[ $addon_name ] ) ){
283
-				self::$_settings[ $addon_name ] = $addon_settings;
282
+			if ( ! isset(self::$_settings[$addon_name])) {
283
+				self::$_settings[$addon_name] = $addon_settings;
284 284
 				$addon = self::_load_and_init_addon_class($addon_name);
285 285
 				$addon->set_activation_indicator_option();
286 286
 				//dont bother setting up the rest of the addon.
287 287
 				//we know it was just activated and the request will end soon
288 288
 			}
289 289
 			return;
290
-		}else{
290
+		} else {
291 291
 			// make sure this was called in the right place!
292
-			if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System___detect_if_activation_or_upgrade__begin' )) {
292
+			if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')) {
293 293
 				EE_Error::doing_it_wrong(
294 294
 					__METHOD__,
295 295
 					sprintf(
296
-						__( 'An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.','event_espresso'),
296
+						__('An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.', 'event_espresso'),
297 297
 						$addon_name
298 298
 					),
299 299
 					'4.3.0'
300 300
 				);
301 301
 			}
302
-			self::$_settings[ $addon_name ] = $addon_settings;
302
+			self::$_settings[$addon_name] = $addon_settings;
303 303
 		}
304 304
 		// we need cars
305
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_paths'] )) {
305
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
306 306
 			// setup autoloader for single file
307
-			EEH_Autoloader::instance()->register_autoloader( self::$_settings[ $addon_name ]['autoloader_paths'] );
307
+			EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
308 308
 		}
309 309
 		// setup autoloaders for folders
310
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_folders'] )) {
311
-			foreach ( self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder ) {
312
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $autoloader_folder );
310
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
311
+			foreach (self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
312
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
313 313
 			}
314 314
 		}
315 315
 		// register new models
316
-		if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
317
-			EE_Register_Model::register( $addon_name, array( 'model_paths' => self::$_settings[ $addon_name ]['model_paths'] , 'class_paths' => self::$_settings[ $addon_name ]['class_paths']));
316
+		if ( ! empty(self::$_settings[$addon_name]['model_paths']) || ! empty(self::$_settings[$addon_name]['class_paths'])) {
317
+			EE_Register_Model::register($addon_name, array('model_paths' => self::$_settings[$addon_name]['model_paths'], 'class_paths' => self::$_settings[$addon_name]['class_paths']));
318 318
 		}
319 319
 		// register model extensions
320
-		if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
321
-			EE_Register_Model_Extensions::register( $addon_name, array( 'model_extension_paths' => self::$_settings[ $addon_name ]['model_extension_paths'] , 'class_extension_paths' => self::$_settings[ $addon_name ]['class_extension_paths']));
320
+		if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) || ! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
321
+			EE_Register_Model_Extensions::register($addon_name, array('model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'], 'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths']));
322 322
 		}
323 323
 		// setup DMS
324
-		if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
325
-			EE_Register_Data_Migration_Scripts::register( $addon_name, array( 'dms_paths' => self::$_settings[ $addon_name ]['dms_paths'] ));
324
+		if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
325
+			EE_Register_Data_Migration_Scripts::register($addon_name, array('dms_paths' => self::$_settings[$addon_name]['dms_paths']));
326 326
 		}
327 327
 		// if config_class is present let's register config.
328
-		if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
328
+		if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
329 329
 			EE_Register_Config::register(
330
-				self::$_settings[ $addon_name ]['config_class'],
330
+				self::$_settings[$addon_name]['config_class'],
331 331
 				array(
332
-					'config_section' => self::$_settings[ $addon_name ]['config_section'],
333
-					'config_name' => self::$_settings[ $addon_name ]['config_name']
332
+					'config_section' => self::$_settings[$addon_name]['config_section'],
333
+					'config_name' => self::$_settings[$addon_name]['config_name']
334 334
 				)
335 335
 			);
336 336
 		}
337 337
 		// register admin page
338
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
339
-			EE_Register_Admin_Page::register( $addon_name, array( 'page_path' => self::$_settings[ $addon_name ]['admin_path'] ));
338
+		if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
339
+			EE_Register_Admin_Page::register($addon_name, array('page_path' => self::$_settings[$addon_name]['admin_path']));
340 340
 
341 341
 		}
342 342
 		// add to list of modules to be registered
343
-		if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
344
-			EE_Register_Module::register( $addon_name, array( 'module_paths' => self::$_settings[ $addon_name ]['module_paths'] ));
343
+		if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
344
+			EE_Register_Module::register($addon_name, array('module_paths' => self::$_settings[$addon_name]['module_paths']));
345 345
 		}
346 346
 		// add to list of shortcodes to be registered
347
-		if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
348
-			EE_Register_Shortcode::register( $addon_name, array( 'shortcode_paths' => self::$_settings[ $addon_name ]['shortcode_paths'] ));
347
+		if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
348
+			EE_Register_Shortcode::register($addon_name, array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths']));
349 349
 		}
350 350
 		// add to list of widgets to be registered
351
-		if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
352
-			EE_Register_Widget::register( $addon_name, array( 'widget_paths' => self::$_settings[ $addon_name ]['widget_paths'] ));
351
+		if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
352
+			EE_Register_Widget::register($addon_name, array('widget_paths' => self::$_settings[$addon_name]['widget_paths']));
353 353
 		}
354 354
 
355 355
 		//register capability related stuff.
356
-		if ( ! empty( self::$_settings[ $addon_name ]['capabilities'] ) ) {
357
-			EE_Register_Capabilities::register( $addon_name , array( 'capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps'] ) );
356
+		if ( ! empty(self::$_settings[$addon_name]['capabilities'])) {
357
+			EE_Register_Capabilities::register($addon_name, array('capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps']));
358 358
 		}
359 359
 		//any message type to register?
360
-		if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
361
-				add_action( 'EE_Brewing_Regular___messages_caf', array( 'EE_Register_Addon', 'register_message_types' ) );
360
+		if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
361
+				add_action('EE_Brewing_Regular___messages_caf', array('EE_Register_Addon', 'register_message_types'));
362 362
 		}
363 363
 
364 364
 		// if plugin update engine is being used for auto-updates (not needed if PUE is not being used)
365
-		if ( ! empty( $setup_args['pue_options'] )) {
366
-			self::$_settings[ $addon_name ]['pue_options'] = array(
367
-				'pue_plugin_slug' 	=> isset( $setup_args['pue_options']['pue_plugin_slug'] ) ? (string)$setup_args['pue_options']['pue_plugin_slug'] : 'espresso_' . strtolower( $class_name ),
368
-				'plugin_basename' => isset( $setup_args['pue_options']['plugin_basename'] ) ? (string)$setup_args['pue_options']['plugin_basename'] : plugin_basename( self::$_settings[ $addon_name ]['main_file_path'] ),
369
-				'checkPeriod' 			=> isset( $setup_args['pue_options']['checkPeriod'] ) ? (string)$setup_args['pue_options']['checkPeriod'] : '24',
370
-				'use_wp_update'		=> isset( $setup_args['pue_options']['use_wp_update'] ) ? (string)$setup_args['pue_options']['use_wp_update'] : FALSE
365
+		if ( ! empty($setup_args['pue_options'])) {
366
+			self::$_settings[$addon_name]['pue_options'] = array(
367
+				'pue_plugin_slug' 	=> isset($setup_args['pue_options']['pue_plugin_slug']) ? (string) $setup_args['pue_options']['pue_plugin_slug'] : 'espresso_'.strtolower($class_name),
368
+				'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) ? (string) $setup_args['pue_options']['plugin_basename'] : plugin_basename(self::$_settings[$addon_name]['main_file_path']),
369
+				'checkPeriod' 			=> isset($setup_args['pue_options']['checkPeriod']) ? (string) $setup_args['pue_options']['checkPeriod'] : '24',
370
+				'use_wp_update'		=> isset($setup_args['pue_options']['use_wp_update']) ? (string) $setup_args['pue_options']['use_wp_update'] : FALSE
371 371
 			);
372
-			add_action( 'AHEE__EE_System__brew_espresso__after_pue_init', array( 'EE_Register_Addon', 'load_pue_update' ));
372
+			add_action('AHEE__EE_System__brew_espresso__after_pue_init', array('EE_Register_Addon', 'load_pue_update'));
373 373
 		}
374 374
 
375 375
 		//any custom post type/ custom capabilities or default terms to register
376
-		if ( !empty( self::$_settings[$addon_name]['custom_post_types'] ) || !empty( self::$_settings[$addon_name]['custom_taxonomies'] ) ) {
377
-			EE_Register_CPT::register( $addon_name, array( 'cpts' => self::$_settings[$addon_name]['custom_post_types'] , 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], 'default_terms' => self::$_settings[$addon_name]['default_terms'] ) );
376
+		if ( ! empty(self::$_settings[$addon_name]['custom_post_types']) || ! empty(self::$_settings[$addon_name]['custom_taxonomies'])) {
377
+			EE_Register_CPT::register($addon_name, array('cpts' => self::$_settings[$addon_name]['custom_post_types'], 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], 'default_terms' => self::$_settings[$addon_name]['default_terms']));
378 378
 		}
379
-		if( ! empty( self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) ){
380
-			EE_Register_Payment_Method::register($addon_name, array( 'payment_method_paths' => self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) );
379
+		if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
380
+			EE_Register_Payment_Method::register($addon_name, array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths']));
381 381
 		}
382 382
 		// load and instantiate main addon class
383 383
 		$addon = self::_load_and_init_addon_class($addon_name);
384 384
 		// call any additional admin_callback functions during load_admin_controller hook
385
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_callback'] )) {
386
-			add_action( 'AHEE__EE_System__load_controllers__load_admin_controllers', array( $addon, self::$_settings[ $addon_name ]['admin_callback'] ));
385
+		if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) {
386
+			add_action('AHEE__EE_System__load_controllers__load_admin_controllers', array($addon, self::$_settings[$addon_name]['admin_callback']));
387 387
 		}
388 388
 	}
389 389
 
@@ -394,22 +394,22 @@  discard block
 block discarded – undo
394 394
 	 * @param string $addon_name
395 395
 	 * @return EE_Addon
396 396
 	 */
397
-	private static function _load_and_init_addon_class($addon_name){
398
-		$addon = EE_Registry::instance()->load_addon( dirname( self::$_settings[ $addon_name ]['main_file_path'] ), self::$_settings[ $addon_name ]['class_name'] );
399
-		$addon->set_name( $addon_name );
400
-		$addon->set_plugin_slug( self::$_settings[ $addon_name ][ 'plugin_slug' ] );
401
-		$addon->set_plugin_basename( self::$_settings[ $addon_name ][ 'plugin_basename' ] );
402
-		$addon->set_main_plugin_file( self::$_settings[ $addon_name ]['main_file_path'] );
403
-		$addon->set_plugin_action_slug( self::$_settings[ $addon_name ][ 'plugin_action_slug' ] );
404
-		$addon->set_plugins_page_row( self::$_settings[ $addon_name ][ 'plugins_page_row' ] );
405
-		$addon->set_version( self::$_settings[ $addon_name ]['version'] );
406
-		$addon->set_min_core_version( self::_effective_version( self::$_settings[ $addon_name ]['min_core_version'] ) );
407
-		$addon->set_config_section( self::$_settings[ $addon_name ]['config_section'] );
408
-		$addon->set_config_class( self::$_settings[ $addon_name ]['config_class'] );
409
-		$addon->set_config_name( self::$_settings[ $addon_name ]['config_name'] );
397
+	private static function _load_and_init_addon_class($addon_name) {
398
+		$addon = EE_Registry::instance()->load_addon(dirname(self::$_settings[$addon_name]['main_file_path']), self::$_settings[$addon_name]['class_name']);
399
+		$addon->set_name($addon_name);
400
+		$addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
401
+		$addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
402
+		$addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
403
+		$addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
404
+		$addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
405
+		$addon->set_version(self::$_settings[$addon_name]['version']);
406
+		$addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
407
+		$addon->set_config_section(self::$_settings[$addon_name]['config_section']);
408
+		$addon->set_config_class(self::$_settings[$addon_name]['config_class']);
409
+		$addon->set_config_name(self::$_settings[$addon_name]['config_name']);
410 410
 		//unfortunately this can't be hooked in upon construction, because we don't have
411 411
 		//the plugin mainfile's path upon construction.
412
-		register_deactivation_hook($addon->get_main_plugin_file(), array($addon,'deactivation'));
412
+		register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
413 413
 		return $addon;
414 414
 	}
415 415
 
@@ -422,18 +422,18 @@  discard block
 block discarded – undo
422 422
 	 */
423 423
 	public static function load_pue_update() {
424 424
 		// load PUE client
425
-		require_once  EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
425
+		require_once  EE_THIRD_PARTY.'pue'.DS.'pue-client.php';
426 426
 		// cycle thru settings
427
-		foreach ( self::$_settings as $settings ) {
428
-			if ( ! empty( $settings['pue_options'] )) {
427
+		foreach (self::$_settings as $settings) {
428
+			if ( ! empty($settings['pue_options'])) {
429 429
 				// initiate the class and start the plugin update engine!
430 430
 				new PluginUpdateEngineChecker(
431 431
 				// host file URL
432 432
 					'https://eventespresso.com',
433 433
 					// plugin slug(s)
434 434
 					array(
435
-						'premium' => array( 'p' => $settings['pue_options']['pue_plugin_slug'] ),
436
-						'prerelease' => array( 'beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr' )
435
+						'premium' => array('p' => $settings['pue_options']['pue_plugin_slug']),
436
+						'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'].'-pr')
437 437
 					),
438 438
 					// options
439 439
 					array(
@@ -461,9 +461,9 @@  discard block
 block discarded – undo
461 461
 	 * @return void
462 462
 	 */
463 463
 	public static function register_message_types() {
464
-		foreach ( self::$_settings as $settings ) {
465
-			foreach( $settings['message_types'] as $message_type => $message_type_settings ) {
466
-				EE_Register_Message_Type::register( $message_type, $message_type_settings );
464
+		foreach (self::$_settings as $settings) {
465
+			foreach ($settings['message_types'] as $message_type => $message_type_settings) {
466
+				EE_Register_Message_Type::register($message_type, $message_type_settings);
467 467
 			}
468 468
 		}
469 469
 	}
@@ -479,60 +479,60 @@  discard block
 block discarded – undo
479 479
 	 * @throws EE_Error
480 480
 	 * @return void
481 481
 	 */
482
-	public static function deregister( $addon_name = NULL ) {
483
-		if ( isset( self::$_settings[ $addon_name ] )) {
484
-			$class_name = self::$_settings[ $addon_name ]['class_name'];
485
-			if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
482
+	public static function deregister($addon_name = NULL) {
483
+		if (isset(self::$_settings[$addon_name])) {
484
+			$class_name = self::$_settings[$addon_name]['class_name'];
485
+			if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
486 486
 				// setup DMS
487
-				EE_Register_Data_Migration_Scripts::deregister( $addon_name );
487
+				EE_Register_Data_Migration_Scripts::deregister($addon_name);
488 488
 			}
489
-			if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
489
+			if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
490 490
 				// register admin page
491
-				EE_Register_Admin_Page::deregister( $addon_name );
491
+				EE_Register_Admin_Page::deregister($addon_name);
492 492
 			}
493
-			if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
493
+			if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
494 494
 				// add to list of modules to be registered
495
-				EE_Register_Module::deregister( $addon_name );
495
+				EE_Register_Module::deregister($addon_name);
496 496
 			}
497
-			if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
497
+			if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
498 498
 				// add to list of shortcodes to be registered
499
-				EE_Register_Shortcode::deregister( $addon_name );
499
+				EE_Register_Shortcode::deregister($addon_name);
500 500
 			}
501
-			if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
501
+			if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
502 502
 				// if config_class present let's register config.
503
-				EE_Register_Config::deregister( self::$_settings[ $addon_name ]['config_class']);
503
+				EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
504 504
 			}
505
-			if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
505
+			if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
506 506
 				// add to list of widgets to be registered
507
-				EE_Register_Widget::deregister( $addon_name );
507
+				EE_Register_Widget::deregister($addon_name);
508 508
 			}
509
-			if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) ||
510
-					! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
509
+			if ( ! empty(self::$_settings[$addon_name]['model_paths']) ||
510
+					! empty(self::$_settings[$addon_name]['class_paths'])) {
511 511
 				// add to list of shortcodes to be registered
512
-				EE_Register_Model::deregister( $addon_name );
512
+				EE_Register_Model::deregister($addon_name);
513 513
 			}
514
-			if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) ||
515
-					! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
514
+			if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) ||
515
+					! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
516 516
 				// add to list of shortcodes to be registered
517
-				EE_Register_Model_Extensions::deregister( $addon_name );
517
+				EE_Register_Model_Extensions::deregister($addon_name);
518 518
 				}
519
-			if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
520
-				foreach( self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings ) {
521
-					EE_Register_Message_Type::deregister( $message_type );
519
+			if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
520
+				foreach (self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
521
+					EE_Register_Message_Type::deregister($message_type);
522 522
 				}
523 523
 			}
524 524
 			//deregister capabilities for addon
525
-			if ( ! empty( self::$_settings[$addon_name]['capabilities'] ) || ! empty( self::$_settings[$addon_name]['capability_maps']) ) {
526
-				EE_Register_Capabilities::deregister( $addon_name );
525
+			if ( ! empty(self::$_settings[$addon_name]['capabilities']) || ! empty(self::$_settings[$addon_name]['capability_maps'])) {
526
+				EE_Register_Capabilities::deregister($addon_name);
527 527
 			}
528 528
 			//deregister custom_post_types for addon
529
-			if ( ! empty( self::$_settings[$addon_name]['custom_post_types'] ) ) {
530
-				EE_Register_CPT::deregister( $addon_name );
529
+			if ( ! empty(self::$_settings[$addon_name]['custom_post_types'])) {
530
+				EE_Register_CPT::deregister($addon_name);
531 531
 			}
532
-			remove_action('deactivate_'.EE_Registry::instance()->addons->$class_name->get_main_plugin_file_basename(),  array( EE_Registry::instance()->addons->$class_name, 'deactivation' ) );
533
-			remove_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( EE_Registry::instance()->addons->$class_name, 'initialize_db_if_no_migrations_required' ) );
532
+			remove_action('deactivate_'.EE_Registry::instance()->addons->$class_name->get_main_plugin_file_basename(), array(EE_Registry::instance()->addons->$class_name, 'deactivation'));
533
+			remove_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array(EE_Registry::instance()->addons->$class_name, 'initialize_db_if_no_migrations_required'));
534 534
 			unset(EE_Registry::instance()->addons->$class_name);
535
-			unset( self::$_settings[ $addon_name ] );
535
+			unset(self::$_settings[$addon_name]);
536 536
 		}
537 537
 	}
538 538
 
Please login to merge, or discard this patch.
modules/add_new_state/EED_Add_New_State.module.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  *
4 6
  * EED_Add_New_State class
Please login to merge, or discard this patch.
Spacing   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	 * @return EED_Add_New_State
17 17
 	 */
18 18
 	public static function instance() {
19
-		return parent::get_instance( __CLASS__ );
19
+		return parent::get_instance(__CLASS__);
20 20
 	}
21 21
 
22 22
 
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 	 *  	@return 		void
28 28
 	 */
29 29
 	public static function set_hooks() {
30
-		add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 );
31
-		add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'translate_js_strings' ), 0 );
32
-		add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'wp_enqueue_scripts' ), 10 );
33
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
34
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
35
-		add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 );
36
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 );
37
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 );
38
-		add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 );
39
-		add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 );
30
+		add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2);
31
+		add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0);
32
+		add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10);
33
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
34
+		add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
35
+		add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1);
36
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5);
37
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5);
38
+		add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1);
39
+		add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1);
40 40
 	}
41 41
 
42 42
 	/**
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
 	 *  	@return 		void
47 47
 	 */
48 48
 	public static function set_hooks_admin() {
49
-		add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 );
50
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
51
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 );
52
-		add_action( 'wp_ajax_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' ));
53
-		add_action( 'wp_ajax_nopriv_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' ));
54
-		add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 );
55
-		add_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 );
56
-		add_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 );
57
-		add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 );
58
-		add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 );
59
-		add_filter( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', array( 'EED_Add_New_State', 'filter_checkout_request_params' ), 10, 1 );
60
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 );
61
-		add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 );
49
+		add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2);
50
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
51
+		add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1);
52
+		add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state'));
53
+		add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state'));
54
+		add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1);
55
+		add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array('EED_Add_New_State', 'update_country_settings'), 10, 3);
56
+		add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array('EED_Add_New_State', 'update_country_settings'), 10, 3);
57
+		add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1);
58
+		add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1);
59
+		add_filter('FHEE__Single_Page_Checkout___check_form_submission__request_params', array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1);
60
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5);
61
+		add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5);
62 62
 	}
63 63
 
64 64
 
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 *  	@return 		void
71 71
 	 */
72 72
 	public static function set_definitions() {
73
-		define( 'ANS_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
74
-		define( 'ANS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
73
+		define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
74
+		define('ANS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
75 75
 	}
76 76
 
77 77
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param \WP $WP
84 84
 	 * @return        void
85 85
 	 */
86
-	public function run( $WP ) {
86
+	public function run($WP) {
87 87
 	}
88 88
 
89 89
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	 * 	@return 		void
112 112
 	 */
113 113
 	public static function wp_enqueue_scripts() {
114
-		if ( apply_filters( 'EED_Single_Page_Checkout__SPCO_active', false ) ) {
115
-			wp_register_script( 'add_new_state', ANS_ASSETS_URL . 'add_new_state.js', array( 'espresso_core', 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, true );
116
-			wp_enqueue_script( 'add_new_state' );
114
+		if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) {
115
+			wp_register_script('add_new_state', ANS_ASSETS_URL.'add_new_state.js', array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true);
116
+			wp_enqueue_script('add_new_state');
117 117
 		}
118 118
 	}
119 119
 
@@ -127,30 +127,30 @@  discard block
 block discarded – undo
127 127
 	 * @return 	string
128 128
 	 */
129 129
 //	public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){
130
-	public static function display_add_new_state_micro_form( EE_Form_Section_Proper $question_group_reg_form ){
130
+	public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) {
131 131
 		// only add the 'new_state_micro_form' when displaying reg forms,
132 132
 		// not during processing since we process the 'new_state_micro_form' in it's own AJAX request
133
-		$action = EE_Registry::instance()->REQ->get( 'action', '' );
134
-		if ( $action === 'process_reg_step' || $action === 'update_reg_step' ) {
133
+		$action = EE_Registry::instance()->REQ->get('action', '');
134
+		if ($action === 'process_reg_step' || $action === 'update_reg_step') {
135 135
 			return $question_group_reg_form;
136 136
 		}
137 137
 		// is the "state" question in this form section?
138
-		$input = $question_group_reg_form->get_subsection( 'state' );
138
+		$input = $question_group_reg_form->get_subsection('state');
139 139
 		// we're only doing this for state select inputs
140
-		if ( $input instanceof EE_State_Select_Input ) {
140
+		if ($input instanceof EE_State_Select_Input) {
141 141
 			// load helpers
142
-			EE_Registry::instance()->load_helper( 'HTML' );
142
+			EE_Registry::instance()->load_helper('HTML');
143 143
 			// grab any set values from the request
144
-			$country_name = str_replace( 'state', 'new_state_country', $input->html_name() );
145
-			$state_name = str_replace( 'state', 'new_state_name', $input->html_name() );
146
-			$abbrv_name = str_replace( 'state', 'new_state_abbrv', $input->html_name() );
147
-			$new_state_submit_id = str_replace( 'state', 'new_state', $input->html_id() );
144
+			$country_name = str_replace('state', 'new_state_country', $input->html_name());
145
+			$state_name = str_replace('state', 'new_state_name', $input->html_name());
146
+			$abbrv_name = str_replace('state', 'new_state_abbrv', $input->html_name());
147
+			$new_state_submit_id = str_replace('state', 'new_state', $input->html_id());
148 148
 			$country_options = array();
149 149
 			$countries = EEM_Country::instance()->get_all_countries();
150
-			if ( ! empty( $countries )) {
151
-				foreach( $countries as $country ){
152
-					if ( $country instanceof EE_Country ) {
153
-						$country_options[ $country->ID() ] = $country->name();
150
+			if ( ! empty($countries)) {
151
+				foreach ($countries as $country) {
152
+					if ($country instanceof EE_Country) {
153
+						$country_options[$country->ID()] = $country->name();
154 154
 					}
155 155
 				}
156 156
 			}
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 						// add hidden input to indicate that a new state is being added
164 164
 						'add_new_state' 	=> new EE_Hidden_Input(
165 165
 							array(
166
-								'html_name' 	=> str_replace( 'state', 'add_new_state', $input->html_name() ),
167
-								'html_id' 			=> str_replace( 'state', 'add_new_state', $input->html_id() ),
166
+								'html_name' 	=> str_replace('state', 'add_new_state', $input->html_name()),
167
+								'html_id' 			=> str_replace('state', 'add_new_state', $input->html_id()),
168 168
 								'default'			=> 0
169 169
 							)
170 170
 						),
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 									'',
177 177
 									__('click here to add a new state/province', 'event_espresso'),
178 178
 									'',
179
-									'display-' . $input->html_id(),
179
+									'display-'.$input->html_id(),
180 180
 									'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js',
181 181
 									'',
182
-									'rel="' . $input->html_id() . '"'
182
+									'rel="'.$input->html_id().'"'
183 183
 								)
184 184
 							)
185 185
 						),
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 						'add_new_state_micro_form' =>new EE_Form_Section_HTML(
188 188
 							apply_filters(
189 189
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form',
190
-								EEH_HTML::div( '', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', 'display: none;' ) .
191
-								EEH_HTML::h6( __('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')) .
192
-								EEH_HTML::ul() .
193
-								EEH_HTML::li( __('first select the Country that your State/Province belongs to', 'event_espresso') ) .
194
-								EEH_HTML::li( __('enter the name of your State/Province', 'event_espresso') ) .
195
-								EEH_HTML::li( __('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso') ) .
196
-								EEH_HTML::li( __('click the ADD button', 'event_espresso') ) .
190
+								EEH_HTML::div('', $input->html_id().'-dv', 'ee-form-add-new-state-dv', 'display: none;').
191
+								EEH_HTML::h6(__('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')).
192
+								EEH_HTML::ul().
193
+								EEH_HTML::li(__('first select the Country that your State/Province belongs to', 'event_espresso')).
194
+								EEH_HTML::li(__('enter the name of your State/Province', 'event_espresso')).
195
+								EEH_HTML::li(__('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso')).
196
+								EEH_HTML::li(__('click the ADD button', 'event_espresso')).
197 197
 								EEH_HTML::ulx()
198 198
 							)
199 199
 						),
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 							$country_options,
203 203
 							array(
204 204
 								'html_name' 			=> $country_name,
205
-								'html_id' 					=> str_replace( 'state', 'new_state_country', $input->html_id() ),
206
-								'html_class' 			=> $input->html_class() . ' new-state-country',
205
+								'html_id' 					=> str_replace('state', 'new_state_country', $input->html_id()),
206
+								'html_class' 			=> $input->html_class().' new-state-country',
207 207
 								'html_label_text'		=> __('New State/Province Country', 'event_espresso'),
208
-								'default'					=> EE_Registry::instance()->REQ->get( $country_name, '' ),
208
+								'default'					=> EE_Registry::instance()->REQ->get($country_name, ''),
209 209
 								'required' 				=> false
210 210
 							)
211 211
 						),
@@ -213,23 +213,23 @@  discard block
 block discarded – undo
213 213
 						'new_state_name' => new EE_Text_Input(
214 214
 							array(
215 215
 								'html_name' 			=> $state_name,
216
-								'html_id' 					=> str_replace( 'state', 'new_state_name', $input->html_id() ),
217
-								'html_class' 			=> $input->html_class() . ' new-state-state',
216
+								'html_id' 					=> str_replace('state', 'new_state_name', $input->html_id()),
217
+								'html_class' 			=> $input->html_class().' new-state-state',
218 218
 								'html_label_text'		=> __('New State/Province Name', 'event_espresso'),
219
-								'default'					=> EE_Registry::instance()->REQ->get( $state_name, '' ),
219
+								'default'					=> EE_Registry::instance()->REQ->get($state_name, ''),
220 220
 								'required' 				=> false
221 221
 							)
222 222
 						),
223
-						'spacer' => new EE_Form_Section_HTML( EEH_HTML::br() ),
223
+						'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()),
224 224
 						// NEW STATE NAME
225 225
 						'new_state_abbrv' => new EE_Text_Input(
226 226
 							array(
227 227
 								'html_name' 					=> $abbrv_name,
228
-								'html_id' 							=> str_replace( 'state', 'new_state_abbrv', $input->html_id() ),
229
-								'html_class' 					=> $input->html_class() . ' new-state-abbrv',
228
+								'html_id' 							=> str_replace('state', 'new_state_abbrv', $input->html_id()),
229
+								'html_class' 					=> $input->html_class().' new-state-abbrv',
230 230
 								'html_label_text'				=> __('New State/Province Abbreviation', 'event_espresso'),
231 231
 								'html_other_attributes'	=> 'size="24"',
232
-								'default'							=> EE_Registry::instance()->REQ->get( $abbrv_name, '' ),
232
+								'default'							=> EE_Registry::instance()->REQ->get($abbrv_name, ''),
233 233
 								'required' 						=> false
234 234
 							)
235 235
 						),
@@ -237,26 +237,26 @@  discard block
 block discarded – undo
237 237
 						'add_new_state_submit_button' => new EE_Form_Section_HTML(
238 238
 							apply_filters(
239 239
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button',
240
-								EEH_HTML::nbsp(3) .
241
-								EEH_HTML::link( '', __('ADD', 'event_espresso'), '', 'submit-' . $new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="' . $new_state_submit_id . '"' )
240
+								EEH_HTML::nbsp(3).
241
+								EEH_HTML::link('', __('ADD', 'event_espresso'), '', 'submit-'.$new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="'.$new_state_submit_id.'"')
242 242
 							)
243 243
 						),
244 244
 						// extra info
245 245
 						'add_new_state_extra' => new EE_Form_Section_HTML(
246 246
 							apply_filters(
247 247
 								'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra',
248
-								EEH_HTML::br(2) .
249
-								EEH_HTML::div( '', '', 'small-text' ) .
250
-								EEH_HTML::strong( __('Don\'t know your State/Province Abbreviation?', 'event_espresso') ) .
251
-								EEH_HTML::br() .
248
+								EEH_HTML::br(2).
249
+								EEH_HTML::div('', '', 'small-text').
250
+								EEH_HTML::strong(__('Don\'t know your State/Province Abbreviation?', 'event_espresso')).
251
+								EEH_HTML::br().
252 252
 								sprintf(
253 253
 									__('You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', 'event_espresso'),
254
-									EEH_HTML::link( 'http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk' )
255
-								) .
256
-								EEH_HTML::divx() .
257
-								EEH_HTML::br() .
258
-								EEH_HTML::link( '', __('cancel new state/province', 'event_espresso'), '', 'hide-' . $input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="' . $input->html_id() . '"' ) .
259
-								EEH_HTML::divx() .
254
+									EEH_HTML::link('http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk')
255
+								).
256
+								EEH_HTML::divx().
257
+								EEH_HTML::br().
258
+								EEH_HTML::link('', __('cancel new state/province', 'event_espresso'), '', 'hide-'.$input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="'.$input->html_id().'"').
259
+								EEH_HTML::divx().
260 260
 								EEH_HTML::br()
261 261
 							)
262 262
 						)
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 					)
265 265
 				)
266 266
 			);
267
-			$question_group_reg_form->add_subsections( array( 'new_state_micro_form' => $new_state_micro_form ), 'state', false );
267
+			$question_group_reg_form->add_subsections(array('new_state_micro_form' => $new_state_micro_form), 'state', false);
268 268
 		}
269 269
 		return $question_group_reg_form;
270 270
 	}
@@ -281,41 +281,41 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public static function add_new_state() {
283 283
 		$REQ = EE_Registry::instance()->load_core('Request_Handler');
284
-		if ( $REQ->is_set( 'add_new_state' ) && $REQ->get( 'add_new_state' ) == 1 ) {
284
+		if ($REQ->is_set('add_new_state') && $REQ->get('add_new_state') == 1) {
285 285
 			EE_Registry::instance()->load_model('State');
286 286
 			// grab country ISO code, new state name, and new state abbreviation
287
-			$state_country = $REQ->is_set( 'new_state_country' ) ? sanitize_text_field( $REQ->get( 'new_state_country' )) : FALSE;
288
-			$state_name = $REQ->is_set( 'new_state_name' ) ? sanitize_text_field( $REQ->get( 'new_state_name' )) : FALSE;
289
-			$state_abbr = $REQ->is_set( 'new_state_abbrv' ) ? sanitize_text_field( $REQ->get( 'new_state_abbrv' )) : FALSE;
287
+			$state_country = $REQ->is_set('new_state_country') ? sanitize_text_field($REQ->get('new_state_country')) : FALSE;
288
+			$state_name = $REQ->is_set('new_state_name') ? sanitize_text_field($REQ->get('new_state_name')) : FALSE;
289
+			$state_abbr = $REQ->is_set('new_state_abbrv') ? sanitize_text_field($REQ->get('new_state_abbrv')) : FALSE;
290 290
 
291 291
 //echo '<h4>$state_country : ' . $state_country . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
292 292
 //echo '<h4>$state_name : ' . $state_name . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
293 293
 //echo '<h4>$state_abbr : ' . $state_abbr . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
294 294
 
295
-			if ( $state_country && $state_name && $state_abbr ) {
296
-				$new_state = EED_Add_New_State::save_new_state_to_db( array(
297
-					'CNT_ISO'=> strtoupper( $state_country ),
298
-					'STA_abbrev' => strtoupper( $state_abbr ),
299
-					'STA_name' => ucwords( $state_name ),
295
+			if ($state_country && $state_name && $state_abbr) {
296
+				$new_state = EED_Add_New_State::save_new_state_to_db(array(
297
+					'CNT_ISO'=> strtoupper($state_country),
298
+					'STA_abbrev' => strtoupper($state_abbr),
299
+					'STA_name' => ucwords($state_name),
300 300
 					'STA_active' => FALSE
301 301
 				));
302 302
 
303
-				if ( $new_state instanceof EE_State ) {
303
+				if ($new_state instanceof EE_State) {
304 304
 					// clean house
305
-					EE_Registry::instance()->REQ->un_set( 'add_new_state' );
306
-					EE_Registry::instance()->REQ->un_set( 'new_state_country' );
307
-					EE_Registry::instance()->REQ->un_set( 'new_state_name' );
308
-					EE_Registry::instance()->REQ->un_set( 'new_state_abbrv' );
305
+					EE_Registry::instance()->REQ->un_set('add_new_state');
306
+					EE_Registry::instance()->REQ->un_set('new_state_country');
307
+					EE_Registry::instance()->REQ->un_set('new_state_name');
308
+					EE_Registry::instance()->REQ->un_set('new_state_abbrv');
309 309
 
310 310
 					// get any existing new states
311 311
 					$new_states = EE_Registry::instance()->SSN->get_session_data(
312 312
 						'new_states'
313 313
 					);
314
-					$new_states[ $new_state->ID() ] = $new_state;
315
-					EE_Registry::instance()->SSN->set_session_data( array( 'new_states' => $new_states ));
314
+					$new_states[$new_state->ID()] = $new_state;
315
+					EE_Registry::instance()->SSN->set_session_data(array('new_states' => $new_states));
316 316
 
317
-					if ( EE_Registry::instance()->REQ->ajax ) {
318
-						echo json_encode( array(
317
+					if (EE_Registry::instance()->REQ->ajax) {
318
+						echo json_encode(array(
319 319
 							'success' => TRUE,
320 320
 							'id' => $new_state->ID(),
321 321
 							'name' => $new_state->name(),
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 				}
331 331
 
332 332
 			} else {
333
-				$error = __( 'A new State/Province could not be added because invalid or missing data was received.', 'event_espresso' );
334
-				if ( EE_Registry::instance()->REQ->ajax ) {
335
-					echo json_encode( array( 'error' => $error ));
333
+				$error = __('A new State/Province could not be added because invalid or missing data was received.', 'event_espresso');
334
+				if (EE_Registry::instance()->REQ->ajax) {
335
+					echo json_encode(array('error' => $error));
336 336
 					exit();
337 337
 				} else {
338
-					EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
338
+					EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
339 339
 				}
340 340
 			}
341 341
 		}
@@ -353,11 +353,11 @@  discard block
 block discarded – undo
353 353
 	 * @param array $request_params
354 354
 	 * @return array
355 355
 	 */
356
-	public static function filter_checkout_request_params ( $request_params ) {
357
-		foreach ( $request_params as $form_section ) {
358
-			if ( is_array( $form_section )) {
359
-				EED_Add_New_State::unset_new_state_request_params( $form_section );
360
-				EED_Add_New_State::filter_checkout_request_params( $form_section );
356
+	public static function filter_checkout_request_params($request_params) {
357
+		foreach ($request_params as $form_section) {
358
+			if (is_array($form_section)) {
359
+				EED_Add_New_State::unset_new_state_request_params($form_section);
360
+				EED_Add_New_State::filter_checkout_request_params($form_section);
361 361
 			}
362 362
 		}
363 363
 		return $request_params;
@@ -372,12 +372,12 @@  discard block
 block discarded – undo
372 372
 	 * @param array $request_params
373 373
 	 * @return        boolean
374 374
 	 */
375
-	public static function unset_new_state_request_params ( $request_params ) {
376
-		unset( $request_params[ 'new_state_micro_form' ] );
377
-		unset( $request_params[ 'add_new_state' ] );
378
-		unset( $request_params[ 'new_state_country' ] );
379
-		unset( $request_params[ 'new_state_name' ] );
380
-		unset( $request_params[ 'new_state_abbrv' ] );
375
+	public static function unset_new_state_request_params($request_params) {
376
+		unset($request_params['new_state_micro_form']);
377
+		unset($request_params['add_new_state']);
378
+		unset($request_params['new_state_country']);
379
+		unset($request_params['new_state_name']);
380
+		unset($request_params['new_state_abbrv']);
381 381
 		return $request_params;
382 382
 	}
383 383
 
@@ -390,25 +390,25 @@  discard block
 block discarded – undo
390 390
 	 * @param array $props_n_values
391 391
 	 * @return        boolean
392 392
 	 */
393
-	public static function save_new_state_to_db ( $props_n_values = array() ) {
393
+	public static function save_new_state_to_db($props_n_values = array()) {
394 394
 //		EEH_Debug_Tools::printr( $props_n_values, '$props_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
395
-		$existing_state = EEM_State::instance()->get_all( array( $props_n_values, 'limit' => 1 ));
396
-		if ( ! empty( $existing_state )) {
397
-			return array_pop( $existing_state );
395
+		$existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1));
396
+		if ( ! empty($existing_state)) {
397
+			return array_pop($existing_state);
398 398
 		}
399
-		$new_state = EE_State::new_instance( $props_n_values );
400
-		if ( $new_state instanceof EE_State ) {
399
+		$new_state = EE_State::new_instance($props_n_values);
400
+		if ($new_state instanceof EE_State) {
401 401
 			// if not non-ajax admin
402
-			$new_state_key = $new_state->country_iso() . '-' . $new_state->abbrev();
402
+			$new_state_key = $new_state->country_iso().'-'.$new_state->abbrev();
403 403
 			$new_state_notice = sprintf(
404
-					__( 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso' ),
405
-					'<b>' . $new_state->name() . '</b>',
406
-					'<b>' . $new_state->abbrev() . '</b>',
407
-					'<b>' . $new_state->country()->name() . '</b>',
408
-					'<a href="' . add_query_arg( array( 'page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso() ), admin_url( 'admin.php' )) . '">' . __( 'Event Espresso - General Settings > Countries Tab', 'event_espresso' ) . '</a>',
404
+					__('A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso'),
405
+					'<b>'.$new_state->name().'</b>',
406
+					'<b>'.$new_state->abbrev().'</b>',
407
+					'<b>'.$new_state->country()->name().'</b>',
408
+					'<a href="'.add_query_arg(array('page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso()), admin_url('admin.php')).'">'.__('Event Espresso - General Settings > Countries Tab', 'event_espresso').'</a>',
409 409
 					'<br />'
410 410
 			);
411
-			EE_Error::add_persistent_admin_notice( $new_state_key, $new_state_notice );
411
+			EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice);
412 412
 			$new_state->save();
413 413
 			EEM_State::instance()->reset_cached_states();
414 414
 			return $new_state;
@@ -427,22 +427,22 @@  discard block
 block discarded – undo
427 427
 	 * @param array  $cols_n_values
428 428
 	 * @return        boolean
429 429
 	 */
430
-	public static function update_country_settings( $CNT_ISO = '', $STA_ID = '', $cols_n_values = array() ) {
431
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : FALSE;
432
-		if ( ! $CNT_ISO ) {
433
-			EE_Error::add_error( __( 'An invalid or missing Country ISO Code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
430
+	public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) {
431
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : FALSE;
432
+		if ( ! $CNT_ISO) {
433
+			EE_Error::add_error(__('An invalid or missing Country ISO Code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
434 434
 		}
435
-		$STA_abbrev = is_array( $cols_n_values ) && isset( $cols_n_values['STA_abbrev'] ) ? $cols_n_values['STA_abbrev'] : FALSE;
436
-		if (  ! $STA_abbrev && ! empty( $STA_ID )) {
437
-			$state = EEM_State::instance()->get_one_by_ID( $STA_ID );
438
-			if ( $state instanceof EE_State ) {
435
+		$STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] : FALSE;
436
+		if ( ! $STA_abbrev && ! empty($STA_ID)) {
437
+			$state = EEM_State::instance()->get_one_by_ID($STA_ID);
438
+			if ($state instanceof EE_State) {
439 439
 				$STA_abbrev = $state->abbrev();
440 440
 			}
441 441
 		}
442
-		if ( ! $STA_abbrev ) {
443
-			EE_Error::add_error( __( 'An invalid or missing State Abbreviation was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
442
+		if ( ! $STA_abbrev) {
443
+			EE_Error::add_error(__('An invalid or missing State Abbreviation was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
444 444
 		}
445
-		EE_Error::dismiss_persistent_admin_notice( $CNT_ISO . '-' . $STA_abbrev, TRUE, TRUE );
445
+		EE_Error::dismiss_persistent_admin_notice($CNT_ISO.'-'.$STA_abbrev, TRUE, TRUE);
446 446
 	}
447 447
 
448 448
 
@@ -458,19 +458,19 @@  discard block
 block discarded – undo
458 458
 	 * @param $answer
459 459
 	 * @return bool
460 460
 	 */
461
-	public static function inject_new_reg_state_into_options( $state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) {
462
-		if ( $answer instanceof EE_Answer  && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state ) {
461
+	public static function inject_new_reg_state_into_options($state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) {
462
+		if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state) {
463 463
 			$STA_ID = $answer->value();
464
-			if ( ! empty( $STA_ID ) ) {
465
-				$state = EEM_State::instance()->get_one_by_ID( $STA_ID );
466
-				if ( $state instanceof EE_State ) {
464
+			if ( ! empty($STA_ID)) {
465
+				$state = EEM_State::instance()->get_one_by_ID($STA_ID);
466
+				if ($state instanceof EE_State) {
467 467
 					$country = $state->country();
468
-					if ( $country instanceof EE_Country ) {
469
-						if ( ! isset( $state_options[ $country->name() ] )) {
470
-							$state_options[ $country->name() ] = array();
468
+					if ($country instanceof EE_Country) {
469
+						if ( ! isset($state_options[$country->name()])) {
470
+							$state_options[$country->name()] = array();
471 471
 						}
472
-						if ( ! isset( $state_options[ $country->name() ][ $STA_ID ] )) {
473
-							$state_options[ $country->name() ][ $STA_ID ] = $state->name();
472
+						if ( ! isset($state_options[$country->name()][$STA_ID])) {
473
+							$state_options[$country->name()][$STA_ID] = $state->name();
474 474
 						}
475 475
 					}
476 476
 				}
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
 	 * @param $answer
493 493
 	 * @return bool
494 494
 	 */
495
-	public static function inject_new_reg_country_into_options( $country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) {
496
-		if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country ) {
495
+	public static function inject_new_reg_country_into_options($country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) {
496
+		if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country) {
497 497
 			$CNT_ISO = $answer->value();
498
-			if ( ! empty( $CNT_ISO ) ) {
499
-				$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
500
-				if ( $country instanceof EE_Country ) {
501
-					if ( ! isset( $country_options[ $CNT_ISO ] ) ) {
502
-						$country_options[ $CNT_ISO ] = $country->name();
498
+			if ( ! empty($CNT_ISO)) {
499
+				$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
500
+				if ($country instanceof EE_Country) {
501
+					if ( ! isset($country_options[$CNT_ISO])) {
502
+						$country_options[$CNT_ISO] = $country->name();
503 503
 					}
504 504
 				}
505 505
 			}
@@ -516,17 +516,17 @@  discard block
 block discarded – undo
516 516
 	 * @param EE_State[]  $state_options
517 517
 	 * @return        boolean
518 518
 	 */
519
-	public static function state_options( $state_options = array() ) {
519
+	public static function state_options($state_options = array()) {
520 520
 		$new_states = EE_Registry::instance()->SSN->get_session_data(
521 521
 			'new_states'
522 522
 		);
523
-		if ( is_array( $new_states ) && ! empty( $new_states )) {
524
-			foreach ( $new_states as $new_state ) {
523
+		if (is_array($new_states) && ! empty($new_states)) {
524
+			foreach ($new_states as $new_state) {
525 525
 				if (
526 526
 					$new_state instanceof EE_State
527 527
 					&& $new_state->country() instanceof EE_Country
528 528
 				) {
529
-					$state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name();
529
+					$state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name();
530 530
 				}
531 531
 			}
532 532
 		}
@@ -542,17 +542,17 @@  discard block
 block discarded – undo
542 542
 	 * @param EE_Country[]  $country_options
543 543
 	 * @return        boolean
544 544
 	 */
545
-	public static function country_options( $country_options = array() ) {
545
+	public static function country_options($country_options = array()) {
546 546
 		$new_states = EE_Registry::instance()->SSN->get_session_data(
547 547
 			'new_states'
548 548
 		);
549
-		if ( is_array( $new_states ) && ! empty( $new_states )) {
550
-			foreach ( $new_states as $new_state ) {
549
+		if (is_array($new_states) && ! empty($new_states)) {
550
+			foreach ($new_states as $new_state) {
551 551
 				if (
552 552
 					$new_state instanceof EE_State
553 553
 					&& $new_state->country() instanceof EE_Country
554 554
 				) {
555
-					$country_options[ $new_state->country()->ID() ] = $new_state->country()->name();
555
+					$country_options[$new_state->country()->ID()] = $new_state->country()->name();
556 556
 				}
557 557
 			}
558 558
 		}
Please login to merge, or discard this patch.
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Single Page Checkout (SPCO)
4 6
  *
Please login to merge, or discard this patch.
Spacing   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 * @return EED_Single_Page_Checkout
39 39
 	 */
40 40
 	public static function instance() {
41
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
42
-		return parent::get_instance( __CLASS__ );
41
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
42
+		return parent::get_instance(__CLASS__);
43 43
 	}
44 44
 
45 45
 
@@ -84,22 +84,22 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function set_hooks_admin() {
86 86
 		EED_Single_Page_Checkout::set_definitions();
87
-		if ( defined( 'DOING_AJAX' )) {
87
+		if (defined('DOING_AJAX')) {
88 88
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
89 89
 			ob_start();
90 90
 			EED_Single_Page_Checkout::load_request_handler();
91 91
 			EED_Single_Page_Checkout::load_reg_steps();
92 92
 		} else {
93 93
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
94
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
94
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
95 95
 		}
96 96
 		// set ajax hooks
97
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
98
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
99
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
100
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
101
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
102
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
97
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
98
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
99
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
100
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
101
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
102
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
103 103
 	}
104 104
 
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * 	process ajax request
109 109
 	 * @param string $ajax_action
110 110
 	 */
111
-	public static function process_ajax_request( $ajax_action ) {
112
-		EE_Registry::instance()->REQ->set( 'action', $ajax_action );
111
+	public static function process_ajax_request($ajax_action) {
112
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
113 113
 		EED_Single_Page_Checkout::instance()->_initialize();
114 114
 	}
115 115
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * 	ajax display registration step
120 120
 	 */
121 121
 	public static function display_reg_step() {
122
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
122
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
123 123
 	}
124 124
 
125 125
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * 	ajax process registration step
129 129
 	 */
130 130
 	public static function process_reg_step() {
131
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
131
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
132 132
 	}
133 133
 
134 134
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * 	ajax process registration step
138 138
 	 */
139 139
 	public static function update_reg_step() {
140
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
140
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
141 141
 	}
142 142
 
143 143
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @return void
150 150
 	 */
151 151
 	public static function update_checkout() {
152
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
152
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
153 153
 	}
154 154
 
155 155
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public static function load_request_handler() {
164 164
 		// load core Request_Handler class
165
-		if ( ! isset( EE_Registry::instance()->REQ )) {
166
-			EE_Registry::instance()->load_core( 'Request_Handler' );
165
+		if ( ! isset(EE_Registry::instance()->REQ)) {
166
+			EE_Registry::instance()->load_core('Request_Handler');
167 167
 		}
168 168
 	}
169 169
 
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 	 *  @return 	void
177 177
 	 */
178 178
 	public static function set_definitions() {
179
-		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
180
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
181
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
182
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
183
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
184
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
185
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
186
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
179
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
180
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
181
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
182
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
183
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
184
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
185
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
186
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
187 187
 	}
188 188
 
189 189
 
@@ -198,31 +198,31 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public static function load_reg_steps() {
200 200
 		static $reg_steps_loaded = FALSE;
201
-		if ( $reg_steps_loaded ) {
201
+		if ($reg_steps_loaded) {
202 202
 			return;
203 203
 		}
204 204
 		// load EE_SPCO_Reg_Step base class
205 205
 //		EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class'  );
206 206
 		// filter list of reg_steps
207
-		$reg_steps_to_load = apply_filters( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps() );
207
+		$reg_steps_to_load = apply_filters('AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps());
208 208
 		// sort by key (order)
209
-		ksort( $reg_steps_to_load );
209
+		ksort($reg_steps_to_load);
210 210
 		// loop through folders
211
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
211
+		foreach ($reg_steps_to_load as $order => $reg_step) {
212 212
 			// we need a
213
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
213
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
214 214
 				// copy over to the reg_steps_array
215
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
215
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
216 216
 				// register custom key route for each reg step ( ie: step=>"slug" - this is the entire reason we load the reg steps array now )
217
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
217
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
218 218
 				// add AJAX or other hooks
219
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
219
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
220 220
 					// setup autoloaders if necessary
221
-					if ( ! class_exists( $reg_step['class_name'] )) {
222
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
221
+					if ( ! class_exists($reg_step['class_name'])) {
222
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
223 223
 					}
224
-					if ( is_callable( $reg_step['class_name'], 'set_hooks' )) {
225
-						call_user_func( array( $reg_step['class_name'], 'set_hooks' ));
224
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
225
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
226 226
 					}
227 227
 				}
228 228
 			}
@@ -241,28 +241,28 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public static function get_reg_steps() {
243 243
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
244
-		if ( empty( $reg_steps )) {
244
+		if (empty($reg_steps)) {
245 245
 			$reg_steps = array(
246 246
 				10 => array(
247
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
247
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
248 248
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
249 249
 					'slug' => 'attendee_information',
250 250
 					'has_hooks' => FALSE
251 251
 				),
252 252
 				20 => array(
253
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
253
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
254 254
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
255 255
 					'slug' => 'registration_confirmation',
256 256
 					'has_hooks' => FALSE
257 257
 				),
258 258
 				30 => array(
259
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
259
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
260 260
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
261 261
 					'slug' => 'payment_options',
262 262
 					'has_hooks' => TRUE
263 263
 				),
264 264
 				999 => array(
265
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
265
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
266 266
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
267 267
 					'slug' => 'finalize_registration',
268 268
 					'has_hooks' => FALSE
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	public static function registration_checkout_for_admin() {
284 284
 		EED_Single_Page_Checkout::load_reg_steps();
285
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
286
-		EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' );
287
-		EE_Registry::instance()->REQ->set( 'process_form_submission', false );
285
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
286
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
287
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
288 288
 		EED_Single_Page_Checkout::instance()->_initialize();
289 289
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
290 290
 		return EE_Registry::instance()->REQ->get_output();
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	public static function process_registration_from_admin() {
302 302
 		EED_Single_Page_Checkout::load_reg_steps();
303
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
304
-		EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' );
305
-		EE_Registry::instance()->REQ->set( 'process_form_submission', true );
303
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
304
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
305
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
306 306
 		EED_Single_Page_Checkout::instance()->_initialize();
307
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
308
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
309
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
310
-				if ( $final_reg_step->process_reg_step() ) {
307
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
308
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
309
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
310
+				if ($final_reg_step->process_reg_step()) {
311 311
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
312 312
 				}
313 313
 			}
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 	 * @param WP_Query $WP_Query
325 325
 	 * @return    void
326 326
 	 */
327
-	public function run( $WP_Query ) {
328
-		if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )) {
327
+	public function run($WP_Query) {
328
+		if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)) {
329 329
 			$this->_initialize();
330 330
 		}
331 331
 	}
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 	 * @param WP_Query $WP_Query
341 341
 	 * @return    void
342 342
 	 */
343
-	public static function init( $WP_Query ) {
344
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
343
+	public static function init($WP_Query) {
344
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
345 345
 	}
346 346
 
347 347
 
@@ -355,32 +355,32 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	private function _initialize() {
357 357
 		// ensure SPCO doesn't run twice
358
-		if ( EED_Single_Page_Checkout::$_initialized ) {
358
+		if (EED_Single_Page_Checkout::$_initialized) {
359 359
 			return;
360 360
 		}
361 361
 		// setup the EE_Checkout object
362 362
 		$this->checkout = $this->_initialize_checkout();
363 363
 		// filter checkout
364
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
364
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
365 365
 		// get the $_GET
366 366
 		$this->_get_request_vars();
367 367
 		// filter continue_reg
368
-		$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
368
+		$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
369 369
 		// load the reg steps array
370
-		if ( ! $this->_load_and_instantiate_reg_steps() ) {
370
+		if ( ! $this->_load_and_instantiate_reg_steps()) {
371 371
 			EED_Single_Page_Checkout::$_initialized = true;
372 372
 			return;
373 373
 		}
374 374
 		// set the current step
375
-		$this->checkout->set_current_step( $this->checkout->step );
375
+		$this->checkout->set_current_step($this->checkout->step);
376 376
 		// and the next step
377 377
 		$this->checkout->set_next_step();
378 378
 		// was there already a valid transaction in the checkout from the session ?
379
-		if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
379
+		if ( ! $this->checkout->transaction instanceof EE_Transaction) {
380 380
 			// get transaction from db or session
381 381
 			$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() ? $this->_get_transaction_and_cart_for_previous_visit() : $this->_get_cart_for_current_session_and_setup_new_transaction();
382
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
383
-				EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
382
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
383
+				EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
384 384
 				// add some style and make it dance
385 385
 				$this->checkout->transaction = EE_Transaction::new_instance();
386 386
 				$this->add_styles_and_scripts();
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 				return;
389 389
 			}
390 390
 			// and the registrations for the transaction
391
-			$this->_get_registrations( $this->checkout->transaction );
391
+			$this->_get_registrations($this->checkout->transaction);
392 392
 		}
393 393
 		// verify that everything has been setup correctly
394
-		if ( ! $this->_final_verifications() ) {
394
+		if ( ! $this->_final_verifications()) {
395 395
 			EED_Single_Page_Checkout::$_initialized = true;
396 396
 			return;
397 397
 		}
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 		// set no cache headers and constants
417 417
 		EE_System::do_not_cache();
418 418
 		// add anchor
419
-		add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
419
+		add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
420 420
 		// remove transaction lock
421
-		add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 );
421
+		add_action('shutdown', array($this, 'unlock_transaction'), 1);
422 422
 	}
423 423
 
424 424
 
@@ -435,20 +435,20 @@  discard block
 block discarded – undo
435 435
 		// look in session for existing checkout
436 436
 		$checkout = EE_Registry::instance()->SSN->checkout();
437 437
 		// verify
438
-		if ( ! $checkout instanceof EE_Checkout ) {
438
+		if ( ! $checkout instanceof EE_Checkout) {
439 439
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
440
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
440
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
441 441
 			// verify again
442
-			if ( ! $checkout instanceof EE_Checkout ) {
443
-				throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
442
+			if ( ! $checkout instanceof EE_Checkout) {
443
+				throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
444 444
 			}
445 445
 		} else {
446
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
447
-				wp_safe_redirect( $checkout->redirect_url );
446
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
447
+				wp_safe_redirect($checkout->redirect_url);
448 448
 				exit();
449 449
 			}
450 450
 		}
451
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
451
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
452 452
 		// reset anything that needs a clean slate for each request
453 453
 		$checkout->reset_for_current_request();
454 454
 		return $checkout;
@@ -466,22 +466,22 @@  discard block
 block discarded – undo
466 466
 		// load classes
467 467
 		EED_Single_Page_Checkout::load_request_handler();
468 468
 		//make sure this request is marked as belonging to EE
469
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
469
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
470 470
 		// which step is being requested ?
471
-		$this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() );
471
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
472 472
 		// which step is being edited ?
473
-		$this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' );
473
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
474 474
 		// and what we're doing on the current step
475
-		$this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' );
475
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
476 476
 		// returning to edit ?
477
-		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' );
477
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
478 478
 		// or some other kind of revisit ?
479
-		$this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
479
+		$this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE);
480 480
 		// and whether or not to generate a reg form for this request
481
-		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
481
+		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE 	FALSE
482 482
 		// and whether or not to process a reg form submission for this request
483
-		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
484
-		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; 		// TRUE 	FALSE
483
+		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE 	FALSE
484
+		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE 	FALSE
485 485
 		//$this->_display_request_vars();
486 486
 	}
487 487
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
 	 * @return    void
495 495
 	 */
496 496
 	protected function _display_request_vars() {
497
-		if ( ! WP_DEBUG ) {
497
+		if ( ! WP_DEBUG) {
498 498
 			return;
499 499
 		}
500
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
501
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
502
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
503
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
504
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
505
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
506
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
507
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
500
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
501
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
502
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
503
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
504
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
505
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
506
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
507
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
508 508
 	}
509 509
 
510 510
 
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 	 * @return    array
519 519
 	 */
520 520
 	private function _get_first_step() {
521
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
522
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
521
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
522
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
523 523
 	}
524 524
 
525 525
 
@@ -535,37 +535,37 @@  discard block
 block discarded – undo
535 535
 	private function _load_and_instantiate_reg_steps() {
536 536
 		// have reg_steps already been instantiated ?
537 537
 		if (
538
-			empty( $this->checkout->reg_steps ) ||
539
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
538
+			empty($this->checkout->reg_steps) ||
539
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
540 540
 		) {
541 541
 			// if not, then loop through raw reg steps array
542
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
543
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
542
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
543
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
544 544
 					return false;
545 545
 				}
546 546
 			}
547 547
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
548 548
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
549 549
 			// skip the registration_confirmation page ?
550
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
550
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
551 551
 				// just remove it from the reg steps array
552
-				$this->checkout->remove_reg_step( 'registration_confirmation', false );
553
-			} else if ( EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset( 	$this->checkout->reg_steps['registration_confirmation'] )) {
552
+				$this->checkout->remove_reg_step('registration_confirmation', false);
553
+			} else if (EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset($this->checkout->reg_steps['registration_confirmation'])) {
554 554
 				// set the order to something big like 100
555
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
555
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
556 556
 			}
557 557
 			// filter the array for good luck
558
-			$this->checkout->reg_steps = apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps );
558
+			$this->checkout->reg_steps = apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps);
559 559
 			// finally re-sort based on the reg step class order properties
560 560
 			$this->checkout->sort_reg_steps();
561 561
 		} else {
562
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
562
+			foreach ($this->checkout->reg_steps as $reg_step) {
563 563
 				// set all current step stati to FALSE
564
-				$reg_step->set_is_current_step( FALSE );
564
+				$reg_step->set_is_current_step(FALSE);
565 565
 			}
566 566
 		}
567
-		if ( empty( $this->checkout->reg_steps )) {
568
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
567
+		if (empty($this->checkout->reg_steps)) {
568
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
569 569
 			return false;
570 570
 		}
571 571
 			// make reg step details available to JS
@@ -583,34 +583,34 @@  discard block
 block discarded – undo
583 583
 	 * @param int   $order
584 584
 	 * @return bool
585 585
 	 */
586
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
586
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
587 587
 
588 588
 		// we need a file_path, class_name, and slug to add a reg step
589
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
589
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
590 590
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
591
-			if ( $this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration' ) {
591
+			if ($this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration') {
592 592
 				return true;
593 593
 			}
594 594
 			// instantiate step class using file path and class name
595
-			$reg_step_obj = EE_Registry::instance()->load_file( $reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE  );
595
+			$reg_step_obj = EE_Registry::instance()->load_file($reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE);
596 596
 			// did we gets the goods ?
597
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
597
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
598 598
 				// set reg step order based on config
599
-				$reg_step_obj->set_order( $order );
599
+				$reg_step_obj->set_order($order);
600 600
 				// add instantiated reg step object to the master reg steps array
601
-				$this->checkout->add_reg_step( $reg_step_obj );
601
+				$this->checkout->add_reg_step($reg_step_obj);
602 602
 			} else {
603
-				EE_Error::add_error( __( 'The current step could not be set.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
603
+				EE_Error::add_error(__('The current step could not be set.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
604 604
 				return false;
605 605
 			}
606 606
 		} else {
607
-			if ( WP_DEBUG ) {
607
+			if (WP_DEBUG) {
608 608
 				EE_Error::add_error(
609 609
 					sprintf(
610
-						__( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ),
611
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
612
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
613
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
610
+						__('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'),
611
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
612
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
613
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
614 614
 						'<ul>',
615 615
 						'<li>',
616 616
 						'</li>',
@@ -634,16 +634,16 @@  discard block
 block discarded – undo
634 634
 	 */
635 635
 	private function _get_transaction_and_cart_for_previous_visit() {
636 636
 		/** @var $TXN_model EEM_Transaction */
637
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
637
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
638 638
 		// because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
639
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
639
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
640 640
 		// verify transaction
641
-		if ( $transaction instanceof EE_Transaction ) {
641
+		if ($transaction instanceof EE_Transaction) {
642 642
 			// and get the cart that was used for that transaction
643
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
643
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
644 644
 			return $transaction;
645 645
 		} else {
646
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
646
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
647 647
 			return NULL;
648 648
 		}
649 649
 	}
@@ -657,11 +657,11 @@  discard block
 block discarded – undo
657 657
 	 * @param EE_Transaction $transaction
658 658
 	 * @return EE_Cart
659 659
 	 */
660
-	private function _get_cart_for_transaction( $transaction ) {
661
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL;
660
+	private function _get_cart_for_transaction($transaction) {
661
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL;
662 662
 		// verify cart
663
-		if ( ! $cart instanceof EE_Cart ) {
664
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
663
+		if ( ! $cart instanceof EE_Cart) {
664
+			$cart = EE_Registry::instance()->load_core('Cart');
665 665
 		}
666 666
 		return $cart;
667 667
 	}
@@ -676,8 +676,8 @@  discard block
 block discarded – undo
676 676
 	 * @param EE_Transaction $transaction
677 677
 	 * 	@return EE_Cart
678 678
 	 */
679
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
680
-		return EE_Cart::get_cart_from_txn( $transaction );
679
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
680
+		return EE_Cart::get_cart_from_txn($transaction);
681 681
 	}
682 682
 
683 683
 
@@ -692,17 +692,17 @@  discard block
 block discarded – undo
692 692
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
693 693
 		//  if there's no transaction, then this is the FIRST visit to SPCO
694 694
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
695
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
695
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
696 696
 		// and then create a new transaction
697 697
 		$transaction = $this->_initialize_transaction();
698 698
 		// verify transaction
699
-		if ( $transaction instanceof EE_Transaction ) {
699
+		if ($transaction instanceof EE_Transaction) {
700 700
 			// save it so that we have an ID for other objects to use
701 701
 			$transaction->save();
702 702
 			// and save TXN data to the cart
703
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
703
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
704 704
 		} else {
705
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
705
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
706 706
 		}
707 707
 		return $transaction;
708 708
 	}
@@ -722,15 +722,15 @@  discard block
 block discarded – undo
722 722
 			// grab the cart grand total
723 723
 			$cart_total = $this->checkout->cart->get_cart_grand_total();
724 724
 			// create new TXN
725
-			return EE_Transaction::new_instance( array(
725
+			return EE_Transaction::new_instance(array(
726 726
 				'TXN_timestamp' 	=> time(),
727 727
 				'TXN_reg_steps' 		=> $this->checkout->initialize_txn_reg_steps_array(),
728 728
 				'TXN_total' 				=> $cart_total > 0 ? $cart_total : 0,
729 729
 				'TXN_paid' 				=> 0,
730 730
 				'STS_ID' 					=> EEM_Transaction::failed_status_code,
731 731
 			));
732
-		} catch( Exception $e ) {
733
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
732
+		} catch (Exception $e) {
733
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
734 734
 		}
735 735
 		return NULL;
736 736
 	}
@@ -744,34 +744,34 @@  discard block
 block discarded – undo
744 744
 	 * @param EE_Transaction $transaction
745 745
 	 * @return EE_Cart
746 746
 	 */
747
-	private function _get_registrations( EE_Transaction $transaction ) {
747
+	private function _get_registrations(EE_Transaction $transaction) {
748 748
 		// first step: grab the registrants  { : o
749
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
749
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
750 750
 		// verify registrations have been set
751
-		if ( empty( $registrations )) {
751
+		if (empty($registrations)) {
752 752
 			// if no cached registrations, then check the db
753
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
753
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
754 754
 			// still nothing ? well as long as this isn't a revisit
755
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
755
+			if (empty($registrations) && ! $this->checkout->revisit) {
756 756
 				// generate new registrations from scratch
757
-				$registrations = $this->_initialize_registrations( $transaction );
757
+				$registrations = $this->_initialize_registrations($transaction);
758 758
 			}
759 759
 		}
760 760
 		// sort by their original registration order
761
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
761
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
762 762
 		// then loop thru the array
763
-		foreach ( $registrations as $registration ) {
763
+		foreach ($registrations as $registration) {
764 764
 			// verify each registration
765
-			if ( $registration instanceof EE_Registration ) {
765
+			if ($registration instanceof EE_Registration) {
766 766
 				// we display all attendee info for the primary registrant
767
-				if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) {
767
+				if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) {
768 768
 					$this->checkout->primary_revisit = TRUE;
769 769
 					break;
770
-				} else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) {
770
+				} else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) {
771 771
 					// but hide info if it doesn't belong to you
772
-					$transaction->clear_cache( 'Registration', $registration->ID() );
772
+					$transaction->clear_cache('Registration', $registration->ID());
773 773
 				}
774
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
774
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
775 775
 			}
776 776
 		}
777 777
 	}
@@ -785,17 +785,17 @@  discard block
 block discarded – undo
785 785
 	 * @param EE_Transaction $transaction
786 786
 	 * @return    array
787 787
 	 */
788
-	private function _initialize_registrations( EE_Transaction $transaction ) {
788
+	private function _initialize_registrations(EE_Transaction $transaction) {
789 789
 		$att_nmbr = 0;
790 790
 		$registrations = array();
791
-		if ( $transaction instanceof EE_Transaction ) {
791
+		if ($transaction instanceof EE_Transaction) {
792 792
 			/** @type EE_Registration_Processor $registration_processor */
793
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
793
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
794 794
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
795 795
 			// now let's add the cart items to the $transaction
796
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
796
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
797 797
 				//do the following for each ticket of this type they selected
798
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
798
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
799 799
 					$att_nmbr++;
800 800
 					$registration = $registration_processor->generate_ONE_registration_from_line_item(
801 801
 						$line_item,
@@ -803,12 +803,12 @@  discard block
 block discarded – undo
803 803
 						$att_nmbr,
804 804
 						$this->checkout->total_ticket_count
805 805
 					);
806
-					if ( $registration instanceof EE_Registration ) {
807
-						$registrations[ $registration->ID() ] = $registration;
806
+					if ($registration instanceof EE_Registration) {
807
+						$registrations[$registration->ID()] = $registration;
808 808
 					}
809 809
 				}
810 810
 			}
811
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
811
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
812 812
 		}
813 813
 		return $registrations;
814 814
 	}
@@ -823,12 +823,12 @@  discard block
 block discarded – undo
823 823
 	 * @param EE_Registration $reg_B
824 824
 	 * @return array()
825 825
 	 */
826
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
826
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
827 827
 		// this shouldn't ever happen within the same TXN, but oh well
828
-		if ( $reg_A->count() == $reg_B->count() ) {
828
+		if ($reg_A->count() == $reg_B->count()) {
829 829
 			return 0;
830 830
 		}
831
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
831
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
832 832
 	}
833 833
 
834 834
 
@@ -843,35 +843,35 @@  discard block
 block discarded – undo
843 843
 	 */
844 844
 	private function _final_verifications() {
845 845
 		// filter checkout
846
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
846
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
847 847
 		//verify that current step is still set correctly
848
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
849
-			EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
848
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
849
+			EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850 850
 			return false;
851 851
 		}
852 852
 		// if returning to SPCO, then verify that primary registrant is set
853
-		if ( ! empty( $this->checkout->reg_url_link )) {
853
+		if ( ! empty($this->checkout->reg_url_link)) {
854 854
 			$valid_registrant = $this->checkout->transaction->primary_registration();
855
-			if ( ! $valid_registrant instanceof EE_Registration ) {
856
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
855
+			if ( ! $valid_registrant instanceof EE_Registration) {
856
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
857 857
 				return false;
858 858
 			}
859 859
 			$valid_registrant = null;
860
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
861
-				if ( $registration instanceof EE_Registration ) {
862
-					if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) {
860
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
861
+				if ($registration instanceof EE_Registration) {
862
+					if ($registration->reg_url_link() == $this->checkout->reg_url_link) {
863 863
 						$valid_registrant = $registration;
864 864
 					}
865 865
 				}
866 866
 			}
867
-			if ( ! $valid_registrant instanceof EE_Registration ) {
868
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
867
+			if ( ! $valid_registrant instanceof EE_Registration) {
868
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
869 869
 				return false;
870 870
 			}
871 871
 		}
872 872
 		// now that things have been kinda sufficiently verified,
873 873
 		// let's add the checkout to the session so that's available other systems
874
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
874
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
875 875
 		return true;
876 876
 	}
877 877
 
@@ -887,28 +887,28 @@  discard block
 block discarded – undo
887 887
 	 * @access    private
888 888
 	 * @param bool $reinitializing
889 889
 	 */
890
-	private function _initialize_reg_steps( $reinitializing = false ) {
891
-		$this->checkout->set_reg_step_initiated( $this->checkout->current_step );
890
+	private function _initialize_reg_steps($reinitializing = false) {
891
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
892 892
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
893
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
894
-			if ( ! $reg_step->initialize_reg_step() ) {
893
+		foreach ($this->checkout->reg_steps as $reg_step) {
894
+			if ( ! $reg_step->initialize_reg_step()) {
895 895
 				// if not initialized then maybe this step is being removed...
896
-				if ( $reg_step->is_current_step() && ! $reinitializing ) {
896
+				if ($reg_step->is_current_step() && ! $reinitializing) {
897 897
 					// if it was the current step, then we need to start over here
898
-					$this->_initialize_reg_steps( true );
898
+					$this->_initialize_reg_steps(true);
899 899
 					return;
900 900
 				}
901 901
 				continue;
902 902
 			}
903 903
 			// i18n
904 904
 			$reg_step->translate_js_strings();
905
-			if ( $reg_step->is_current_step() ) {
905
+			if ($reg_step->is_current_step()) {
906 906
 				// the text that appears on the reg step form submit button
907 907
 				$reg_step->set_submit_button_text();
908 908
 			}
909 909
 		}
910 910
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
911
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
911
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
912 912
 	}
913 913
 
914 914
 
@@ -921,39 +921,39 @@  discard block
 block discarded – undo
921 921
 	 */
922 922
 	private function _check_form_submission() {
923 923
 		//does this request require the reg form to be generated ?
924
-		if ( $this->checkout->generate_reg_form ) {
924
+		if ($this->checkout->generate_reg_form) {
925 925
 			// ever heard that song by Blue Rodeo ?
926 926
 			try {
927 927
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
928 928
 				// if not displaying a form, then check for form submission
929
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
929
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
930 930
 					// clear out any old data in case this step is being run again
931
-					$this->checkout->current_step->set_valid_data( array() );
931
+					$this->checkout->current_step->set_valid_data(array());
932 932
 					// capture submitted form data
933 933
 					$this->checkout->current_step->reg_form->receive_form_submission(
934
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout )
934
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout)
935 935
 					);
936 936
 					// validate submitted form data
937
-					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) {
937
+					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) {
938 938
 						// thou shall not pass !!!
939 939
 						$this->checkout->continue_reg = FALSE;
940 940
 						// any form validation errors?
941
-						if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) {
941
+						if ($this->checkout->current_step->reg_form->submission_error_message() != '') {
942 942
 							$submission_error_messages = array();
943 943
 							// bad, bad, bad registrant
944
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
945
-								if ( $validation_error instanceof EE_Validation_Error ) {
946
-									$submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() );
944
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
945
+								if ($validation_error instanceof EE_Validation_Error) {
946
+									$submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage());
947 947
 								}
948 948
 							}
949
-							EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
949
+							EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
950 950
 						}
951 951
 						// well not really... what will happen is we'll just get redirected back to redo the current step
952 952
 						$this->go_to_next_step();
953 953
 						return;
954 954
 					}
955 955
 				}
956
-			} catch( EE_Error $e ) {
956
+			} catch (EE_Error $e) {
957 957
 				$e->get_error();
958 958
 			}
959 959
 		}
@@ -969,38 +969,38 @@  discard block
 block discarded – undo
969 969
 	 */
970 970
 	private function _process_form_action() {
971 971
 		// what cha wanna do?
972
-		switch( $this->checkout->action ) {
972
+		switch ($this->checkout->action) {
973 973
 			// AJAX next step reg form
974 974
 			case 'display_spco_reg_step' :
975 975
 				$this->checkout->redirect = FALSE;
976
-				if ( EE_Registry::instance()->REQ->ajax ) {
977
-					$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
976
+				if (EE_Registry::instance()->REQ->ajax) {
977
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
978 978
 				}
979 979
 				break;
980 980
 
981 981
 			default :
982 982
 				// meh... do one of those other steps first
983
-				if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
983
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
984 984
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
985
-					do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
985
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
986 986
 					// call action on current step
987
-					if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) {
987
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
988 988
 						// good registrant, you get to proceed
989
-						if ( $this->checkout->current_step->success_message() != '' ) {
990
-							if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) {
991
-								EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() );
989
+						if ($this->checkout->current_step->success_message() != '') {
990
+							if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) {
991
+								EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions());
992 992
 							}
993 993
 						}
994 994
 						// pack it up, pack it in...
995 995
 						$this->_setup_redirect();
996 996
 					}
997 997
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
998
-					do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
998
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
999 999
 
1000 1000
 				} else {
1001 1001
 					EE_Error::add_error(
1002 1002
 						sprintf(
1003
-							__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1003
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1004 1004
 							$this->checkout->action,
1005 1005
 							$this->checkout->current_step->name()
1006 1006
 						),
@@ -1026,10 +1026,10 @@  discard block
 block discarded – undo
1026 1026
 	public function add_styles_and_scripts() {
1027 1027
 		// i18n
1028 1028
 		$this->translate_js_strings();
1029
-		if ( $this->checkout->admin_request ) {
1030
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1029
+		if ($this->checkout->admin_request) {
1030
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1031 1031
 		} else {
1032
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1032
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1033 1033
 		}
1034 1034
 	}
1035 1035
 
@@ -1045,42 +1045,42 @@  discard block
 block discarded – undo
1045 1045
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1046 1046
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1047 1047
 		EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1048
-		EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' );
1049
-		EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' );
1050
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' );
1048
+		EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1049
+		EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso');
1050
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso');
1051 1051
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1052 1052
 		EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso');
1053
-		EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' );
1054
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1053
+		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>');
1054
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1055 1055
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1056 1056
 		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1057 1057
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1058
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1059
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1060
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1061
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1062
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1063
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1064
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1065
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1066
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1067
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1068
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1069
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1070
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1071
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1058
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1059
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1060
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1061
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1062
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1063
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1064
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1065
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1066
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1067
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1068
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1069
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1070
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1071
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1072 1072
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1073
-			__( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
1073
+			__('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
1074 1074
 			'<h4 class="important-notice">',
1075 1075
 			'</h4>',
1076 1076
 			'<br />',
1077 1077
 			'<p>',
1078
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1078
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1079 1079
 			'">',
1080 1080
 			'</a>',
1081 1081
 			'</p>'
1082 1082
 		);
1083
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1083
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1084 1084
 	}
1085 1085
 
1086 1086
 
@@ -1093,25 +1093,25 @@  discard block
 block discarded – undo
1093 1093
 	 */
1094 1094
 	public function enqueue_styles_and_scripts() {
1095 1095
 		// load css
1096
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1097
-		wp_enqueue_style( 'single_page_checkout' );
1096
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1097
+		wp_enqueue_style('single_page_checkout');
1098 1098
 		// load JS
1099
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1100
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1101
-		wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE );
1102
-		wp_enqueue_script( 'single_page_checkout' );
1099
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1100
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1101
+		wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE);
1102
+		wp_enqueue_script('single_page_checkout');
1103 1103
 
1104 1104
 		/**
1105 1105
 		 * global action hook for enqueueing styles and scripts with
1106 1106
 		 * spco calls.
1107 1107
 		 */
1108
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1108
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1109 1109
 
1110 1110
 		/**
1111 1111
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1112 1112
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1113 1113
 		 */
1114
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1114
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1115 1115
 
1116 1116
 		// add css and JS for current step
1117 1117
 		$this->checkout->current_step->enqueue_styles_and_scripts();
@@ -1127,20 +1127,20 @@  discard block
 block discarded – undo
1127 1127
 	 */
1128 1128
 	private function _display_spco_reg_form() {
1129 1129
 		// if registering via the admin, just display the reg form for the current step
1130
-		if ( $this->checkout->admin_request ) {
1131
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1130
+		if ($this->checkout->admin_request) {
1131
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1132 1132
 		} else {
1133 1133
 			// add powered by EE msg
1134
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1134
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1135 1135
 
1136
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1136
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1137 1137
 			$cookies_not_set_msg = '';
1138
-			if ( $empty_cart ) {
1139
-				if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1138
+			if ($empty_cart) {
1139
+				if ( ! isset($_COOKIE['ee_cookie_test'])) {
1140 1140
 					$cookies_not_set_msg = apply_filters(
1141 1141
 						'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1142 1142
 						sprintf(
1143
-							__( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ),
1143
+							__('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'),
1144 1144
 							'<div class="ee-attention">',
1145 1145
 							'</div>',
1146 1146
 							'<h6 class="important-notice">',
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 					'layout_strategy' =>
1162 1162
 						new EE_Template_Layout(
1163 1163
 							array(
1164
-								'layout_template_file' 			=> SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1164
+								'layout_template_file' 			=> SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1165 1165
 								'template_args' => array(
1166 1166
 									'empty_cart' 		=> $empty_cart,
1167 1167
 									'revisit' 				=> $this->checkout->revisit,
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
 									'empty_msg' 		=> apply_filters(
1171 1171
 										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1172 1172
 										sprintf(
1173
-											__( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ),
1174
-											'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1173
+											__('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'),
1174
+											'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1175 1175
 											'">',
1176 1176
 											'</a>'
1177 1177
 										)
@@ -1179,14 +1179,14 @@  discard block
 block discarded – undo
1179 1179
 									'cookies_not_set_msg' 		=> $cookies_not_set_msg,
1180 1180
 									'registration_time_limit' 	=> $this->checkout->get_registration_time_limit(),
1181 1181
 									'session_expiration' 			=>
1182
-										gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) )
1182
+										gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS))
1183 1183
 							)
1184 1184
 						)
1185 1185
 					)
1186 1186
 				)
1187 1187
 			);
1188 1188
 			// load template and add to output sent that gets filtered into the_content()
1189
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() );
1189
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js());
1190 1190
 		}
1191 1191
 	}
1192 1192
 
@@ -1200,8 +1200,8 @@  discard block
 block discarded – undo
1200 1200
 	 * @internal  param string $label
1201 1201
 	 * @return        string
1202 1202
 	 */
1203
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1204
-		if ( $next_step == 'finalize_registration' ) {
1203
+	public function add_extra_finalize_registration_inputs($next_step) {
1204
+		if ($next_step == 'finalize_registration') {
1205 1205
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1206 1206
 		}
1207 1207
 	}
@@ -1215,18 +1215,18 @@  discard block
 block discarded – undo
1215 1215
 	 *  @return 	string
1216 1216
 	 */
1217 1217
 	public static function display_registration_footer() {
1218
-		if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) {
1219
-			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1220
-			$url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' );
1221
-			$url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1218
+		if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) {
1219
+			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1220
+			$url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/');
1221
+			$url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1222 1222
 			echo apply_filters(
1223 1223
 				'FHEE__EE_Front_Controller__display_registration_footer',
1224 1224
 				sprintf(
1225
-					__( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ),
1226
-					'<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="',
1225
+					__('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'),
1226
+					'<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="',
1227 1227
 					'" target="_blank">',
1228 1228
 					'</a>',
1229
-					'<a href="' . $url . '" title="',
1229
+					'<a href="'.$url.'" title="',
1230 1230
 					'" target="_blank">',
1231 1231
 					'</a></div>'
1232 1232
 				)
@@ -1257,12 +1257,12 @@  discard block
 block discarded – undo
1257 1257
 	 * @return 	array
1258 1258
 	 */
1259 1259
 	private function _setup_redirect() {
1260
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1260
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1261 1261
 			$this->checkout->redirect = TRUE;
1262
-			if ( empty( $this->checkout->redirect_url )) {
1262
+			if (empty($this->checkout->redirect_url)) {
1263 1263
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1264 1264
 			}
1265
-			$this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout );
1265
+			$this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout);
1266 1266
 		}
1267 1267
 	}
1268 1268
 
@@ -1275,12 +1275,12 @@  discard block
 block discarded – undo
1275 1275
 	 * @return void
1276 1276
 	 */
1277 1277
 	public function go_to_next_step() {
1278
-		if ( EE_Registry::instance()->REQ->ajax ) {
1278
+		if (EE_Registry::instance()->REQ->ajax) {
1279 1279
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1280
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1280
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1281 1281
 		}
1282 1282
 		// just return for these conditions
1283
-		if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) {
1283
+		if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') {
1284 1284
 			return;
1285 1285
 		}
1286 1286
 		// AJAX response
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 	 */
1302 1302
 	protected function _handle_json_response() {
1303 1303
 		// if this is an ajax request
1304
-		if ( EE_Registry::instance()->REQ->ajax ) {
1304
+		if (EE_Registry::instance()->REQ->ajax) {
1305 1305
 			// DEBUG LOG
1306 1306
 			//$this->checkout->log(
1307 1307
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1311,10 +1311,10 @@  discard block
 block discarded – undo
1311 1311
 			//		'continue_reg'               => $this->checkout->continue_reg,
1312 1312
 			//	)
1313 1313
 			//);
1314
-			$this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() );
1315
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1314
+			$this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit());
1315
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1316 1316
 			// just send the ajax (
1317
-			$json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response );
1317
+			$json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response);
1318 1318
 			$this->unlock_transaction();
1319 1319
 			echo $json_response;
1320 1320
 			exit();
@@ -1331,9 +1331,9 @@  discard block
 block discarded – undo
1331 1331
 	 */
1332 1332
 	protected function _handle_html_redirects() {
1333 1333
 		// going somewhere ?
1334
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1334
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1335 1335
 			// store notices in a transient
1336
-			EE_Error::get_notices( false, true, true );
1336
+			EE_Error::get_notices(false, true, true);
1337 1337
 			$this->unlock_transaction();
1338 1338
 			// DEBUG LOG
1339 1339
 			//$this->checkout->log(
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
 			//		'headers_list'    => headers_list(),
1345 1345
 			//	)
1346 1346
 			//);
1347
-			wp_safe_redirect( $this->checkout->redirect_url );
1347
+			wp_safe_redirect($this->checkout->redirect_url);
1348 1348
 			exit();
1349 1349
 		}
1350 1350
 	}
Please login to merge, or discard this patch.
espresso_event_attendees/EES_Espresso_Event_Attendees.shortcode.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Attendees shortcode class
4 6
  *
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * @param       WP $WP
20 20
 	 * @return    void
21 21
 	 */
22
-	public function run( WP $WP ) {}
22
+	public function run(WP $WP) {}
23 23
 
24 24
 
25 25
 	/**
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	 *  @param 	    array 	$attributes
70 70
 	 *  @return 	string
71 71
 	 */
72
-	public function process_shortcode( $attributes = array() ) {
72
+	public function process_shortcode($attributes = array()) {
73 73
 
74 74
 		//load helpers
75
-		EE_Registry::instance()->load_helper( 'Event_View' );
76
-		EE_Registry::instance()->load_helper( 'Template' );
75
+		EE_Registry::instance()->load_helper('Event_View');
76
+		EE_Registry::instance()->load_helper('Template');
77 77
 
78 78
 		// merge in any attributes passed via fallback shortcode processor
79
-		$attributes = array_merge( (array) $attributes, (array) $this->_attributes );
79
+		$attributes = array_merge((array) $attributes, (array) $this->_attributes);
80 80
 
81 81
 		//set default attributes
82 82
 		$default_shortcode_attributes = array(
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 		);
89 89
 
90 90
 		// allow the defaults to be filtered
91
-		$default_shortcode_attributes = apply_filters( 'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes );
91
+		$default_shortcode_attributes = apply_filters('EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes);
92 92
 		// grab attributes and merge with defaults, then extract
93
-		$attributes = array_merge( $default_shortcode_attributes, $attributes );
93
+		$attributes = array_merge($default_shortcode_attributes, $attributes);
94 94
 
95 95
 		$template_args = array(
96 96
 			'contacts'      => array(),
@@ -106,31 +106,31 @@  discard block
 block discarded – undo
106 106
 		$error = false;
107 107
 
108 108
 		//what event?
109
-		if ( empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) && empty( $attributes['ticket_id'] ) ) {
109
+		if (empty($attributes['event_id']) && empty($attributes['datetime_id']) && empty($attributes['ticket_id'])) {
110 110
 			//seems like is_espresso_event_single() isn't working as expected. So using alternate method.
111
-			if ( is_single() && is_espresso_event() ) {
111
+			if (is_single() && is_espresso_event()) {
112 112
 				$event = EEH_Event_View::get_event();
113
-				if ( $event instanceof EE_Event ) {
113
+				if ($event instanceof EE_Event) {
114 114
 					$template_args['event']          = $event;
115 115
 					$query[0]['Registration.EVT_ID'] = $event->ID();
116 116
 				}
117 117
 			} else {
118 118
 				//try getting the earliest active event if none then get the
119
-				$events = EEM_Event::instance()->get_active_events( array( 'limit'    => 1,
120
-				                                                          'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' )
121
-				) );
122
-				$events = empty( $events ) ? EEM_Event::instance()->get_upcoming_events( array( 'limit'    => 1,
123
-				                                                                              'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' )
124
-				) ) : $events;
125
-				$event = reset( $events );
126
-				if ( $event instanceof EE_Event ) {
119
+				$events = EEM_Event::instance()->get_active_events(array('limit'    => 1,
120
+				                                                          'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
121
+				));
122
+				$events = empty($events) ? EEM_Event::instance()->get_upcoming_events(array('limit'    => 1,
123
+				                                                                              'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
124
+				)) : $events;
125
+				$event = reset($events);
126
+				if ($event instanceof EE_Event) {
127 127
 					$query[0]['Registration.EVT_ID'] = $event->ID();
128 128
 					$template_args['event']          = $event;
129 129
 				}
130 130
 			}
131
-		} elseif ( ! empty( $attributes['event_id'] ) ) {
132
-			$event = EEM_Event::instance()->get_one_by_ID( $attributes['event_id'] );
133
-			if ( $event instanceof EE_Event ) {
131
+		} elseif ( ! empty($attributes['event_id'])) {
132
+			$event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']);
133
+			if ($event instanceof EE_Event) {
134 134
 				$query[0]['Registration.EVT_ID'] = $attributes['event_id'];
135 135
 				$template_args['event']          = $event;
136 136
 			} else {
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 		}
140 140
 
141 141
 		//datetime?
142
-		if ( ! empty( $attributes['datetime_id'] ) && empty( $attributes['event_id'] ) ) {
143
-			$datetime = EEM_Datetime::instance()->get_one_by_ID( $attributes['datetime_id'] );
144
-			if ( $datetime instanceof EE_Datetime ) {
142
+		if ( ! empty($attributes['datetime_id']) && empty($attributes['event_id'])) {
143
+			$datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']);
144
+			if ($datetime instanceof EE_Datetime) {
145 145
 				$query[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id'];
146 146
 				$query['default_where_conditions'] = 'this_model_only';
147 147
 				$template_args['datetime']                      = $datetime;
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 		}
153 153
 
154 154
 		//ticket?just
155
-		if ( ! empty( $attributes['ticket_id'] ) && empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) ) {
156
-			$ticket = EEM_Ticket::instance()->get_one_by_ID( $attributes['ticket_id'] );
157
-			if ( $ticket instanceof EE_Ticket ) {
155
+		if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) {
156
+			$ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']);
157
+			if ($ticket instanceof EE_Ticket) {
158 158
 				$query[0]['Registration.TKT_ID'] = $attributes['ticket_id'];
159 159
 				$template_args['ticket']         = $ticket;
160 160
 				$template_args['event']          = $ticket->first_datetime() instanceof EE_Datetime ? $ticket->first_datetime()->event() : null;
@@ -165,17 +165,17 @@  discard block
 block discarded – undo
165 165
 
166 166
 		//status
167 167
 		$reg_status_array = EEM_Registration::reg_status_array();
168
-		if ( $attributes['status'] != 'all' && isset( $reg_status_array[$attributes['status']] ) ) {
168
+		if ($attributes['status'] != 'all' && isset($reg_status_array[$attributes['status']])) {
169 169
 			$query[0]['Registration.STS_ID'] = $attributes['status'];
170 170
 		}
171
-		$query['group_by'] = array( 'ATT_ID' );
172
-		$query['order_by'] = apply_filters( 'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array( 'ATT_lname' => 'ASC', 'ATT_fname' => 'ASC' ) );
171
+		$query['group_by'] = array('ATT_ID');
172
+		$query['order_by'] = apply_filters('FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC'));
173 173
 
174 174
 		//if we have NO query where conditions, then there was an invalid parameter or the shortcode was used incorrectly
175 175
 		//so when WP_DEBUG is set and true, we'll show a message, otherwise we'll just return an empty string.
176
-		if ( ( ! isset( $query[0] ) || ! is_array( $query[0] ) ) || $error ) {
177
-			if ( WP_DEBUG ) {
178
-				return '<div class="important-notice ee-attention">' . __( 'The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly.  Please double check the arguments you used for any typos.  In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso' ) . '</div>';
176
+		if (( ! isset($query[0]) || ! is_array($query[0])) || $error) {
177
+			if (WP_DEBUG) {
178
+				return '<div class="important-notice ee-attention">'.__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly.  Please double check the arguments you used for any typos.  In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso').'</div>';
179 179
 			} else {
180 180
 				return '';
181 181
 			}
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 
184 184
 
185 185
 		//get contacts!
186
-		$template_args['contacts'] = EEM_Attendee::instance()->get_all( $query );
186
+		$template_args['contacts'] = EEM_Attendee::instance()->get_all($query);
187 187
 
188 188
 
189 189
 		//all set let's load up the template and return.
190
-		return EEH_Template::locate_template( 'loop-espresso_event_attendees.php', $template_args, true, true );
190
+		return EEH_Template::locate_template('loop-espresso_event_attendees.php', $template_args, true, true);
191 191
 
192 192
 	}
193 193
 
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,10 +113,10 @@
 block discarded – undo
113 113
 			} else {
114 114
 				//try getting the earliest active event if none then get the
115 115
 				$events = EEM_Event::instance()->get_active_events( array( 'limit'    => 1,
116
-				                                                          'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' )
116
+																		  'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' )
117 117
 				) );
118 118
 				$events = empty( $events ) ? EEM_Event::instance()->get_upcoming_events( array( 'limit'    => 1,
119
-				                                                                              'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' )
119
+																							  'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' )
120 120
 				) ) : $events;
121 121
 				$event = reset( $events );
122 122
 				if ( $event instanceof EE_Event ) {
Please login to merge, or discard this patch.
core/db_classes/EE_Post_Meta.class.php 2 patches
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 	/**
51 51
 	 * Gets meta_id
52
-	 * @return int
52
+	 * @return boolean
53 53
 	 */
54 54
 	function meta_id() {
55 55
 		return $this->get( 'meta_id' );
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 	/**
61 61
 	 * Sets meta_id
62 62
 	 * @param int $meta_id
63
-	 * @return boolean
63
+	 * @return boolean|null
64 64
 	 */
65 65
 	function set_meta_id( $meta_id) {
66 66
 		return $this->set( 'meta_id', $meta_id);
67 67
 	}
68 68
 	/**
69 69
 	 * Gets post_id
70
-	 * @return int
70
+	 * @return boolean
71 71
 	 */
72 72
 	function post_id() {
73 73
 		return $this->get( 'post_id' );
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 	/**
79 79
 	 * Sets post_id
80 80
 	 * @param int $post_id
81
-	 * @return boolean
81
+	 * @return boolean|null
82 82
 	 */
83 83
 	function set_post_id( $post_id) {
84 84
 		return $this->set( 'post_id', $post_id);
85 85
 	}
86 86
 	/**
87 87
 	 * Gets meta_key
88
-	 * @return string
88
+	 * @return boolean
89 89
 	 */
90 90
 	function meta_key() {
91 91
 		return $this->get( 'meta_key' );
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * Sets meta_key
98 98
 	 * @param string $meta_key
99
-	 * @return boolean
99
+	 * @return boolean|null
100 100
 	 */
101 101
 	function set_meta_key( $meta_key) {
102 102
 		return $this->set( 'meta_key', $meta_key);
103 103
 	}
104 104
 	/**
105 105
 	 * Gets meta_value
106
-	 * @return mixed
106
+	 * @return boolean
107 107
 	 */
108 108
 	function meta_value() {
109 109
 		return $this->get( 'meta_value' );
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * Sets meta_value
116 116
 	 * @param mixed $meta_value
117
-	 * @return boolean
117
+	 * @return boolean|null
118 118
 	 */
119 119
 	function set_meta_value( $meta_value) {
120 120
 		return $this->set( 'meta_value', $meta_value);
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 	 * @param array $props_n_values
31 31
 	 * @return EE_Post_Meta|mixed
32 32
 	 */
33
-	public static function new_instance( $props_n_values = array() ) {
34
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
35
-		return $has_object ? $has_object : new self( $props_n_values );
33
+	public static function new_instance($props_n_values = array()) {
34
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
35
+		return $has_object ? $has_object : new self($props_n_values);
36 36
 	}
37 37
 
38 38
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 * @param array $props_n_values
42 42
 	 * @return EE_Post_Meta
43 43
 	 */
44
-	public static function new_instance_from_db( $props_n_values = array() ) {
45
-		return new self( $props_n_values, TRUE );
44
+	public static function new_instance_from_db($props_n_values = array()) {
45
+		return new self($props_n_values, TRUE);
46 46
 	}
47 47
 
48 48
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @return int
53 53
 	 */
54 54
 	function meta_id() {
55
-		return $this->get( 'meta_id' );
55
+		return $this->get('meta_id');
56 56
 	}
57 57
 
58 58
 
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 	 * @param int $meta_id
63 63
 	 * @return boolean
64 64
 	 */
65
-	function set_meta_id( $meta_id) {
66
-		return $this->set( 'meta_id', $meta_id);
65
+	function set_meta_id($meta_id) {
66
+		return $this->set('meta_id', $meta_id);
67 67
 	}
68 68
 	/**
69 69
 	 * Gets post_id
70 70
 	 * @return int
71 71
 	 */
72 72
 	function post_id() {
73
-		return $this->get( 'post_id' );
73
+		return $this->get('post_id');
74 74
 	}
75 75
 
76 76
 
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	 * @param int $post_id
81 81
 	 * @return boolean
82 82
 	 */
83
-	function set_post_id( $post_id) {
84
-		return $this->set( 'post_id', $post_id);
83
+	function set_post_id($post_id) {
84
+		return $this->set('post_id', $post_id);
85 85
 	}
86 86
 	/**
87 87
 	 * Gets meta_key
88 88
 	 * @return string
89 89
 	 */
90 90
 	function meta_key() {
91
-		return $this->get( 'meta_key' );
91
+		return $this->get('meta_key');
92 92
 	}
93 93
 
94 94
 
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 	 * @param string $meta_key
99 99
 	 * @return boolean
100 100
 	 */
101
-	function set_meta_key( $meta_key) {
102
-		return $this->set( 'meta_key', $meta_key);
101
+	function set_meta_key($meta_key) {
102
+		return $this->set('meta_key', $meta_key);
103 103
 	}
104 104
 	/**
105 105
 	 * Gets meta_value
106 106
 	 * @return mixed
107 107
 	 */
108 108
 	function meta_value() {
109
-		return $this->get( 'meta_value' );
109
+		return $this->get('meta_value');
110 110
 	}
111 111
 
112 112
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 * @param mixed $meta_value
117 117
 	 * @return boolean
118 118
 	 */
119
-	function set_meta_value( $meta_value) {
120
-		return $this->set( 'meta_value', $meta_value);
119
+	function set_meta_value($meta_value) {
120
+		return $this->set('meta_value', $meta_value);
121 121
 	}
122 122
 
123 123
 
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page.core.php 1 patch
Spacing   +505 added lines, -505 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('NO direct script access allowed');
3 3
 
4 4
 /**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @access public
74 74
 	 * @return void
75 75
 	 */
76
-	public function __construct( $routing = TRUE ) {
76
+	public function __construct($routing = TRUE) {
77 77
 		//make sure MSG Template helper is loaded.
78 78
 		EE_Registry::instance()->load_helper('MSG_Template');
79 79
 		//make sure messages autoloader is running
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();
96 96
 
97
-		$this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : NULL;
97
+		$this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : NULL;
98 98
 
99
-		EE_Registry::instance()->load_lib( 'messages' );
99
+		EE_Registry::instance()->load_lib('messages');
100 100
 		//we're also going to set the active messengers and active message types in here.
101 101
 		$this->_active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
102
-		$this->_active_messengers = !empty($this->_active_messengers) ?  $this->_active_messengers : array();
103
-		$this->_active_message_types = !empty($this->_active_messenger) && !empty($this->_active_messengers[$this->_active_messenger]) && ! empty(  $this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types'] ) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types']) : array();
102
+		$this->_active_messengers = ! empty($this->_active_messengers) ? $this->_active_messengers : array();
103
+		$this->_active_message_types = ! empty($this->_active_messenger) && ! empty($this->_active_messengers[$this->_active_messenger]) && ! empty($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) : array();
104 104
 
105 105
 
106 106
 		//what about saving the objects in the active_messengers and active_message_types?
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	 * @return void
119 119
 	 */
120 120
 	protected function _load_active_messenger_objects() {
121
-		foreach ( $this->_active_messengers as $messenger => $values ) {
122
-			$ref = ucwords( str_replace( '_' , ' ', $messenger) );
123
-			$ref = str_replace( ' ', '_', $ref );
124
-			$classname = 'EE_' . $ref . '_messenger';
125
-			require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );
126
-			if ( !class_exists($classname) )
127
-				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
128
-
129
-			$a = new ReflectionClass( $classname );
121
+		foreach ($this->_active_messengers as $messenger => $values) {
122
+			$ref = ucwords(str_replace('_', ' ', $messenger));
123
+			$ref = str_replace(' ', '_', $ref);
124
+			$classname = 'EE_'.$ref.'_messenger';
125
+			require_once(EE_LIBRARIES.'messages'.DS.'messenger'.DS.$classname.'.class.php');
126
+			if ( ! class_exists($classname))
127
+				throw new EE_Error(sprintf(__('There is no messenger for the given classname (%s)', 'event_espresso'), $classname));
128
+
129
+			$a = new ReflectionClass($classname);
130 130
 			$this->_active_messengers[$messenger]['obj'] = $a->newInstance();
131 131
 		}
132 132
 	}
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	 * @return void
142 142
 	 */
143 143
 	protected function _load_active_message_type_objects() {
144
-		if ( empty($this->_active_message_types) ) return;
145
-		foreach ( $this->_active_message_types as $message_type ) {
146
-			$ref = ucwords( str_replace( '_' , ' ', $message_type) );
147
-			$ref = str_replace( ' ', '_', $ref );
148
-			$classname = 'EE_' . $ref . '_message_type';
144
+		if (empty($this->_active_message_types)) return;
145
+		foreach ($this->_active_message_types as $message_type) {
146
+			$ref = ucwords(str_replace('_', ' ', $message_type));
147
+			$ref = str_replace(' ', '_', $ref);
148
+			$classname = 'EE_'.$ref.'_message_type';
149 149
 
150
-			if ( !class_exists($classname) )
151
-				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
150
+			if ( ! class_exists($classname))
151
+				throw new EE_Error(sprintf(__('There is no message type for the given classname (%s)', 'event_espresso'), $classname));
152 152
 
153
-			$a = new ReflectionClass( $classname );
153
+			$a = new ReflectionClass($classname);
154 154
 			$this->_active_message_types[$message_type]['obj'] = $a->newInstance();
155 155
 		}
156 156
 	}
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 
159 159
 
160 160
 	protected function _ajax_hooks() {
161
-		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) );
162
-		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') );
163
-		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') );
164
-		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) );
165
-		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) );
161
+		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle'));
162
+		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle'));
163
+		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings'));
164
+		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form'));
165
+		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack'));
166 166
 	}
167 167
 
168 168
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	*		@return void
195 195
 	*/
196 196
 	protected function _set_page_routes() {
197
-		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
198
-		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
197
+		$grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
198
+		$grp_id = empty($grp_id) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $grp_id;
199 199
 
200 200
 		$this->_page_routes = array(
201 201
 				'default'=> array(
@@ -231,35 +231,35 @@  discard block
 block discarded – undo
231 231
 				'insert_message_template' => array(
232 232
 					'func' => '_insert_or_update_message_template',
233 233
 					'capability' => 'ee_edit_messages',
234
-					'args' => array( 'new_template' => TRUE ),
234
+					'args' => array('new_template' => TRUE),
235 235
 					'noheader' => TRUE
236 236
 					 ),
237 237
 				'update_message_template' => array(
238 238
 					'func' => '_insert_or_update_message_template',
239 239
 					'capability' => 'ee_edit_message',
240 240
 					'obj_id' => $grp_id,
241
-					'args' => array( 'new_template' => FALSE ),
241
+					'args' => array('new_template' => FALSE),
242 242
 					'noheader' => TRUE
243 243
 					),
244 244
 				'trash_message_template' => array(
245 245
 					'func' => '_trash_or_restore_message_template',
246 246
 					'capability' => 'ee_delete_message',
247 247
 					'obj_id' => $grp_id,
248
-					'args' => array( 'trash' => TRUE, 'all' => TRUE ),
248
+					'args' => array('trash' => TRUE, 'all' => TRUE),
249 249
 					'noheader' => TRUE
250 250
 					),
251 251
 				'trash_message_template_context' => array(
252 252
 					'func' => '_trash_or_restore_message_template',
253 253
 					'capability' => 'ee_delete_message',
254 254
 					'obj_id' => $grp_id,
255
-					'args' => array( 'trash' => TRUE ),
255
+					'args' => array('trash' => TRUE),
256 256
 					'noheader' => TRUE
257 257
 					),
258 258
 				'restore_message_template' => array(
259 259
 					'func' => '_trash_or_restore_message_template',
260 260
 					'capability' => 'ee_delete_message',
261 261
 					'obj_id' => $grp_id,
262
-					'args' => array( 'trash' => FALSE, 'all' => TRUE ),
262
+					'args' => array('trash' => FALSE, 'all' => TRUE),
263 263
 					'noheader' => TRUE
264 264
 					),
265 265
 				'restore_message_template_context' => array(
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 						'filename' => 'messages_overview_other',
339 339
 					),
340 340
 				),
341
-				'help_tour' => array( 'Messages_Overview_Help_Tour' ),
341
+				'help_tour' => array('Messages_Overview_Help_Tour'),
342 342
 				'require_nonce' => FALSE
343 343
 				),
344 344
 			'custom_mtps' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 					),
374 374
 				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'),
375 375
 				'has_metaboxes' => TRUE,
376
-				'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),
376
+				'help_tour' => array('Message_Templates_Edit_Help_Tour'),
377 377
 				'help_tabs' => array(
378 378
 						'edit_message_template' => array(
379 379
 							'title' => __('Message Template Editor', 'event_espresso'),
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 							'filename' => 'messages_settings_messengers'
430 430
 							),
431 431
                     ),
432
-				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
432
+				'help_tour' => array('Messages_Settings_Help_Tour'),
433 433
 				'require_nonce' => FALSE
434 434
 				)
435 435
 			/*'reports' => array(
@@ -479,43 +479,43 @@  discard block
 block discarded – undo
479 479
 
480 480
 
481 481
 	public function messages_help_tab() {
482
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php';
483
-		EEH_Template::display_template( $templatepath, array());
482
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php';
483
+		EEH_Template::display_template($templatepath, array());
484 484
 	}
485 485
 
486 486
 
487 487
 	public function messengers_help_tab() {
488
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php';
489
-		EEH_Template::display_template( $templatepath, array());
488
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php';
489
+		EEH_Template::display_template($templatepath, array());
490 490
 	}
491 491
 
492 492
 
493 493
 	public function message_types_help_tab() {
494
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php';
495
-		EEH_Template::display_template( $templatepath, array());
494
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php';
495
+		EEH_Template::display_template($templatepath, array());
496 496
 	}
497 497
 
498 498
 
499 499
 	public function messages_overview_help_tab() {
500
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php';
501
-		EEH_Template::display_template( $templatepath, array());
500
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php';
501
+		EEH_Template::display_template($templatepath, array());
502 502
 	}
503 503
 
504 504
 
505 505
 	public function message_templates_help_tab() {
506
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php';
507
-		EEH_Template::display_template( $templatepath, array());
506
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php';
507
+		EEH_Template::display_template($templatepath, array());
508 508
 	}
509 509
 
510 510
 
511 511
 	public function edit_message_template_help_tab() {
512
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php';
513
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
514
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
515
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
516
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
517
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
518
-		EEH_Template::display_template( $templatepath, $args);
512
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php';
513
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
514
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
515
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
516
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
517
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
518
+		EEH_Template::display_template($templatepath, $args);
519 519
 	}
520 520
 
521 521
 
@@ -523,25 +523,25 @@  discard block
 block discarded – undo
523 523
 	public function message_template_shortcodes_help_tab() {
524 524
 		$this->_set_shortcodes();
525 525
 		$args['shortcodes'] = $this->_shortcodes;
526
-		$template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php';
527
-		EEH_Template::display_template( $template_path, $args );
526
+		$template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php';
527
+		EEH_Template::display_template($template_path, $args);
528 528
 	}
529 529
 
530 530
 
531 531
 
532 532
 	public function preview_message_help_tab() {
533
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php';
534
-		EEH_Template::display_template( $templatepath, array());
533
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php';
534
+		EEH_Template::display_template($templatepath, array());
535 535
 	}
536 536
 
537 537
 
538 538
 	public function settings_help_tab() {
539
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php';
540
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
541
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
539
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php';
540
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
541
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
542 542
 		$args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>';
543 543
 		$args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>';
544
-		EEH_Template::display_template( $templatepath, $args);
544
+		EEH_Template::display_template($templatepath, $args);
545 545
 	}
546 546
 
547 547
 
@@ -549,24 +549,24 @@  discard block
 block discarded – undo
549 549
 
550 550
 
551 551
 	public function load_scripts_styles() {
552
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
552
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
553 553
 		wp_enqueue_style('espresso_ee_msg');
554 554
 
555
-		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE );
555
+		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
556 556
 	}
557 557
 
558 558
 
559 559
 
560 560
 
561 561
 
562
-	public function wp_editor_css( $mce_css ) {
562
+	public function wp_editor_css($mce_css) {
563 563
 		//if we're on the edit_message_template route
564
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
564
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
565 565
 			$message_type_name = $this->_active_message_type_name;
566 566
 
567 567
 			//we're going to REPLACE the existing mce css
568 568
 			//we need to get the css file location from the active messenger
569
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation );
569
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation);
570 570
 		}
571 571
 
572 572
 		return $mce_css;
@@ -584,37 +584,37 @@  discard block
 block discarded – undo
584 584
 			$this->_message_template_group->messenger_obj()->label['singular'],
585 585
 			$this->_message_template_group->message_type_obj()->label['singular']
586 586
 		);
587
-		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' );
587
+		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso');
588 588
 
589
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
589
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
590 590
 
591 591
 		wp_enqueue_script('ee_admin_js');
592 592
 		wp_enqueue_script('ee_msgs_edit_js');
593 593
 
594 594
 		//add in special css for tiny_mce
595
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
595
+		add_filter('mce_css', array($this, 'wp_editor_css'));
596 596
 	}
597 597
 
598 598
 
599 599
 
600 600
 	public function load_scripts_styles_display_preview_message() {
601 601
 		$this->_set_message_template_group();
602
-		if ( isset( $this->_req_data['messenger'] ) ) {
602
+		if (isset($this->_req_data['messenger'])) {
603 603
 			$this->_active_messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
604 604
 		}
605 605
 
606
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
606
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
607 607
 
608 608
 
609
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation ) );
609
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation));
610 610
 	}
611 611
 
612 612
 
613 613
 
614 614
 	public function load_scripts_styles_settings() {
615
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
616
-		wp_enqueue_style( 'ee-text-links' );
617
-		wp_enqueue_style( 'ee-message-settings' );
615
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
616
+		wp_enqueue_style('ee-text-links');
617
+		wp_enqueue_style('ee-message-settings');
618 618
 
619 619
 		wp_enqueue_script('ee-messages-settings');
620 620
 	}
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 
651 651
 	protected function _custom_mtps_preview() {
652 652
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
653
-		$this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />';
653
+		$this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />';
654 654
 		$this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso.  With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>';
655
-		$this->display_admin_caf_preview_page( 'custom_message_types', FALSE );
655
+		$this->display_admin_caf_preview_page('custom_message_types', FALSE);
656 656
 	}
657 657
 
658 658
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 * @param bool $global whether to return just global (true) or custom templates (false)
675 675
 	 * @return array|WP_Error object
676 676
 	 */
677
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE ) {
677
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE) {
678 678
 		global $espresso_wp_user;
679 679
 		// start with an empty array
680 680
 		$message_templates = array();
@@ -684,24 +684,24 @@  discard block
 block discarded – undo
684 684
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
685 685
 		$orderby = $this->_req_data['orderby'];
686 686
 
687
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
687
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
688 688
 
689
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
690
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
689
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
690
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
691 691
 
692
-		$offset = ($current_page-1)*$per_page;
693
-		$limit = $all ? NULL : array( $offset, $per_page );
692
+		$offset = ($current_page - 1) * $per_page;
693
+		$limit = $all ? NULL : array($offset, $per_page);
694 694
 
695 695
 
696 696
 		//options will match what is in the _views array property
697
-		switch( $type ) {
697
+		switch ($type) {
698 698
 
699 699
 			case 'in_use':
700
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE );
700
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE);
701 701
 				break;
702 702
 
703 703
 			default:
704
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
704
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
705 705
 
706 706
 		}
707 707
 
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 		$imts = $installed_objects['message_types'];
738 738
 		$installed = array();
739 739
 
740
-		foreach ( $imts as $message_type ) {
740
+		foreach ($imts as $message_type) {
741 741
 			$installed[$message_type->name]['obj'] = $message_type;
742 742
 		}
743 743
 
@@ -769,24 +769,24 @@  discard block
 block discarded – undo
769 769
 	 * @access  protected
770 770
 	 * @return void
771 771
 	 */
772
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
772
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
773 773
 		//set values override any request data
774
-		$message_type = !empty( $message_type ) ? $message_type : '';
775
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
774
+		$message_type = ! empty($message_type) ? $message_type : '';
775
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
776 776
 
777
-		$messenger = !empty( $messenger ) ? $messenger : '';
778
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
777
+		$messenger = ! empty($messenger) ? $messenger : '';
778
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
779 779
 
780
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
781
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
780
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
781
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
782 782
 
783 783
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
784
-		if ( empty( $message_type ) || empty( $messenger )  )
784
+		if (empty($message_type) || empty($messenger))
785 785
 			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
786 786
 
787 787
 		//we need the GRP_ID for the template being used as the base for the new template
788
-		if ( empty( $GRP_ID ) )
789
-			throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
788
+		if (empty($GRP_ID))
789
+			throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso'));
790 790
 
791 791
 		//let's just make sure the template gets generated!
792 792
 
@@ -805,8 +805,8 @@  discard block
 block discarded – undo
805 805
 	 * @param string $messenger    messenger slug
806 806
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based off of.
807 807
 	 */
808
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
809
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
808
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
809
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
810 810
 	}
811 811
 
812 812
 
@@ -817,36 +817,36 @@  discard block
 block discarded – undo
817 817
 	 * @return void
818 818
 	 */
819 819
 	protected function _edit_message_template() {
820
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
820
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
821 821
 
822 822
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
823
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
823
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
824 824
 
825
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
825
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
826 826
 
827 827
 		$this->_set_shortcodes(); //this also sets the _message_template property.
828 828
 		$message_template_group = $this->_message_template_group;
829 829
 		$c_label = $message_template_group->context_label();
830 830
 		$c_config = $message_template_group->contexts_config();
831 831
 
832
-		reset( $c_config );
833
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) ? strtolower($this->_req_data['context']) : key($c_config);
832
+		reset($c_config);
833
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) ? strtolower($this->_req_data['context']) : key($c_config);
834 834
 
835 835
 
836
-		if ( empty($GRP_ID) ) {
836
+		if (empty($GRP_ID)) {
837 837
 			$action = 'insert_message_template';
838 838
 			$button_both = FALSE;
839
-			$button_text = array( __( 'Save','event_espresso') );
839
+			$button_text = array(__('Save', 'event_espresso'));
840 840
 			$button_actions = array('something_different');
841 841
 			$referrer = FALSE;
842
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
842
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
843 843
 		} else {
844 844
 			$action = 'update_message_template';
845 845
 			$button_both = TRUE;
846 846
 			$button_text = array();
847 847
 			$button_actions = array();
848 848
 			$referrer = $this->_admin_base_url;
849
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
849
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
850 850
 		}
851 851
 
852 852
 		//set active messenger for this view
@@ -856,13 +856,13 @@  discard block
 block discarded – undo
856 856
 
857 857
 		//Do we have any validation errors?
858 858
 		$validators = $this->_get_transient();
859
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
859
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
860 860
 
861 861
 
862 862
 		//we need to assemble the title from Various details
863
-		$context_label = sprintf( __('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'] ));
863
+		$context_label = sprintf(__('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label']));
864 864
 
865
-		$title = sprintf( __(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label );
865
+		$title = sprintf(__(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label);
866 866
 
867 867
 		$this->_template_args['GRP_ID'] = $GRP_ID;
868 868
 		$this->_template_args['message_template'] = $message_template_group;
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 		$MSG = new EE_messages();
874 874
 		$template_field_structure = $MSG->get_fields($message_template_group->messenger(), $message_template_group->message_type());
875 875
 
876
-		if ( !$template_field_structure ) {
876
+		if ( ! $template_field_structure) {
877 877
 			$template_field_structure = FALSE;
878 878
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
879 879
 		}
@@ -883,38 +883,38 @@  discard block
 block discarded – undo
883 883
 
884 884
 
885 885
 		//if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array.
886
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
887
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
888
-				unset( $template_field_structure[$context][$reference_field] );
886
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
887
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
888
+				unset($template_field_structure[$context][$reference_field]);
889 889
 			}
890 890
 		}
891 891
 
892 892
 		//let's loop through the template_field_structure and actually assemble the input fields!
893
-		if ( !empty($template_field_structure) ) {
894
-			$id_prefix= 'ee-msg-edit-template-fields-';
895
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
893
+		if ( ! empty($template_field_structure)) {
894
+			$id_prefix = 'ee-msg-edit-template-fields-';
895
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
896 896
 				//if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them.
897
-				if ( $template_field == 'extra' ) {
897
+				if ($template_field == 'extra') {
898 898
 					$this->_template_args['is_extra_fields'] = TRUE;
899
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
900
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
899
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
900
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
901 901
 							//let's verify if we need this extra field via the shortcodes parameter.
902 902
 							$continue = FALSE;
903
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
904
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
905
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
903
+							if (isset($extra_array['shortcodes_required'])) {
904
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
905
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
906 906
 										$continue = TRUE;
907 907
 								}
908
-								if ( $continue ) continue;
908
+								if ($continue) continue;
909 909
 							}
910 910
 
911
-							$field_id = $reference_field . '-' . $extra_field . '-content';
911
+							$field_id = $reference_field.'-'.$extra_field.'-content';
912 912
 							$template_form_fields[$field_id] = $extra_array;
913
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
914
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
915
-							$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array($extra_field, $v_fields) && ( is_array($validators[$extra_field] ) && isset( $validators[$extra_field]['msg'] ) ) ? 'validate-error ' . $css_class : $css_class;
913
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
914
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
915
+							$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($extra_field, $v_fields) && (is_array($validators[$extra_field]) && isset($validators[$extra_field]['msg'])) ? 'validate-error '.$css_class : $css_class;
916 916
 							$content = $message_templates[$context][$reference_field]->get('MTP_content');
917
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) : '';
917
+							$template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) : '';
918 918
 
919 919
 							//do we have a validation error?  if we do then let's use that value instead
920 920
 							$template_form_fields[$field_id]['value'] = isset($validators[$extra_field]) ? $validators[$extra_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -924,32 +924,32 @@  discard block
 block discarded – undo
924 924
 
925 925
 							//shortcode selector
926 926
 							$field_name_to_use = $extra_field == 'main' ? 'content' : $extra_field;
927
-							$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $field_name_to_use, $field_id );
927
+							$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($field_name_to_use, $field_id);
928 928
 
929
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
929
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
930 930
 								//we want to decode the entities
931
-								$template_form_fields[$field_id]['value'] = stripslashes( html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") );
931
+								$template_form_fields[$field_id]['value'] = stripslashes(html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8"));
932 932
 
933 933
 							}/**/
934 934
 						}
935
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
936
-						$templatefield_templatename_id = $reference_field . '-name';
935
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
936
+						$templatefield_templatename_id = $reference_field.'-name';
937 937
 
938 938
 						$template_form_fields[$templatefield_MTP_id] = array(
939
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
939
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
940 940
 							'label' => NULL,
941 941
 							'input' => 'hidden',
942 942
 							'type' => 'int',
943 943
 							'required' => FALSE,
944 944
 							'validation' => FALSE,
945
-							'value' => !empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
945
+							'value' => ! empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
946 946
 							'css_class' => '',
947 947
 							'format' => '%d',
948 948
 							'db-col' => 'MTP_ID'
949 949
 						);
950 950
 
951 951
 						$template_form_fields[$templatefield_templatename_id] = array(
952
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
952
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
953 953
 							'label' => NULL,
954 954
 							'input' => 'hidden',
955 955
 							'type' => 'string',
@@ -963,10 +963,10 @@  discard block
 block discarded – undo
963 963
 					}
964 964
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
965 965
 				} else {
966
-					$field_id = $template_field . '-content';
966
+					$field_id = $template_field.'-content';
967 967
 					$template_form_fields[$field_id] = $field_setup_array;
968
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
969
-					$template_form_fields[$field_id]['value'] = !empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ?$message_templates[$context][$template_field]->get('MTP_content') : '';
968
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
969
+					$template_form_fields[$field_id]['value'] = ! empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ? $message_templates[$context][$template_field]->get('MTP_content') : '';
970 970
 
971 971
 					//do we have a validator error for this field?  if we do then we'll use that value instead
972 972
 					$template_form_fields[$field_id]['value'] = isset($validators[$template_field]) ? $validators[$template_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -974,12 +974,12 @@  discard block
 block discarded – undo
974 974
 
975 975
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
976 976
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
977
-					$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array( $template_field, $v_fields ) && isset( $validators[$template_field]['msg'] ) ? 'validate-error ' . $css_class : $css_class;
977
+					$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($template_field, $v_fields) && isset($validators[$template_field]['msg']) ? 'validate-error '.$css_class : $css_class;
978 978
 
979 979
 					//shortcode selector
980
-					$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $template_field, $field_id );
980
+					$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($template_field, $field_id);
981 981
 
982
-					if ( isset( $field_setup_array['input'] ) && $field_setup_array['input'] == 'wp_editor' ) {
982
+					if (isset($field_setup_array['input']) && $field_setup_array['input'] == 'wp_editor') {
983 983
 						//we want to decode the entities
984 984
 						$template_form_fields[$field_id]['value'] = $template_form_fields[$field_id]['value'];
985 985
 					}/**/
@@ -987,25 +987,25 @@  discard block
 block discarded – undo
987 987
 
988 988
 				//k took care of content field(s) now let's take care of others.
989 989
 
990
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
991
-				$templatefield_field_templatename_id = $template_field . '-name';
990
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
991
+				$templatefield_field_templatename_id = $template_field.'-name';
992 992
 
993 993
 				//foreach template field there are actually two form fields created
994 994
 				$template_form_fields[$templatefield_MTP_id] = array(
995
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
995
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
996 996
 					'label' => NULL,
997 997
 					'input' => 'hidden',
998 998
 					'type' => 'int',
999 999
 					'required' => FALSE,
1000 1000
 					'validation' => TRUE,
1001
-					'value' => !empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
1001
+					'value' => ! empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
1002 1002
 					'css_class' => '',
1003 1003
 					'format' => '%d',
1004 1004
 					'db-col' => 'MTP_ID'
1005 1005
 				);
1006 1006
 
1007 1007
 				$template_form_fields[$templatefield_field_templatename_id] = array(
1008
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
1008
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
1009 1009
 					'label' => NULL,
1010 1010
 					'input' => 'hidden',
1011 1011
 					'type' => 'string',
@@ -1149,15 +1149,15 @@  discard block
 block discarded – undo
1149 1149
 				'value' => $GRP_ID
1150 1150
 				);
1151 1151
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1152
-				'name' => $action . '_nonce',
1152
+				'name' => $action.'_nonce',
1153 1153
 				'input' => 'hidden',
1154 1154
 				'type' => 'string',
1155
-				'value' => wp_create_nonce( $action . '_nonce')
1155
+				'value' => wp_create_nonce($action.'_nonce')
1156 1156
 				);
1157 1157
 
1158 1158
 			$sidebar_array = array('ee-msg-is-global', 'ee-msg-is-override', 'ee-msg-deleted', 'ee-msg-is-active');
1159 1159
 
1160
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1160
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1161 1161
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1162 1162
 					'name' => 'template_switch',
1163 1163
 					'input' => 'hidden',
@@ -1167,19 +1167,19 @@  discard block
 block discarded – undo
1167 1167
 			}
1168 1168
 
1169 1169
 
1170
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1171
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1170
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1171
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1172 1172
 
1173 1173
 
1174 1174
 		} //end if ( !empty($template_field_structure) )
1175 1175
 
1176 1176
 		//set extra content for publish box
1177 1177
 		$this->_template_args['publish_box_extra_content'] = $sidebar_fields;
1178
-		$this->_set_publish_post_box_vars( 'id', $GRP_ID );
1178
+		$this->_set_publish_post_box_vars('id', $GRP_ID);
1179 1179
 
1180 1180
 		//add preview button
1181
-		$preview_url = parent::add_query_args_and_nonce( array( 'message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context,'GRP_ID' => $GRP_ID, 'action' => 'preview_message' ), $this->_admin_base_url );
1182
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1181
+		$preview_url = parent::add_query_args_and_nonce(array('message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context, 'GRP_ID' => $GRP_ID, 'action' => 'preview_message'), $this->_admin_base_url);
1182
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1183 1183
 
1184 1184
 
1185 1185
 		//setup context switcher
@@ -1206,16 +1206,16 @@  discard block
 block discarded – undo
1206 1206
 		$this->_template_args['before_admin_page_content'] .= $this->_add_form_element_before();
1207 1207
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1208 1208
 
1209
-		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php';
1209
+		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php';
1210 1210
 
1211 1211
 		//send along EE_Message_Template_Group object for further template use.
1212 1212
 		$this->_template_args['MTP'] = $message_template_group;
1213 1213
 
1214
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, TRUE );
1214
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
1215 1215
 
1216 1216
 
1217 1217
 		//finally, let's set the admin_page title
1218
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1218
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1219 1219
 
1220 1220
 
1221 1221
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 	}
1229 1229
 
1230 1230
 
1231
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1231
+	public function filter_tinymce_init($mceInit, $editor_id) {
1232 1232
 		return $mceInit;
1233 1233
 	}
1234 1234
 
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 	}
1240 1240
 
1241 1241
 	public function _add_form_element_before() {
1242
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1242
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1243 1243
 	}
1244 1244
 
1245 1245
 	public function _add_form_element_after() {
@@ -1257,32 +1257,32 @@  discard block
 block discarded – undo
1257 1257
 	 * @return json json object
1258 1258
 	 */
1259 1259
 	public function switch_template_pack() {
1260
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1261
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1260
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1261
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1262 1262
 
1263 1263
 		//verify we have needed values.
1264
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1264
+		if (empty($GRP_ID) || empty($template_pack)) {
1265 1265
 			$this->_template_args['error'] = TRUE;
1266
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1266
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1267 1267
 		} else {
1268 1268
 			//get template, set the new template_pack and then reset to default
1269
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1269
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1270 1270
 
1271
-			$mtpg->set_template_pack_name( $template_pack );
1271
+			$mtpg->set_template_pack_name($template_pack);
1272 1272
 			$this->_req_data['msgr'] = $mtpg->messenger();
1273 1273
 			$this->_req_data['mt'] = $mtpg->message_type();
1274 1274
 
1275 1275
 			$query_args = $this->_reset_to_default_template();
1276 1276
 
1277
-			if ( empty( $query_args['id'] ) ) {
1278
-				EE_Error::add_error( __('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1277
+			if (empty($query_args['id'])) {
1278
+				EE_Error::add_error(__('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1279 1279
 				$this->_template_args['error'] = TRUE;
1280 1280
 			} else {
1281
-				$template_label =$mtpg->get_template_pack()->label;
1281
+				$template_label = $mtpg->get_template_pack()->label;
1282 1282
 				$template_pack_labels = $mtpg->messenger_obj()->get_supports_labels();
1283
-				EE_Error::add_success( sprintf( __('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack ) );
1283
+				EE_Error::add_success(sprintf(__('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack));
1284 1284
 				//generate the redirect url for js.
1285
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1285
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1286 1286
 				$this->_template_args['data']['redirect_url'] = $url;
1287 1287
 				$this->_template_args['success'] = true;
1288 1288
 			}
@@ -1303,56 +1303,56 @@  discard block
 block discarded – undo
1303 1303
 	protected function _reset_to_default_template() {
1304 1304
 		$success = TRUE;
1305 1305
 		$templates = array();
1306
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1306
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1307 1307
 		//we need to make sure we've got the info we need.
1308
-		if ( !isset( $this->_req_data['msgr'] ) && !isset( $this->_req_data['mt'] ) && !isset( $this->_req_data['GRP_ID'] ) ) {
1309
-			EE_Error::add_error( __('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1308
+		if ( ! isset($this->_req_data['msgr']) && ! isset($this->_req_data['mt']) && ! isset($this->_req_data['GRP_ID'])) {
1309
+			EE_Error::add_error(__('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1310 1310
 			$success = FALSE;
1311 1311
 		}
1312 1312
 
1313 1313
 		//all templates will be reset to whatever the defaults are for the global template matching the messenger and message type.
1314
-		$success = !empty( $GRP_ID ) ? TRUE : FALSE;
1314
+		$success = ! empty($GRP_ID) ? TRUE : FALSE;
1315 1315
 
1316
-		if ( $success ) {
1316
+		if ($success) {
1317 1317
 
1318 1318
 			//let's first determine if the incoming template is a global template, if it isn't then we need to get the global template matching messenger and message type.
1319
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1319
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1320 1320
 
1321 1321
 
1322 1322
 			//note this is ONLY deleteing the template fields (Message Template rows) NOT the message template group.
1323
-			$success = $this->_delete_mtp_permanently( $GRP_ID, FALSE );
1323
+			$success = $this->_delete_mtp_permanently($GRP_ID, FALSE);
1324 1324
 
1325
-			if ( $success ) {
1325
+			if ($success) {
1326 1326
 				//if successfully deleted, lets generate the new ones.  Note. We set GLOBAL to true, because resets on ANY template will use the related global template defaults for regeneration.  This means that if a custom template is reset it resets to whatever the related global template is.  HOWEVER, we DO keep the template pack and template variation set for the current custom template when resetting.
1327
-				$templates = $this->_generate_new_templates( $this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE );
1327
+				$templates = $this->_generate_new_templates($this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE);
1328 1328
 			}
1329 1329
 
1330 1330
 		}
1331 1331
 
1332 1332
 		//any error messages?
1333
-		if ( !$success ) {
1334
-			EE_Error::add_error( __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1333
+		if ( ! $success) {
1334
+			EE_Error::add_error(__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1335 1335
 		}
1336 1336
 
1337 1337
 		//all good, let's add a success message!
1338
-		if ( $success && ! empty( $templates ) ) {
1338
+		if ($success && ! empty($templates)) {
1339 1339
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1340 1340
 			EE_Error::overwrite_success();
1341
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1341
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1342 1342
 		}
1343 1343
 
1344 1344
 
1345 1345
 		$query_args = array(
1346
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : NULL,
1347
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : NULL,
1348
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'default'
1346
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : NULL,
1347
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : NULL,
1348
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'default'
1349 1349
 			);
1350 1350
 
1351 1351
 		//if called via ajax then we return query args otherwise redirect
1352
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1352
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1353 1353
 			return $query_args;
1354 1354
 		} else {
1355
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1355
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1356 1356
 		}
1357 1357
 
1358 1358
 	}
@@ -1365,20 +1365,20 @@  discard block
 block discarded – undo
1365 1365
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1366 1366
 	 * @return void
1367 1367
 	 */
1368
-	public function _preview_message( $send = FALSE ) {
1368
+	public function _preview_message($send = FALSE) {
1369 1369
 		//first make sure we've got the necessary parameters
1370
-		if ( !isset( $this->_req_data['message_type'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['GRP_ID'] ) ) {
1371
-			EE_Error::add_error( __('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1370
+		if ( ! isset($this->_req_data['message_type']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['GRP_ID'])) {
1371
+			EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1372 1372
 		}
1373 1373
 
1374
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1374
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1375 1375
 
1376 1376
 		$MSG = new EE_messages();
1377 1377
 
1378 1378
 		//get the preview!
1379
-		$preview = $MSG->preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1379
+		$preview = $MSG->preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1380 1380
 
1381
-		if ( $send ) {
1381
+		if ($send) {
1382 1382
 			return $preview;
1383 1383
 		}
1384 1384
 
@@ -1388,16 +1388,16 @@  discard block
 block discarded – undo
1388 1388
 			'context' => $this->_req_data['context'],
1389 1389
 			'action' => 'edit_message_template'
1390 1390
 			);
1391
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1392
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1391
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1392
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1393 1393
 
1394 1394
 		//let's provide a helpful title for context
1395
-		$preview_title = sprintf( __('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']) );
1395
+		$preview_title = sprintf(__('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']));
1396 1396
 
1397 1397
 
1398 1398
 		//setup display of preview.
1399 1399
 		$this->_admin_page_title = $preview_title;
1400
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1400
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1401 1401
 		$this->_template_args['data']['force_json'] = TRUE;
1402 1402
 	}
1403 1403
 
@@ -1425,9 +1425,9 @@  discard block
 block discarded – undo
1425 1425
 	 * @return void
1426 1426
 	 */
1427 1427
 	protected function _register_edit_meta_boxes() {
1428
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1429
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1430
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1428
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1429
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1430
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1431 1431
 	}
1432 1432
 
1433 1433
 
@@ -1448,10 +1448,10 @@  discard block
 block discarded – undo
1448 1448
 
1449 1449
 		$tp_select_values = array();
1450 1450
 
1451
-		foreach ( $template_packs as $tp ) {
1451
+		foreach ($template_packs as $tp) {
1452 1452
 			//only include template packs that support this messenger and message type!
1453 1453
 			$supports = $tp->get_supports();
1454
-			if ( ! isset( $supports[$this->_message_template_group->messenger()] ) || ! in_array( $this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()] ) ) {
1454
+			if ( ! isset($supports[$this->_message_template_group->messenger()]) || ! in_array($this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()])) {
1455 1455
 				//not supported
1456 1456
 				continue;
1457 1457
 			}
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 		}
1464 1464
 
1465 1465
 		//if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack.  This still allows for the odd template pack to override.
1466
-		if ( empty( $tp_select_values ) ) {
1466
+		if (empty($tp_select_values)) {
1467 1467
 			$tp_select_values[] = array(
1468 1468
 				'text' => __('Default', 'event_espresso'),
1469 1469
 				'id' => 'default'
@@ -1471,27 +1471,27 @@  discard block
 block discarded – undo
1471 1471
 		}
1472 1472
 
1473 1473
 		//setup variation select values for the currently selected template.
1474
-		$variations = $this->_message_template_group->get_template_pack()->get_variations( $this->_message_template_group->messenger(), $this->_message_template_group->message_type() );
1474
+		$variations = $this->_message_template_group->get_template_pack()->get_variations($this->_message_template_group->messenger(), $this->_message_template_group->message_type());
1475 1475
 		$variations_select_values = array();
1476
-		foreach ( $variations as $variation => $label ) {
1476
+		foreach ($variations as $variation => $label) {
1477 1477
 			$variations_select_values[] = array(
1478 1478
 				'text' => $label,
1479 1479
 				'id' => $variation
1480 1480
 				);
1481 1481
 		}
1482 1482
 
1483
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1483
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1484 1484
 
1485
-		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input( 'MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name() );
1486
-		$template_args['variations_selector'] = EEH_Form_Fields::select_input( 'MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation() );
1485
+		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input('MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name());
1486
+		$template_args['variations_selector'] = EEH_Form_Fields::select_input('MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation());
1487 1487
 		$template_args['template_pack_label'] = $template_pack_labels->template_pack;
1488 1488
 		$template_args['template_variation_label'] = $template_pack_labels->template_variation;
1489 1489
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1490 1490
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1491 1491
 
1492
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1492
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1493 1493
 
1494
-		EEH_Template::display_template( $template, $template_args );
1494
+		EEH_Template::display_template($template, $template_args);
1495 1495
 	}
1496 1496
 
1497 1497
 
@@ -1512,52 +1512,52 @@  discard block
 block discarded – undo
1512 1512
 			'GRP_ID' => $this->_message_template_group->GRP_ID()
1513 1513
 			);
1514 1514
 
1515
-		$button = $this->get_action_link_or_button( 'reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button' );
1515
+		$button = $this->get_action_link_or_button('reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button');
1516 1516
 
1517 1517
 
1518 1518
 		//test button
1519 1519
 		//first we need to see if there are any fields
1520 1520
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1521 1521
 
1522
-		if ( !empty( $fields ) ) {
1522
+		if ( ! empty($fields)) {
1523 1523
 			//yup there be fields
1524
-			foreach ( $fields as $field => $config ) {
1525
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1524
+			foreach ($fields as $field => $config) {
1525
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1526 1526
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1527
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1528
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1527
+				$default = isset($config['default']) ? $config['default'] : '';
1528
+				$default = isset($config['value']) ? $config['value'] : $default;
1529 1529
 
1530 1530
 				//if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults
1531 1531
 				$fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : '';
1532
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix;
1532
+				$existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix;
1533 1533
 
1534 1534
 				$template_form_fields[$field_id] = array(
1535
-					'name' => 'test_settings_fld[' . $field . ']',
1535
+					'name' => 'test_settings_fld['.$field.']',
1536 1536
 					'label' => $config['label'],
1537 1537
 					'input' => $config['input'],
1538 1538
 					'type' => $config['type'],
1539 1539
 					'required' => $config['required'],
1540 1540
 					'validation' => $config['validation'],
1541
-					'value' => isset( $existing[$field] ) ? $existing[$field] : $default,
1541
+					'value' => isset($existing[$field]) ? $existing[$field] : $default,
1542 1542
 					'css_class' => $config['css_class'],
1543
-					'options' => isset( $config['options'] ) ? $config['options'] : array(),
1543
+					'options' => isset($config['options']) ? $config['options'] : array(),
1544 1544
 					'default' => $default,
1545 1545
 					'format' => $config['format']
1546 1546
 					);
1547 1547
 			}
1548 1548
 		}
1549 1549
 
1550
-		$test_settings_fields = !empty( $template_form_fields) ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) : '';
1550
+		$test_settings_fields = ! empty($template_form_fields) ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') : '';
1551 1551
 
1552 1552
 		$test_settings_html = '';
1553 1553
 		//print out $test_settings_fields
1554
-		if ( !empty( $test_settings_fields ) ) {
1554
+		if ( ! empty($test_settings_fields)) {
1555 1555
 			echo $test_settings_fields;
1556
-			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" /><div style="clear:both"></div>';
1556
+			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" /><div style="clear:both"></div>';
1557 1557
 		}
1558 1558
 
1559 1559
 		//and button
1560
-		echo $test_settings_html . '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>' . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>';
1560
+		echo $test_settings_html.'<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>';
1561 1561
 	}
1562 1562
 
1563 1563
 
@@ -1572,13 +1572,13 @@  discard block
 block discarded – undo
1572 1572
      * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1573 1573
      * @return string
1574 1574
     */
1575
-	protected function _get_shortcode_selector( $field, $linked_input_id ) {
1575
+	protected function _get_shortcode_selector($field, $linked_input_id) {
1576 1576
 		$template_args = array(
1577
-			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
1577
+			'shortcodes' => $this->_get_shortcodes(array($field), true),
1578 1578
 			'fieldname' => $field,
1579 1579
 			'linked_input_id' => $linked_input_id
1580 1580
 		);
1581
-		return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true );
1581
+		return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true);
1582 1582
 	}
1583 1583
 
1584 1584
 
@@ -1592,13 +1592,13 @@  discard block
 block discarded – undo
1592 1592
 		$shortcodes = $this->_get_shortcodes(array(), FALSE); //just make sure shortcodes property is set
1593 1593
 		$messenger = $this->_message_template_group->messenger_obj();
1594 1594
 		//now let's set the content depending on the status of the shortcodes array
1595
-		if ( empty( $shortcodes ) ) {
1596
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
1595
+		if (empty($shortcodes)) {
1596
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
1597 1597
 			echo $content;
1598 1598
 		} else {
1599 1599
 			$alt = 0;
1600 1600
 			?>
1601
-			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
1601
+			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p>
1602 1602
 			<?php
1603 1603
 		}
1604 1604
 
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 	protected function _set_shortcodes() {
1616 1616
 
1617 1617
 		//no need to run this if the property is already set
1618
-		if ( !empty($this->_shortcodes ) ) return;
1618
+		if ( ! empty($this->_shortcodes)) return;
1619 1619
 
1620 1620
 		$this->_shortcodes = $this->_get_shortcodes();
1621 1621
 	}
@@ -1632,14 +1632,14 @@  discard block
 block discarded – undo
1632 1632
 	 * @param  boolean $merged Whether to merge all the shortcodes into one list of unique shortcodes
1633 1633
 	 * @return array          Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true just an array of shortcode/label pairs.
1634 1634
 	 */
1635
-	protected function _get_shortcodes( $fields = array(), $merged = TRUE ) {
1635
+	protected function _get_shortcodes($fields = array(), $merged = TRUE) {
1636 1636
 		$this->_set_message_template_group();
1637 1637
 
1638 1638
 		//we need the messenger and message template to retrieve the valid shortcodes array.
1639
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
1640
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
1639
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
1640
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
1641 1641
 
1642
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
1642
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
1643 1643
 	}
1644 1644
 
1645 1645
 
@@ -1652,19 +1652,19 @@  discard block
 block discarded – undo
1652 1652
 	 */
1653 1653
 	protected function _set_message_template_group() {
1654 1654
 
1655
-		if ( !empty( $this->_message_template_group ) )
1655
+		if ( ! empty($this->_message_template_group))
1656 1656
 			return; //get out if this is already set.
1657 1657
 
1658
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;
1659
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
1658
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : FALSE;
1659
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
1660 1660
 
1661 1661
 		//let's get the message templates
1662 1662
 		$MTP = EEM_Message_Template_Group::instance();
1663 1663
 
1664
-		if ( empty($GRP_ID) )
1664
+		if (empty($GRP_ID))
1665 1665
 			$this->_message_template_group = $MTP->create_default_object();
1666 1666
 		else
1667
-			$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1667
+			$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID);
1668 1668
 
1669 1669
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1670 1670
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1690,26 +1690,26 @@  discard block
 block discarded – undo
1690 1690
 		<div class="ee-msg-switcher-container">
1691 1691
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1692 1692
 				<?php
1693
-					foreach ( $args as $name => $value ) {
1694
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;
1693
+					foreach ($args as $name => $value) {
1694
+						if ($name == 'context' || empty($value) || $name == 'extra') continue;
1695 1695
 						?>
1696 1696
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1697 1697
 						<?php
1698 1698
 					}
1699 1699
 					//setup nonce_url
1700
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
1700
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
1701 1701
 				?>
1702 1702
 				<select name="context">
1703 1703
 					<?php
1704 1704
 					$context_templates = $template_group_object->context_templates();
1705
-					if ( is_array($context_templates) ) :
1706
-							foreach ( $context_templates as $context => $template_fields ) :
1705
+					if (is_array($context_templates)) :
1706
+							foreach ($context_templates as $context => $template_fields) :
1707 1707
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
1708 1708
 					?>
1709 1709
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>><?php echo $context_details[$context]['label']; ?></option>
1710 1710
 					<?php endforeach; endif; ?>
1711 1711
 				</select>
1712
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
1712
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
1713 1713
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
1714 1714
 			</form>
1715 1715
 			<?php echo $args['extra']; ?>
@@ -1733,8 +1733,8 @@  discard block
 block discarded – undo
1733 1733
 	 * @param int $index This helps us know which template field to select from the request array.
1734 1734
 	 */
1735 1735
 	protected function _set_message_template_column_values($index) {
1736
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
1737
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
1736
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
1737
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
1738 1738
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
1739 1739
 			}
1740 1740
 		} else {
@@ -1766,27 +1766,27 @@  discard block
 block discarded – undo
1766 1766
 
1767 1767
 
1768 1768
 
1769
-	protected function _insert_or_update_message_template($new = FALSE ) {
1769
+	protected function _insert_or_update_message_template($new = FALSE) {
1770 1770
 
1771
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
1771
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1772 1772
 		$success = 0;
1773 1773
 		$override = FALSE;
1774 1774
 
1775 1775
 		//setup notices description
1776
-		$messenger = !empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'] ) ) : false;
1777
-		$message_type = !empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'] ) ) : false;
1778
-		$context = !empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'] ) ) : false;
1776
+		$messenger = ! empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) : false;
1777
+		$message_type = ! empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) : false;
1778
+		$context = ! empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) : false;
1779 1779
 
1780
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
1780
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
1781 1781
 		$item_desc .= 'Message Template';
1782 1782
 		$query_args = array();
1783 1783
 		$validates = '';
1784 1784
 
1785 1785
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
1786
-		if ( $new ) {
1787
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1788
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
1789
-				if ( empty($edit_array) ) {
1786
+		if ($new) {
1787
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1788
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
1789
+				if (empty($edit_array)) {
1790 1790
 					$success = 0;
1791 1791
 				} else {
1792 1792
 					$success = 1;
@@ -1805,34 +1805,34 @@  discard block
 block discarded – undo
1805 1805
 
1806 1806
 
1807 1807
 			//run update for each template field in displayed context
1808
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
1809
-				EE_Error::add_error( __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1808
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
1809
+				EE_Error::add_error(__('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1810 1810
 				$success = 0;
1811 1811
 				$action_desc = '';
1812 1812
 
1813 1813
 			} else {
1814 1814
 				//first validate all fields!
1815
-				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1815
+				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1816 1816
 
1817 1817
 				//if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array.  WE need to make sure there is no actual error messages in validates.
1818
-				if ( is_array($validates) && !empty($validates) ) {
1818
+				if (is_array($validates) && ! empty($validates)) {
1819 1819
 					//add the transient so when the form loads we know which fields to highlight
1820
-					$this->_add_transient( 'edit_message_template', $validates );
1820
+					$this->_add_transient('edit_message_template', $validates);
1821 1821
 
1822 1822
 					$success = 0;
1823
-					$action_desc ='';
1823
+					$action_desc = '';
1824 1824
 
1825 1825
 					//setup notices
1826
-					foreach ( $validates as $field => $error ) {
1827
-						if ( isset($error['msg'] ) )
1828
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1826
+					foreach ($validates as $field => $error) {
1827
+						if (isset($error['msg']))
1828
+							EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);
1829 1829
 					}
1830 1830
 
1831 1831
 				} else {
1832
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
1832
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
1833 1833
 						$set_column_values = $this->_set_message_template_column_values($template_field);
1834 1834
 
1835
-						$where_cols_n_values = array( 'MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1835
+						$where_cols_n_values = array('MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1836 1836
 
1837 1837
 						$message_template_fields = array(
1838 1838
 							'GRP_ID' => $set_column_values['GRP_ID'],
@@ -1840,10 +1840,10 @@  discard block
 block discarded – undo
1840 1840
 							'MTP_context' => $set_column_values['MTP_context'],
1841 1841
 							'MTP_content' => $set_column_values['MTP_content']
1842 1842
 							);
1843
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
1844
-							if ( $updated === FALSE ) {
1845
-								$msg = sprintf( __('%s field was NOT updated for some reason', 'event_espresso'), $template_field );
1846
-								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1843
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
1844
+							if ($updated === FALSE) {
1845
+								$msg = sprintf(__('%s field was NOT updated for some reason', 'event_espresso'), $template_field);
1846
+								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1847 1847
 							} else {
1848 1848
 								$success = 1;
1849 1849
 							}
@@ -1860,24 +1860,24 @@  discard block
 block discarded – undo
1860 1860
 						'MTP_is_override' => $set_column_values['MTP_is_override'],
1861 1861
 						'MTP_deleted' => $set_column_values['MTP_deleted'],
1862 1862
 						'MTP_is_active' => $set_column_values['MTP_is_active'],
1863
-						'MTP_name' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_name'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1864
-						'MTP_description' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_description'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1863
+						'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1864
+						'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1865 1865
 						);
1866 1866
 
1867
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
1868
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
1867
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
1868
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
1869 1869
 
1870
-					if ( $updated === FALSE ) {
1871
-						$msg = sprintf( __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID'] );
1872
-						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1870
+					if ($updated === FALSE) {
1871
+						$msg = sprintf(__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID']);
1872
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1873 1873
 					} else {
1874 1874
 						//k now we need to ensure the template_pack and template_variation fields are set.
1875
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) ? $this->_req_data['MTP_template_pack'] : 'default';
1876
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) ? $this->_req_data['MTP_template_variation'] : 'default';
1877
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
1878
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
1879
-							$mtpg_obj->set_template_pack_name( $template_pack );
1880
-							$mtpg_obj->set_template_pack_variation( $template_variation );
1875
+						$template_pack = ! empty($this->_req_data['MTP_template_pack']) ? $this->_req_data['MTP_template_pack'] : 'default';
1876
+						$template_variation = ! empty($this->_req_data['MTP_template_variation']) ? $this->_req_data['MTP_template_variation'] : 'default';
1877
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
1878
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
1879
+							$mtpg_obj->set_template_pack_name($template_pack);
1880
+							$mtpg_obj->set_template_pack_variation($template_variation);
1881 1881
 						}
1882 1882
 						$success = 1;
1883 1883
 					}
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 		}
1888 1888
 
1889 1889
 		//we return things differently if doing ajax
1890
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1890
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1891 1891
 			$this->_template_args['success'] = $success;
1892 1892
 			$this->_template_args['error'] = ! $success ? TRUE : FALSE;
1893 1893
 			$this->_template_args['content'] = '';
@@ -1895,9 +1895,9 @@  discard block
 block discarded – undo
1895 1895
 				'grpID' => $edit_array['GRP_ID'],
1896 1896
 				'templateName' => $edit_array['template_name']
1897 1897
 				);
1898
-			if ( $success ) {
1898
+			if ($success) {
1899 1899
 				EE_Error::overwrite_success();
1900
-				EE_Error::add_success( __('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso') );
1900
+				EE_Error::add_success(__('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso'));
1901 1901
 			}
1902 1902
 
1903 1903
 			$this->_return_json();
@@ -1905,13 +1905,13 @@  discard block
 block discarded – undo
1905 1905
 
1906 1906
 
1907 1907
 		//was a test send triggered?
1908
-		if ( isset( $this->_req_data['test_button'] ) ) {
1908
+		if (isset($this->_req_data['test_button'])) {
1909 1909
 			EE_Error::overwrite_success();
1910
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
1910
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1911 1911
 			$override = TRUE;
1912 1912
 		}
1913 1913
 
1914
-		if ( empty( $query_args ) ) {
1914
+		if (empty($query_args)) {
1915 1915
 			$query_args = array(
1916 1916
 				'id' => $this->_req_data['GRP_ID'],
1917 1917
 				'context' => $this->_req_data['MTP_context'],
@@ -1919,7 +1919,7 @@  discard block
 block discarded – undo
1919 1919
 				);
1920 1920
 		}
1921 1921
 
1922
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
1922
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
1923 1923
 	}
1924 1924
 
1925 1925
 
@@ -1932,24 +1932,24 @@  discard block
 block discarded – undo
1932 1932
 	 * @param  string $message_type message type being tested
1933 1933
 	 * @return void
1934 1934
 	 */
1935
-	protected function _do_test_send( $context, $messenger, $message_type ) {
1935
+	protected function _do_test_send($context, $messenger, $message_type) {
1936 1936
 		//set things up for preview
1937 1937
 		$this->_req_data['messenger'] = $messenger;
1938 1938
 		$this->_req_data['message_type'] = $message_type;
1939 1939
 		$this->_req_data['context'] = $context;
1940
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
1940
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
1941 1941
 
1942 1942
 		//let's save any existing fields that might be required by the messenger
1943
-		if ( isset( $this->_req_data['test_settings_fld'] ) ) {
1944
-			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
1943
+		if (isset($this->_req_data['test_settings_fld'])) {
1944
+			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings($this->_req_data['test_settings_fld']);
1945 1945
 		}
1946 1946
 
1947 1947
 		$success = $this->_preview_message(TRUE);
1948 1948
 
1949
-		if ( $success ) {
1950
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
1949
+		if ($success) {
1950
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
1951 1951
 		} else {
1952
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1952
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1953 1953
 		}
1954 1954
 	}
1955 1955
 
@@ -1971,12 +1971,12 @@  discard block
 block discarded – undo
1971 1971
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
1972 1972
 
1973 1973
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
1974
-		if ( empty( $message_types ) )
1974
+		if (empty($message_types))
1975 1975
 			return true;
1976 1976
 
1977
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1977
+		EE_Registry::instance()->load_helper('MSG_Template');
1978 1978
 
1979
-		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID,  $global);
1979
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
1980 1980
 
1981 1981
 	}
1982 1982
 
@@ -1992,33 +1992,33 @@  discard block
 block discarded – undo
1992 1992
 	 * @param boolean $all whether this is going to trash/restore all contexts within a template group (TRUE) OR just an individual context (FALSE).
1993 1993
 	 * @return void
1994 1994
 	 */
1995
-	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE ) {
1996
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1995
+	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE) {
1996
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1997 1997
 		$MTP = EEM_Message_Template_Group::instance();
1998 1998
 
1999 1999
 		$success = 1;
2000 2000
 
2001 2001
 		//incoming GRP_IDs
2002
-		if ( $all ) {
2002
+		if ($all) {
2003 2003
 			//Checkboxes
2004
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
2004
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2005 2005
 				//if array has more than one element then success message should be plural.
2006 2006
 				//todo: what about nonce?
2007
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2007
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2008 2008
 
2009 2009
 				//cycle through checkboxes
2010
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2011
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2012
-					if ( ! $trashed_or_restored ) {
2010
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2011
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2012
+					if ( ! $trashed_or_restored) {
2013 2013
 						$success = 0;
2014 2014
 					}
2015 2015
 				}
2016 2016
 			} else {
2017 2017
 				//grab single GRP_ID and handle
2018
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2019
-				if ( ! empty( $GRP_ID ) ) {
2020
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2021
-					if ( ! $trashed_or_restored ) {
2018
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2019
+				if ( ! empty($GRP_ID)) {
2020
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2021
+					if ( ! $trashed_or_restored) {
2022 2022
 						$success = 0;
2023 2023
 					}
2024 2024
 				} else {
@@ -2030,13 +2030,13 @@  discard block
 block discarded – undo
2030 2030
 
2031 2031
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2032 2032
 
2033
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2033
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2034 2034
 
2035 2035
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2036 2036
 
2037
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2037
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2038 2038
 
2039
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2039
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2040 2040
 
2041 2041
 	}
2042 2042
 
@@ -2052,26 +2052,26 @@  discard block
 block discarded – undo
2052 2052
 	 * @return void
2053 2053
 	 */
2054 2054
 	protected function _delete_message_template() {
2055
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2055
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2056 2056
 
2057 2057
 		$success = 1;
2058 2058
 
2059 2059
 		//checkboxes
2060
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2060
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2061 2061
 			//if array has more than one element then success message should be plural
2062
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2062
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2063 2063
 
2064 2064
 			//cycle through bulk action checkboxes
2065
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2066
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2065
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2066
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2067 2067
 			}
2068 2068
 		} else {
2069 2069
 			//grab single grp_id and delete
2070
-			$GRP_ID = absint($this->_req_data['id'] );
2071
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2070
+			$GRP_ID = absint($this->_req_data['id']);
2071
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2072 2072
 		}
2073 2073
 
2074
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2074
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2075 2075
 
2076 2076
 	}
2077 2077
 
@@ -2084,20 +2084,20 @@  discard block
 block discarded – undo
2084 2084
 	 * @param  bool $include_group whether to delete the Message Template Group as well.
2085 2085
 	 * @return success        boolean to indicate the success of the deletes or not.
2086 2086
 	 */
2087
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) {
2087
+	private function _delete_mtp_permanently($GRP_ID, $include_group = TRUE) {
2088 2088
 		$success = 1;
2089 2089
 		$MTPG = EEM_Message_Template_Group::instance();
2090 2090
 		//first let's GET this group
2091
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2091
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2092 2092
 		//then delete permanently all the related Message Templates
2093
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2093
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2094 2094
 
2095
-		if ( $deleted === 0 )
2095
+		if ($deleted === 0)
2096 2096
 			$success = 0;
2097 2097
 
2098 2098
 		//now delete permanently this particular group
2099 2099
 
2100
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2100
+		if ($include_group && ! $MTG->delete_permanently()) {
2101 2101
 			$success = 0;
2102 2102
 		}
2103 2103
 		return $success;
@@ -2115,7 +2115,7 @@  discard block
 block discarded – undo
2115 2115
 	*	@return string
2116 2116
 	*/
2117 2117
 	protected function _learn_more_about_message_templates_link() {
2118
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2118
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2119 2119
 	}
2120 2120
 
2121 2121
 
@@ -2129,14 +2129,14 @@  discard block
 block discarded – undo
2129 2129
 	 */
2130 2130
 	protected function _settings() {
2131 2131
 
2132
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
2132
+		EE_Registry::instance()->load_helper('Tabbed_Content');
2133 2133
 
2134 2134
 		$this->_set_m_mt_settings();
2135 2135
 
2136
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2136
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2137 2137
 
2138 2138
 		//let's setup the messenger tabs
2139
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2139
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2140 2140
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2141 2141
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2142 2142
 
@@ -2155,10 +2155,10 @@  discard block
 block discarded – undo
2155 2155
 	 */
2156 2156
 	protected function _set_m_mt_settings() {
2157 2157
 		//first if this is already set then lets get out no need to regenerate data.
2158
-		if ( !empty($this->_m_mt_settings) )
2158
+		if ( ! empty($this->_m_mt_settings))
2159 2159
 			return;
2160 2160
 
2161
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2161
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2162 2162
 
2163 2163
 		//get all installed messengers and message_types
2164 2164
 		$installed_message_objects = $this->_get_installed_message_objects();
@@ -2168,10 +2168,10 @@  discard block
 block discarded – undo
2168 2168
 
2169 2169
 		//assemble the array for the _tab_text_links helper
2170 2170
 
2171
-		foreach ( $messengers as $messenger ) {
2171
+		foreach ($messengers as $messenger) {
2172 2172
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2173 2173
 				'label' => ucwords($messenger->label['singular']),
2174
-				'class' => isset( $this->_active_messengers[$messenger->name] ) ? 'messenger-active' : '',
2174
+				'class' => isset($this->_active_messengers[$messenger->name]) ? 'messenger-active' : '',
2175 2175
 				'href' => $messenger->name,
2176 2176
 				'title' => __('Modify this Messenger', 'event_espresso'),
2177 2177
 				'slug' => $messenger->name,
@@ -2181,23 +2181,23 @@  discard block
 block discarded – undo
2181 2181
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2182 2182
 
2183 2183
 			//assemble the array for the ACTIVE and INACTIVE message types with the selected messenger //note that all message types will be in the inactive box if the messenger is NOT active.
2184
-			$selected_settings = isset( $this->_active_messengers[$messenger->name]['settings'] ) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2185
-			foreach ( $message_types as $message_type ) {
2184
+			$selected_settings = isset($this->_active_messengers[$messenger->name]['settings']) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2185
+			foreach ($message_types as $message_type) {
2186 2186
 				//first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox.
2187
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2187
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2188 2188
 					continue;
2189 2189
 				}
2190 2190
 
2191
-				$a_or_i = isset( $selected_settings[$messenger->name . '-message_types'][$message_type->name] ) && $selected_settings[$messenger->name . '-message_types'][$message_type->name] ? 'active' : 'inactive';
2191
+				$a_or_i = isset($selected_settings[$messenger->name.'-message_types'][$message_type->name]) && $selected_settings[$messenger->name.'-message_types'][$message_type->name] ? 'active' : 'inactive';
2192 2192
 
2193 2193
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2194 2194
 						'label' => ucwords($message_type->label['singular']),
2195
-						'class' => 'message-type-' . $a_or_i,
2196
-						'slug_id' => $message_type->name . '-messagetype-' . $messenger->name,
2197
-						'mt_nonce' => wp_create_nonce($message_type->name . '_nonce'),
2198
-						'href' => 'espresso_' . $message_type->name . '_message_type_settings',
2195
+						'class' => 'message-type-'.$a_or_i,
2196
+						'slug_id' => $message_type->name.'-messagetype-'.$messenger->name,
2197
+						'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2198
+						'href' => 'espresso_'.$message_type->name.'_message_type_settings',
2199 2199
 						'title' => $a_or_i == 'active' ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') : __('Drag this message type to the messenger to activate', 'event_espresso'),
2200
-						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content( $message_type, $messenger, TRUE ) : $this->_message_type_settings_content( $message_type, $messenger ),
2200
+						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content($message_type, $messenger, TRUE) : $this->_message_type_settings_content($message_type, $messenger),
2201 2201
 						'slug' => $message_type->name,
2202 2202
 						'active' => $a_or_i == 'active' ? TRUE : FALSE,
2203 2203
 						'obj' => $message_type
@@ -2214,34 +2214,34 @@  discard block
 block discarded – undo
2214 2214
 	 * @param  boolean $active       Whether the message type is active or not
2215 2215
 	 * @return string                html output for the content
2216 2216
 	 */
2217
-	protected function _message_type_settings_content( $message_type, $messenger, $active = FALSE ) {
2217
+	protected function _message_type_settings_content($message_type, $messenger, $active = FALSE) {
2218 2218
 		//get message type fields
2219 2219
 		$fields = $message_type->get_admin_settings_fields();
2220
-		$settings_template_args['template_form_fields']= '';
2220
+		$settings_template_args['template_form_fields'] = '';
2221 2221
 
2222
-		if ( !empty( $fields ) && $active ) {
2222
+		if ( ! empty($fields) && $active) {
2223 2223
 
2224
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2224
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2225 2225
 
2226
-			foreach( $fields as $fldname => $fldprops ) {
2227
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2226
+			foreach ($fields as $fldname => $fldprops) {
2227
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2228 2228
 				$template_form_field[$field_id] = array(
2229
-					'name' => 'message_type_settings[' . $fldname . ']',
2229
+					'name' => 'message_type_settings['.$fldname.']',
2230 2230
 					'label' => $fldprops['label'],
2231 2231
 					'input' => $fldprops['field_type'],
2232 2232
 					'type' => $fldprops['value_type'],
2233 2233
 					'required' => $fldprops['required'],
2234 2234
 					'validation' => $fldprops['validation'],
2235
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2236
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2237
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2235
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2236
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2237
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2238 2238
 					'css_class' => 'no-drag',
2239 2239
 					'format' => $fldprops['format']
2240 2240
 					);
2241 2241
 			}
2242 2242
 
2243 2243
 
2244
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2244
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2245 2245
 		}
2246 2246
 
2247 2247
 		$settings_template_args['description'] = $message_type->description;
@@ -2261,13 +2261,13 @@  discard block
 block discarded – undo
2261 2261
 					)
2262 2262
 				);
2263 2263
 
2264
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2265
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2264
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2265
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2266 2266
 
2267 2267
 
2268 2268
 
2269
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2270
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE );
2269
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2270
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2271 2271
 		return $content;
2272 2272
 	}
2273 2273
 
@@ -2284,21 +2284,21 @@  discard block
 block discarded – undo
2284 2284
 		$m_boxes = $mt_boxes = array();
2285 2285
 		$m_template_args = $mt_template_args = array();
2286 2286
 
2287
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2287
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2288 2288
 
2289
-		foreach ( $this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array ) {
2289
+		foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2290 2290
 
2291
-			$hide_on_message = isset( $this->_active_messengers[$messenger] ) ? '' : 'hidden';
2292
-			$hide_off_message = isset( $this->_active_messengers[$messenger] ) ? 'hidden' : '';
2291
+			$hide_on_message = isset($this->_active_messengers[$messenger]) ? '' : 'hidden';
2292
+			$hide_off_message = isset($this->_active_messengers[$messenger]) ? 'hidden' : '';
2293 2293
 
2294 2294
 			//messenger meta boxes
2295 2295
 			$active = $selected_messenger == $messenger ? TRUE : FALSE;
2296
-			$active_mt_tabs = isset(  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] ) ?  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2297
-			$m_boxes[$messenger . '_a_box'] = sprintf( __('%s Settings', 'event_espresso'), $tab_array['label'] );
2298
-			$m_template_args[$messenger . '_a_box'] = array(
2299
-					'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2300
-					'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2301
-					'content' => $this->_get_messenger_box_content( $tab_array['obj'] ),
2296
+			$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2297
+			$m_boxes[$messenger.'_a_box'] = sprintf(__('%s Settings', 'event_espresso'), $tab_array['label']);
2298
+			$m_template_args[$messenger.'_a_box'] = array(
2299
+					'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2300
+					'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2301
+					'content' => $this->_get_messenger_box_content($tab_array['obj']),
2302 2302
 					'hidden' => $active ? '' : ' hidden',
2303 2303
 					'hide_on_message' => $hide_on_message,
2304 2304
 					'messenger' => $messenger,
@@ -2307,10 +2307,10 @@  discard block
 block discarded – undo
2307 2307
 
2308 2308
 
2309 2309
 			//message type meta boxes (which is really just the inactive container for each messenger showing inactive message types for that messenger)
2310
-			$mt_boxes[$messenger . '_i_box'] = __('Inactive Message Types', 'event_espresso');
2311
-			$mt_template_args[$messenger . '_i_box'] = array(
2312
-				'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2313
-				'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2310
+			$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2311
+			$mt_template_args[$messenger.'_i_box'] = array(
2312
+				'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2313
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2314 2314
 				'hidden' => $active ? '' : ' hidden',
2315 2315
 				'hide_on_message' => $hide_on_message,
2316 2316
 				'hide_off_message' => $hide_off_message,
@@ -2320,19 +2320,19 @@  discard block
 block discarded – undo
2320 2320
 		}
2321 2321
 
2322 2322
 		//register messenger metaboxes
2323
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2324
-		foreach ( $m_boxes as $box => $label ) {
2325
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2326
-			$msgr = str_replace( '_a_box', '', $box );
2327
-			add_meta_box( 'espresso_' . $msgr . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args );
2323
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2324
+		foreach ($m_boxes as $box => $label) {
2325
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2326
+			$msgr = str_replace('_a_box', '', $box);
2327
+			add_meta_box('espresso_'.$msgr.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
2328 2328
 		}
2329 2329
 
2330 2330
 		//register message type metaboxes
2331
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2332
-		foreach ( $mt_boxes as $box => $label ) {
2333
-			$callback_args = array( 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] );
2334
-			$mt = str_replace( '_i_box', '', $box );
2335
-			add_meta_box( 'espresso_' . $mt . '_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args );
2331
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2332
+		foreach ($mt_boxes as $box => $label) {
2333
+			$callback_args = array('template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]);
2334
+			$mt = str_replace('_i_box', '', $box);
2335
+			add_meta_box('espresso_'.$mt.'_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args);
2336 2336
 		}
2337 2337
 
2338 2338
 	}
@@ -2343,13 +2343,13 @@  discard block
 block discarded – undo
2343 2343
 	 * @param  array $tab_array  This is an array of message type tab details used to generate the tabs
2344 2344
 	 * @return string            html formatted tabs
2345 2345
 	 */
2346
-	protected function _get_mt_tabs( $tab_array ) {
2346
+	protected function _get_mt_tabs($tab_array) {
2347 2347
 		$tab_array = (array) $tab_array;
2348
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
2348
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
2349 2349
 		$tabs = '';
2350 2350
 
2351
-		foreach ( $tab_array as $tab ) {
2352
-			$tabs .=  EEH_Template::display_template( $template, $tab, TRUE );
2351
+		foreach ($tab_array as $tab) {
2352
+			$tabs .= EEH_Template::display_template($template, $tab, TRUE);
2353 2353
 		}
2354 2354
 
2355 2355
 		return $tabs;
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
 	 * @param  object $messenger The messenger we're setting up content for
2364 2364
 	 * @return string            html formatted content
2365 2365
 	 */
2366
-	protected function _get_messenger_box_content( $messenger ) {
2366
+	protected function _get_messenger_box_content($messenger) {
2367 2367
 
2368 2368
 		$fields = $messenger->get_admin_settings_fields();
2369 2369
 		$settings_template_args['template_form_fields'] = '';
@@ -2372,27 +2372,27 @@  discard block
 block discarded – undo
2372 2372
 		$settings_template_args['active'] = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2373 2373
 
2374 2374
 
2375
-		if ( !empty( $fields ) ) {
2375
+		if ( ! empty($fields)) {
2376 2376
 
2377 2377
 			$existing_settings = $messenger->get_existing_admin_settings();
2378 2378
 
2379
-			foreach( $fields as $fldname => $fldprops ) {
2380
-				$field_id = $messenger->name . '-' . $fldname;
2379
+			foreach ($fields as $fldname => $fldprops) {
2380
+				$field_id = $messenger->name.'-'.$fldname;
2381 2381
 				$template_form_field[$field_id] = array(
2382
-					'name' => 'messenger_settings[' . $field_id . ']',
2382
+					'name' => 'messenger_settings['.$field_id.']',
2383 2383
 					'label' => $fldprops['label'],
2384 2384
 					'input' => $fldprops['field_type'],
2385 2385
 					'type' => $fldprops['value_type'],
2386 2386
 					'required' => $fldprops['required'],
2387 2387
 					'validation' => $fldprops['validation'],
2388
-					'value' => isset( $existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2388
+					'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2389 2389
 					'css_class' => '',
2390 2390
 					'format' => $fldprops['format']
2391 2391
 					);
2392 2392
 			}
2393 2393
 
2394 2394
 
2395
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) : '';
2395
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : '';
2396 2396
 		}
2397 2397
 
2398 2398
 		//we also need some hidden fields
@@ -2408,8 +2408,8 @@  discard block
 block discarded – undo
2408 2408
 			);
2409 2409
 
2410 2410
 		//make sure any active message types that are existing are included in the hidden fields
2411
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
2412
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
2411
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
2412
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
2413 2413
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
2414 2414
 						'type' => 'hidden',
2415 2415
 						'value' => $mt
@@ -2417,25 +2417,25 @@  discard block
 block discarded – undo
2417 2417
 			}
2418 2418
 		}
2419 2419
 
2420
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2420
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2421 2421
 
2422
-		$active = isset( $this->_active_messengers[$messenger->name] ) ? TRUE : FALSE;
2422
+		$active = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2423 2423
 
2424 2424
 		$settings_template_args['messenger'] = $messenger->name;
2425 2425
 		$settings_template_args['description'] = $messenger->description;
2426 2426
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
2427 2427
 
2428 2428
 
2429
-		$settings_template_args['show_hide_edit_form'] = isset( $this->_active_messengers[$messenger->name] ) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2429
+		$settings_template_args['show_hide_edit_form'] = isset($this->_active_messengers[$messenger->name]) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2430 2430
 
2431
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2431
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2432 2432
 
2433 2433
 
2434 2434
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
2435
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
2435
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
2436 2436
 		$settings_template_args['on_off_status'] = $active ? true : false;
2437
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
2438
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE);
2437
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
2438
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2439 2439
 		return $content;
2440 2440
 	}
2441 2441
 
@@ -2449,39 +2449,39 @@  discard block
 block discarded – undo
2449 2449
 	public function activate_messenger_toggle() {
2450 2450
 		$success = TRUE;
2451 2451
 		//let's check that we have required data
2452
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2453
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2452
+		if ( ! isset($this->_req_data['messenger'])) {
2453
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2454 2454
 			$success = FALSE;
2455 2455
 		}
2456 2456
 
2457 2457
 		//do a nonce check here since we're not arriving via a normal route
2458
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
2459
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
2458
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
2459
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
2460 2460
 
2461
-		$this->_verify_nonce( $nonce, $nonce_ref );
2461
+		$this->_verify_nonce($nonce, $nonce_ref);
2462 2462
 
2463 2463
 
2464 2464
 
2465
-		if ( !isset( $this->_req_data[ 'status' ])) {
2466
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2465
+		if ( ! isset($this->_req_data['status'])) {
2466
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2467 2467
 			$success = FALSE;
2468 2468
 		}
2469 2469
 
2470 2470
 		//do check to verify we have a valid status.
2471 2471
 		$status = $this->_req_data['status'];
2472 2472
 
2473
-		if ( $status != 'off' && $status != 'on' ) {
2474
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2473
+		if ($status != 'off' && $status != 'on') {
2474
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2475 2475
 			$success = FALSE;
2476 2476
 		}
2477 2477
 
2478
-		if ( $success ) {
2478
+		if ($success) {
2479 2479
 			//made it here?  Stop dawdling then!!
2480
-			if ( $status == 'off' ) {
2480
+			if ($status == 'off') {
2481 2481
 				//off = deactivate.  get it?
2482
-				$success = $this->_activate_messenger( $this->_req_data['messenger'], TRUE );
2482
+				$success = $this->_activate_messenger($this->_req_data['messenger'], TRUE);
2483 2483
 			} else {
2484
-				$success = $this->_activate_messenger( $this->_req_data['messenger'] );
2484
+				$success = $this->_activate_messenger($this->_req_data['messenger']);
2485 2485
 			}
2486 2486
 		}
2487 2487
 
@@ -2507,26 +2507,26 @@  discard block
 block discarded – undo
2507 2507
 
2508 2508
 
2509 2509
 		//let's make sure we have the necessary data
2510
-		if ( !isset( $this->_req_data[ 'message_type' ] ) ) {
2511
-			EE_Error::add_error( __('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2510
+		if ( ! isset($this->_req_data['message_type'])) {
2511
+			EE_Error::add_error(__('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2512 2512
 			$success = FALSE;
2513 2513
 		}
2514 2514
 
2515 2515
 
2516 2516
 		//do a nonce check here since we're not arriving via a normal route
2517
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
2518
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
2517
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
2518
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
2519 2519
 
2520
-		$this->_verify_nonce( $nonce, $nonce_ref );
2520
+		$this->_verify_nonce($nonce, $nonce_ref);
2521 2521
 
2522 2522
 
2523
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2524
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2523
+		if ( ! isset($this->_req_data['messenger'])) {
2524
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2525 2525
 			$success = FALSE;
2526 2526
 		}
2527 2527
 
2528
-		if ( !isset( $this->_req_data[ 'status' ])) {
2529
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2528
+		if ( ! isset($this->_req_data['status'])) {
2529
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2530 2530
 			$success = FALSE;
2531 2531
 		}
2532 2532
 
@@ -2534,16 +2534,16 @@  discard block
 block discarded – undo
2534 2534
 		//do check to verify we have a valid status.
2535 2535
 		$status = $this->_req_data['status'];
2536 2536
 
2537
-		if ( $status != 'activate' && $status != 'deactivate' ) {
2538
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2537
+		if ($status != 'activate' && $status != 'deactivate') {
2538
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2539 2539
 			$success = FALSE;
2540 2540
 		}
2541 2541
 
2542 2542
 
2543
-		if ( $success ) {
2543
+		if ($success) {
2544 2544
 			//made it here? um, what are you waiting for then?
2545 2545
 			$deactivate = $status == 'deactivate' ? TRUE : FALSE;
2546
-			$success = $this->_activate_messenger( $this->_req_data['messenger'], $deactivate, $this->_req_data['message_type'] );
2546
+			$success = $this->_activate_messenger($this->_req_data['messenger'], $deactivate, $this->_req_data['message_type']);
2547 2547
 		}
2548 2548
 
2549 2549
 		$this->_template_args['success'] = $success;
@@ -2570,28 +2570,28 @@  discard block
 block discarded – undo
2570 2570
 		$templates = TRUE;
2571 2571
 		$this->_set_m_mt_settings();
2572 2572
 
2573
-		if ( !$deactivate ) {
2573
+		if ( ! $deactivate) {
2574 2574
 
2575 2575
 
2576 2576
 			//we are activating.  we can use $this->_m_mt_settings to get all the installed messengers
2577
-			$this->_active_messengers[$messenger]['settings'] = !isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2577
+			$this->_active_messengers[$messenger]['settings'] = ! isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2578 2578
 			$this->_active_messengers[$messenger]['obj'] = $this->_m_mt_settings['messenger_tabs'][$messenger]['obj'];
2579 2579
 
2580 2580
 			//get has_active so we can sure its kept up to date.
2581
-			$has_activated = get_option( 'ee_has_activated_messages' );
2581
+			$has_activated = get_option('ee_has_activated_messages');
2582 2582
 
2583
-			if ( empty( $has_activated[$messenger] ) ) {
2583
+			if (empty($has_activated[$messenger])) {
2584 2584
 				$has_activated[$messenger] = array();
2585 2585
 			}
2586 2586
 
2587 2587
 			//k we need to get what default message types are to be associated with the messenger that's been activated.
2588 2588
 			$default_types = $message_type ? (array) $message_type : $this->_active_messengers[$messenger]['obj']->get_default_message_types();
2589 2589
 
2590
-			foreach ( $default_types as $type ) {
2590
+			foreach ($default_types as $type) {
2591 2591
 				$settings_fields = $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$type]['obj']->get_admin_settings_fields();
2592
-				if ( !empty( $settings_fields ) ) {
2592
+				if ( ! empty($settings_fields)) {
2593 2593
 					//we have fields for this message type so let's get the defaults for saving.
2594
-					foreach ( $settings_fields as $field => $values ) {
2594
+					foreach ($settings_fields as $field => $values) {
2595 2595
 						$settings[$field] = $values['default'];
2596 2596
 					}
2597 2597
 					//let's set the data for reloading this message type form in ajax
@@ -2599,9 +2599,9 @@  discard block
 block discarded – undo
2599 2599
 				} else {
2600 2600
 					$settings = array();
2601 2601
 				}
2602
-				$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$type]['settings'] =  $settings;
2602
+				$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$type]['settings'] = $settings;
2603 2603
 
2604
-				if ( ! in_array( $type, $has_activated[$messenger] ) ) {
2604
+				if ( ! in_array($type, $has_activated[$messenger])) {
2605 2605
 					$has_activated[$messenger][] = $type;
2606 2606
 				}
2607 2607
 			}
@@ -2609,41 +2609,41 @@  discard block
 block discarded – undo
2609 2609
 			//any default settings for the messenger?
2610 2610
 			$msgr_settings = $this->_active_messengers[$messenger]['obj']->get_admin_settings_fields();
2611 2611
 
2612
-			if ( !empty( $msgr_settings ) ) {
2613
-				foreach ( $msgr_settings as $field => $value ) {
2612
+			if ( ! empty($msgr_settings)) {
2613
+				foreach ($msgr_settings as $field => $value) {
2614 2614
 					$this->_active_messengers[$messenger]['settings'][$field] = $value;
2615 2615
 				}
2616 2616
 			}
2617 2617
 
2618 2618
 			//update settings in database
2619
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2620
-			update_option( 'ee_has_activated_messages', $has_activated );
2619
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2620
+			update_option('ee_has_activated_messages', $has_activated);
2621 2621
 
2622 2622
 
2623 2623
 			//generate new templates (if necessary)
2624
-			$templates = $this->_generate_new_templates( $messenger, $default_types, 0, TRUE );
2624
+			$templates = $this->_generate_new_templates($messenger, $default_types, 0, TRUE);
2625 2625
 
2626 2626
 			EE_Error::overwrite_success();
2627 2627
 
2628 2628
 			//if generation failed then we need to remove the active messenger.
2629
-			if ( !$templates ) {
2629
+			if ( ! $templates) {
2630 2630
 				unset($this->_active_messengers[$messenger]);
2631
-				EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2631
+				EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2632 2632
 			} else {
2633 2633
 				//all is good let's do a success message
2634
-				if ( $message_type ) {
2635
-					EE_Error::add_success( sprintf( __('%s message type has been successfully activated with the %s messenger', 'event_espresso'),ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2634
+				if ($message_type) {
2635
+					EE_Error::add_success(sprintf(__('%s message type has been successfully activated with the %s messenger', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2636 2636
 
2637 2637
 					//if message type was invoice then let's make sure we activate the invoice payment method.
2638
-					if ( $message_type == 'invoice' ) {
2639
-						EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2640
-						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
2641
-						if ( $pm instanceof EE_Payment_Method ) {
2642
-							EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) );
2638
+					if ($message_type == 'invoice') {
2639
+						EE_Registry::instance()->load_lib('Payment_Method_Manager');
2640
+						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
2641
+						if ($pm instanceof EE_Payment_Method) {
2642
+							EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso'));
2643 2643
 						}
2644 2644
 					}
2645 2645
 				} else {
2646
-					EE_Error::add_success( sprintf( __('%s messenger has been successfully activated', 'event_espresso'), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2646
+					EE_Error::add_success(sprintf(__('%s messenger has been successfully activated', 'event_espresso'), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2647 2647
 				}
2648 2648
 			}
2649 2649
 
@@ -2659,36 +2659,36 @@  discard block
 block discarded – undo
2659 2659
 			$update_array = array(
2660 2660
 				'MTP_messenger' => $messenger);
2661 2661
 
2662
-			if ( $message_type ) {
2662
+			if ($message_type) {
2663 2663
 				$update_array['MTP_message_type'] = $message_type;
2664 2664
 			}
2665 2665
 
2666
-			$success = $MTP->update( array( 'MTP_is_active' => 0 ), array($update_array) );
2666
+			$success = $MTP->update(array('MTP_is_active' => 0), array($update_array));
2667 2667
 
2668 2668
 			$messenger_obj = $this->_active_messengers[$messenger]['obj'];
2669 2669
 
2670 2670
 			//if this is a message type deactivation then we're only unsetting the message type otherwise unset the messenger
2671
-			if ( $message_type ) {
2672
-				unset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] );
2671
+			if ($message_type) {
2672
+				unset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type]);
2673 2673
 			} else {
2674
-				unset( $this->_active_messengers[$messenger] );
2674
+				unset($this->_active_messengers[$messenger]);
2675 2675
 			}
2676 2676
 
2677
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2677
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2678 2678
 			EE_Error::overwrite_success();
2679
-			if ( $message_type ) {
2680
-				EE_Error::add_success( sprintf( __('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular']) ) );
2679
+			if ($message_type) {
2680
+				EE_Error::add_success(sprintf(__('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular'])));
2681 2681
 			} else {
2682
-				EE_Error::add_success( sprintf( __('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'] ) ) );
2682
+				EE_Error::add_success(sprintf(__('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'])));
2683 2683
 			}
2684 2684
 
2685 2685
 			//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
2686
-			if ( $messenger == 'html'  || $message_type == 'invoice') {
2687
-				EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2688
-				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
2689
-				if ( $count_updated > 0 ) {
2690
-					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' );
2691
-					EE_Error::add_attention( $msg );
2686
+			if ($messenger == 'html' || $message_type == 'invoice') {
2687
+				EE_Registry::instance()->load_lib('Payment_Method_Manager');
2688
+				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
2689
+				if ($count_updated > 0) {
2690
+					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso');
2691
+					EE_Error::add_attention($msg);
2692 2692
 				}
2693 2693
 			}
2694 2694
 
@@ -2705,8 +2705,8 @@  discard block
 block discarded – undo
2705 2705
 	 * @return string html data
2706 2706
 	 */
2707 2707
 	public function update_mt_form() {
2708
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
2709
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
2708
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
2709
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
2710 2710
 			$this->_return_json();
2711 2711
 		}
2712 2712
 
@@ -2715,7 +2715,7 @@  discard block
 block discarded – undo
2715 2715
 		$message_type = $message_types[$this->_req_data['message_type']]['obj'];
2716 2716
 		$messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
2717 2717
 
2718
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, TRUE, TRUE );
2718
+		$content = $this->_message_type_settings_content($message_type, $messenger, TRUE, TRUE);
2719 2719
 		$this->_template_args['success'] = true;
2720 2720
 		$this->_template_args['content'] = $content;
2721 2721
 		$this->_return_json();
@@ -2729,36 +2729,36 @@  discard block
 block discarded – undo
2729 2729
 	 * @return json success or fail message
2730 2730
 	 */
2731 2731
 	public function save_settings() {
2732
-		if ( !isset( $this->_req_data['type'] ) ) {
2733
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2732
+		if ( ! isset($this->_req_data['type'])) {
2733
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2734 2734
 			$this->_template_args['error'] = TRUE;
2735 2735
 			$this->_return_json();
2736 2736
 		}
2737 2737
 
2738 2738
 
2739
-		if ( $this->_req_data['type'] == 'messenger' ) {
2739
+		if ($this->_req_data['type'] == 'messenger') {
2740 2740
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
2741 2741
 			$messenger = $settings['messenger'];
2742 2742
 			//let's setup the settings data
2743
-			foreach ( $settings as $key => $value ) {
2744
-				switch ( $key ) {
2743
+			foreach ($settings as $key => $value) {
2744
+				switch ($key) {
2745 2745
 					case 'messenger' :
2746
-						unset( $settings['messenger'] );
2746
+						unset($settings['messenger']);
2747 2747
 						break;
2748 2748
 					case 'message_types' :
2749
-						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2750
-							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2751
-								if ( isset( $settings['message_types'][$mt] ) )
2752
-									$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2749
+						if (isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'])) {
2750
+							foreach ($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'] as $mt => $v) {
2751
+								if (isset($settings['message_types'][$mt]))
2752
+									$settings[$messenger.'-message_types'][$mt]['settings'] = isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) ? $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt] : array();
2753 2753
 							}
2754 2754
 						} else {
2755
-							foreach ( $value as $mt => $v ) {
2755
+							foreach ($value as $mt => $v) {
2756 2756
 								//let's see if this message type is already present and has settings.
2757
-								$settings[$messenger . '-message_types'][$mt]['settings'] = array();
2757
+								$settings[$messenger.'-message_types'][$mt]['settings'] = array();
2758 2758
 							}
2759 2759
 						}
2760 2760
 						//k settings are set let's get rid of the message types index
2761
-						unset( $settings['message_types'] );
2761
+						unset($settings['message_types']);
2762 2762
 						break;
2763 2763
 					default :
2764 2764
 						$settings[$key] = $value;
@@ -2768,36 +2768,36 @@  discard block
 block discarded – undo
2768 2768
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2769 2769
 		}
2770 2770
 
2771
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2771
+		else if ($this->_req_data['type'] == 'message_type') {
2772 2772
 			$settings = $this->_req_data['message_type_settings'];
2773 2773
 			$messenger = $settings['messenger'];
2774 2774
 			$message_type = $settings['message_type'];
2775 2775
 
2776
-			foreach ( $settings as $key => $value ) {
2777
-				switch ( $key ) {
2776
+			foreach ($settings as $key => $value) {
2777
+				switch ($key) {
2778 2778
 					case 'messenger' :
2779
-						unset( $settings['messenger'] );
2779
+						unset($settings['messenger']);
2780 2780
 						break;
2781 2781
 					case 'message_type' :
2782
-						unset( $settings['message_type'] );
2782
+						unset($settings['message_type']);
2783 2783
 						break;
2784 2784
 					default :
2785 2785
 						$settings['settings'][$key] = $value;
2786
-						unset( $settings[$key] );
2786
+						unset($settings[$key]);
2787 2787
 						break;
2788 2788
 				}
2789 2789
 			}
2790 2790
 
2791
-			$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] = $settings;
2791
+			$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type] = $settings;
2792 2792
 		}
2793 2793
 
2794 2794
 		//okay we should have the data all setup.  Now we just update!
2795
-		$success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2795
+		$success = EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2796 2796
 
2797
-		if ( $success ) {
2798
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
2797
+		if ($success) {
2798
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
2799 2799
 		} else {
2800
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2800
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2801 2801
 		}
2802 2802
 
2803 2803
 		$this->_template_args['success'] = $success;
Please login to merge, or discard this patch.
core/db_models/EEM_Answer.model.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -125,14 +125,14 @@
 block discarded – undo
125 125
 	public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){
126 126
 		$field_name = NULL;
127 127
 		$value = NULL;
128
-                //backward compat: we still want to find the question's ID
129
-                if( is_numeric( $question_system_id ) ) {
130
-                    //find this question's QST_system value
131
-                    $question_id = $question_system_id;
132
-                    $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' );
133
-                } else {
134
-                    $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) );
135
-                }
128
+				//backward compat: we still want to find the question's ID
129
+				if( is_numeric( $question_system_id ) ) {
130
+					//find this question's QST_system value
131
+					$question_id = $question_system_id;
132
+					$question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' );
133
+				} else {
134
+					$question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) );
135
+				}
136 136
 		//only bother checking if the registration has an attendee
137 137
 		if( $registration->attendee() instanceof EE_Attendee ) {
138 138
 			$field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id );
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -51,18 +51,18 @@  discard block
 block discarded – undo
51 51
 	/**
52 52
 	 * 	constructor
53 53
 	 */
54
-	protected function __construct( $timezone = NULL ){
55
-		$this->singular_item = __('Answer','event_espresso');
56
-		$this->plural_item = __('Answers','event_espresso');
54
+	protected function __construct($timezone = NULL) {
55
+		$this->singular_item = __('Answer', 'event_espresso');
56
+		$this->plural_item = __('Answers', 'event_espresso');
57 57
 		$this->_tables = array(
58 58
 			'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID')
59 59
 		);
60 60
 		$this->_fields = array(
61 61
 			'Answer'=>array(
62
-				'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')),
63
-				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'),
64
-				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'),
65
-				'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value','event_espresso'), false, '')
62
+				'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')),
63
+				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'),
64
+				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
65
+				'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '')
66 66
 			));
67 67
 		$this->_model_relations = array(
68 68
 			'Registration'=>new EE_Belongs_To_Relation(),
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		);
71 71
 		$this->_model_chain_to_wp_user = 'Registration.Event';
72 72
 		$this->_caps_slug = 'registrations';
73
-		parent::__construct( $timezone );
73
+		parent::__construct($timezone);
74 74
 	}
75 75
 
76 76
 
@@ -83,19 +83,19 @@  discard block
 block discarded – undo
83 83
 	 * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value'
84 84
 	 * @return string
85 85
 	 */
86
-	public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){
87
-		$value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer );
88
-		if (  $value === NULL ){
89
-			$answer_obj = $this->get_registration_question_answer_object( $registration, $question_id, $pretty_answer );
90
-			if( $answer_obj instanceof EE_Answer ){
91
-				if($pretty_answer){
86
+	public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) {
87
+		$value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer);
88
+		if ($value === NULL) {
89
+			$answer_obj = $this->get_registration_question_answer_object($registration, $question_id, $pretty_answer);
90
+			if ($answer_obj instanceof EE_Answer) {
91
+				if ($pretty_answer) {
92 92
 					$value = $answer_obj->pretty_value();
93
-				}else{
93
+				} else {
94 94
 					$value = $answer_obj->value();
95 95
 				}
96 96
 			}
97 97
 		}
98
-		return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id );
98
+		return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id);
99 99
 	}
100 100
 
101 101
 
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 	 * @param int $question_id
107 107
 	 * @return EE_Answer
108 108
 	 */
109
-	public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){
110
-		$answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() )));
111
-		return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id );
109
+	public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) {
110
+		$answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID())));
111
+		return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id);
112 112
 	}
113 113
 
114 114
 
@@ -122,39 +122,39 @@  discard block
 block discarded – undo
122 122
 	 * @return string|null (if the registration has no attendee, or the question_system_id is not a QST_ID or QST_system for 
123 123
 	 * a question corresponding to an attendee field, returns null)
124 124
 	 */
125
-	public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){
125
+	public function get_attendee_property_answer_value(EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE) {
126 126
 		$field_name = NULL;
127 127
 		$value = NULL;
128 128
                 //backward compat: we still want to find the question's ID
129
-                if( is_numeric( $question_system_id ) ) {
129
+                if (is_numeric($question_system_id)) {
130 130
                     //find this question's QST_system value
131 131
                     $question_id = $question_system_id;
132
-                    $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' );
132
+                    $question_system_id = EEM_Question::instance()->get_var(array(array('QST_ID' => $question_system_id)), 'QST_system');
133 133
                 } else {
134
-                    $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) );
134
+                    $question_id = intval(EEM_Question::instance()->get_var(array(array('QST_system' => $question_system_id)), 'QST_ID'));
135 135
                 }
136 136
 		//only bother checking if the registration has an attendee
137
-		if( $registration->attendee() instanceof EE_Attendee ) {
138
-			$field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id );
139
-			if( $field_name ) {
140
-				if( $pretty_answer ) {
141
-					if( $field_name == 'STA_ID' ) {
137
+		if ($registration->attendee() instanceof EE_Attendee) {
138
+			$field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question($question_system_id);
139
+			if ($field_name) {
140
+				if ($pretty_answer) {
141
+					if ($field_name == 'STA_ID') {
142 142
 						$state = $registration->attendee()->state_obj();
143
-						$value = $state instanceof EE_State ? $state->name() : sprintf( __('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID() );
144
-					} else if($field_name == 'CNT_ISO') {
143
+						$value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID());
144
+					} else if ($field_name == 'CNT_ISO') {
145 145
 						$country = $registration->attendee()->country_obj();
146
-						$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID());
146
+						$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID());
147 147
 					} else {
148
-						$value = $registration->attendee()->get_pretty( $field_name );
148
+						$value = $registration->attendee()->get_pretty($field_name);
149 149
 					}
150 150
 					//if field name is blank, leave the value as null too
151
-				}else{
152
-					$value = $registration->attendee()->get( $field_name );
151
+				} else {
152
+					$value = $registration->attendee()->get($field_name);
153 153
 				}
154 154
 			}
155 155
 			//if no field was found, leave value blank
156 156
 		}
157
-		return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id );
157
+		return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id);
158 158
 	}
159 159
 
160 160
 
Please login to merge, or discard this patch.
core/db_models/EEM_Term_Taxonomy.model.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
24
+require_once (EE_MODELS.'EEM_Base.model.php');
25 25
 
26 26
 class EEM_Term_Taxonomy extends EEM_Base {
27 27
 
@@ -29,67 +29,67 @@  discard block
 block discarded – undo
29 29
 	protected static $_instance = NULL;
30 30
 
31 31
 
32
-	protected function __construct( $timezone = NULL ) {
33
-		$this->singular_item = __('Term Taxonomy','event_espresso');
34
-		$this->plural_item = __('Term Taxonomy','event_espresso');
32
+	protected function __construct($timezone = NULL) {
33
+		$this->singular_item = __('Term Taxonomy', 'event_espresso');
34
+		$this->plural_item = __('Term Taxonomy', 'event_espresso');
35 35
 		$this->_tables = array(
36 36
 			'Term_Taxonomy'=> new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id')
37 37
 		);
38 38
 		$this->_fields = array(
39 39
 			'Term_Taxonomy'=>array(
40
-				'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID','event_espresso')),
41
-				'term_id'=>new EE_Foreign_Key_Int_Field('term_id',  __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
42
-				'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name','event_espresso'), false, 'category'),
43
-				'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false,''),
44
-				'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false,0),
40
+				'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID', 'event_espresso')),
41
+				'term_id'=>new EE_Foreign_Key_Int_Field('term_id', __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
42
+				'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name', 'event_espresso'), false, 'category'),
43
+				'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false, ''),
44
+				'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false, 0),
45 45
 				'term_count'=> new EE_Integer_Field('count', __("Count of Objects attached", 'event_espresso'), false, 0)
46 46
 			));
47 47
 		$this->_model_relations = array(
48 48
 			'Term_Relationship'=>new EE_Has_Many_Relation(),
49 49
 			'Term'=>new EE_Belongs_To_Relation(),
50 50
 		);
51
-		$cpt_models = array_keys( EE_Registry::instance()->cpt_models() );
52
-		foreach( $cpt_models  as $model_name ) {
53
-			$this->_model_relations[ $model_name ] = new EE_HABTM_Relation( 'Term_Relationship' );
51
+		$cpt_models = array_keys(EE_Registry::instance()->cpt_models());
52
+		foreach ($cpt_models  as $model_name) {
53
+			$this->_model_relations[$model_name] = new EE_HABTM_Relation('Term_Relationship');
54 54
 		}
55 55
 		$this->_indexes = array(
56
-			'term_id_taxonomy'=>new EE_Unique_Index(array('term_id','taxonomy'))
56
+			'term_id_taxonomy'=>new EE_Unique_Index(array('term_id', 'taxonomy'))
57 57
 		);
58 58
 		$path_to_tax_model = '';
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( $path_to_tax_model );
61
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
62
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
59
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
60
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected($path_to_tax_model);
61
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = false;
62
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = false;
63 63
 
64 64
 		//add cap restrictions for editing relating to the "ee_edit_*"
65
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
65
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
66 66
 				array(
67
-					$path_to_tax_model . 'taxonomy*ee_edit_event_category' => array( '!=', 'espresso_event_categories' )
67
+					$path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories')
68 68
 				));
69
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
69
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
70 70
 				array(
71
-					$path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array( '!=', 'espresso_venue_categories' )
71
+					$path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories')
72 72
 				));
73
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
73
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
74 74
 				array(
75
-					$path_to_tax_model . 'taxonomy*ee_edit_event_type' => array( '!=', 'espresso_event_type' )
75
+					$path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type')
76 76
 				));
77 77
 
78 78
 		//add cap restrictions for deleting relating to the "ee_deleting_*"
79
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
79
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
80 80
 				array(
81
-					$path_to_tax_model . 'taxonomy*ee_delete_event_category' => array( '!=', 'espresso_event_categories' )
81
+					$path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories')
82 82
 				));
83
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
83
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
84 84
 				array(
85
-					$path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array( '!=', 'espresso_venue_categories' )
85
+					$path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories')
86 86
 				));
87
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
87
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
88 88
 				array(
89
-					$path_to_tax_model . 'taxonomy*ee_delete_event_type' => array( '!=', 'espresso_event_type' )
89
+					$path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type')
90 90
 				));
91 91
 
92
-		parent::__construct( $timezone );
92
+		parent::__construct($timezone);
93 93
 	}
94 94
 
95 95
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.