Completed
Branch BUG-9647-cpt-queries (303307)
by
unknown
1231:16 queued 1214:43
created
core/db_models/EEM_Attendee.model.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 
4 4
 /**
5 5
  *
@@ -21,60 +21,60 @@  discard block
 block discarded – undo
21 21
 	 * Please instead use the EEM_Attendee::system_question_* constants
22 22
 	 * @deprecated
23 23
 	 */
24
-	const fname_question_id=1;
24
+	const fname_question_id = 1;
25 25
 
26 26
 	/**
27 27
 	 * @deprecated
28 28
 	 */
29
-	const lname_question_id=2;
29
+	const lname_question_id = 2;
30 30
 
31 31
 
32 32
 	/**
33 33
 	 * @deprecated
34 34
 	 */
35
-	const email_question_id=3;
35
+	const email_question_id = 3;
36 36
 
37 37
 
38 38
 	/**
39 39
 	 * @deprecated
40 40
 	 */
41
-	const address_question_id=4;
41
+	const address_question_id = 4;
42 42
 
43 43
 
44 44
 	/**
45 45
 	 * @deprecated
46 46
 	 */
47
-	const address2_question_id=5;
47
+	const address2_question_id = 5;
48 48
 
49 49
 
50 50
 	/**
51 51
 	 * @deprecated
52 52
 	 */
53
-	const city_question_id=6;
53
+	const city_question_id = 6;
54 54
 
55 55
 
56 56
 	/**
57 57
 	 * @deprecated
58 58
 	 */
59
-	const state_question_id=7;
59
+	const state_question_id = 7;
60 60
 
61 61
 
62 62
 	/**
63 63
 	 * @deprecated
64 64
 	 */
65
-	const country_question_id=8;
65
+	const country_question_id = 8;
66 66
 
67 67
 
68 68
 	/**
69 69
 	 * @deprecated
70 70
 	 */
71
-	const zip_question_id=9;
71
+	const zip_question_id = 9;
72 72
 
73 73
 
74 74
 	/**
75 75
 	 * @deprecated
76 76
 	 */
77
-	const phone_question_id=10;
77
+	const phone_question_id = 10;
78 78
 
79 79
 	/**
80 80
 	 * When looking for questions that correspond to attendee fields,
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 	 * @access protected
120 120
 	 * @param null $timezone
121 121
 	 */
122
-	protected function __construct( $timezone = NULL ) {
123
-		$this->singular_item = __('Attendee','event_espresso');
124
-		$this->plural_item = __('Attendees','event_espresso');
122
+	protected function __construct($timezone = NULL) {
123
+		$this->singular_item = __('Attendee', 'event_espresso');
124
+		$this->plural_item = __('Attendees', 'event_espresso');
125 125
 		$this->_tables = array(
126 126
 			'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'),
127 127
 			'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID')
@@ -135,37 +135,37 @@  discard block
 block discarded – undo
135 135
 				'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, time()),
136 136
 				'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")),
137 137
 				'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, time()),
138
-				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ),
138
+				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false),
139 139
 				'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0),
140
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'),// EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
140
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'), // EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
141 141
 				'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish')
142 142
 			),
143 143
 			'Attendee_Meta'=>array(
144
-				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false),
144
+				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false),
145 145
 				'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false),
146
-				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''),
147
-				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''),
148
-				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''),
149
-				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''),
150
-				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''),
151
-				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'),
152
-				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'),
153
-				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''),
154
-				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''),
155
-				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '')
146
+				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''),
147
+				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''),
148
+				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''),
149
+				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''),
150
+				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''),
151
+				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'),
152
+				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'),
153
+				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''),
154
+				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''),
155
+				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '')
156 156
 			));
157 157
 		$this->_model_relations = array(
158 158
 			'Registration'=>new EE_Has_Many_Relation(),
159 159
 			'State'=>new EE_Belongs_To_Relation(),
160 160
 			'Country'=>new EE_Belongs_To_Relation(),
161
-			'Event'=>new EE_HABTM_Relation('Registration', FALSE ),
161
+			'Event'=>new EE_HABTM_Relation('Registration', FALSE),
162 162
 			'WP_User' => new EE_Belongs_To_Relation(),
163
-			'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletion of attendees even if they have messages in the queue for them.
163
+			'Message' => new EE_Has_Many_Any_Relation(false) //allow deletion of attendees even if they have messages in the queue for them.
164 164
 		);
165 165
 		require_once('strategies/EE_CPT_Where_Conditions.strategy.php');
166 166
 		$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_attendees', 'ATTM_ID');
167 167
 		$this->_caps_slug = 'contacts';
168
-		parent::__construct( $timezone );
168
+		parent::__construct($timezone);
169 169
 
170 170
 	}
171 171
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @param string $system_question_string
176 176
 	 * @return string|null if not found
177 177
 	 */
178
-	public function get_attendee_field_for_system_question( $system_question_string ) {
179
-		return isset( $this->_system_question_to_attendee_field_name[ $system_question_string ] ) ? $this->_system_question_to_attendee_field_name[ $system_question_string ] : null;
178
+	public function get_attendee_field_for_system_question($system_question_string) {
179
+		return isset($this->_system_question_to_attendee_field_name[$system_question_string]) ? $this->_system_question_to_attendee_field_name[$system_question_string] : null;
180 180
 	}
181 181
 
182 182
 
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID
188 188
 	 * @return EE_Attendee[]
189 189
 	 */
190
-	public function get_attendees_for_transaction( $transaction_id_or_obj ){
191
-		return $this->get_all( array( array(
190
+	public function get_attendees_for_transaction($transaction_id_or_obj) {
191
+		return $this->get_all(array(array(
192 192
 			  'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj
193 193
 		  )));
194 194
 	}
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
 	*		@return 		mixed		array on success, FALSE on fail
204 204
 	 * 		@deprecated
205 205
 	*/
206
-	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
206
+	public function get_attendee_by_ID($ATT_ID = FALSE) {
207 207
 		// retrieve a particular EE_Attendee
208
-		return $this->get_one_by_ID( $ATT_ID );
208
+		return $this->get_one_by_ID($ATT_ID);
209 209
 	}
210 210
 
211 211
 
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 	* 		@param		array $where_cols_n_values
219 219
 	*		@return 		mixed		array on success, FALSE on fail
220 220
 	*/
221
-	public function get_attendee( $where_cols_n_values = array() ) {
221
+	public function get_attendee($where_cols_n_values = array()) {
222 222
 
223
-		if ( empty( $where_cols_n_values )) {
223
+		if (empty($where_cols_n_values)) {
224 224
 			return FALSE;
225 225
 		}
226
-		$attendee = $this->get_all( array($where_cols_n_values ));
227
-		if ( ! empty( $attendee )) {
228
-			return array_shift( $attendee );
226
+		$attendee = $this->get_all(array($where_cols_n_values));
227
+		if ( ! empty($attendee)) {
228
+			return array_shift($attendee);
229 229
 		} else {
230 230
 			return FALSE;
231 231
 		}
@@ -241,20 +241,20 @@  discard block
 block discarded – undo
241 241
 	 * @param array $where_cols_n_values
242 242
 	 * @return bool|mixed
243 243
 	 */
244
-	public function find_existing_attendee( $where_cols_n_values = NULL ) {
244
+	public function find_existing_attendee($where_cols_n_values = NULL) {
245 245
 		// search by combo of first and last names plus the email address
246
-		$attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email );
246
+		$attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email);
247 247
 		// no search params means attendee object already exists.
248
-		$where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys;
248
+		$where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys;
249 249
 		$valid_data = TRUE;
250 250
 		// check for required values
251
-		$valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE;
252
-		$valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE;
253
-		$valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE;
251
+		$valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE;
252
+		$valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE;
253
+		$valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE;
254 254
 
255
-		if ( $valid_data ) {
256
-			$attendee = $this->get_attendee( $where_cols_n_values );
257
-			if ( $attendee instanceof EE_Attendee ) {
255
+		if ($valid_data) {
256
+			$attendee = $this->get_attendee($where_cols_n_values);
257
+			if ($attendee instanceof EE_Attendee) {
258 258
 				return $attendee;
259 259
 			}
260 260
 		}
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
              * @param  array $ids array of EE_Registration ids
273 273
              * @return  EE_Attendee[]
274 274
              */
275
-            public function get_array_of_contacts_from_reg_ids( $ids ) {
275
+            public function get_array_of_contacts_from_reg_ids($ids) {
276 276
                 $ids = (array) $ids;
277 277
                 $_where = array(
278
-                    'Registration.REG_ID' => array( 'in', $ids )
278
+                    'Registration.REG_ID' => array('in', $ids)
279 279
                     );
280
-                return $this->get_all( array( $_where ) );
280
+                return $this->get_all(array($_where));
281 281
             }
282 282
 
283 283
 
Please login to merge, or discard this patch.
admin/extend/messages/espresso_events_Messages_Hooks_Extend.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
 	 *
96 96
 	 * @param  EE_Event $event 	EE event object
97 97
 	 * @param  array    $data   The request data from the form
98
-	 * @return bool     		success or fail
98
+	 * @return integer     		success or fail
99 99
 	 */
100 100
 	public function attach_evt_message_templates( $event, $data ) {
101 101
 		//first we remove all existing relations on the Event for message types.
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @param \EE_Admin_Page $admin_page
24 24
 	 */
25
-	public function __construct( EE_Admin_Page $admin_page ) {
25
+	public function __construct(EE_Admin_Page $admin_page) {
26 26
 		/**
27 27
 		 * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages
28 28
 		 */
29 29
 		if (
30
-			! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' )
30
+			! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')
31 31
 		) {
32 32
 			return;
33 33
 		}
34 34
 		add_filter(
35 35
 			'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
36
-			array( $this, 'caf_updates' ),
36
+			array($this, 'caf_updates'),
37 37
 			10
38 38
 		);
39
-		parent::__construct( $admin_page );
39
+		parent::__construct($admin_page);
40 40
 	}
41 41
 
42 42
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function _extend_properties() {
51 51
 
52
-		define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' );
52
+		define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/');
53 53
 		$this->_ajax_func = array(
54 54
 			'ee_msgs_create_new_custom' => 'create_new_custom'
55 55
 			);
56 56
 		$this->_metaboxes = array(
57 57
 			0 => array(
58
-				'page_route' => array('edit','create_new'),
58
+				'page_route' => array('edit', 'create_new'),
59 59
 				'func' => 'messages_metabox',
60 60
 				'label' => __('Notifications', 'event_espresso'),
61 61
 				'priority' => 'high'
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 		$this->_scripts_styles = array(
67 67
 			'registers' => array(
68 68
 				'events_msg_admin' => array(
69
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js',
69
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js',
70 70
 					'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array')
71 71
 				),
72 72
 				'events_msg_admin_css' => array(
73
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css',
73
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css',
74 74
 					'type' => 'css'
75 75
 				)
76 76
 			),
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 
85
-	public function caf_updates( $update_callbacks ) {
86
-		$update_callbacks[] = array( $this, 'attach_evt_message_templates' );
85
+	public function caf_updates($update_callbacks) {
86
+		$update_callbacks[] = array($this, 'attach_evt_message_templates');
87 87
 		return $update_callbacks;
88 88
 	}
89 89
 
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 	 * @param  array    $data   The request data from the form
98 98
 	 * @return bool     		success or fail
99 99
 	 */
100
-	public function attach_evt_message_templates( $event, $data ) {
100
+	public function attach_evt_message_templates($event, $data) {
101 101
 		//first we remove all existing relations on the Event for message types.
102 102
 		$event->_remove_relations('Message_Template_Group');
103 103
 		//now let's just loop through the selected templates and add relations!
104
-		if ( isset( $data[ 'event_message_templates_relation' ] ) ) {
105
-			foreach ( $data[ 'event_message_templates_relation' ] as $grp_ID ) {
106
-				$event->_add_relation_to( $grp_ID, 'Message_Template_Group' );
104
+		if (isset($data['event_message_templates_relation'])) {
105
+			foreach ($data['event_message_templates_relation'] as $grp_ID) {
106
+				$event->_add_relation_to($grp_ID, 'Message_Template_Group');
107 107
 			}
108 108
 		}
109 109
 		//now save
@@ -118,25 +118,25 @@  discard block
 block discarded – undo
118 118
 	 * @return string
119 119
 	 * @throws \EE_Error
120 120
 	 */
121
-	public function messages_metabox( $event, $callback_args ) {
121
+	public function messages_metabox($event, $callback_args) {
122 122
 		//let's get the active messengers (b/c messenger objects have the active message templates)
123 123
 		//convert 'evt_id' to 'EVT_ID'
124
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL;
125
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] )
124
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
125
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID'])
126 126
 			? $this->_req_data['post']
127 127
 			: $this->_req_data['EVT_ID'];
128 128
 
129
-		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] )
129
+		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id'])
130 130
 			? $this->_req_data['evt_id']
131 131
 			: $this->_req_data['EVT_ID'];
132 132
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
133
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
133
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
134 134
 		$active_messengers = $message_resource_manager->active_messengers();
135 135
 		$tabs = array();
136 136
 
137 137
 		//empty messengers?
138 138
 		//Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected.
139
-		if ( empty( $active_messengers ) ) {
139
+		if (empty($active_messengers)) {
140 140
 			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(
141 141
 				array('action' => 'settings'),
142 142
 				EE_MSG_ADMIN_URL
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
 				__('There are no active messengers. So no notifications will go out for %1$sany%2$s events.  You will want to %3$sActivate a Messenger%4$s.', 'event_espresso'),
146 146
 				'<strong>',
147 147
 				'</strong>',
148
-				'<a href="' . $msg_activate_url . '">',
148
+				'<a href="'.$msg_activate_url.'">',
149 149
 				'</a>'
150 150
 			);
151
-			$error_content = '<div class="error"><p>' . $error_msg . '</p></div>';
152
-			$internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>';
151
+			$error_content = '<div class="error"><p>'.$error_msg.'</p></div>';
152
+			$internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>';
153 153
 
154 154
 			echo $error_content;
155 155
 			echo $internal_content;
@@ -158,20 +158,20 @@  discard block
 block discarded – undo
158 158
 
159 159
 		$event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
160 160
 		//get content for active messengers
161
-		foreach ( $active_messengers as $name => $messenger ) {
161
+		foreach ($active_messengers as $name => $messenger) {
162 162
 			//first check if there are any active message types for this messenger.
163
-			$active_mts = $message_resource_manager->get_active_message_types_for_messenger( $name );
164
-			if ( empty( $active_mts ) ) {
163
+			$active_mts = $message_resource_manager->get_active_message_types_for_messenger($name);
164
+			if (empty($active_mts)) {
165 165
 				continue;
166 166
 			}
167 167
 
168 168
 			$tab_content = $messenger->get_messenger_admin_page_content(
169 169
 				'events',
170 170
 				'edit',
171
-				array( 'event' => $event_id )
171
+				array('event' => $event_id)
172 172
 			);
173 173
 
174
-			if ( ! empty( $tab_content ) ) {
174
+			if ( ! empty($tab_content)) {
175 175
 				$tabs[$name] = $tab_content;
176 176
 			}
177 177
 		}
@@ -179,23 +179,23 @@  discard block
 block discarded – undo
179 179
 
180 180
 		//we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper.
181 181
 		$tabbed_content = EEH_Tabbed_Content::display($tabs);
182
-		if ( $tabbed_content instanceof WP_Error ) {
182
+		if ($tabbed_content instanceof WP_Error) {
183 183
 			$tabbed_content = $tabbed_content->get_error_message();
184 184
 		}
185 185
 
186 186
 		$notices = '
187 187
 	<div id="espresso-ajax-loading" class="ajax-loader-grey">
188
-		<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span>
188
+		<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span>
189 189
 	</div>
190 190
 	<div class="ee-notices"></div>';
191 191
 
192
-		if ( defined('DOING_AJAX' ) ) {
192
+		if (defined('DOING_AJAX')) {
193 193
 			return $tabbed_content;
194 194
 		}
195 195
 
196
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content' );
197
-		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
198
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content' );
196
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content');
197
+		echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>';
198
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content');
199 199
 
200 200
 	}
201 201
 
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public function create_new_custom() {
212 212
 
213
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) {
214
-			wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) );
213
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) {
214
+			wp_die(__('You don\'t have privileges to do this action', 'event_espresso'));
215 215
 		}
216 216
 
217 217
 		//let's clean up the _POST global a bit for downstream usage of name and description.
218
-		$_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] )
218
+		$_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name'])
219 219
 			? $this->_req_data['custom_template_args']['MTP_name']
220 220
 			: '';
221
-		$_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] )
221
+		$_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description'])
222 222
 			? $this->_req_data['custom_template_args']['MTP_description']
223 223
 			: '';
224 224
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$this->_set_page_object();
228 228
 
229 229
 		// is this a template switch if so EE_Admin_Page child needs this object
230
-		$this->_page_object->set_hook_object( $this );
230
+		$this->_page_object->set_hook_object($this);
231 231
 
232 232
 		$this->_page_object->add_message_template(
233 233
 			$this->_req_data['messageType'],
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	public function edit_admin_footer() {
253 253
 		EEH_Template::display_template(
254
-			EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php'
254
+			EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php'
255 255
 		);
256 256
 	}
257 257
 
Please login to merge, or discard this patch.
core/admin/EE_Admin_List_Table.core.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -594,7 +594,7 @@
 block discarded – undo
594 594
 	 * @since 4.1
595 595
 	 * @access public
596 596
 	 *
597
-	 * @param object $item The current item
597
+	 * @param EE_Message_Template_Group $item The current item
598 598
 	 */
599 599
 	public function single_row( $item ) {
600 600
 		$row_class = $this->_get_row_class( $item );
Please login to merge, or discard this patch.
core/db_models/EEM_Message_Template_Group.model.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param        $messenger
85 85
 	 * @param string $orderby
86 86
 	 * @param string $order
87
-	 * @return array all (including trashed or inactive) message template group objects for the given messenger
87
+	 * @return EE_Base_Class[] all (including trashed or inactive) message template group objects for the given messenger
88 88
 	 */
89 89
 	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC' ) {
90 90
 		return $this->get_all_deleted_and_undeleted(
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	/**
344 344
 	 * This sends things to the validator for the given messenger and message type.
345 345
 	 *
346
-	 * @param  array $fields the incoming fields to check.
346
+	 * @param  string $fields the incoming fields to check.
347 347
 	 *                       Note this array is in the formatted fields from the form fields setup.
348 348
 	 *                       So we need to reformat this into an array of expected field refs by the validator.
349 349
 	 *                       Note also that this is not only the fields for the Message Template Group
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION') )
2 2
 	exit('NO direct script access allowed');
3 3
 /**
4
- * EEM_Message_Template_Group
5
- *
6
- * @package		Event Espresso
7
- * @subpackage	includes/models/EEM_Message_Template_Group.model.php
8
- * @author		Darren Ethier
9
- *
10
- *
11
- */
4
+	 * EEM_Message_Template_Group
5
+	 *
6
+	 * @package		Event Espresso
7
+	 * @subpackage	includes/models/EEM_Message_Template_Group.model.php
8
+	 * @author		Darren Ethier
9
+	 *
10
+	 *
11
+	 */
12 12
 require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
13 13
 class EEM_Message_Template_Group extends EEM_Soft_Delete_Base {
14 14
 
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 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
  * EEM_Message_Template_Group
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  *
10 10
  *
11 11
  */
12
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
12
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
13 13
 class EEM_Message_Template_Group extends EEM_Soft_Delete_Base {
14 14
 
15 15
 	// private instance of the EEM_Message_Template_Group object
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 
19 19
 
20
-	protected function __construct( $timezone = NULL ) {
20
+	protected function __construct($timezone = NULL) {
21 21
 		$this->singular_item = __('Message Template Group', 'event_espresso');
22 22
 		$this->plural_item = __('Message Template Groups', 'event_espresso');
23 23
 		$this->_tables = array(
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 		$this->_fields = array(
27 27
 			'Message_Template_Group' => array(
28 28
 				'GRP_ID' => new EE_Primary_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso')),
29
-				'MTP_name' => new EE_Plain_Text_Field( 'MTP_name', __('The name of the template group', 'event_espresso'), FALSE, '' ),
30
-				'MTP_description' => new EE_Simple_HTML_Field( 'MTP_description', __('A brief description about this template.', 'event_espresso' ), FALSE, '' ),
31
-				'MTP_user_id'=> new EE_WP_User_Field('MTP_user_id', __('Template Creator ID', 'event_espresso'), FALSE, get_current_user_id() ),
32
-				'MTP_messenger'=>new EE_Plain_Text_Field('MTP_messenger', __('Messenger Used for Template', 'event_espresso'), FALSE, 'email' ),
33
-				'MTP_message_type'=>new EE_Plain_Text_Field('MTP_message_type', __('Message Type', 'event_espresso'),false,'registration'),
29
+				'MTP_name' => new EE_Plain_Text_Field('MTP_name', __('The name of the template group', 'event_espresso'), FALSE, ''),
30
+				'MTP_description' => new EE_Simple_HTML_Field('MTP_description', __('A brief description about this template.', 'event_espresso'), FALSE, ''),
31
+				'MTP_user_id'=> new EE_WP_User_Field('MTP_user_id', __('Template Creator ID', 'event_espresso'), FALSE, get_current_user_id()),
32
+				'MTP_messenger'=>new EE_Plain_Text_Field('MTP_messenger', __('Messenger Used for Template', 'event_espresso'), FALSE, 'email'),
33
+				'MTP_message_type'=>new EE_Plain_Text_Field('MTP_message_type', __('Message Type', 'event_espresso'), false, 'registration'),
34 34
 				'MTP_is_global'=>new EE_Boolean_Field('MTP_is_global', __('Flag indicating if Template Group is Global', 'event_espresso'), false, true),
35 35
 				'MTP_is_override'=>new EE_Boolean_Field('MTP_is_override', __('Flag indicating if Template Group overrides any other Templates for the messenger/messagetype combination', 'event_espresso'), false, false),
36 36
 				'MTP_deleted'=>new EE_Trashed_Flag_Field('MTP_deleted', __('Flag indicating whether this has been trashed', 'event_espresso'), false, false),
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 			'Event' => new EE_HABTM_Relation('Event_Message_Template'),
44 44
 			'WP_User' => new EE_Belongs_To_Relation()
45 45
 		);
46
-		foreach( $this->_cap_contexts_to_cap_action_map as $context => $action ){
47
-			$this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_Global( 'MTP_is_global');
46
+		foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) {
47
+			$this->_cap_restriction_generators[$context] = new EE_Restriction_Generator_Global('MTP_is_global');
48 48
 		}
49 49
 		$this->_caps_slug = 'messages';
50 50
 
51
-		parent::__construct( $timezone );
51
+		parent::__construct($timezone);
52 52
 	}
53 53
 
54 54
 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 		$limit = null,
72 72
 		$count = false
73 73
 	) {
74
-		$query_params = array( array('Event.EVT_ID' => $EVT_ID), 'order_by' => array($orderby => $order), 'limit' => $limit );
75
-		return $count ? $this->count_deleted( $query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted( $query_params );
74
+		$query_params = array(array('Event.EVT_ID' => $EVT_ID), 'order_by' => array($orderby => $order), 'limit' => $limit);
75
+		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted($query_params);
76 76
 	}
77 77
 
78 78
 
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	 * @param string $order
87 87
 	 * @return array all (including trashed or inactive) message template group objects for the given messenger
88 88
 	 */
89
-	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC' ) {
89
+	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC') {
90 90
 		return $this->get_all_deleted_and_undeleted(
91
-			array( array( 'MTP_messenger' => $messenger ), 'order_by' => array( $orderby => $order ) )
91
+			array(array('MTP_messenger' => $messenger), 'order_by' => array($orderby => $order))
92 92
 		);
93 93
 	}
94 94
 
@@ -99,18 +99,18 @@  discard block
 block discarded – undo
99 99
 	 * @param  array  $_where any existing where conditions to append these to.
100 100
 	 * @return array          original where conditions or original with additional filters.
101 101
 	 */
102
-	protected function _maybe_mtp_filters( $_where = array() ) {
102
+	protected function _maybe_mtp_filters($_where = array()) {
103 103
 		//account for messenger or message type filters
104 104
 		if (
105
-			isset( $_REQUEST[ 'ee_messenger_filter_by' ] )
106
-			&& $_REQUEST[ 'ee_messenger_filter_by' ] != 'none_selected'
107
-			&& $_REQUEST[ 'ee_messenger_filter_by' ] != 'all'
105
+			isset($_REQUEST['ee_messenger_filter_by'])
106
+			&& $_REQUEST['ee_messenger_filter_by'] != 'none_selected'
107
+			&& $_REQUEST['ee_messenger_filter_by'] != 'all'
108 108
 		) {
109
-			$_where['MTP_messenger'] =  $_REQUEST['ee_messenger_filter_by'] ;
109
+			$_where['MTP_messenger'] = $_REQUEST['ee_messenger_filter_by'];
110 110
 		}
111 111
 
112 112
 		if (
113
-			isset( $_REQUEST['ee_message_type_filter_by'])
113
+			isset($_REQUEST['ee_message_type_filter_by'])
114 114
 			&& $_REQUEST['ee_message_type_filter_by'] != 'none_selected'
115 115
 		) {
116 116
 			$_where['MTP_message_type'] = $_REQUEST['ee_message_type_filter_by'];
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		$global = true,
142 142
 		$user_check = false
143 143
 	) {
144
-		$_where = $global ? array('MTP_is_global' => TRUE ) : array('MTP_is_global' => FALSE );
144
+		$_where = $global ? array('MTP_is_global' => TRUE) : array('MTP_is_global' => FALSE);
145 145
 		$_where['MTP_is_active'] = TRUE;
146 146
 		$_where = $this->_maybe_mtp_filters($_where);
147 147
 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 			$_where['MTP_user_id'] = get_current_user_id();
157 157
 		}
158 158
 
159
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
159
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
160 160
 
161
-		return $count ? $this->count($query_params, 'GRP_ID', TRUE ) : $this->get_all($query_params);
161
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
162 162
 	}
163 163
 
164 164
 
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
 	 * @param bool   $count
174 174
 	 * @return mixed array on success, FALSE on fail
175 175
 	 */
176
-	public function get_all_message_templates( $orderby = 'GRP_ID', $order = 'ASC', $limit = null, $count = false ) {
176
+	public function get_all_message_templates($orderby = 'GRP_ID', $order = 'ASC', $limit = null, $count = false) {
177 177
 		$_where = $this->_maybe_mtp_filters();
178 178
 
179
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
179
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
180 180
 
181 181
 		$r_templates = $count
182
-			? $this->count_deleted_and_undeleted($query_params, 'GRP_ID', TRUE )
183
-			: $this->get_all_deleted_and_undeleted( $query_params );
182
+			? $this->count_deleted_and_undeleted($query_params, 'GRP_ID', TRUE)
183
+			: $this->get_all_deleted_and_undeleted($query_params);
184 184
 
185 185
 		return $r_templates;
186 186
 	}
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 	 * @param  array  $query_params same as EEM_Base::get_all()
195 195
 	 * @return  EE_Message_Template_Group[]
196 196
 	 */
197
-	public function get_all_custom_templates_by_event( $EVT_ID, $query_params = array() ) {
198
-		$where = array_merge( $query_params, array( 'Event.EVT_ID' => $EVT_ID ) );
197
+	public function get_all_custom_templates_by_event($EVT_ID, $query_params = array()) {
198
+		$where = array_merge($query_params, array('Event.EVT_ID' => $EVT_ID));
199 199
 		return $this->get_all(
200
-			array( $where )
200
+			array($where)
201 201
 		);
202 202
 	}
203 203
 
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 		$count = false,
223 223
 		$global = true
224 224
 	) {
225
-		$_where = $global ? array('MTP_is_global' => TRUE ) : array('MTP_is_global' => FALSE );
225
+		$_where = $global ? array('MTP_is_global' => TRUE) : array('MTP_is_global' => FALSE);
226 226
 		$_where['MTP_is_active'] = TRUE;
227 227
 		$_where = $this->_maybe_mtp_filters($_where);
228 228
 
229
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
229
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
230 230
 
231
-		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted( $query_params );
231
+		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted($query_params);
232 232
 	}
233 233
 
234 234
 
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 			'MTP_is_active' => $active
265 265
 		);
266 266
 
267
-		$query_params = array( $_where, 'order_by' => array($orderby=>$order), 'limit' => $limit );
267
+		$query_params = array($_where, 'order_by' => array($orderby=>$order), 'limit' => $limit);
268 268
 
269
-		return $count ? $this->count($query_params, 'GRP_ID', TRUE ) : $this->get_all( $query_params );
269
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
270 270
 	}
271 271
 
272 272
 
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 			'MTP_is_global' => TRUE,
301 301
 		);
302 302
 
303
-		if ( $active != 'all' ) {
303
+		if ($active != 'all') {
304 304
 			$_where['MTP_is_active'] = $active;
305 305
 		}
306 306
 
307
-		$query_params = array( $_where, 'order_by' => array( $orderby => $order ), 'limit' => $limit );
307
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
308 308
 
309
-		return $count ? $this->count( $query_params, 'GRP_ID', TRUE ) : $this->get_all( $query_params );
309
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
310 310
 	}
311 311
 
312 312
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 * @param  array  $query_params same as EEM_Base->get_all()
320 320
 	 * @return EE_Message_Template_Group[]
321 321
 	 */
322
-	public function get_custom_message_template_by_m_and_mt( $messenger, $message_type, $query_params = array() ) {
322
+	public function get_custom_message_template_by_m_and_mt($messenger, $message_type, $query_params = array()) {
323 323
 		return $this->get_all(
324 324
 			array_merge(
325 325
 				$query_params,
@@ -356,14 +356,14 @@  discard block
 block discarded – undo
356 356
 		$assembled_fields = array();
357 357
 
358 358
 		//let's loop through all the fields and set them up in the right format
359
-		foreach ( $fields as $index => $value ) {
359
+		foreach ($fields as $index => $value) {
360 360
 			// first let's figure out if the value['content'] in the current index is an array.
361 361
 			//  If it is then this is special fields that are used in parsing special shortcodes (i.e. 'attendee_list').
362
-			if ( is_array($value['content']) ) {
362
+			if (is_array($value['content'])) {
363 363
 				$assembled_fields[$value['name']] = $value['content']['main'];
364 364
 				//loop through the content and get the other fields.
365
-				foreach ( $value['content'] as $name => $val ) {
366
-					if ( $name == 'main' ) continue;
365
+				foreach ($value['content'] as $name => $val) {
366
+					if ($name == 'main') continue;
367 367
 					$assembled_fields[$name] = $val;
368 368
 				}
369 369
 				continue;
@@ -375,15 +375,15 @@  discard block
 block discarded – undo
375 375
 
376 376
 		// now we've got the assembled_fields.
377 377
 		// We need to setup the string for the appropriate validator class and call that.
378
-		$m_ref = ucwords( str_replace('_',' ', $messenger ) );
379
-		$m_ref = str_replace( ' ', '_', $m_ref );
380
-		$mt_ref = ucwords( str_replace('_', ' ', $message_type ) );
381
-		$mt_ref = str_replace( ' ', '_', $mt_ref );
378
+		$m_ref = ucwords(str_replace('_', ' ', $messenger));
379
+		$m_ref = str_replace(' ', '_', $m_ref);
380
+		$mt_ref = ucwords(str_replace('_', ' ', $message_type));
381
+		$mt_ref = str_replace(' ', '_', $mt_ref);
382 382
 
383
-		$classname = 'EE_Messages_' . $m_ref . '_' . $mt_ref . '_Validator';
383
+		$classname = 'EE_Messages_'.$m_ref.'_'.$mt_ref.'_Validator';
384 384
 
385
-		if ( !class_exists( $classname ) ) {
386
-			$msg[] = __( 'The Validator class was unable to load', 'event_espresso');
385
+		if ( ! class_exists($classname)) {
386
+			$msg[] = __('The Validator class was unable to load', 'event_espresso');
387 387
 			$msg[] = sprintf(
388 388
 				__(
389 389
 					'The class name compiled was %s. Please check and make sure the spelling and case is correct for the class name and that there is an autoloader in place for this class',
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
 				),
392 392
 				$classname
393 393
 			);
394
-			throw new EE_Error( implode( '||', $msg ) );
394
+			throw new EE_Error(implode('||', $msg));
395 395
 		}
396 396
 
397
-		$a = new ReflectionClass( $classname );
398
-		$_VLD = $a->newInstance( $assembled_fields, $context );
397
+		$a = new ReflectionClass($classname);
398
+		$_VLD = $a->newInstance($assembled_fields, $context);
399 399
 		$result = $_VLD->validate();
400 400
 		return $result;
401 401
 	}
@@ -414,18 +414,18 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @return int  count of updated records.
416 416
 	 */
417
-	public function deactivate_message_template_groups_for( $messenger_names = array(), $message_type_names = array() ) {
417
+	public function deactivate_message_template_groups_for($messenger_names = array(), $message_type_names = array()) {
418 418
 		$query_args = array();
419
-		if ( empty( $messenger_names ) && empty( $message_type_names ) ) {
419
+		if (empty($messenger_names) && empty($message_type_names)) {
420 420
 			return 0;
421 421
 		}
422
-		if ( ! empty( $messenger_names ) ) {
423
-			$query_args[ 0 ][ 'MTP_messenger' ] = array( 'IN', (array) $messenger_names );
422
+		if ( ! empty($messenger_names)) {
423
+			$query_args[0]['MTP_messenger'] = array('IN', (array) $messenger_names);
424 424
 		}
425
-		if ( ! empty( $message_type_names ) ) {
426
-			$query_args[ 0 ][ 'MTP_message_type' ] = array( 'IN', (array) $message_type_names );
425
+		if ( ! empty($message_type_names)) {
426
+			$query_args[0]['MTP_message_type'] = array('IN', (array) $message_type_names);
427 427
 		}
428
-		return $this->update( array( 'MTP_is_active' => false ), $query_args );
428
+		return $this->update(array('MTP_is_active' => false), $query_args);
429 429
 	}
430 430
 
431 431
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_Messages_Queue.lib.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -534,7 +534,7 @@
 block discarded – undo
534 534
 *@param EE_Message            $message
535 535
 	 * @param EE_Messenger    $messenger
536 536
 	 * @param EE_message_type $message_type
537
-	 * @param $test_send
537
+	 * @param boolean $test_send
538 538
 	 * @return bool   true means all went well, false means, not so much.
539 539
 	 */
540 540
 	protected function _do_preview( EE_Message $message, EE_Messenger $messenger, EE_message_type $message_type, $test_send ) {
Please login to merge, or discard this patch.
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param \EE_Message_Repository       $message_repository
73 73
 	 */
74
-	public function __construct( EE_Message_Repository $message_repository ) {
75
-		$this->_batch_count = apply_filters( 'FHEE__EE_Messages_Queue___batch_count', 50 );
74
+	public function __construct(EE_Message_Repository $message_repository) {
75
+		$this->_batch_count = apply_filters('FHEE__EE_Messages_Queue___batch_count', 50);
76 76
 		$this->_rate_limit = $this->get_rate_limit();
77 77
 		$this->_queue = $message_repository;
78 78
 	}
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 	 *                                 use the messenger send method but typically is based on preview data.
92 92
 	 * @return bool          Whether the message was successfully added to the repository or not.
93 93
 	 */
94
-	public function add( EE_Message $message, $data = array(), $preview = false, $test_send = false ) {
94
+	public function add(EE_Message $message, $data = array(), $preview = false, $test_send = false) {
95 95
 		$data['preview'] = $preview;
96 96
 		$data['test_send'] = $test_send;
97
-		return $this->_queue->add( $message, $data );
97
+		return $this->_queue->add($message, $data);
98 98
 	}
99 99
 
100 100
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	 * @param bool          $persist    This flag indicates whether to attempt to delete the object from the db as well.
107 107
 	 * @return bool
108 108
 	 */
109
-	public function remove( EE_Message $message, $persist = false ) {
110
-		if ( $persist && $this->_queue->current() !== $message ) {
109
+	public function remove(EE_Message $message, $persist = false) {
110
+		if ($persist && $this->_queue->current() !== $message) {
111 111
 			//get pointer on right message
112
-			if ( $this->_queue->has( $message ) ) {
112
+			if ($this->_queue->has($message)) {
113 113
 				$this->_queue->rewind();
114
-				while( $this->_queue->valid() ) {
115
-					if ( $this->_queue->current() === $message ) {
114
+				while ($this->_queue->valid()) {
115
+					if ($this->_queue->current() === $message) {
116 116
 						break;
117 117
 					}
118 118
 					$this->_queue->next();
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				return false;
122 122
 			}
123 123
 		}
124
-		return $persist ? $this->_queue->delete() : $this->_queue->remove( $message );
124
+		return $persist ? $this->_queue->delete() : $this->_queue->remove($message);
125 125
 	}
126 126
 
127 127
 
@@ -161,29 +161,29 @@  discard block
 block discarded – undo
161 161
 	 * @return bool  true if successfully retrieved batch, false no batch ready.
162 162
 	 */
163 163
 	public function get_batch_to_generate() {
164
-		if ( $this->is_locked( EE_Messages_Queue::action_generating ) ) {
164
+		if ($this->is_locked(EE_Messages_Queue::action_generating)) {
165 165
 			return false;
166 166
 		}
167 167
 
168 168
 		//lock batch generation to prevent race conditions.
169
-		$this->lock_queue( EE_Messages_Queue::action_generating );
169
+		$this->lock_queue(EE_Messages_Queue::action_generating);
170 170
 
171 171
 		$query_args = array(
172 172
 			// key 0 = where conditions
173
-			0 => array( 'STS_ID' => EEM_Message::status_incomplete ),
173
+			0 => array('STS_ID' => EEM_Message::status_incomplete),
174 174
 			'order_by' => $this->_get_priority_orderby(),
175 175
 			'limit' => $this->_batch_count
176 176
 		);
177
-		$messages = EEM_Message::instance()->get_all( $query_args );
177
+		$messages = EEM_Message::instance()->get_all($query_args);
178 178
 
179
-		if ( ! $messages ) {
179
+		if ( ! $messages) {
180 180
 			return false; //nothing to generate
181 181
 		}
182 182
 
183
-		foreach ( $messages as $message ) {
184
-			if ( $message instanceof EE_Message ) {
183
+		foreach ($messages as $message) {
184
+			if ($message instanceof EE_Message) {
185 185
 				$data = $message->all_extra_meta_array();
186
-				$this->add( $message, $data );
186
+				$this->add($message, $data);
187 187
 			}
188 188
 		}
189 189
 		return true;
@@ -206,34 +206,34 @@  discard block
 block discarded – undo
206 206
 	 *               to assist with notifying user.
207 207
 	 */
208 208
 	public function get_to_send_batch_and_send() {
209
-		if ( $this->is_locked( EE_Messages_Queue::action_sending ) || $this->_rate_limit < 1 ) {
209
+		if ($this->is_locked(EE_Messages_Queue::action_sending) || $this->_rate_limit < 1) {
210 210
 			return false;
211 211
 		}
212 212
 
213
-		$this->lock_queue( EE_Messages_Queue::action_sending );
213
+		$this->lock_queue(EE_Messages_Queue::action_sending);
214 214
 
215 215
 		$batch = $this->_batch_count < $this->_rate_limit ? $this->_batch_count : $this->_rate_limit;
216 216
 
217 217
 		$query_args = array(
218 218
 			// key 0 = where conditions
219
-			0 => array( 'STS_ID' => array( 'IN', EEM_Message::instance()->stati_indicating_to_send() ) ),
219
+			0 => array('STS_ID' => array('IN', EEM_Message::instance()->stati_indicating_to_send())),
220 220
 			'order_by' => $this->_get_priority_orderby(),
221 221
 			'limit' => $batch
222 222
 		);
223 223
 
224
-		$messages_to_send = EEM_Message::instance()->get_all( $query_args );
224
+		$messages_to_send = EEM_Message::instance()->get_all($query_args);
225 225
 
226 226
 
227 227
 		//any to send?
228
-		if ( ! $messages_to_send ) {
229
-			$this->unlock_queue( EE_Messages_Queue::action_sending );
228
+		if ( ! $messages_to_send) {
229
+			$this->unlock_queue(EE_Messages_Queue::action_sending);
230 230
 			return false;
231 231
 		}
232 232
 
233 233
 		//add to queue.
234
-		foreach ( $messages_to_send as $message ) {
235
-			if ( $message instanceof EE_Message ) {
236
-				$this->add( $message );
234
+		foreach ($messages_to_send as $message) {
235
+			if ($message instanceof EE_Message) {
236
+				$this->add($message);
237 237
 			}
238 238
 		}
239 239
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		$this->execute();
242 242
 
243 243
 		//release lock
244
-		$this->unlock_queue( EE_Messages_Queue::action_sending );
244
+		$this->unlock_queue(EE_Messages_Queue::action_sending);
245 245
 		return true;
246 246
 	}
247 247
 
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @param   string  $type   The type of queue being locked.
255 255
 	 */
256
-	public function lock_queue( $type = EE_Messages_Queue::action_generating ) {
257
-		set_transient( $this->_get_lock_key( $type ), 1, $this->_get_lock_expiry( $type ) );
256
+	public function lock_queue($type = EE_Messages_Queue::action_generating) {
257
+		set_transient($this->_get_lock_key($type), 1, $this->_get_lock_expiry($type));
258 258
 	}
259 259
 
260 260
 
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @param   string  $type   The type of queue being unlocked.
267 267
 	 */
268
-	public function unlock_queue( $type = EE_Messages_Queue::action_generating ) {
269
-		delete_transient( $this->_get_lock_key( $type ) );
268
+	public function unlock_queue($type = EE_Messages_Queue::action_generating) {
269
+		delete_transient($this->_get_lock_key($type));
270 270
 	}
271 271
 
272 272
 
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 	 * @param string $type  The type of lock.
278 278
 	 * @return string
279 279
 	 */
280
-	protected function _get_lock_key( $type = EE_Messages_Queue::action_generating ) {
281
-		return '_ee_lock_' . $type;
280
+	protected function _get_lock_key($type = EE_Messages_Queue::action_generating) {
281
+		return '_ee_lock_'.$type;
282 282
 	}
283 283
 
284 284
 
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 	 * @param string $type  The type of lock
290 290
 	 * @return int   time to expiry in seconds.
291 291
 	 */
292
-	protected function _get_lock_expiry( $type = EE_Messages_Queue::action_generating ) {
293
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type );
292
+	protected function _get_lock_expiry($type = EE_Messages_Queue::action_generating) {
293
+		return (int) apply_filters('FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type);
294 294
 	}
295 295
 
296 296
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 * @return int
309 309
 	 */
310 310
 	protected function _get_rate_limit_expiry() {
311
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS );
311
+		return (int) apply_filters('FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS);
312 312
 	}
313 313
 
314 314
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 * @return int
320 320
 	 */
321 321
 	protected function _default_rate_limit() {
322
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue___rate_limit', 200 );
322
+		return (int) apply_filters('FHEE__EE_Messages_Queue___rate_limit', 200);
323 323
 	}
324 324
 
325 325
 
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 	 * @param  string $type The type of lock being checked for.
346 346
 	 * @return bool
347 347
 	 */
348
-	public function is_locked( $type = EE_Messages_Queue::action_generating ) {
349
-		return (bool) get_transient( $this->_get_lock_key( $type ) );
348
+	public function is_locked($type = EE_Messages_Queue::action_generating) {
349
+		return (bool) get_transient($this->_get_lock_key($type));
350 350
 	}
351 351
 
352 352
 
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 	 * @return int
362 362
 	 */
363 363
 	public function get_rate_limit() {
364
-		if ( ! $rate_limit = get_transient( $this->_get_rate_limit_key() ) ) {
364
+		if ( ! $rate_limit = get_transient($this->_get_rate_limit_key())) {
365 365
 			$rate_limit = $this->_default_rate_limit();
366
-			set_transient( $this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key() );
366
+			set_transient($this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key());
367 367
 		}
368 368
 		return $rate_limit;
369 369
 	}
@@ -375,12 +375,12 @@  discard block
 block discarded – undo
375 375
 	 * This updates existing rate limit with the new limit which is the old minus the batch.
376 376
 	 * @param int $batch_completed  This sets the new rate limit based on the given batch that was completed.
377 377
 	 */
378
-	public function set_rate_limit( $batch_completed ) {
378
+	public function set_rate_limit($batch_completed) {
379 379
 		//first get the most up to date rate limit (in case its expired and reset)
380 380
 		$rate_limit = $this->get_rate_limit();
381 381
 		$new_limit = $rate_limit - $batch_completed;
382 382
 		//updating the transient option directly to avoid resetting the expiry.
383
-		update_option( '_transient_' . $this->_get_rate_limit_key(), $new_limit );
383
+		update_option('_transient_'.$this->_get_rate_limit_key(), $new_limit);
384 384
 	}
385 385
 
386 386
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 	 * @param string $task This indicates what type of request is going to be initiated.
394 394
 	 * @param int    $priority  This indicates the priority that triggers initiating the request.
395 395
 	 */
396
-	public function initiate_request_by_priority( $task = 'generate', $priority = EEM_Message::priority_high ) {
396
+	public function initiate_request_by_priority($task = 'generate', $priority = EEM_Message::priority_high) {
397 397
 		//determine what status is matched with the priority as part of the trigger conditions.
398 398
 		$status = $task == 'generate'
399 399
 			? EEM_Message::status_incomplete
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 		// always make sure we save because either this will get executed immediately on a separate request
402 402
 		// or remains in the queue for the regularly scheduled queue batch.
403 403
 		$this->save();
404
-		if ( $this->_queue->count_by_priority_and_status( $priority, $status ) ) {
405
-			EE_Messages_Scheduler::initiate_scheduled_non_blocking_request( $task );
404
+		if ($this->_queue->count_by_priority_and_status($priority, $status)) {
405
+			EE_Messages_Scheduler::initiate_scheduled_non_blocking_request($task);
406 406
 		}
407 407
 	}
408 408
 
@@ -427,50 +427,50 @@  discard block
 block discarded – undo
427 427
 	 *                    Also, if the messenger is an request type messenger (or a preview),
428 428
 	 * 					  its entirely possible that the messenger will exit before
429 429
 	 */
430
-	public function execute( $save = true, $sending_messenger = null, $by_priority = false ) {
430
+	public function execute($save = true, $sending_messenger = null, $by_priority = false) {
431 431
 		$messages_sent = 0;
432 432
 		$this->_did_hook = array();
433 433
 		$this->_queue->rewind();
434
-		while ( $this->_queue->valid() ) {
434
+		while ($this->_queue->valid()) {
435 435
 			$error_messages = array();
436 436
 			/** @type EE_Message $message */
437 437
 			$message = $this->_queue->current();
438 438
 			//if the message in the queue has a sent status, then skip
439
-			if ( in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_sent() ) ) {
439
+			if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_sent())) {
440 440
 				continue;
441 441
 			}
442 442
 			//if $by_priority is set and does not match then continue;
443
-			if ( $by_priority && $by_priority != $message->priority() ) {
443
+			if ($by_priority && $by_priority != $message->priority()) {
444 444
 				continue;
445 445
 			}
446 446
 			//error checking
447
-			if ( ! $message->valid_messenger() ) {
447
+			if ( ! $message->valid_messenger()) {
448 448
 				$error_messages[] = sprintf(
449
-					__( 'The %s messenger is not active at time of sending.', 'event_espresso' ),
449
+					__('The %s messenger is not active at time of sending.', 'event_espresso'),
450 450
 					$message->messenger()
451 451
 				);
452 452
 			}
453
-			if ( ! $message->valid_message_type() ) {
453
+			if ( ! $message->valid_message_type()) {
454 454
 				$error_messages[] = sprintf(
455
-					__( 'The %s message type is not active at the time of sending.', 'event_espresso' ),
455
+					__('The %s message type is not active at the time of sending.', 'event_espresso'),
456 456
 					$message->message_type()
457 457
 				);
458 458
 			}
459 459
 			// if there was supposed to be a sending messenger for this message, but it was invalid/inactive,
460 460
 			// then it will instead be an EE_Error object, so let's check for that
461
-			if ( $sending_messenger instanceof EE_Error ) {
461
+			if ($sending_messenger instanceof EE_Error) {
462 462
 				$error_messages[] = $sending_messenger->getMessage();
463 463
 			}
464 464
 			// if there are no errors, then let's process the message
465
-			if ( empty( $error_messages ) && $this->_process_message( $message, $sending_messenger ) ) {
465
+			if (empty($error_messages) && $this->_process_message($message, $sending_messenger)) {
466 466
 				$messages_sent++;
467 467
 			}
468
-			$this->_set_error_message( $message, $error_messages );
468
+			$this->_set_error_message($message, $error_messages);
469 469
 			//add modified time
470
-			$message->set_modified( time() );
470
+			$message->set_modified(time());
471 471
 			$this->_queue->next();
472 472
 		}
473
-		if ( $save ) {
473
+		if ($save) {
474 474
 			$this->save();
475 475
 		}
476 476
 		return $messages_sent;
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 	 * @param mixed 	 $sending_messenger (optional)
486 486
 	 * @return bool
487 487
 	 */
488
-	protected function _process_message( EE_Message $message, $sending_messenger = null ) {
488
+	protected function _process_message(EE_Message $message, $sending_messenger = null) {
489 489
 		// these *should* have been validated in the execute() method above
490 490
 		$messenger = $message->messenger_object();
491 491
 		$message_type = $message->message_type_object();
@@ -495,20 +495,20 @@  discard block
 block discarded – undo
495 495
 			&& $messenger instanceof EE_messenger
496 496
 			&& $sending_messenger->name != $messenger->name
497 497
 		) {
498
-			$messenger->do_secondary_messenger_hooks( $sending_messenger->name );
498
+			$messenger->do_secondary_messenger_hooks($sending_messenger->name);
499 499
 			$messenger = $sending_messenger;
500 500
 		}
501 501
 		// send using messenger, but double check objects
502
-		if ( $messenger instanceof EE_messenger && $message_type instanceof EE_message_type ) {
502
+		if ($messenger instanceof EE_messenger && $message_type instanceof EE_message_type) {
503 503
 			//set hook for message type (but only if not using another messenger to send).
504
-			if ( ! isset( $this->_did_hook[ $message_type->name ] ) ) {
505
-				$message_type->do_messenger_hooks( $messenger );
506
-				$this->_did_hook[ $message_type->name ] = 1;
504
+			if ( ! isset($this->_did_hook[$message_type->name])) {
505
+				$message_type->do_messenger_hooks($messenger);
506
+				$this->_did_hook[$message_type->name] = 1;
507 507
 			}
508 508
 			//if preview then use preview method
509 509
 			return $this->_queue->is_preview()
510
-				? $this->_do_preview( $message, $messenger, $message_type, $this->_queue->is_test_send() )
511
-				: $this->_do_send( $message, $messenger, $message_type );
510
+				? $this->_do_preview($message, $messenger, $message_type, $this->_queue->is_test_send())
511
+				: $this->_do_send($message, $messenger, $message_type);
512 512
 		}
513 513
 		return false;
514 514
 	}
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
 	 * @param array $status  Stati to check for in queue
527 527
 	 * @return int  Count of EE_Message's matching the given status.
528 528
 	 */
529
-	public function count_STS_in_queue( $status ) {
529
+	public function count_STS_in_queue($status) {
530 530
 		$count = 0;
531
-		$status = is_array( $status ) ? $status : array( $status );
531
+		$status = is_array($status) ? $status : array($status);
532 532
 		$this->_queue->rewind();
533
-		foreach( $this->_queue as $message ) {
534
-			if ( in_array( $message->STS_ID(), $status ) ) {
533
+		foreach ($this->_queue as $message) {
534
+			if (in_array($message->STS_ID(), $status)) {
535 535
 				$count++;
536 536
 			}
537 537
 		}
@@ -548,15 +548,15 @@  discard block
 block discarded – undo
548 548
 	 * @param $test_send
549 549
 	 * @return bool   true means all went well, false means, not so much.
550 550
 	 */
551
-	protected function _do_preview( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send ) {
552
-		if ( $preview = $messenger->get_preview( $message, $message_type, $test_send ) ) {
553
-			if ( ! $test_send ) {
554
-				$message->set_content( $preview );
551
+	protected function _do_preview(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send) {
552
+		if ($preview = $messenger->get_preview($message, $message_type, $test_send)) {
553
+			if ( ! $test_send) {
554
+				$message->set_content($preview);
555 555
 			}
556
-			$message->set_STS_ID( EEM_Message::status_sent );
556
+			$message->set_STS_ID(EEM_Message::status_sent);
557 557
 			return true;
558 558
 		} else {
559
-			$message->set_STS_ID( EEM_Message::status_failed );
559
+			$message->set_STS_ID(EEM_Message::status_failed);
560 560
 			return false;
561 561
 		}
562 562
 	}
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 	 * @param EE_message_type $message_type
573 573
 	 * @return bool true means all went well, false means, not so much.
574 574
 	 */
575
-	protected function _do_send( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type ) {
576
-		if ( $messenger->send_message( $message, $message_type ) ) {
577
-			$message->set_STS_ID( EEM_Message::status_sent );
575
+	protected function _do_send(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type) {
576
+		if ($messenger->send_message($message, $message_type)) {
577
+			$message->set_STS_ID(EEM_Message::status_sent);
578 578
 			return true;
579 579
 		} else {
580
-			$message->set_STS_ID( EEM_Message::status_retry );
580
+			$message->set_STS_ID(EEM_Message::status_retry);
581 581
 			return false;
582 582
 		}
583 583
 	}
@@ -591,21 +591,21 @@  discard block
 block discarded – undo
591 591
 	 * @param EE_Message $message
592 592
 	 * @param array      $error_messages the response from the messenger.
593 593
 	 */
594
-	protected function _set_error_message( EE_Message $message, $error_messages ) {
594
+	protected function _set_error_message(EE_Message $message, $error_messages) {
595 595
 		$error_messages = (array) $error_messages;
596
-		if ( in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending() ) ) {
596
+		if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending())) {
597 597
 			$notices = EE_Error::has_notices();
598
-			$error_messages[] = __( 'Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso' );
599
-			if ( $notices === 1 ) {
598
+			$error_messages[] = __('Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso');
599
+			if ($notices === 1) {
600 600
 				$notices = EE_Error::get_vanilla_notices();
601
-				$notices['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : array();
602
-				$error_messages[] = implode( "\n", $notices['errors'] );
601
+				$notices['errors'] = isset($notices['errors']) ? $notices['errors'] : array();
602
+				$error_messages[] = implode("\n", $notices['errors']);
603 603
 			}
604 604
 		}
605
-		if ( count( $error_messages ) > 0 ) {
606
-			$msg = __( 'Message was not executed successfully.', 'event_espresso' );
607
-			$msg = $msg . "\n" . implode( "\n", $error_messages );
608
-			$message->set_error_message( $msg );
605
+		if (count($error_messages) > 0) {
606
+			$msg = __('Message was not executed successfully.', 'event_espresso');
607
+			$msg = $msg."\n".implode("\n", $error_messages);
608
+			$message->set_error_message($msg);
609 609
 		}
610 610
 	}
611 611
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_To_Generate.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@
 block discarded – undo
200 200
 	 * generates an EE_Message using the supplied arguments and some defaults
201 201
 	 *
202 202
 	 * @param array $properties
203
-	 * @return string
203
+	 * @return EE_Message
204 204
 	 */
205 205
 	protected function _generate_message( $properties = array() ) {
206 206
 		$message = EE_Message_Factory::create(
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 	public function __construct(
106 106
 		$messenger_name,
107 107
 		$message_type_name,
108
-		$data 	 = array(),
108
+		$data = array(),
109 109
 		$context = '',
110 110
 		$preview = false,
111 111
 		$status  = EEM_Message::status_incomplete
112 112
 	) {
113
-		$this->_messenger_name 		= $messenger_name;
114
-		$this->_message_type_name 	= $message_type_name;
115
-		$this->_data 				= is_array( $data ) ? $data : array( $data );
113
+		$this->_messenger_name = $messenger_name;
114
+		$this->_message_type_name = $message_type_name;
115
+		$this->_data = is_array($data) ? $data : array($data);
116 116
 		$this->_context 			= $context;
117 117
 		$this->_preview 			= $preview;
118 118
 		$this->_status 				= $status;
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	/**
171 171
 	 * @param boolean $preview
172 172
 	 */
173
-	public function set_preview( $preview ) {
174
-		$this->_preview = filter_var( $preview, FILTER_VALIDATE_BOOLEAN );
173
+	public function set_preview($preview) {
174
+		$this->_preview = filter_var($preview, FILTER_VALIDATE_BOOLEAN);
175 175
 	}
176 176
 
177 177
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @param array $properties
203 203
 	 * @return string
204 204
 	 */
205
-	protected function _generate_message( $properties = array() ) {
205
+	protected function _generate_message($properties = array()) {
206 206
 		$message = EE_Message_Factory::create(
207 207
 			array_merge(
208 208
 				array(
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 		);
217 217
 		// validate the message, and if it's good, set some properties
218 218
 		try {
219
-			$message->is_valid_for_sending_or_generation( true );
219
+			$message->is_valid_for_sending_or_generation(true);
220 220
 			$this->_valid = true;
221 221
 			$this->_messenger = $message->messenger_object();
222 222
 			$this->_message_type = $message->message_type_object();
223 223
 			$this->_send_now = $message->send_now();
224
-		} catch ( Exception $e ) {
224
+		} catch (Exception $e) {
225 225
 			$this->_valid = false;
226 226
 			$this->_error_msg[] = $e->getMessage();
227 227
 		}
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	public function get_EE_Message() {
239 239
 		// already set ?
240
-		if ( $this->_message instanceof EE_Message ) {
240
+		if ($this->_message instanceof EE_Message) {
241 241
 			return $this->_message;
242 242
 		}
243 243
 		// no? then let's create one
@@ -255,15 +255,15 @@  discard block
 block discarded – undo
255 255
 	 * @param   bool    $preview    Used to indicate that the preview data handler is to be returned.
256 256
 	 * @return  string
257 257
 	 */
258
-	public function get_data_handler_class_name( $preview = false ) {
259
-		if ( $this->_data_handler_class_name === '' && $this->valid() ) {
260
-			$ref = $preview ? 'Preview' : $this->_message_type->get_data_handler( $this->_data );
258
+	public function get_data_handler_class_name($preview = false) {
259
+		if ($this->_data_handler_class_name === '' && $this->valid()) {
260
+			$ref = $preview ? 'Preview' : $this->_message_type->get_data_handler($this->_data);
261 261
 			//make sure internal data is updated.
262 262
 			$this->_data = $this->_message_type->get_data();
263 263
 
264 264
 			//verify
265
-			$this->_data_handler_class_name = EE_Message_To_Generate::verify_and_retrieve_class_name_for_data_handler_reference( $ref );
266
-			if ( $this->_data_handler_class_name === '' ) {
265
+			$this->_data_handler_class_name = EE_Message_To_Generate::verify_and_retrieve_class_name_for_data_handler_reference($ref);
266
+			if ($this->_data_handler_class_name === '') {
267 267
 				$this->_valid = false;
268 268
 			}
269 269
 		}
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
 	 * @param string $data_handler_reference
280 280
 	 * @return string
281 281
 	 */
282
-	public static function verify_and_retrieve_class_name_for_data_handler_reference( $data_handler_reference ) {
283
-		$class_name = 'EE_Messages_' . $data_handler_reference . '_incoming_data';
284
-		if ( ! class_exists( $class_name ) ) {
282
+	public static function verify_and_retrieve_class_name_for_data_handler_reference($data_handler_reference) {
283
+		$class_name = 'EE_Messages_'.$data_handler_reference.'_incoming_data';
284
+		if ( ! class_exists($class_name)) {
285 285
 			EE_Error::add_error(
286 286
 				sprintf(
287 287
 					__(
Please login to merge, or discard this patch.
core/EE_System.core.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
 
197 197
 
198 198
 	/**
199
-	* detect_if_activation_or_upgrade
200
-	*
201
-	* Takes care of detecting whether this is a brand new install or code upgrade,
202
-	* and either setting up the DB or setting up maintenance mode etc.
203
-	*
204
-	* @access public
205
-	* @return void
206
-	*/
199
+	 * detect_if_activation_or_upgrade
200
+	 *
201
+	 * Takes care of detecting whether this is a brand new install or code upgrade,
202
+	 * and either setting up the DB or setting up maintenance mode etc.
203
+	 *
204
+	 * @access public
205
+	 * @return void
206
+	 */
207 207
 	public function detect_if_activation_or_upgrade() {
208 208
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
209 209
 
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
 			$query_params =  array( 'page' => 'espresso_about' );
513 513
 
514 514
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
515
-			    $query_params['new_activation'] = TRUE;
515
+				$query_params['new_activation'] = TRUE;
516 516
 			}
517 517
 
518 518
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
519
-			    $query_params['reactivation'] = TRUE;
519
+				$query_params['reactivation'] = TRUE;
520 520
 			}
521 521
 			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
522 522
 			wp_safe_redirect( $url );
@@ -619,11 +619,11 @@  discard block
 block discarded – undo
619 619
 
620 620
 
621 621
 	/**
622
-	* _incompatible_addon_error
623
-	*
624
-	* @access public
625
-	* @return void
626
-	*/
622
+	 * _incompatible_addon_error
623
+	 *
624
+	 * @access public
625
+	 * @return void
626
+	 */
627 627
 	private function _incompatible_addon_error() {
628 628
 		// get array of classes hooking into here
629 629
 		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
@@ -745,14 +745,14 @@  discard block
 block discarded – undo
745 745
 
746 746
 
747 747
 	/**
748
-	* load_controllers
749
-	*
750
-	* this is the best place to load any additional controllers that needs access to EE core.
751
-	* it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
752
-	*
753
-	* @access public
754
-	* @return void
755
-	*/
748
+	 * load_controllers
749
+	 *
750
+	 * this is the best place to load any additional controllers that needs access to EE core.
751
+	 * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
752
+	 *
753
+	 * @access public
754
+	 * @return void
755
+	 */
756 756
 	public function load_controllers() {
757 757
 		do_action( 'AHEE__EE_System__load_controllers__start' );
758 758
 		// let's get it started
@@ -769,13 +769,13 @@  discard block
 block discarded – undo
769 769
 
770 770
 
771 771
 	/**
772
-	* core_loaded_and_ready
773
-	*
774
-	* all of the basic EE core should be loaded at this point and available regardless of M-Mode
775
-	*
776
-	* @access public
777
-	* @return void
778
-	*/
772
+	 * core_loaded_and_ready
773
+	 *
774
+	 * all of the basic EE core should be loaded at this point and available regardless of M-Mode
775
+	 *
776
+	 * @access public
777
+	 * @return void
778
+	 */
779 779
 	public function core_loaded_and_ready() {
780 780
 		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
781 781
 		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
@@ -786,13 +786,13 @@  discard block
 block discarded – undo
786 786
 
787 787
 
788 788
 	/**
789
-	* initialize
790
-	*
791
-	* this is the best place to begin initializing client code
792
-	*
793
-	* @access public
794
-	* @return void
795
-	*/
789
+	 * initialize
790
+	 *
791
+	 * this is the best place to begin initializing client code
792
+	 *
793
+	 * @access public
794
+	 * @return void
795
+	 */
796 796
 	public function initialize() {
797 797
 		do_action( 'AHEE__EE_System__initialize' );
798 798
 	}
@@ -800,13 +800,13 @@  discard block
 block discarded – undo
800 800
 
801 801
 
802 802
 	/**
803
-	* initialize_last
804
-	*
805
-	* this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
806
-	*
807
-	* @access public
808
-	* @return void
809
-	*/
803
+	 * initialize_last
804
+	 *
805
+	 * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
806
+	 *
807
+	 * @access public
808
+	 * @return void
809
+	 */
810 810
 	public function initialize_last() {
811 811
 		do_action( 'AHEE__EE_System__initialize_last' );
812 812
 	}
@@ -815,14 +815,14 @@  discard block
 block discarded – undo
815 815
 
816 816
 
817 817
 	/**
818
-	* set_hooks_for_shortcodes_modules_and_addons
819
-	*
820
-	* this is the best place for other systems to set callbacks for hooking into other parts of EE
821
-	* this happens at the very beginning of the wp_loaded hookpoint
822
-	*
823
-	* @access public
824
-	* @return void
825
-	*/
818
+	 * set_hooks_for_shortcodes_modules_and_addons
819
+	 *
820
+	 * this is the best place for other systems to set callbacks for hooking into other parts of EE
821
+	 * this happens at the very beginning of the wp_loaded hookpoint
822
+	 *
823
+	 * @access public
824
+	 * @return void
825
+	 */
826 826
 	public function set_hooks_for_shortcodes_modules_and_addons() {
827 827
 //		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
828 828
 	}
@@ -831,13 +831,13 @@  discard block
 block discarded – undo
831 831
 
832 832
 
833 833
 	/**
834
-	* do_not_cache
835
-	*
836
-	* sets no cache headers and defines no cache constants for WP plugins
837
-	*
838
-	* @access public
839
-	* @return void
840
-	*/
834
+	 * do_not_cache
835
+	 *
836
+	 * sets no cache headers and defines no cache constants for WP plugins
837
+	 *
838
+	 * @access public
839
+	 * @return void
840
+	 */
841 841
 	public static function do_not_cache() {
842 842
 		// set no cache constants
843 843
 		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			//Current post
957 957
 			global $post;
958 958
 
959
-	    	if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
959
+			if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
960 960
 				//Events Edit Current Event
961 961
 				$admin_bar->add_menu(array(
962 962
 						'id' => 'espresso-toolbar-events-edit',
Please login to merge, or discard this patch.
Spacing   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 	 * @param  \EE_Registry        $Registry
89 89
 	 * @return \EE_System
90 90
 	 */
91
-	public static function instance( EE_Registry $Registry = null ) {
91
+	public static function instance(EE_Registry $Registry = null) {
92 92
 		// check if class object is instantiated
93
-		if ( ! self::$_instance instanceof EE_System ) {
94
-			self::$_instance = new self( $Registry );
93
+		if ( ! self::$_instance instanceof EE_System) {
94
+			self::$_instance = new self($Registry);
95 95
 		}
96 96
 		return self::$_instance;
97 97
 	}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 	 * resets the instance and returns it
102 102
 	 * @return EE_System
103 103
 	 */
104
-	public static function reset(){
104
+	public static function reset() {
105 105
 		self::$_instance->_req_type = NULL;
106 106
 		//we need to reset the migration manager in order for it to detect DMSs properly
107 107
 		EE_Data_Migration_Manager::reset();
108 108
 		//make sure none of the old hooks are left hanging around
109
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations');
109
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
110 110
 		self::instance()->detect_activations_or_upgrades();
111 111
 		self::instance()->perform_activations_upgrades_and_migrations();
112 112
 		return self::instance();
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
 	 * @access private
123 123
 	 * @param  \EE_Registry        $Registry
124 124
 	 */
125
-	private function __construct( EE_Registry $Registry ) {
125
+	private function __construct(EE_Registry $Registry) {
126 126
 		$this->registry = $Registry;
127
-		do_action( 'AHEE__EE_System__construct__begin', $this );
127
+		do_action('AHEE__EE_System__construct__begin', $this);
128 128
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
129
-		add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) );
129
+		add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons'));
130 130
 		// when an ee addon is activated, we want to call the core hook(s) again
131 131
 		// because the newly-activated addon didn't get a chance to run at all
132
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
132
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
133 133
 		// detect whether install or upgrade
134
-		add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 );
134
+		add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3);
135 135
 		// load EE_Config, EE_Textdomain, etc
136
-		add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 );
136
+		add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5);
137 137
 		// load EE_Config, EE_Textdomain, etc
138
-		add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
138
+		add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7);
139 139
 		// you wanna get going? I wanna get going... let's get going!
140
-		add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 );
140
+		add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9);
141 141
 		//other housekeeping
142 142
 		//exclude EE critical pages from wp_list_pages
143
-		add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 );
143
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
144 144
 		// ALL EE Addons should use the following hook point to attach their initial setup too
145 145
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
146
-		do_action( 'AHEE__EE_System__construct__complete', $this );
146
+		do_action('AHEE__EE_System__construct__complete', $this);
147 147
 	}
148 148
 
149 149
 
@@ -163,30 +163,30 @@  discard block
 block discarded – undo
163 163
 	public function load_espresso_addons() {
164 164
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
165 165
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
166
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
166
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
167 167
 		//load and setup EE_Capabilities
168
-		$this->registry->load_core( 'Capabilities' );
168
+		$this->registry->load_core('Capabilities');
169 169
 		//caps need to be initialized on every request so that capability maps are set.
170 170
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
171 171
 		$this->registry->CAP->init_caps();
172
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
172
+		do_action('AHEE__EE_System__load_espresso_addons');
173 173
 		//if the WP API basic auth plugin isn't already loaded, load it now.
174 174
 		//We want it for mobile apps. Just include the entire plugin
175 175
 		//also, don't load the basic auth when a plugin is getting activated, because
176 176
 		//it could be the basic auth plugin, and it doesn't check if its methods are already defined
177 177
 		//and causes a fatal error
178
-		if( !function_exists( 'json_basic_auth_handler' )
179
-			&& ! function_exists( 'json_basic_auth_error' )
178
+		if ( ! function_exists('json_basic_auth_handler')
179
+			&& ! function_exists('json_basic_auth_error')
180 180
 			&& ! (
181
-				isset( $_GET[ 'action'] )
182
-				&& in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) )
181
+				isset($_GET['action'])
182
+				&& in_array($_GET['action'], array('activate', 'activate-selected'))
183 183
 			)
184 184
 			&& ! (
185
-				isset( $_GET['activate' ] )
186
-				&& $_GET['activate' ] === 'true'
185
+				isset($_GET['activate'])
186
+				&& $_GET['activate'] === 'true'
187 187
 			)
188 188
 		) {
189
-			include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
189
+			include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php';
190 190
 		}
191 191
 	}
192 192
 
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 * @access public
203 203
 	 * @return void
204 204
 	 */
205
-	public function detect_activations_or_upgrades(){
205
+	public function detect_activations_or_upgrades() {
206 206
 		//first off: let's make sure to handle core
207 207
 		$this->detect_if_activation_or_upgrade();
208
-		foreach($this->registry->addons as $addon){
208
+		foreach ($this->registry->addons as $addon) {
209 209
 			//detect teh request type for that addon
210 210
 			$addon->detect_activation_or_upgrade();
211 211
 		}
@@ -226,41 +226,41 @@  discard block
 block discarded – undo
226 226
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
227 227
 
228 228
 		// load M-Mode class
229
-		$this->registry->load_core( 'Maintenance_Mode' );
229
+		$this->registry->load_core('Maintenance_Mode');
230 230
 		// check if db has been updated, or if its a brand-new installation
231 231
 
232 232
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
233
-		$request_type =  $this->detect_req_type($espresso_db_update);
233
+		$request_type = $this->detect_req_type($espresso_db_update);
234 234
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
235 235
 
236
-		switch($request_type){
236
+		switch ($request_type) {
237 237
 			case EE_System::req_type_new_activation:
238
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
239
-				$this->_handle_core_version_change( $espresso_db_update );
238
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
239
+				$this->_handle_core_version_change($espresso_db_update);
240 240
 				break;
241 241
 			case EE_System::req_type_reactivation:
242
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
243
-				$this->_handle_core_version_change( $espresso_db_update );
242
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
243
+				$this->_handle_core_version_change($espresso_db_update);
244 244
 				break;
245 245
 			case EE_System::req_type_upgrade:
246
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
246
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
247 247
 				//migrations may be required now that we've upgraded
248 248
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
249
-				$this->_handle_core_version_change( $espresso_db_update );
249
+				$this->_handle_core_version_change($espresso_db_update);
250 250
 //				echo "done upgrade";die;
251 251
 				break;
252 252
 			case EE_System::req_type_downgrade:
253
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
253
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
254 254
 				//its possible migrations are no longer required
255 255
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
256
-				$this->_handle_core_version_change( $espresso_db_update );
256
+				$this->_handle_core_version_change($espresso_db_update);
257 257
 				break;
258 258
 			case EE_System::req_type_normal:
259 259
 			default:
260 260
 //				$this->_maybe_redirect_to_ee_about();
261 261
 				break;
262 262
 		}
263
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
263
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
264 264
 	}
265 265
 
266 266
 	/**
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
 	 * initializing the database later during the request
269 269
 	 * @param array $espresso_db_update
270 270
 	 */
271
-	protected function _handle_core_version_change( $espresso_db_update ){
272
-		$this->update_list_of_installed_versions( $espresso_db_update );
271
+	protected function _handle_core_version_change($espresso_db_update) {
272
+		$this->update_list_of_installed_versions($espresso_db_update);
273 273
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
274
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
274
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
275 275
 	}
276 276
 
277 277
 
@@ -286,44 +286,44 @@  discard block
 block discarded – undo
286 286
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
287 287
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
288 288
 	 */
289
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
290
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
291
-		if( ! $espresso_db_update){
292
-			$espresso_db_update = get_option( 'espresso_db_update' );
289
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
290
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
291
+		if ( ! $espresso_db_update) {
292
+			$espresso_db_update = get_option('espresso_db_update');
293 293
 		}
294 294
 		// check that option is an array
295
-		if( ! is_array( $espresso_db_update )) {
295
+		if ( ! is_array($espresso_db_update)) {
296 296
 			// if option is FALSE, then it never existed
297
-			if ( $espresso_db_update === FALSE ) {
297
+			if ($espresso_db_update === FALSE) {
298 298
 				// make $espresso_db_update an array and save option with autoload OFF
299
-				$espresso_db_update =  array();
300
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
299
+				$espresso_db_update = array();
300
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
301 301
 			} else {
302 302
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
303
-				$espresso_db_update =  array( $espresso_db_update=>array() );
304
-				update_option( 'espresso_db_update', $espresso_db_update );
303
+				$espresso_db_update = array($espresso_db_update=>array());
304
+				update_option('espresso_db_update', $espresso_db_update);
305 305
 			}
306
-		}else{
306
+		} else {
307 307
 			$corrected_db_update = array();
308 308
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
309
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
310
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
309
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
310
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
311 311
 					//the key is an int, and the value IS NOT an array
312 312
 					//so it must be numerically-indexed, where values are versions installed...
313 313
 					//fix it!
314 314
 					$version_string = $should_be_array;
315 315
 					$corrected_db_update[$version_string] = array('unknown-date');
316
-				}else{
316
+				} else {
317 317
 					//ok it checks out
318 318
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
319 319
 				}
320 320
 			}
321 321
 			$espresso_db_update = $corrected_db_update;
322
-			update_option( 'espresso_db_update', $espresso_db_update );
322
+			update_option('espresso_db_update', $espresso_db_update);
323 323
 
324 324
 		}
325 325
 
326
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
326
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
327 327
 		return $espresso_db_update;
328 328
 	}
329 329
 
@@ -343,34 +343,34 @@  discard block
 block discarded – undo
343 343
 	 * so we prefer to only do it when necessary
344 344
 	 * @return void
345 345
 	 */
346
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
346
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
347 347
 		$request_type = $this->detect_req_type();
348 348
 		//only initialize system if we're not in maintenance mode.
349
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
350
-			update_option( 'ee_flush_rewrite_rules', TRUE );
349
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
350
+			update_option('ee_flush_rewrite_rules', TRUE);
351 351
 
352
-			if( $verify_schema ) {
352
+			if ($verify_schema) {
353 353
 				EEH_Activation::initialize_db_and_folders();
354 354
 			}
355 355
 			EEH_Activation::initialize_db_content();
356 356
 			EEH_Activation::system_initialization();
357
-			if( $initialize_addons_too ) {
357
+			if ($initialize_addons_too) {
358 358
 				$this->initialize_addons();
359 359
 			}
360
-		}else{
361
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
360
+		} else {
361
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
362 362
 		}
363
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
364
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
363
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
364
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
365 365
 		}
366 366
 	}
367 367
 
368 368
 	/**
369 369
 	 * Initializes the db for all registered addons
370 370
 	 */
371
-	public function initialize_addons(){
371
+	public function initialize_addons() {
372 372
 		//foreach registered addon, make sure its db is up-to-date too
373
-		foreach($this->registry->addons as $addon){
373
+		foreach ($this->registry->addons as $addon) {
374 374
 			$addon->initialize_db_if_no_migrations_required();
375 375
 		}
376 376
 	}
@@ -382,16 +382,16 @@  discard block
 block discarded – undo
382 382
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
383 383
 	 * @return 	boolean success as to whether or not this option was changed
384 384
 	 */
385
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
386
-		if( ! $version_history ) {
385
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
386
+		if ( ! $version_history) {
387 387
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
388 388
 		}
389
-		if( $current_version_to_add == NULL){
389
+		if ($current_version_to_add == NULL) {
390 390
 			$current_version_to_add = espresso_version();
391 391
 		}
392
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
392
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
393 393
 		// re-save
394
-		return update_option( 'espresso_db_update', $version_history );
394
+		return update_option('espresso_db_update', $version_history);
395 395
 	}
396 396
 
397 397
 
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
 	 *                            but still know if this is a new install or not
409 409
 	 * @return int one of the constants on EE_System::req_type_
410 410
 	 */
411
-	public function detect_req_type( $espresso_db_update = NULL ){
412
-		if ( $this->_req_type === NULL ){
413
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
414
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
411
+	public function detect_req_type($espresso_db_update = NULL) {
412
+		if ($this->_req_type === NULL) {
413
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
414
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
415 415
 		}
416 416
 		return $this->_req_type;
417 417
 	}
@@ -427,39 +427,39 @@  discard block
 block discarded – undo
427 427
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
428 428
 	 * @return int one of the constants on EE_System::req_type_*
429 429
 	 */
430
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
431
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
432
-		if( $activation_history_for_addon ){
430
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
431
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
432
+		if ($activation_history_for_addon) {
433 433
 			//it exists, so this isn't a completely new install
434 434
 			//check if this version already in that list of previously installed versions
435
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
435
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
436 436
 				//it a version we haven't seen before
437
-				if( $version_is_higher === 1 ){
437
+				if ($version_is_higher === 1) {
438 438
 					$req_type = EE_System::req_type_upgrade;
439
-				}else{
439
+				} else {
440 440
 					$req_type = EE_System::req_type_downgrade;
441 441
 				}
442
-				delete_option( $activation_indicator_option_name );
442
+				delete_option($activation_indicator_option_name);
443 443
 			} else {
444 444
 				// its not an update. maybe a reactivation?
445
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
446
-					if ( $version_is_higher === -1 ){
445
+				if (get_option($activation_indicator_option_name, FALSE)) {
446
+					if ($version_is_higher === -1) {
447 447
 						$req_type = EE_System::req_type_downgrade;
448
-					}elseif( $version_is_higher === 0 ){
448
+					}elseif ($version_is_higher === 0) {
449 449
 						//we've seen this version before, but it's an activation. must be a reactivation
450 450
 						$req_type = EE_System::req_type_reactivation;
451
-					}else{//$version_is_higher === 1
451
+					} else {//$version_is_higher === 1
452 452
 						$req_type = EE_System::req_type_upgrade;
453 453
 					}
454
-					delete_option( $activation_indicator_option_name );
454
+					delete_option($activation_indicator_option_name);
455 455
 				} else {
456 456
 					//we've seen this version before and the activation indicate doesn't show it was just activated
457
-					if ( $version_is_higher === -1 ){
457
+					if ($version_is_higher === -1) {
458 458
 						$req_type = EE_System::req_type_downgrade;
459
-					}elseif( $version_is_higher === 0 ){
459
+					}elseif ($version_is_higher === 0) {
460 460
 						//we've seen this version before and it's not an activation. its normal request
461 461
 						$req_type = EE_System::req_type_normal;
462
-					}else{//$version_is_higher === 1
462
+					} else {//$version_is_higher === 1
463 463
 						$req_type = EE_System::req_type_upgrade;
464 464
 					}
465 465
 				}
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		} else {
468 468
 			//brand new install
469 469
 			$req_type = EE_System::req_type_new_activation;
470
-			delete_option( $activation_indicator_option_name );
470
+			delete_option($activation_indicator_option_name);
471 471
 		}
472 472
 		return $req_type;
473 473
 	}
@@ -485,30 +485,30 @@  discard block
 block discarded – undo
485 485
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
486 486
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
487 487
 	 */
488
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
488
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
489 489
 		//find the most recently-activated version
490 490
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
491 491
 		$most_recently_active_version = '0.0.0.dev.000';
492
-		if( is_array( $activation_history_for_addon ) ){
493
-			foreach( $activation_history_for_addon as $version => $times_activated ){
492
+		if (is_array($activation_history_for_addon)) {
493
+			foreach ($activation_history_for_addon as $version => $times_activated) {
494 494
 				//check there is a record of when this version was activated. Otherwise,
495 495
 				//mark it as unknown
496
-				if( ! $times_activated ){
497
-					$times_activated = array( 'unknown-date');
496
+				if ( ! $times_activated) {
497
+					$times_activated = array('unknown-date');
498 498
 				}
499
-				if( is_string( $times_activated ) ){
500
-					$times_activated = array( $times_activated );
499
+				if (is_string($times_activated)) {
500
+					$times_activated = array($times_activated);
501 501
 				}
502
-				foreach( $times_activated as $an_activation ){
503
-					if( $an_activation != 'unknown-date' &&
504
-							$an_activation > $most_recently_active_version_activation  ){
502
+				foreach ($times_activated as $an_activation) {
503
+					if ($an_activation != 'unknown-date' &&
504
+							$an_activation > $most_recently_active_version_activation) {
505 505
 						$most_recently_active_version = $version;
506 506
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
507 507
 					}
508 508
 				}
509 509
 			}
510 510
 		}
511
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
511
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
512 512
 	}
513 513
 
514 514
 
@@ -518,24 +518,24 @@  discard block
 block discarded – undo
518 518
 	 * @return void
519 519
 	 */
520 520
 	public function redirect_to_about_ee() {
521
-		$notices = EE_Error::get_notices( FALSE );
521
+		$notices = EE_Error::get_notices(FALSE);
522 522
 		//if current user is an admin and it's not an ajax request
523 523
 		if (
524
-			$this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' )
525
-			&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
526
-			&& ! isset( $notices[ 'errors' ] )
524
+			$this->registry->CAP->current_user_can('manage_options', 'espresso_about_default')
525
+			&& ! (defined('DOING_AJAX') && DOING_AJAX)
526
+			&& ! isset($notices['errors'])
527 527
 		) {
528
-			$query_params =  array( 'page' => 'espresso_about' );
528
+			$query_params = array('page' => 'espresso_about');
529 529
 
530
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
530
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
531 531
 			    $query_params['new_activation'] = TRUE;
532 532
 			}
533 533
 
534
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
534
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
535 535
 			    $query_params['reactivation'] = TRUE;
536 536
 			}
537
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
538
-			wp_safe_redirect( $url );
537
+			$url = add_query_arg($query_params, admin_url('admin.php'));
538
+			wp_safe_redirect($url);
539 539
 			exit();
540 540
 		}
541 541
 	}
@@ -549,31 +549,31 @@  discard block
 block discarded – undo
549 549
 	 *
550 550
 	 * @return void
551 551
 	 */
552
-	public function load_core_configuration(){
553
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
554
-		$this->registry->load_core( 'EE_Load_Textdomain' );
552
+	public function load_core_configuration() {
553
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
554
+		$this->registry->load_core('EE_Load_Textdomain');
555 555
 		//load textdomain
556 556
 		EE_Load_Textdomain::load_textdomain();
557 557
 		// load and setup EE_Config and EE_Network_Config
558
-		$this->registry->load_core( 'Config' );
559
-		$this->registry->load_core( 'Network_Config' );
558
+		$this->registry->load_core('Config');
559
+		$this->registry->load_core('Network_Config');
560 560
 		// setup autoloaders
561 561
 		// enable logging?
562
-		if ( $this->registry->CFG->admin->use_full_logging ) {
563
-			$this->registry->load_core( 'Log' );
562
+		if ($this->registry->CFG->admin->use_full_logging) {
563
+			$this->registry->load_core('Log');
564 564
 		}
565 565
 		// check for activation errors
566
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
567
-		if ( $activation_errors ) {
568
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
569
-			update_option( 'ee_plugin_activation_errors', FALSE );
566
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
567
+		if ($activation_errors) {
568
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
569
+			update_option('ee_plugin_activation_errors', FALSE);
570 570
 		}
571 571
 		// get model names
572 572
 		$this->_parse_model_names();
573 573
 
574 574
 		//load caf stuff a chance to play during the activation process too.
575 575
 		$this->_maybe_brew_regular();
576
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
576
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
577 577
 	}
578 578
 
579 579
 
@@ -582,23 +582,23 @@  discard block
 block discarded – undo
582 582
 	 *
583 583
 	 * @return void
584 584
 	 */
585
-	private function _parse_model_names(){
585
+	private function _parse_model_names() {
586 586
 		//get all the files in the EE_MODELS folder that end in .model.php
587
-		$models = glob( EE_MODELS.'*.model.php');
587
+		$models = glob(EE_MODELS.'*.model.php');
588 588
 		$model_names = array();
589 589
 		$non_abstract_db_models = array();
590
-		foreach( $models as $model ){
590
+		foreach ($models as $model) {
591 591
 			// get model classname
592
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
593
-			$short_name = str_replace( 'EEM_', '', $classname );
592
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
593
+			$short_name = str_replace('EEM_', '', $classname);
594 594
 			$reflectionClass = new ReflectionClass($classname);
595
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
596
-				$non_abstract_db_models[ $short_name ] = $classname;
595
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
596
+				$non_abstract_db_models[$short_name] = $classname;
597 597
 			}
598
-			$model_names[ $short_name ] = $classname;
598
+			$model_names[$short_name] = $classname;
599 599
 		}
600
-		$this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
601
-		$this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
600
+		$this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
601
+		$this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
602 602
 	}
603 603
 
604 604
 
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
 	 * @return void
609 609
 	 */
610 610
 	private function _maybe_brew_regular() {
611
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
612
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
611
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
612
+			require_once EE_CAFF_PATH.'brewing_regular.php';
613 613
 		}
614 614
 	}
615 615
 
@@ -626,9 +626,9 @@  discard block
 block discarded – undo
626 626
 	 * @return void
627 627
 	 */
628 628
 	public function register_shortcodes_modules_and_widgets() {
629
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
629
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
630 630
 		// check for addons using old hookpoint
631
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
631
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
632 632
 			$this->_incompatible_addon_error();
633 633
 		}
634 634
 	}
@@ -642,19 +642,19 @@  discard block
 block discarded – undo
642 642
 	*/
643 643
 	private function _incompatible_addon_error() {
644 644
 		// get array of classes hooking into here
645
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
646
-		if ( ! empty( $class_names )) {
647
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
645
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
646
+		if ( ! empty($class_names)) {
647
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
648 648
 			$msg .= '<ul>';
649
-			foreach ( $class_names as $class_name ) {
650
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
649
+			foreach ($class_names as $class_name) {
650
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
651 651
 			}
652 652
 			$msg .= '</ul>';
653
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
653
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
654 654
 			// save list of incompatible addons to wp-options for later use
655
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
656
-			if ( is_admin() ) {
657
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
655
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
656
+			if (is_admin()) {
657
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
658 658
 			}
659 659
 		}
660 660
 	}
@@ -671,25 +671,25 @@  discard block
 block discarded – undo
671 671
 	 *
672 672
 	 * @return void
673 673
 	 */
674
-	public function brew_espresso(){
675
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
674
+	public function brew_espresso() {
675
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
676 676
 		// load some final core systems
677
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
678
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
679
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
680
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
681
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
682
-		add_action( 'init', array( $this, 'initialize' ), 10 );
683
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
684
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
685
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
686
-
687
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
677
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
678
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
679
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
680
+		add_action('init', array($this, 'load_controllers'), 7);
681
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
682
+		add_action('init', array($this, 'initialize'), 10);
683
+		add_action('init', array($this, 'initialize_last'), 100);
684
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
685
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
686
+
687
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
688 688
 			// pew pew pew
689
-			$this->registry->load_core( 'PUE' );
690
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
689
+			$this->registry->load_core('PUE');
690
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
691 691
 		}
692
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
692
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
693 693
 	}
694 694
 
695 695
 
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	 */
704 704
 	public function set_hooks_for_core() {
705 705
 		$this->_deactivate_incompatible_addons();
706
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
706
+		do_action('AHEE__EE_System__set_hooks_for_core');
707 707
 	}
708 708
 
709 709
 
@@ -712,15 +712,15 @@  discard block
 block discarded – undo
712 712
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
713 713
 	 * deactivates any addons considered incompatible with the current version of EE
714 714
 	 */
715
-	private function _deactivate_incompatible_addons(){
716
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
717
-		if ( ! empty( $incompatible_addons )) {
718
-			$active_plugins = get_option( 'active_plugins', array() );
719
-			foreach ( $active_plugins as $active_plugin ) {
720
-				foreach ( $incompatible_addons as $incompatible_addon ) {
721
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
722
-						unset( $_GET['activate'] );
723
-						espresso_deactivate_plugin( $active_plugin );
715
+	private function _deactivate_incompatible_addons() {
716
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
717
+		if ( ! empty($incompatible_addons)) {
718
+			$active_plugins = get_option('active_plugins', array());
719
+			foreach ($active_plugins as $active_plugin) {
720
+				foreach ($incompatible_addons as $incompatible_addon) {
721
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
722
+						unset($_GET['activate']);
723
+						espresso_deactivate_plugin($active_plugin);
724 724
 					}
725 725
 				}
726 726
 			}
@@ -737,10 +737,10 @@  discard block
 block discarded – undo
737 737
 	 */
738 738
 	public function perform_activations_upgrades_and_migrations() {
739 739
 		//first check if we had previously attempted to setup EE's directories but failed
740
-		if( EEH_Activation::upload_directories_incomplete() ) {
740
+		if (EEH_Activation::upload_directories_incomplete()) {
741 741
 			EEH_Activation::create_upload_directories();
742 742
 		}
743
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
743
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
744 744
 	}
745 745
 
746 746
 
@@ -752,10 +752,10 @@  discard block
 block discarded – undo
752 752
 	 *  	@return 	void
753 753
 	 */
754 754
 	public function load_CPTs_and_session() {
755
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
755
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
756 756
 		// register Custom Post Types
757
-		$this->registry->load_core( 'Register_CPTs' );
758
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
757
+		$this->registry->load_core('Register_CPTs');
758
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
759 759
 	}
760 760
 
761 761
 
@@ -770,16 +770,16 @@  discard block
 block discarded – undo
770 770
 	* @return void
771 771
 	*/
772 772
 	public function load_controllers() {
773
-		do_action( 'AHEE__EE_System__load_controllers__start' );
773
+		do_action('AHEE__EE_System__load_controllers__start');
774 774
 		// let's get it started
775
-		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) {
776
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
777
-			$this->registry->load_core( 'Front_Controller', array(), false, true );
778
-		} else if ( ! EE_FRONT_AJAX ) {
779
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
780
-			EE_Registry::instance()->load_core( 'Admin' );
775
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
776
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
777
+			$this->registry->load_core('Front_Controller', array(), false, true);
778
+		} else if ( ! EE_FRONT_AJAX) {
779
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
780
+			EE_Registry::instance()->load_core('Admin');
781 781
 		}
782
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
782
+		do_action('AHEE__EE_System__load_controllers__complete');
783 783
 	}
784 784
 
785 785
 
@@ -793,9 +793,9 @@  discard block
 block discarded – undo
793 793
 	* @return void
794 794
 	*/
795 795
 	public function core_loaded_and_ready() {
796
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
797
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
798
-		$this->registry->load_core( 'Session' );
796
+		do_action('AHEE__EE_System__core_loaded_and_ready');
797
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
798
+		$this->registry->load_core('Session');
799 799
 		//		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
800 800
 	}
801 801
 
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 	* @return void
811 811
 	*/
812 812
 	public function initialize() {
813
-		do_action( 'AHEE__EE_System__initialize' );
813
+		do_action('AHEE__EE_System__initialize');
814 814
 	}
815 815
 
816 816
 
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 	* @return void
825 825
 	*/
826 826
 	public function initialize_last() {
827
-		do_action( 'AHEE__EE_System__initialize_last' );
827
+		do_action('AHEE__EE_System__initialize_last');
828 828
 	}
829 829
 
830 830
 
@@ -856,21 +856,21 @@  discard block
 block discarded – undo
856 856
 	*/
857 857
 	public static function do_not_cache() {
858 858
 		// set no cache constants
859
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
860
-			define( 'DONOTCACHEPAGE', true );
859
+		if ( ! defined('DONOTCACHEPAGE')) {
860
+			define('DONOTCACHEPAGE', true);
861 861
 		}
862
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
863
-			define( 'DONOTCACHCEOBJECT', true );
862
+		if ( ! defined('DONOTCACHCEOBJECT')) {
863
+			define('DONOTCACHCEOBJECT', true);
864 864
 		}
865
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
866
-			define( 'DONOTCACHEDB', true );
865
+		if ( ! defined('DONOTCACHEDB')) {
866
+			define('DONOTCACHEDB', true);
867 867
 		}
868 868
 		// add no cache headers
869
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
869
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
870 870
 		// plus a little extra for nginx and Google Chrome
871
-		add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 );
871
+		add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
872 872
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
873
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
873
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
874 874
 	}
875 875
 
876 876
 
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 	 * @param $headers
883 883
 	 * @return    array
884 884
 	 */
885
-	public static function extra_nocache_headers ( $headers ) {
885
+	public static function extra_nocache_headers($headers) {
886 886
 		// for NGINX
887 887
 		$headers['X-Accel-Expires'] = 0;
888 888
 		// plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
@@ -911,14 +911,14 @@  discard block
 block discarded – undo
911 911
 	 * @param  WP_Admin_Bar $admin_bar
912 912
 	 * @return void
913 913
 	 */
914
-	public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) {
914
+	public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) {
915 915
 
916 916
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
917
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
917
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
918 918
 			return;
919 919
 		}
920 920
 
921
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
921
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
922 922
 		$menu_class = 'espresso_menu_item_class';
923 923
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
924 924
 		//because they're only defined in each of their respective constructors
@@ -930,20 +930,20 @@  discard block
 block discarded – undo
930 930
 		//Top Level
931 931
 		$admin_bar->add_menu(array(
932 932
 				'id' => 'espresso-toolbar',
933
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
933
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
934 934
 				'href' => $events_admin_url,
935 935
 				'meta' => array(
936 936
 						'title' => __('Event Espresso', 'event_espresso'),
937
-						'class' => $menu_class . 'first'
937
+						'class' => $menu_class.'first'
938 938
 				),
939 939
 		));
940 940
 
941 941
 		//Events
942
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
942
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
943 943
 			$admin_bar->add_menu(array(
944 944
 					'id' => 'espresso-toolbar-events',
945 945
 					'parent' => 'espresso-toolbar',
946
-					'title' => __( 'Events', 'event_espresso' ),
946
+					'title' => __('Events', 'event_espresso'),
947 947
 					'href' => $events_admin_url,
948 948
 					'meta' => array(
949 949
 							'title' => __('Events', 'event_espresso'),
@@ -954,13 +954,13 @@  discard block
 block discarded – undo
954 954
 		}
955 955
 
956 956
 
957
-		if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
957
+		if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
958 958
 			//Events Add New
959 959
 			$admin_bar->add_menu(array(
960 960
 					'id' => 'espresso-toolbar-events-new',
961 961
 					'parent' => 'espresso-toolbar-events',
962 962
 					'title' => __('Add New', 'event_espresso'),
963
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
963
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
964 964
 					'meta' => array(
965 965
 							'title' => __('Add New', 'event_espresso'),
966 966
 							'target' => '',
@@ -969,18 +969,18 @@  discard block
 block discarded – undo
969 969
 			));
970 970
 		}
971 971
 
972
-		if ( is_single() && ( get_post_type() == 'espresso_events' ) ) {
972
+		if (is_single() && (get_post_type() == 'espresso_events')) {
973 973
 
974 974
 			//Current post
975 975
 			global $post;
976 976
 
977
-	    	if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
977
+	    	if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) {
978 978
 				//Events Edit Current Event
979 979
 				$admin_bar->add_menu(array(
980 980
 						'id' => 'espresso-toolbar-events-edit',
981 981
 						'parent' => 'espresso-toolbar-events',
982 982
 						'title' => __('Edit Event', 'event_espresso'),
983
-						'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ),
983
+						'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url),
984 984
 						'meta' => array(
985 985
 								'title' => __('Edit Event', 'event_espresso'),
986 986
 								'target' => '',
@@ -992,11 +992,11 @@  discard block
 block discarded – undo
992 992
 		}
993 993
 
994 994
 		//Events View
995
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
995
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
996 996
 			$admin_bar->add_menu(array(
997 997
 					'id' => 'espresso-toolbar-events-view',
998 998
 					'parent' => 'espresso-toolbar-events',
999
-					'title' => __( 'View', 'event_espresso' ),
999
+					'title' => __('View', 'event_espresso'),
1000 1000
 					'href' => $events_admin_url,
1001 1001
 					'meta' => array(
1002 1002
 							'title' => __('View', 'event_espresso'),
@@ -1006,12 +1006,12 @@  discard block
 block discarded – undo
1006 1006
 			));
1007 1007
 		}
1008 1008
 
1009
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
1009
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
1010 1010
 			//Events View All
1011 1011
 			$admin_bar->add_menu(array(
1012 1012
 					'id' => 'espresso-toolbar-events-all',
1013 1013
 					'parent' => 'espresso-toolbar-events-view',
1014
-					'title' => __( 'All', 'event_espresso' ),
1014
+					'title' => __('All', 'event_espresso'),
1015 1015
 					'href' => $events_admin_url,
1016 1016
 					'meta' => array(
1017 1017
 							'title' => __('All', 'event_espresso'),
@@ -1022,13 +1022,13 @@  discard block
 block discarded – undo
1022 1022
 		}
1023 1023
 
1024 1024
 
1025
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1025
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1026 1026
 			//Events View Today
1027 1027
 			$admin_bar->add_menu(array(
1028 1028
 					'id' => 'espresso-toolbar-events-today',
1029 1029
 					'parent' => 'espresso-toolbar-events-view',
1030 1030
 					'title' => __('Today', 'event_espresso'),
1031
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1031
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1032 1032
 					'meta' => array(
1033 1033
 							'title' => __('Today', 'event_espresso'),
1034 1034
 							'target' => '',
@@ -1038,13 +1038,13 @@  discard block
 block discarded – undo
1038 1038
 		}
1039 1039
 
1040 1040
 
1041
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1041
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1042 1042
 			//Events View This Month
1043 1043
 			$admin_bar->add_menu(array(
1044 1044
 					'id' => 'espresso-toolbar-events-month',
1045 1045
 					'parent' => 'espresso-toolbar-events-view',
1046
-					'title' => __( 'This Month', 'event_espresso'),
1047
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1046
+					'title' => __('This Month', 'event_espresso'),
1047
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1048 1048
 					'meta' => array(
1049 1049
 							'title' => __('This Month', 'event_espresso'),
1050 1050
 							'target' => '',
@@ -1054,11 +1054,11 @@  discard block
 block discarded – undo
1054 1054
 		}
1055 1055
 
1056 1056
 		//Registration Overview
1057
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1057
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1058 1058
 			$admin_bar->add_menu(array(
1059 1059
 					'id' => 'espresso-toolbar-registrations',
1060 1060
 					'parent' => 'espresso-toolbar',
1061
-					'title' => __( 'Registrations', 'event_espresso' ),
1061
+					'title' => __('Registrations', 'event_espresso'),
1062 1062
 					'href' => $reg_admin_url,
1063 1063
 					'meta' => array(
1064 1064
 							'title' => __('Registrations', 'event_espresso'),
@@ -1069,12 +1069,12 @@  discard block
 block discarded – undo
1069 1069
 		}
1070 1070
 
1071 1071
 		//Registration Overview Today
1072
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1072
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1073 1073
 			$admin_bar->add_menu(array(
1074 1074
 					'id' => 'espresso-toolbar-registrations-today',
1075 1075
 					'parent' => 'espresso-toolbar-registrations',
1076
-					'title' => __( 'Today', 'event_espresso'),
1077
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1076
+					'title' => __('Today', 'event_espresso'),
1077
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1078 1078
 					'meta' => array(
1079 1079
 							'title' => __('Today', 'event_espresso'),
1080 1080
 							'target' => '',
@@ -1084,14 +1084,14 @@  discard block
 block discarded – undo
1084 1084
 		}
1085 1085
 
1086 1086
 		//Registration Overview Today Completed
1087
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1087
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1088 1088
 			$admin_bar->add_menu(array(
1089 1089
 					'id' => 'espresso-toolbar-registrations-today-approved',
1090 1090
 					'parent' => 'espresso-toolbar-registrations-today',
1091
-					'title' => __( 'Approved', 'event_espresso' ),
1092
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1091
+					'title' => __('Approved', 'event_espresso'),
1092
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1093 1093
 					'meta' => array(
1094
-							'title' => __('Approved', 'event_espresso' ),
1094
+							'title' => __('Approved', 'event_espresso'),
1095 1095
 							'target' => '',
1096 1096
 							'class' => $menu_class
1097 1097
 					),
@@ -1099,14 +1099,14 @@  discard block
 block discarded – undo
1099 1099
 		}
1100 1100
 
1101 1101
 		//Registration Overview Today Pending\
1102
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1102
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1103 1103
 			$admin_bar->add_menu(array(
1104 1104
 					'id' => 'espresso-toolbar-registrations-today-pending',
1105 1105
 					'parent' => 'espresso-toolbar-registrations-today',
1106
-					'title' => __( 'Pending', 'event_espresso' ),
1107
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1106
+					'title' => __('Pending', 'event_espresso'),
1107
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1108 1108
 					'meta' => array(
1109
-							'title' => __('Pending Payment', 'event_espresso' ),
1109
+							'title' => __('Pending Payment', 'event_espresso'),
1110 1110
 							'target' => '',
1111 1111
 							'class' => $menu_class
1112 1112
 					),
@@ -1114,14 +1114,14 @@  discard block
 block discarded – undo
1114 1114
 		}
1115 1115
 
1116 1116
 		//Registration Overview Today Incomplete
1117
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1117
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1118 1118
 			$admin_bar->add_menu(array(
1119 1119
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1120 1120
 					'parent' => 'espresso-toolbar-registrations-today',
1121
-					'title' => __( 'Not Approved', 'event_espresso' ),
1122
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1121
+					'title' => __('Not Approved', 'event_espresso'),
1122
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1123 1123
 					'meta' => array(
1124
-							'title' => __('Not Approved', 'event_espresso' ),
1124
+							'title' => __('Not Approved', 'event_espresso'),
1125 1125
 							'target' => '',
1126 1126
 							'class' => $menu_class
1127 1127
 					),
@@ -1129,12 +1129,12 @@  discard block
 block discarded – undo
1129 1129
 		}
1130 1130
 
1131 1131
 		//Registration Overview Today Incomplete
1132
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1132
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1133 1133
 			$admin_bar->add_menu(array(
1134 1134
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1135 1135
 					'parent' => 'espresso-toolbar-registrations-today',
1136
-					'title' => __( 'Cancelled', 'event_espresso'),
1137
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1136
+					'title' => __('Cancelled', 'event_espresso'),
1137
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1138 1138
 					'meta' => array(
1139 1139
 							'title' => __('Cancelled', 'event_espresso'),
1140 1140
 							'target' => '',
@@ -1144,12 +1144,12 @@  discard block
 block discarded – undo
1144 1144
 		}
1145 1145
 
1146 1146
 		//Registration Overview This Month
1147
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1147
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1148 1148
 			$admin_bar->add_menu(array(
1149 1149
 					'id' => 'espresso-toolbar-registrations-month',
1150 1150
 					'parent' => 'espresso-toolbar-registrations',
1151
-					'title' => __( 'This Month', 'event_espresso' ),
1152
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1151
+					'title' => __('This Month', 'event_espresso'),
1152
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1153 1153
 					'meta' => array(
1154 1154
 							'title' => __('This Month', 'event_espresso'),
1155 1155
 							'target' => '',
@@ -1159,12 +1159,12 @@  discard block
 block discarded – undo
1159 1159
 		}
1160 1160
 
1161 1161
 		//Registration Overview This Month Approved
1162
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1162
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1163 1163
 			$admin_bar->add_menu(array(
1164 1164
 					'id' => 'espresso-toolbar-registrations-month-approved',
1165 1165
 					'parent' => 'espresso-toolbar-registrations-month',
1166
-					'title' => __( 'Approved', 'event_espresso' ),
1167
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1166
+					'title' => __('Approved', 'event_espresso'),
1167
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1168 1168
 					'meta' => array(
1169 1169
 							'title' => __('Approved', 'event_espresso'),
1170 1170
 							'target' => '',
@@ -1174,12 +1174,12 @@  discard block
 block discarded – undo
1174 1174
 		}
1175 1175
 
1176 1176
 		//Registration Overview This Month Pending
1177
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1177
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1178 1178
 			$admin_bar->add_menu(array(
1179 1179
 					'id' => 'espresso-toolbar-registrations-month-pending',
1180 1180
 					'parent' => 'espresso-toolbar-registrations-month',
1181
-					'title' => __( 'Pending', 'event_espresso'),
1182
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1181
+					'title' => __('Pending', 'event_espresso'),
1182
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1183 1183
 					'meta' => array(
1184 1184
 							'title' => __('Pending', 'event_espresso'),
1185 1185
 							'target' => '',
@@ -1189,14 +1189,14 @@  discard block
 block discarded – undo
1189 1189
 		}
1190 1190
 
1191 1191
 		//Registration Overview This Month Not Approved
1192
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1192
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1193 1193
 			$admin_bar->add_menu(array(
1194 1194
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1195 1195
 					'parent' => 'espresso-toolbar-registrations-month',
1196
-					'title' => __( 'Not Approved', 'event_espresso'),
1197
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1196
+					'title' => __('Not Approved', 'event_espresso'),
1197
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1198 1198
 					'meta' => array(
1199
-							'title' => __('Not Approved', 'event_espresso' ),
1199
+							'title' => __('Not Approved', 'event_espresso'),
1200 1200
 							'target' => '',
1201 1201
 							'class' => $menu_class
1202 1202
 					),
@@ -1205,12 +1205,12 @@  discard block
 block discarded – undo
1205 1205
 
1206 1206
 
1207 1207
 		//Registration Overview This Month Cancelled
1208
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1208
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1209 1209
 			$admin_bar->add_menu(array(
1210 1210
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1211 1211
 					'parent' => 'espresso-toolbar-registrations-month',
1212 1212
 					'title' => __('Cancelled', 'event_espresso'),
1213
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1213
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1214 1214
 					'meta' => array(
1215 1215
 							'title' => __('Cancelled', 'event_espresso'),
1216 1216
 							'target' => '',
@@ -1220,11 +1220,11 @@  discard block
 block discarded – undo
1220 1220
 		}
1221 1221
 
1222 1222
 		//Extensions & Services
1223
-		if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) {
1223
+		if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) {
1224 1224
 			$admin_bar->add_menu(array(
1225 1225
 					'id' => 'espresso-toolbar-extensions-and-services',
1226 1226
 					'parent' => 'espresso-toolbar',
1227
-					'title' => __( 'Extensions & Services', 'event_espresso' ),
1227
+					'title' => __('Extensions & Services', 'event_espresso'),
1228 1228
 					'href' => $extensions_admin_url,
1229 1229
 					'meta' => array(
1230 1230
 							'title' => __('Extensions & Services', 'event_espresso'),
@@ -1246,8 +1246,8 @@  discard block
 block discarded – undo
1246 1246
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1247 1247
 	 * @return array
1248 1248
 	 */
1249
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1250
-		return  array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() );
1249
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1250
+		return  array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array());
1251 1251
 	}
1252 1252
 
1253 1253
 
@@ -1267,12 +1267,12 @@  discard block
 block discarded – undo
1267 1267
 	 */
1268 1268
 	public function wp_enqueue_scripts() {
1269 1269
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1270
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1270
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1271 1271
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1272
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1272
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1273 1273
 				// register jQuery Validate and additional methods
1274
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE );
1275
-				wp_register_script( 'jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js', array( 'jquery', 'jquery-validate' ), '1.15.0', TRUE );
1274
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
1275
+				wp_register_script('jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js', array('jquery', 'jquery-validate'), '1.15.0', TRUE);
1276 1276
 			}
1277 1277
 		}
1278 1278
 	}
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_To_Generate_From_Request.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
 	 * @param   EE_Message_Resource_Manager $message_resource_manager
39 39
 	 * @param   EE_Request_Handler 			$request
40 40
 	 */
41
-	public function __construct( EE_Message_Resource_Manager $message_resource_manager, EE_Request_Handler $request ) {
41
+	public function __construct(EE_Message_Resource_Manager $message_resource_manager, EE_Request_Handler $request) {
42 42
 		parent::__construct(
43
-			$request->get( 'gen_msgr' ),
44
-			$request->get( 'message_type' ),
43
+			$request->get('gen_msgr'),
44
+			$request->get('message_type'),
45 45
 			array(),
46
-			$request->get( 'context' )
46
+			$request->get('context')
47 47
 		);
48
-		if ( ! $this->valid() ) {
48
+		if ( ! $this->valid()) {
49 49
 			return;
50 50
 		}
51
-		$this->_sending_messenger = $message_resource_manager->get_active_messenger( $request->get( 'snd_msgr' ) );
52
-		$this->token = $request->get( 'token' );
51
+		$this->_sending_messenger = $message_resource_manager->get_active_messenger($request->get('snd_msgr'));
52
+		$this->token = $request->get('token');
53 53
 		$this->_validate_request();
54
-		$this->_data = $this->_get_data_from_request( $request->get( 'id' ) );
54
+		$this->_data = $this->_get_data_from_request($request->get('id'));
55 55
 	}
56 56
 
57 57
 
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 			! $this->_sending_messenger instanceof EE_Messenger
76 76
 			|| ! $this->_messenger instanceof EE_Messenger
77 77
 			|| ! $this->_message_type instanceof EE_message_type
78
-			|| empty( $this->_context )
79
-			|| empty( $this->token )
78
+			|| empty($this->_context)
79
+			|| empty($this->token)
80 80
 		) {
81
-			throw new EE_Error( __( 'The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso' ) );
81
+			throw new EE_Error(__('The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso'));
82 82
 		}
83 83
 	}
84 84
 
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
 	 * @throws EE_Error
91 91
 	 * @return mixed (whatever the data is returned from the message type).
92 92
 	 */
93
-	protected function _get_data_from_request( $id ) {
93
+	protected function _get_data_from_request($id) {
94 94
 		//get the EE_Registration from the token
95 95
 		/** @type EE_Registration $registration */
96
-		$registration = EEM_Registration::instance()->get_one( array( array( 'REG_url_link' => $this->token ) ) );
96
+		$registration = EEM_Registration::instance()->get_one(array(array('REG_url_link' => $this->token)));
97 97
 		//if no registration then bail early.
98
-		if ( ! $registration instanceof EE_Registration ) {
99
-			throw new EE_Error( __( 'Unable to complete the request because the token is invalid.', 'event_espresso' ) );
98
+		if ( ! $registration instanceof EE_Registration) {
99
+			throw new EE_Error(__('Unable to complete the request because the token is invalid.', 'event_espresso'));
100 100
 		}
101 101
 
102
-		return $this->_get_data_to_use( $registration, $id );
102
+		return $this->_get_data_to_use($registration, $id);
103 103
 	}
104 104
 
105 105
 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	 * @param int             $data_id   This is sometimes used for secondary data a message type requires.
112 112
 	 * @return mixed   Data prepared as needed for generating this message.
113 113
 	 */
114
-	protected function _get_data_to_use( $registration, $data_id ) {
114
+	protected function _get_data_to_use($registration, $data_id) {
115 115
 		//use incoming data from url to setup data for the message type requirements
116
-		return $this->_message_type->get_data_for_context( $this->_context, $registration, $data_id );
116
+		return $this->_message_type->get_data_for_context($this->_context, $registration, $data_id);
117 117
 	}
118 118
 
119 119
 
Please login to merge, or discard this patch.
core/libraries/messages/validators/EE_Messages_Validator.core.php 2 patches
Braces   +43 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
4 4
 	exit('NO direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * EE_Messages_Validator class
@@ -121,13 +122,14 @@  discard block
 block discarded – undo
121 122
 	 */
122 123
 	public function __construct( $fields, $context ) {
123 124
 		//check that _m_name and _mt_name have been set by child class otherwise we get out.
124
-		if ( empty($this->_m_name ) || empty( $this->_mt_name) )
125
-			throw new EE_Error(
125
+		if ( empty($this->_m_name ) || empty( $this->_mt_name) ) {
126
+					throw new EE_Error(
126 127
 				__(
127 128
 					'EE_Messages_Validator child classes MUST set the $_m_name and $_mt_name property.  Check that the child class is doing this',
128 129
 					'event_espresso'
129 130
 				)
130 131
 			);
132
+		}
131 133
 		$this->_fields = $fields;
132 134
 		$this->_context = $context;
133 135
 
@@ -228,8 +230,10 @@  discard block
 block discarded – undo
228 230
 		$groups_per_field = array();
229 231
 
230 232
 		foreach ( $msgr_validator as $field => $config ) {
231
-			if ( empty($config) || !isset($config['shortcodes']) )
232
-				continue;  //Nothing to see here.
233
+			if ( empty($config) || !isset($config['shortcodes']) ) {
234
+							continue;
235
+			}
236
+			//Nothing to see here.
233 237
 			$groups_per_field[$field] = array_intersect( $config['shortcodes'], $mt_codes );
234 238
 			$shortcode_groups = array_merge( $config[ 'shortcodes'], $shortcode_groups );
235 239
 		}
@@ -268,8 +272,9 @@  discard block
 block discarded – undo
268 272
 			$required = isset($config['required'])
269 273
 				? array_intersect($config['required'], array_keys($mt_codes))
270 274
 				: true;
271
-			if ( empty($required) )
272
-				continue;
275
+			if ( empty($required) ) {
276
+							continue;
277
+			}
273 278
 
274 279
 			//If we have an override then we use it to indicate the codes we want.
275 280
 			if ( isset( $this->_valid_shortcodes_modifier[$context][$field] ) ) {
@@ -310,8 +315,9 @@  discard block
 block discarded – undo
310 315
 			$specific_excludes = $this->get_specific_shortcode_excludes();
311 316
 			if ( isset( $specific_excludes[$field] ) ) {
312 317
 				foreach( $specific_excludes[$field] as $sex ) {
313
-					if ( isset( $this->_validators[$field]['shortcodes'][$sex] ) )
314
-						unset( $this->_validators[$field]['shortcodes'][$sex] );
318
+					if ( isset( $this->_validators[$field]['shortcodes'][$sex] ) ) {
319
+											unset( $this->_validators[$field]['shortcodes'][$sex] );
320
+					}
315 321
 				}
316 322
 			}
317 323
 
@@ -385,10 +391,13 @@  discard block
 block discarded – undo
385 391
 			//get the translated field label!
386 392
 			//first check if it's in the main fields list
387 393
 			if ( isset( $template_fields[$field] ) ) {
388
-				if ( empty( $template_fields[$field] ) )
389
-					$field_label = $field; //most likely the field is found in the 'extra' array.
390
-				else
391
-					$field_label = $template_fields[$field]['label'];
394
+				if ( empty( $template_fields[$field] ) ) {
395
+									$field_label = $field;
396
+				}
397
+				//most likely the field is found in the 'extra' array.
398
+				else {
399
+									$field_label = $template_fields[$field]['label'];
400
+				}
392 401
 			}
393 402
 
394 403
 			// if field label is empty OR is equal to the current field
@@ -402,8 +411,9 @@  discard block
 block discarded – undo
402 411
 
403 412
 						// if we've got a 'main' secondary field, let's see if that matches what field we're on
404 413
 						// which means it contains the label for this field.
405
-						if ( $name == 'main' && $main_field == $field_label )
406
-							$field_label = $values['label'];
414
+						if ( $name == 'main' && $main_field == $field_label ) {
415
+													$field_label = $values['label'];
416
+						}
407 417
 					}
408 418
 				}
409 419
 			}
@@ -439,8 +449,8 @@  discard block
 block discarded – undo
439 449
 			if ( isset( $this->_validators[$field]['type'] ) && !empty( $this->_validators[$field]['type'] ) ) {
440 450
 				switch ( $this->_validators[$field]['type'] ) {
441 451
 					case 'number' :
442
-						if ( !is_numeric($value) )
443
-							$err_msg .= sprintf(
452
+						if ( !is_numeric($value) ) {
453
+													$err_msg .= sprintf(
444 454
 								__(
445 455
 									'%3$sThe %1$s field is supposed to be a number. The value given (%2$s)  is not.  Please double-check and make sure the field contains a number%4$s',
446 456
 									'event_espresso'
@@ -450,11 +460,12 @@  discard block
 block discarded – undo
450 460
 								'<p>',
451 461
 								'</p >'
452 462
 							);
463
+						}
453 464
 						break;
454 465
 					case 'email' :
455 466
 						$valid_email = $this->_validate_email($value);
456
-						if ( !$valid_email )
457
-							$err_msg .= htmlentities(
467
+						if ( !$valid_email ) {
468
+													$err_msg .= htmlentities(
458 469
 								sprintf(
459 470
 									__(
460 471
 										'The %1$s field has at least one string that is not a valid email address record.  Valid emails are in the format: "Name <[email protected]>" or "[email protected]" and multiple emails can be separated by a comma.'
@@ -463,6 +474,7 @@  discard block
 block discarded – undo
463 474
 
464 475
 								)
465 476
 							);
477
+						}
466 478
 						break;
467 479
 					default :
468 480
 						break;
@@ -539,7 +551,10 @@  discard block
 block discarded – undo
539 551
 			}
540 552
 		}
541 553
 
542
-		if ( empty( $diff ) ) return FALSE; //there is no diff, we have no invalid shortcodes, so return
554
+		if ( empty( $diff ) ) {
555
+			return FALSE;
556
+		}
557
+		//there is no diff, we have no invalid shortcodes, so return
543 558
 
544 559
 		//made it here? then let's assemble the error message
545 560
 		$invalid_shortcodes = implode( '</strong>,<strong>', $diff );
@@ -561,8 +576,9 @@  discard block
 block discarded – undo
561 576
 
562 577
 		// empty strings will validate because this is how a message template
563 578
 		// for a particular context can be "turned off" (if there is no email then no message)
564
-		if ( empty( $value ) )
565
-			return $validate;
579
+		if ( empty( $value ) ) {
580
+					return $validate;
581
+		}
566 582
 
567 583
 		// first determine if there ARE any shortcodes.
568 584
 		// If there are shortcodes and then later we find that there were no other valid emails
@@ -579,8 +595,9 @@  discard block
 block discarded – undo
579 595
 		// its possible that this message is being "turned off" for a particular context
580 596
 
581 597
 
582
-		if ( !empty($or_val) && empty($value) )
583
-			return $validate;
598
+		if ( !empty($or_val) && empty($value) ) {
599
+					return $validate;
600
+		}
584 601
 
585 602
 		//trim any commas from beginning and end of string ( after whitespace trimmed );
586 603
 		$value = trim( trim($value), ',' );
@@ -601,12 +618,12 @@  discard block
 block discarded – undo
601 618
 			//either its of type "[email protected]", or its of type "fname lname <[email protected]>"
602 619
 			if(is_email($email)){
603 620
 				continue;
604
-			}else{
621
+			} else{
605 622
 				$matches = array();
606 623
 				$validate = preg_match( '/(.*)<(.+)>/', $email, $matches ) ? TRUE : FALSE;
607 624
 				if( $validate && is_email($matches[2])){
608 625
 					continue;
609
-				}else{
626
+				} else{
610 627
 					return false;
611 628
 				}
612 629
 			}
Please login to merge, or discard this patch.
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 	 * @param       $context
120 120
 	 * @throws \EE_Error
121 121
 	 */
122
-	public function __construct( $fields, $context ) {
122
+	public function __construct($fields, $context) {
123 123
 		//check that _m_name and _mt_name have been set by child class otherwise we get out.
124
-		if ( empty($this->_m_name ) || empty( $this->_mt_name) )
124
+		if (empty($this->_m_name) || empty($this->_mt_name))
125 125
 			throw new EE_Error(
126 126
 				__(
127 127
 					'EE_Messages_Validator child classes MUST set the $_m_name and $_mt_name property.  Check that the child class is doing this',
@@ -167,14 +167,14 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	private function _load_objects() {
169 169
 		//load messenger
170
-		$messenger = ucwords( str_replace( '_', ' ', $this->_m_name ) );
171
-		$messenger = str_replace( ' ', '_', $messenger );
172
-		$messenger = 'EE_' . $messenger . '_messenger';
170
+		$messenger = ucwords(str_replace('_', ' ', $this->_m_name));
171
+		$messenger = str_replace(' ', '_', $messenger);
172
+		$messenger = 'EE_'.$messenger.'_messenger';
173 173
 
174
-		if ( ! class_exists( $messenger ) ) {
174
+		if ( ! class_exists($messenger)) {
175 175
 			throw new EE_Error(
176 176
 				sprintf(
177
-					__( 'There is no messenger class for the given string (%s)', 'event_espresso' ),
177
+					__('There is no messenger class for the given string (%s)', 'event_espresso'),
178 178
 					$this->_m_name
179 179
 				)
180 180
 			);
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 		$this->_messenger = new $messenger();
184 184
 
185 185
 		//load message type
186
-		$message_type = ucwords( str_replace( '_', ' ', $this->_mt_name ) );
187
-		$message_type = str_replace( ' ', '_', $message_type );
188
-		$message_type = 'EE_' . $message_type . '_message_type';
186
+		$message_type = ucwords(str_replace('_', ' ', $this->_mt_name));
187
+		$message_type = str_replace(' ', '_', $message_type);
188
+		$message_type = 'EE_'.$message_type.'_message_type';
189 189
 
190
-		if ( !class_exists( $message_type ) ) {
190
+		if ( ! class_exists($message_type)) {
191 191
 			throw new EE_Error(
192 192
 				sprintf(
193
-					__( 'There is no message type class for the given string (%s)', 'event_espresso' ),
193
+					__('There is no message type class for the given string (%s)', 'event_espresso'),
194 194
 					$this->_mt_name
195 195
 				)
196 196
 			);
@@ -227,25 +227,25 @@  discard block
 block discarded – undo
227 227
 		$shortcode_groups = $mt_codes;
228 228
 		$groups_per_field = array();
229 229
 
230
-		foreach ( $msgr_validator as $field => $config ) {
231
-			if ( empty($config) || !isset($config['shortcodes']) )
232
-				continue;  //Nothing to see here.
233
-			$groups_per_field[$field] = array_intersect( $config['shortcodes'], $mt_codes );
234
-			$shortcode_groups = array_merge( $config[ 'shortcodes'], $shortcode_groups );
230
+		foreach ($msgr_validator as $field => $config) {
231
+			if (empty($config) || ! isset($config['shortcodes']))
232
+				continue; //Nothing to see here.
233
+			$groups_per_field[$field] = array_intersect($config['shortcodes'], $mt_codes);
234
+			$shortcode_groups = array_merge($config['shortcodes'], $shortcode_groups);
235 235
 		}
236 236
 
237
-		$shortcode_groups = array_unique( $shortcode_groups);
237
+		$shortcode_groups = array_unique($shortcode_groups);
238 238
 
239 239
 		// okay now we've got our groups.
240 240
 		// Let's get the codes from the objects into an array indexed by group for easy retrieval later.
241 241
 		$codes_from_objs = array();
242 242
 
243
-		foreach ( $shortcode_groups as $group ) {
244
-			$ref = ucwords( str_replace('_', ' ', $group ) );
245
-			$ref = str_replace( ' ', '_', $ref );
246
-			$classname = 'EE_' . $ref . '_Shortcodes';
247
-			if ( class_exists( $classname ) ) {
248
-				$a = new ReflectionClass( $classname );
243
+		foreach ($shortcode_groups as $group) {
244
+			$ref = ucwords(str_replace('_', ' ', $group));
245
+			$ref = str_replace(' ', '_', $ref);
246
+			$classname = 'EE_'.$ref.'_Shortcodes';
247
+			if (class_exists($classname)) {
248
+				$a = new ReflectionClass($classname);
249 249
 				$obj = $a->newInstance();
250 250
 				$codes_from_objs[$group] = $obj->get_shortcodes();
251 251
 			}
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 
255 255
 		//let's just replace the $mt shortcode group indexes with the actual shortcodes (unique)
256 256
 		$final_mt_codes = array();
257
-		foreach ( $mt_codes as $group ) {
258
-			$final_mt_codes = array_merge( $final_mt_codes, $codes_from_objs[$group] );
257
+		foreach ($mt_codes as $group) {
258
+			$final_mt_codes = array_merge($final_mt_codes, $codes_from_objs[$group]);
259 259
 		}
260 260
 
261 261
 		$mt_codes = $final_mt_codes;
@@ -263,60 +263,60 @@  discard block
 block discarded – undo
263 263
 
264 264
 		// k now in this next loop we're going to loop through $msgr_validator again
265 265
 		// and setup the _validators property from the data we've setup so far.
266
-		foreach ( $msgr_validator as $field => $config ) {
266
+		foreach ($msgr_validator as $field => $config) {
267 267
 			//if required shortcode is not in our list of codes for the given field, then we skip this field.
268 268
 			$required = isset($config['required'])
269 269
 				? array_intersect($config['required'], array_keys($mt_codes))
270 270
 				: true;
271
-			if ( empty($required) )
271
+			if (empty($required))
272 272
 				continue;
273 273
 
274 274
 			//If we have an override then we use it to indicate the codes we want.
275
-			if ( isset( $this->_valid_shortcodes_modifier[$context][$field] ) ) {
276
-				$this->_validators[ $field ][ 'shortcodes' ] = $this->_reassemble_valid_shortcodes_from_group(
277
-					$this->_valid_shortcodes_modifier[ $context ][ $field ],
275
+			if (isset($this->_valid_shortcodes_modifier[$context][$field])) {
276
+				$this->_validators[$field]['shortcodes'] = $this->_reassemble_valid_shortcodes_from_group(
277
+					$this->_valid_shortcodes_modifier[$context][$field],
278 278
 					$codes_from_objs
279 279
 				);
280 280
 			}
281 281
 
282 282
 			//if we have specific shortcodes for a field then we need to use them
283
-			else if ( isset( $groups_per_field[$field] ) ) {
284
-				$this->_validators[ $field ][ 'shortcodes' ] = $this->_reassemble_valid_shortcodes_from_group(
285
-					$groups_per_field[ $field ],
283
+			else if (isset($groups_per_field[$field])) {
284
+				$this->_validators[$field]['shortcodes'] = $this->_reassemble_valid_shortcodes_from_group(
285
+					$groups_per_field[$field],
286 286
 					$codes_from_objs
287 287
 				);
288 288
 			}
289 289
 
290 290
 			//if empty config then we're assuming we're just going to use the shortcodes from the message type context
291
-			else if ( empty( $config ) ) {
291
+			else if (empty($config)) {
292 292
 				$this->_validators[$field]['shortcodes'] = $mt_codes;
293 293
 			}
294 294
 
295 295
 			//if we have specific shortcodes then we need to use them
296
-			else if ( isset($config['specific_shortcodes'] ) ) {
296
+			else if (isset($config['specific_shortcodes'])) {
297 297
 				$this->_validators[$field]['shortcodes'] = $config['specific_shortcodes'];
298 298
 			}
299 299
 
300 300
 			//otherwise the shortcodes are what is set by the messenger for that field
301 301
 			else {
302
-				foreach ( $config['shortcodes'] as $group ) {
302
+				foreach ($config['shortcodes'] as $group) {
303 303
 					$this->_validators[$field]['shortcodes'] = isset($this->_validators[$field]['shortcodes'])
304
-						? array_merge( $this->_validators[$field]['shortcodes'], $codes_from_objs[$group] )
304
+						? array_merge($this->_validators[$field]['shortcodes'], $codes_from_objs[$group])
305 305
 						: $codes_from_objs[$group];
306 306
 				}
307 307
 			}
308 308
 
309 309
 			//now let's just make sure that any excluded specific shortcodes are removed.
310 310
 			$specific_excludes = $this->get_specific_shortcode_excludes();
311
-			if ( isset( $specific_excludes[$field] ) ) {
312
-				foreach( $specific_excludes[$field] as $sex ) {
313
-					if ( isset( $this->_validators[$field]['shortcodes'][$sex] ) )
314
-						unset( $this->_validators[$field]['shortcodes'][$sex] );
311
+			if (isset($specific_excludes[$field])) {
312
+				foreach ($specific_excludes[$field] as $sex) {
313
+					if (isset($this->_validators[$field]['shortcodes'][$sex]))
314
+						unset($this->_validators[$field]['shortcodes'][$sex]);
315 315
 				}
316 316
 			}
317 317
 
318 318
 			//hey! don't forget to include the type if present!
319
-			$this->_validators[$field]['type'] = isset( $config['type'] ) ? $config['type'] : NULL;
319
+			$this->_validators[$field]['type'] = isset($config['type']) ? $config['type'] : NULL;
320 320
 		}
321 321
 	}
322 322
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	public function get_specific_shortcode_excludes() {
345 345
 		//specific validator filter
346 346
 		$shortcode_excludes = apply_filters(
347
-			'FHEE__' . get_class( $this ) . '__get_specific_shortcode_excludes;',
347
+			'FHEE__'.get_class($this).'__get_specific_shortcode_excludes;',
348 348
 			$this->_specific_shortcode_excludes,
349 349
 			$this->_context
350 350
 		);
@@ -372,20 +372,20 @@  discard block
 block discarded – undo
372 372
 		//some defaults
373 373
 		$template_fields = $this->_messenger->get_template_fields();
374 374
 		//loop through the fields and check!
375
-		foreach ( $this->_fields as $field => $value ) {
375
+		foreach ($this->_fields as $field => $value) {
376 376
 			$this->_errors[$field] = array();
377 377
 			$err_msg = '';
378 378
 			$field_label = '';
379 379
 			//if field is not present in the _validators array then we continue
380
-			if ( !isset( $this->_validators[$field] ) ) {
381
-				unset( $this->_errors[$field] );
380
+			if ( ! isset($this->_validators[$field])) {
381
+				unset($this->_errors[$field]);
382 382
 				continue;
383 383
 			}
384 384
 
385 385
 			//get the translated field label!
386 386
 			//first check if it's in the main fields list
387
-			if ( isset( $template_fields[$field] ) ) {
388
-				if ( empty( $template_fields[$field] ) )
387
+			if (isset($template_fields[$field])) {
388
+				if (empty($template_fields[$field]))
389 389
 					$field_label = $field; //most likely the field is found in the 'extra' array.
390 390
 				else
391 391
 					$field_label = $template_fields[$field]['label'];
@@ -393,16 +393,16 @@  discard block
 block discarded – undo
393 393
 
394 394
 			// if field label is empty OR is equal to the current field
395 395
 			// then we need to loop through the 'extra' fields in the template_fields config (if present)
396
-			if ( isset( $template_fields['extra'] ) && ( empty($field_label) ) || $field_label == $field ) {
397
-				foreach( $template_fields['extra'] as $main_field => $secondary_field ) {
398
-					foreach ( $secondary_field as $name => $values ) {
399
-						if ( $name == $field ) {
396
+			if (isset($template_fields['extra']) && (empty($field_label)) || $field_label == $field) {
397
+				foreach ($template_fields['extra'] as $main_field => $secondary_field) {
398
+					foreach ($secondary_field as $name => $values) {
399
+						if ($name == $field) {
400 400
 							$field_label = $values['label'];
401 401
 						}
402 402
 
403 403
 						// if we've got a 'main' secondary field, let's see if that matches what field we're on
404 404
 						// which means it contains the label for this field.
405
-						if ( $name == 'main' && $main_field == $field_label )
405
+						if ($name == 'main' && $main_field == $field_label)
406 406
 							$field_label = $values['label'];
407 407
 					}
408 408
 				}
@@ -410,36 +410,36 @@  discard block
 block discarded – undo
410 410
 
411 411
 			//field is present. Let's validate shortcodes first (but only if shortcodes present).
412 412
 			if (
413
-				isset( $this->_validators[ $field ][ 'shortcodes' ] )
414
-				&& ! empty( $this->_validators[ $field ][ 'shortcodes' ] )
413
+				isset($this->_validators[$field]['shortcodes'])
414
+				&& ! empty($this->_validators[$field]['shortcodes'])
415 415
 			) {
416
-				$invalid_shortcodes = $this->_invalid_shortcodes( $value, $this->_validators[$field]['shortcodes'] );
416
+				$invalid_shortcodes = $this->_invalid_shortcodes($value, $this->_validators[$field]['shortcodes']);
417 417
 				// if true then that means there is a returned error message
418 418
 				// that we'll need to add to the _errors array for this field.
419
-				if ( $invalid_shortcodes ) {
419
+				if ($invalid_shortcodes) {
420 420
 					$v_s = array_keys($this->_validators[$field]['shortcodes']);
421 421
 					$err_msg = sprintf(
422 422
 						__(
423 423
 							'%3$sThe following shortcodes were found in the "%1$s" field that ARE not valid: %2$s%4$s',
424 424
 							'event_espresso'
425 425
 						),
426
-						'<strong>' . $field_label . '</strong>',
426
+						'<strong>'.$field_label.'</strong>',
427 427
 						$invalid_shortcodes,
428 428
 						'<p>',
429 429
 						'</p >'
430 430
 					);
431 431
 					$err_msg .= sprintf(
432
-						__( '%2$sValid shortcodes for this field are: %1$s%3$s', 'event_espresso' ),
433
-						implode( ', ', $v_s )
432
+						__('%2$sValid shortcodes for this field are: %1$s%3$s', 'event_espresso'),
433
+						implode(', ', $v_s)
434 434
 					);
435 435
 				}
436 436
 			}
437 437
 
438 438
 			//if there's a "type" to be validated then let's do that too.
439
-			if ( isset( $this->_validators[$field]['type'] ) && !empty( $this->_validators[$field]['type'] ) ) {
440
-				switch ( $this->_validators[$field]['type'] ) {
439
+			if (isset($this->_validators[$field]['type']) && ! empty($this->_validators[$field]['type'])) {
440
+				switch ($this->_validators[$field]['type']) {
441 441
 					case 'number' :
442
-						if ( !is_numeric($value) )
442
+						if ( ! is_numeric($value))
443 443
 							$err_msg .= sprintf(
444 444
 								__(
445 445
 									'%3$sThe %1$s field is supposed to be a number. The value given (%2$s)  is not.  Please double-check and make sure the field contains a number%4$s',
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 						break;
454 454
 					case 'email' :
455 455
 						$valid_email = $this->_validate_email($value);
456
-						if ( !$valid_email )
456
+						if ( ! $valid_email)
457 457
 							$err_msg .= htmlentities(
458 458
 								sprintf(
459 459
 									__(
@@ -470,23 +470,23 @@  discard block
 block discarded – undo
470 470
 			}
471 471
 
472 472
 			//if $err_msg isn't empty let's setup the _errors array for this field.
473
-			if ( !empty($err_msg ) ) {
473
+			if ( ! empty($err_msg)) {
474 474
 				$this->_errors[$field]['msg'] = $err_msg;
475 475
 			} else {
476
-				unset( $this->_errors[$field] );
476
+				unset($this->_errors[$field]);
477 477
 			}
478 478
 		}
479 479
 
480 480
 		// if we have ANY errors, then we want to make sure we return the values
481 481
 		// for ALL the fields so the user doesn't have to retype them all.
482
-		if ( !empty( $this->_errors ) ) {
483
-			foreach ( $this->_fields as $field => $value ) {
482
+		if ( ! empty($this->_errors)) {
483
+			foreach ($this->_fields as $field => $value) {
484 484
 				$this->_errors[$field]['value'] = stripslashes($value);
485 485
 			}
486 486
 		}
487 487
 
488 488
 		//return any errors or just TRUE if everything validates
489
-		return empty( $this->_errors ) ? TRUE : $this->_errors;
489
+		return empty($this->_errors) ? TRUE : $this->_errors;
490 490
 	}
491 491
 
492 492
 
@@ -499,10 +499,10 @@  discard block
 block discarded – undo
499 499
 	 * @param  array $codes_from_objs All the codes available.
500 500
 	 * @return array                   an array of actual shortcodes (that will be used for validation).
501 501
 	 */
502
-	private function _reassemble_valid_shortcodes_from_group( $groups, $codes_from_objs ) {
502
+	private function _reassemble_valid_shortcodes_from_group($groups, $codes_from_objs) {
503 503
 		$shortcodes = array();
504
-		foreach ( $groups as $group ) {
505
-			$shortcodes = array_merge( $shortcodes, $codes_from_objs[$group] );
504
+		foreach ($groups as $group) {
505
+			$shortcodes = array_merge($shortcodes, $codes_from_objs[$group]);
506 506
 		}
507 507
 		return $shortcodes;
508 508
 	}
@@ -521,29 +521,29 @@  discard block
 block discarded – undo
521 521
 	 */
522 522
 	protected function _invalid_shortcodes($value, $valid_shortcodes) {
523 523
 		//first we need to go through the string and get the shortcodes in the string
524
-		preg_match_all( '/(\[.+?\])/', $value, $matches );
524
+		preg_match_all('/(\[.+?\])/', $value, $matches);
525 525
 		$incoming_shortcodes = (array) $matches[0];
526 526
 
527 527
 		//get a diff of the shortcodes in the string vs the valid shortcodes
528
-		$diff = array_diff( $incoming_shortcodes, array_keys($valid_shortcodes) );
528
+		$diff = array_diff($incoming_shortcodes, array_keys($valid_shortcodes));
529 529
 
530 530
 		//we need to account for custom codes so let's loop through the diff and remove any of those type of codes
531
-		foreach ( $diff as $ind => $code ) {
532
-			if ( preg_match('/(\[[A-Za-z0-9\_]+_\*)/', $code ) ) {
531
+		foreach ($diff as $ind => $code) {
532
+			if (preg_match('/(\[[A-Za-z0-9\_]+_\*)/', $code)) {
533 533
 				//strip the shortcode so we just have the BASE string (i.e. [ANSWER_*] )
534 534
 				$dynamic_sc = preg_replace('/(_\*+.+)/', '_*]', $code);
535 535
 				//does this exist in the $valid_shortcodes?  If so then unset.
536
-				if ( isset( $valid_shortcodes[$dynamic_sc] ) ) {
537
-					unset( $diff[$ind] );
536
+				if (isset($valid_shortcodes[$dynamic_sc])) {
537
+					unset($diff[$ind]);
538 538
 				}
539 539
 			}
540 540
 		}
541 541
 
542
-		if ( empty( $diff ) ) return FALSE; //there is no diff, we have no invalid shortcodes, so return
542
+		if (empty($diff)) return FALSE; //there is no diff, we have no invalid shortcodes, so return
543 543
 
544 544
 		//made it here? then let's assemble the error message
545
-		$invalid_shortcodes = implode( '</strong>,<strong>', $diff );
546
-		$invalid_shortcodes = '<strong>' . $invalid_shortcodes . '</strong>';
545
+		$invalid_shortcodes = implode('</strong>,<strong>', $diff);
546
+		$invalid_shortcodes = '<strong>'.$invalid_shortcodes.'</strong>';
547 547
 		return $invalid_shortcodes;
548 548
 	}
549 549
 
@@ -555,13 +555,13 @@  discard block
 block discarded – undo
555 555
 	 * @param  string $value incoming value to validate
556 556
 	 * @return bool        true if the string validates, false if it doesn't
557 557
 	 */
558
-	protected function _validate_email( $value ) {
558
+	protected function _validate_email($value) {
559 559
 		$validate = TRUE;
560 560
 		$or_val = $value;
561 561
 
562 562
 		// empty strings will validate because this is how a message template
563 563
 		// for a particular context can be "turned off" (if there is no email then no message)
564
-		if ( empty( $value ) )
564
+		if (empty($value))
565 565
 			return $validate;
566 566
 
567 567
 		// first determine if there ARE any shortcodes.
@@ -579,19 +579,19 @@  discard block
 block discarded – undo
579 579
 		// its possible that this message is being "turned off" for a particular context
580 580
 
581 581
 
582
-		if ( !empty($or_val) && empty($value) )
582
+		if ( ! empty($or_val) && empty($value))
583 583
 			return $validate;
584 584
 
585 585
 		//trim any commas from beginning and end of string ( after whitespace trimmed );
586
-		$value = trim( trim($value), ',' );
586
+		$value = trim(trim($value), ',');
587 587
 
588 588
 
589 589
 		//next we need to split up the string if its comma delimited.
590 590
 		$emails = explode(',', $value);
591 591
 		$empty = FALSE; //used to indicate that there is an empty comma.
592 592
 		//now let's loop through the emails and do our checks
593
-		foreach ( $emails as $email ) {
594
-			if ( empty($email) ) {
593
+		foreach ($emails as $email) {
594
+			if (empty($email)) {
595 595
 				$empty = TRUE;
596 596
 				continue;
597 597
 			}
@@ -599,20 +599,20 @@  discard block
 block discarded – undo
599 599
 			//trim whitespace
600 600
 			$email = trim($email);
601 601
 			//either its of type "[email protected]", or its of type "fname lname <[email protected]>"
602
-			if(is_email($email)){
602
+			if (is_email($email)) {
603 603
 				continue;
604
-			}else{
604
+			} else {
605 605
 				$matches = array();
606
-				$validate = preg_match( '/(.*)<(.+)>/', $email, $matches ) ? TRUE : FALSE;
607
-				if( $validate && is_email($matches[2])){
606
+				$validate = preg_match('/(.*)<(.+)>/', $email, $matches) ? TRUE : FALSE;
607
+				if ($validate && is_email($matches[2])) {
608 608
 					continue;
609
-				}else{
609
+				} else {
610 610
 					return false;
611 611
 				}
612 612
 			}
613 613
 		}
614 614
 
615
-		$validate = $empty && !$has_shortcodes ? FALSE : $validate;
615
+		$validate = $empty && ! $has_shortcodes ? FALSE : $validate;
616 616
 
617 617
 		return $validate;
618 618
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	 * @throws Exception
629 629
 	 * @return mixed
630 630
 	 */
631
-	public function __get( $property ) {
631
+	public function __get($property) {
632 632
 		$expected_properties_map = array(
633 633
 			/**
634 634
 			 * @deprecated 4.9.0
@@ -640,15 +640,15 @@  discard block
 block discarded – undo
640 640
 			'_MSGTYP' => '_message_type'
641 641
 		);
642 642
 
643
-		if ( isset( $expected_properties_map[ $property ] ) ) {
644
-			return $this->{$expected_properties_map[ $property ]};
643
+		if (isset($expected_properties_map[$property])) {
644
+			return $this->{$expected_properties_map[$property]};
645 645
 		}
646 646
 
647 647
 		throw new Exception(
648 648
 			sprintf(
649
-				__( 'The property %1$s being requested on %2$s does not exist', 'event_espresso' ),
649
+				__('The property %1$s being requested on %2$s does not exist', 'event_espresso'),
650 650
 				$property,
651
-				get_class( $this )
651
+				get_class($this)
652 652
 			)
653 653
 		);
654 654
 	}
Please login to merge, or discard this patch.