Completed
Branch BETA-4.9-messages-queue-fixed (941081)
by
unknown
17:38 queued 10s
created
admin_pages/messages/Messages_Admin_Page.core.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 *
113 113
 	 * @throws EE_Error
114
-	*/
114
+	 */
115 115
 	protected function _load_active_messenger_objects() {
116 116
 		foreach ( $this->_active_messengers as $messenger => $values ) {
117 117
 			$ref = ucwords( str_replace( '_' , ' ', $messenger) );
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * loads messenger objects into the $_active_messengers property (so we can access the needed methods)
134 134
 	 *
135 135
 	 * @throws EE_Error
136
-	*/
136
+	 */
137 137
 	protected function _load_active_message_type_objects() {
138 138
 		if ( empty($this->_active_message_types) ) {return;}
139 139
 		foreach ( $this->_active_message_types as $message_type ) {
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
 
185 185
 	/**
186 186
 	 * 		an array for storing key => value pairs of request actions and their corresponding methods
187
-	*		@access protected
188
-	*		@return void
189
-	*/
187
+	 *		@access protected
188
+	 *		@return void
189
+	 */
190 190
 	protected function _set_page_routes() {
191 191
 		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
192 192
 		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
@@ -486,8 +486,8 @@  discard block
 block discarded – undo
486 486
 	protected function _add_screen_options_global_mtps() {
487 487
 		/**
488 488
 		 * Note: the reason for the value swap here on $this->_admin_page_title is because $this->_per_page_screen_options
489
-         * uses the $_admin_page_title property and we want different outputs in the different spots.
490
-         */
489
+		 * uses the $_admin_page_title property and we want different outputs in the different spots.
490
+		 */
491 491
 		$page_title = $this->_admin_page_title;
492 492
 		$this->_admin_page_title = __('Global Message Templates', 'event_espresso');
493 493
 		$this->_per_page_screen_option();
@@ -697,9 +697,9 @@  discard block
 block discarded – undo
697 697
 		$common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' )
698 698
 			? array(
699 699
 				'generate_now' => __( 'Generate Now', 'event_espresso' ),
700
-		        'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ),
701
-		        'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ),
702
-		        'send_now' => __( 'Send Now', 'event_espresso' )
700
+				'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ),
701
+				'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ),
702
+				'send_now' => __( 'Send Now', 'event_espresso' )
703 703
 				)
704 704
 			: array();
705 705
 
@@ -710,10 +710,10 @@  discard block
 block discarded – undo
710 710
 
711 711
 		$this->_views = array(
712 712
 			 'all' => array(
713
-			    'slug' => 'all',
714
-			    'label' => __( 'All', 'event_espresso' ),
715
-			    'count' => 0,
716
-			    'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action )
713
+				'slug' => 'all',
714
+				'label' => __( 'All', 'event_espresso' ),
715
+				'count' => 0,
716
+				'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action )
717 717
 			 )
718 718
 		);
719 719
 
@@ -1359,8 +1359,8 @@  discard block
 block discarded – undo
1359 1359
 			 $GRP_ID,
1360 1360
 			 false,
1361 1361
 			 add_query_arg(
1362
-			    array( 'action' => 'global_mtps' ),
1363
-			    $this->_admin_base_url
1362
+				array( 'action' => 'global_mtps' ),
1363
+				$this->_admin_base_url
1364 1364
 			 )
1365 1365
 		);
1366 1366
 
@@ -1750,14 +1750,14 @@  discard block
 block discarded – undo
1750 1750
 
1751 1751
 
1752 1752
 	/**
1753
-     * This returns the shortcode selector skeleton for a given context and field.
1754
-     *
1755
-     * @since 4.9.rc.000
1756
-     *
1753
+	 * This returns the shortcode selector skeleton for a given context and field.
1754
+	 *
1755
+	 * @since 4.9.rc.000
1756
+	 *
1757 1757
 	 * @param string $field  The name of the field retrieving shortcodes for.
1758
-     * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1759
-     * @return string
1760
-    */
1758
+	 * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1759
+	 * @return string
1760
+	 */
1761 1761
 	protected function _get_shortcode_selector( $field, $linked_input_id ) {
1762 1762
 		$template_args = array(
1763 1763
 			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
@@ -2316,9 +2316,9 @@  discard block
 block discarded – undo
2316 2316
 
2317 2317
 	/**
2318 2318
 	 * 	_learn_more_about_message_templates_link
2319
-	*	@access protected
2320
-	*	@return string
2321
-	*/
2319
+	 *	@access protected
2320
+	 *	@return string
2321
+	 */
2322 2322
 	protected function _learn_more_about_message_templates_link() {
2323 2323
 		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2324 2324
 	}
@@ -3029,10 +3029,10 @@  discard block
 block discarded – undo
3029 3029
 
3030 3030
 	/**
3031 3031
 	 * This immediately generates any EE_Message ID's that are selected that are EEM_Message::status_incomplete
3032
-     * However, this does not send immediately, it just queues for sending.
3033
-     *
3034
-     * @since 4.9.0
3035
-     */
3032
+	 * However, this does not send immediately, it just queues for sending.
3033
+	 *
3034
+	 * @since 4.9.0
3035
+	 */
3036 3036
 	protected function _generate_now() {
3037 3037
 		$msg_ids = $this->_get_msg_ids_from_request();
3038 3038
 		EED_Messages::generate_now( $msg_ids );
@@ -3043,11 +3043,11 @@  discard block
 block discarded – undo
3043 3043
 
3044 3044
 	/**
3045 3045
 	 * This immediately generates AND sends any EE_Message's selected that are EEM_Message::status_incomplete or that are
3046
-     * EEM_Message::status_resend or EEM_Message::status_idle
3047
-     *
3048
-     * @since 4.9.0
3049
-     *
3050
-     */
3046
+	 * EEM_Message::status_resend or EEM_Message::status_idle
3047
+	 *
3048
+	 * @since 4.9.0
3049
+	 *
3050
+	 */
3051 3051
 	protected function _generate_and_send_now() {
3052 3052
 		$this->_generate_now();
3053 3053
 		$this->_send_now();
@@ -3060,9 +3060,9 @@  discard block
 block discarded – undo
3060 3060
 
3061 3061
 	/**
3062 3062
 	 * This queues any EEM_Message::status_sent EE_Message ids in the request for resending.
3063
-     *
3064
-     * @since 4.9.0
3065
-     */
3063
+	 *
3064
+	 * @since 4.9.0
3065
+	 */
3066 3066
 	protected function _queue_for_resending() {
3067 3067
 		$msg_ids = $this->_get_msg_ids_from_request();
3068 3068
 		EED_Messages::queue_for_resending( $msg_ids );
@@ -3074,9 +3074,9 @@  discard block
 block discarded – undo
3074 3074
 
3075 3075
 	/**
3076 3076
 	 *  This sends immediately any EEM_Message::status_idle or EEM_Message::status_resend messages in the queue
3077
-     *
3078
-     *  @since 4.9.0
3079
-     */
3077
+	 *
3078
+	 *  @since 4.9.0
3079
+	 */
3080 3080
 	protected function _send_now() {
3081 3081
 		$msg_ids = $this->_get_msg_ids_from_request();
3082 3082
 		EED_Messages::send_now( $msg_ids );
@@ -3088,9 +3088,9 @@  discard block
 block discarded – undo
3088 3088
 
3089 3089
 	/**
3090 3090
 	 * Deletes EE_Messages for IDs in the request.
3091
-     *
3092
-     * @since 4.9.0
3093
-     */
3091
+	 *
3092
+	 * @since 4.9.0
3093
+	 */
3094 3094
 	protected function _delete_ee_messages() {
3095 3095
 		$msg_ids = $this->_get_msg_ids_from_request();
3096 3096
 		$deleted_count = 0;
@@ -3119,9 +3119,9 @@  discard block
 block discarded – undo
3119 3119
 
3120 3120
 	/**
3121 3121
 	 *  This looks for 'MSG_ID' key in the request and returns an array of MSG_ID's if present.
3122
-     *  @since 4.9.0
3123
-     *  @return array
3124
-     */
3122
+	 *  @since 4.9.0
3123
+	 *  @return array
3124
+	 */
3125 3125
 	protected function _get_msg_ids_from_request() {
3126 3126
 		if ( ! isset( $this->_req_data['MSG_ID'] ) ) {
3127 3127
 			return array();
Please login to merge, or discard this patch.
Spacing   +572 added lines, -572 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
2
-	{exit('NO direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2
+	{exit('NO direct script access allowed'); }
3 3
 
4 4
 /**
5 5
  * Event Espresso
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 	/**
71 71
 	 * @param bool $routing
72 72
 	 */
73
-	public function __construct( $routing = true ) {
73
+	public function __construct($routing = true) {
74 74
 		//make sure MSG Template helper is loaded.
75
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
75
+		EE_Registry::instance()->load_helper('MSG_Template');
76 76
 		//make sure messages autoloader is running
77 77
 		EED_Messages::set_autoloaders();
78
-		parent::__construct( $routing );
78
+		parent::__construct($routing);
79 79
 	}
80 80
 
81 81
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();
91 91
 
92
-		$this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : null;
92
+		$this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : null;
93 93
 
94
-		EE_Registry::instance()->load_lib( 'messages' );
94
+		EE_Registry::instance()->load_lib('messages');
95 95
 		//we're also going to set the active messengers and active message types in here.
96 96
 		$this->_active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
97
-		$this->_active_messengers = !empty($this->_active_messengers) ?  $this->_active_messengers : array();
98
-		$this->_active_message_types = !empty($this->_active_messenger) && !empty($this->_active_messengers[$this->_active_messenger]) && ! empty(  $this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types'] ) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types']) : array();
97
+		$this->_active_messengers = ! empty($this->_active_messengers) ? $this->_active_messengers : array();
98
+		$this->_active_message_types = ! empty($this->_active_messenger) && ! empty($this->_active_messengers[$this->_active_messenger]) && ! empty($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) : array();
99 99
 
100 100
 
101 101
 		//what about saving the objects in the active_messengers and active_message_types?
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 	 * @throws EE_Error
114 114
 	*/
115 115
 	protected function _load_active_messenger_objects() {
116
-		foreach ( $this->_active_messengers as $messenger => $values ) {
117
-			$ref = ucwords( str_replace( '_' , ' ', $messenger) );
118
-			$ref = str_replace( ' ', '_', $ref );
119
-			$classname = 'EE_' . $ref . '_messenger';
120
-			require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );
121
-			if ( !class_exists($classname) )
122
-				{throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );}
123
-
124
-			$a = new ReflectionClass( $classname );
116
+		foreach ($this->_active_messengers as $messenger => $values) {
117
+			$ref = ucwords(str_replace('_', ' ', $messenger));
118
+			$ref = str_replace(' ', '_', $ref);
119
+			$classname = 'EE_'.$ref.'_messenger';
120
+			require_once(EE_LIBRARIES.'messages'.DS.'messenger'.DS.$classname.'.class.php');
121
+			if ( ! class_exists($classname))
122
+				{throw new EE_Error(sprintf(__('There is no messenger for the given classname (%s)', 'event_espresso'), $classname)); }
123
+
124
+			$a = new ReflectionClass($classname);
125 125
 			$this->_active_messengers[$messenger]['obj'] = $a->newInstance();
126 126
 		}
127 127
 	}
@@ -135,16 +135,16 @@  discard block
 block discarded – undo
135 135
 	 * @throws EE_Error
136 136
 	*/
137 137
 	protected function _load_active_message_type_objects() {
138
-		if ( empty($this->_active_message_types) ) {return;}
139
-		foreach ( $this->_active_message_types as $message_type ) {
140
-			$ref = ucwords( str_replace( '_' , ' ', $message_type) );
141
-			$ref = str_replace( ' ', '_', $ref );
142
-			$classname = 'EE_' . $ref . '_message_type';
138
+		if (empty($this->_active_message_types)) {return; }
139
+		foreach ($this->_active_message_types as $message_type) {
140
+			$ref = ucwords(str_replace('_', ' ', $message_type));
141
+			$ref = str_replace(' ', '_', $ref);
142
+			$classname = 'EE_'.$ref.'_message_type';
143 143
 
144
-			if ( !class_exists($classname) )
145
-				{throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );}
144
+			if ( ! class_exists($classname))
145
+				{throw new EE_Error(sprintf(__('There is no message type for the given classname (%s)', 'event_espresso'), $classname)); }
146 146
 
147
-			$a = new ReflectionClass( $classname );
147
+			$a = new ReflectionClass($classname);
148 148
 			$this->_active_message_types[$message_type]['obj'] = $a->newInstance();
149 149
 		}
150 150
 	}
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 
153 153
 
154 154
 	protected function _ajax_hooks() {
155
-		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) );
156
-		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') );
157
-		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') );
158
-		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) );
159
-		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) );
155
+		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle'));
156
+		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle'));
157
+		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings'));
158
+		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form'));
159
+		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack'));
160 160
 	}
161 161
 
162 162
 
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
 	*		@return void
189 189
 	*/
190 190
 	protected function _set_page_routes() {
191
-		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
192
-		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
193
-		$msg_id = ! empty( $this->_req_data['MSG_ID'] ) && ! is_array( $this->_req_data['MSG_ID'] ) ? $this->_req_data['MSG_ID'] : 0;
191
+		$grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
192
+		$grp_id = empty($grp_id) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $grp_id;
193
+		$msg_id = ! empty($this->_req_data['MSG_ID']) && ! is_array($this->_req_data['MSG_ID']) ? $this->_req_data['MSG_ID'] : 0;
194 194
 
195 195
 		$this->_page_routes = array(
196 196
 				'default' => array(
@@ -230,35 +230,35 @@  discard block
 block discarded – undo
230 230
 				'insert_message_template' => array(
231 231
 					'func' => '_insert_or_update_message_template',
232 232
 					'capability' => 'ee_edit_messages',
233
-					'args' => array( 'new_template' => true ),
233
+					'args' => array('new_template' => true),
234 234
 					'noheader' => true
235 235
 					 ),
236 236
 				'update_message_template' => array(
237 237
 					'func' => '_insert_or_update_message_template',
238 238
 					'capability' => 'ee_edit_message',
239 239
 					'obj_id' => $grp_id,
240
-					'args' => array( 'new_template' => false ),
240
+					'args' => array('new_template' => false),
241 241
 					'noheader' => true
242 242
 					),
243 243
 				'trash_message_template' => array(
244 244
 					'func' => '_trash_or_restore_message_template',
245 245
 					'capability' => 'ee_delete_message',
246 246
 					'obj_id' => $grp_id,
247
-					'args' => array( 'trash' => true, 'all' => true ),
247
+					'args' => array('trash' => true, 'all' => true),
248 248
 					'noheader' => true
249 249
 					),
250 250
 				'trash_message_template_context' => array(
251 251
 					'func' => '_trash_or_restore_message_template',
252 252
 					'capability' => 'ee_delete_message',
253 253
 					'obj_id' => $grp_id,
254
-					'args' => array( 'trash' => true ),
254
+					'args' => array('trash' => true),
255 255
 					'noheader' => true
256 256
 					),
257 257
 				'restore_message_template' => array(
258 258
 					'func' => '_trash_or_restore_message_template',
259 259
 					'capability' => 'ee_delete_message',
260 260
 					'obj_id' => $grp_id,
261
-					'args' => array( 'trash' => false, 'all' => true ),
261
+					'args' => array('trash' => false, 'all' => true),
262 262
 					'noheader' => true
263 263
 					),
264 264
 				'restore_message_template_context' => array(
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 					'order' => 10
335 335
 					),
336 336
 				'list_table' => 'EE_Message_List_Table',
337
-				'qtips' => array( 'EE_Message_List_Table_Tips' ),
337
+				'qtips' => array('EE_Message_List_Table_Tips'),
338 338
 				'require_nonce' => false
339 339
 				),
340 340
 			'global_mtps' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 						'filename' => 'messages_overview_other',
374 374
 					),
375 375
 				),
376
-				'help_tour' => array( 'Messages_Overview_Help_Tour' ),
376
+				'help_tour' => array('Messages_Overview_Help_Tour'),
377 377
 				'require_nonce' => false
378 378
 				),
379 379
 			'custom_mtps' => array(
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 					),
409 409
 				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'),
410 410
 				'has_metaboxes' => true,
411
-				'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),
411
+				'help_tour' => array('Message_Templates_Edit_Help_Tour'),
412 412
 				'help_tabs' => array(
413 413
 						'edit_message_template' => array(
414 414
 							'title' => __('Message Template Editor', 'event_espresso'),
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 							'filename' => 'messages_settings_messengers'
465 465
 							),
466 466
 					),
467
-				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
467
+				'help_tour' => array('Messages_Settings_Help_Tour'),
468 468
 				'require_nonce' => false
469 469
 				)
470 470
 		);
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 
499 499
 
500 500
 	protected function _add_screen_options_default() {
501
-		$this->_admin_page_title = __( 'Message Activity', 'event_espresso' );
501
+		$this->_admin_page_title = __('Message Activity', 'event_espresso');
502 502
 		$this->_per_page_screen_option();
503 503
 	}
504 504
 
@@ -520,43 +520,43 @@  discard block
 block discarded – undo
520 520
 
521 521
 
522 522
 	public function messages_help_tab() {
523
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php';
524
-		EEH_Template::display_template( $templatepath, array());
523
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php';
524
+		EEH_Template::display_template($templatepath, array());
525 525
 	}
526 526
 
527 527
 
528 528
 	public function messengers_help_tab() {
529
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php';
530
-		EEH_Template::display_template( $templatepath, array());
529
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php';
530
+		EEH_Template::display_template($templatepath, array());
531 531
 	}
532 532
 
533 533
 
534 534
 	public function message_types_help_tab() {
535
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php';
536
-		EEH_Template::display_template( $templatepath, array());
535
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php';
536
+		EEH_Template::display_template($templatepath, array());
537 537
 	}
538 538
 
539 539
 
540 540
 	public function messages_overview_help_tab() {
541
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php';
542
-		EEH_Template::display_template( $templatepath, array());
541
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php';
542
+		EEH_Template::display_template($templatepath, array());
543 543
 	}
544 544
 
545 545
 
546 546
 	public function message_templates_help_tab() {
547
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php';
548
-		EEH_Template::display_template( $templatepath, array());
547
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php';
548
+		EEH_Template::display_template($templatepath, array());
549 549
 	}
550 550
 
551 551
 
552 552
 	public function edit_message_template_help_tab() {
553
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php';
554
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
555
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
556
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
557
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
558
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
559
-		EEH_Template::display_template( $templatepath, $args);
553
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php';
554
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
555
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
556
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
557
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
558
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
559
+		EEH_Template::display_template($templatepath, $args);
560 560
 	}
561 561
 
562 562
 
@@ -564,25 +564,25 @@  discard block
 block discarded – undo
564 564
 	public function message_template_shortcodes_help_tab() {
565 565
 		$this->_set_shortcodes();
566 566
 		$args['shortcodes'] = $this->_shortcodes;
567
-		$template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php';
568
-		EEH_Template::display_template( $template_path, $args );
567
+		$template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php';
568
+		EEH_Template::display_template($template_path, $args);
569 569
 	}
570 570
 
571 571
 
572 572
 
573 573
 	public function preview_message_help_tab() {
574
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php';
575
-		EEH_Template::display_template( $templatepath, array());
574
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php';
575
+		EEH_Template::display_template($templatepath, array());
576 576
 	}
577 577
 
578 578
 
579 579
 	public function settings_help_tab() {
580
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php';
581
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
582
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
580
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php';
581
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
582
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
583 583
 		$args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>';
584 584
 		$args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>';
585
-		EEH_Template::display_template( $templatepath, $args);
585
+		EEH_Template::display_template($templatepath, $args);
586 586
 	}
587 587
 
588 588
 
@@ -590,31 +590,31 @@  discard block
 block discarded – undo
590 590
 
591 591
 
592 592
 	public function load_scripts_styles() {
593
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
593
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
594 594
 		wp_enqueue_style('espresso_ee_msg');
595 595
 
596
-		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true );
597
-		wp_register_script( 'ee-msg-list-table-js', EE_MSG_ASSETS_URL. 'ee_message_admin_list_table.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION );
596
+		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true);
597
+		wp_register_script('ee-msg-list-table-js', EE_MSG_ASSETS_URL.'ee_message_admin_list_table.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION);
598 598
 	}
599 599
 
600 600
 
601 601
 
602 602
 	public function load_scripts_styles_default() {
603
-		wp_enqueue_script( 'ee-msg-list-table-js' );
603
+		wp_enqueue_script('ee-msg-list-table-js');
604 604
 	}
605 605
 
606 606
 
607 607
 
608 608
 
609 609
 
610
-	public function wp_editor_css( $mce_css ) {
610
+	public function wp_editor_css($mce_css) {
611 611
 		//if we're on the edit_message_template route
612
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
612
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
613 613
 			$message_type_name = $this->_active_message_type_name;
614 614
 
615 615
 			//we're going to REPLACE the existing mce css
616 616
 			//we need to get the css file location from the active messenger
617
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation );
617
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation);
618 618
 		}
619 619
 
620 620
 		return $mce_css;
@@ -632,37 +632,37 @@  discard block
 block discarded – undo
632 632
 			$this->_message_template_group->messenger_obj()->label['singular'],
633 633
 			$this->_message_template_group->message_type_obj()->label['singular']
634 634
 		);
635
-		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' );
635
+		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso');
636 636
 
637
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
637
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
638 638
 
639 639
 		wp_enqueue_script('ee_admin_js');
640 640
 		wp_enqueue_script('ee_msgs_edit_js');
641 641
 
642 642
 		//add in special css for tiny_mce
643
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
643
+		add_filter('mce_css', array($this, 'wp_editor_css'));
644 644
 	}
645 645
 
646 646
 
647 647
 
648 648
 	public function load_scripts_styles_display_preview_message() {
649 649
 		$this->_set_message_template_group();
650
-		if ( isset( $this->_req_data['messenger'] ) ) {
650
+		if (isset($this->_req_data['messenger'])) {
651 651
 			$this->_active_messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
652 652
 		}
653 653
 
654
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
654
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
655 655
 
656 656
 
657
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, true, 'preview', $this->_variation ) );
657
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'preview', $this->_variation));
658 658
 	}
659 659
 
660 660
 
661 661
 
662 662
 	public function load_scripts_styles_settings() {
663
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
664
-		wp_enqueue_style( 'ee-text-links' );
665
-		wp_enqueue_style( 'ee-message-settings' );
663
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
664
+		wp_enqueue_style('ee-text-links');
665
+		wp_enqueue_style('ee-message-settings');
666 666
 
667 667
 		wp_enqueue_script('ee-messages-settings');
668 668
 	}
@@ -692,37 +692,37 @@  discard block
 block discarded – undo
692 692
 	 * set views array for message queue list table
693 693
 	 */
694 694
 	public function _set_list_table_views_default() {
695
-		EE_Registry::instance()->load_helper( 'Template' );
695
+		EE_Registry::instance()->load_helper('Template');
696 696
 
697
-		$common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' )
697
+		$common_bulk_actions = EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'message_list_table_bulk_actions')
698 698
 			? array(
699
-				'generate_now' => __( 'Generate Now', 'event_espresso' ),
700
-		        'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ),
701
-		        'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ),
702
-		        'send_now' => __( 'Send Now', 'event_espresso' )
699
+				'generate_now' => __('Generate Now', 'event_espresso'),
700
+		        'generate_and_send_now' => __('Generate and Send Now', 'event_espresso'),
701
+		        'queue_for_resending' => __('Queue for Resending', 'event_espresso'),
702
+		        'send_now' => __('Send Now', 'event_espresso')
703 703
 				)
704 704
 			: array();
705 705
 
706
-		$delete_bulk_action = EE_Registry::instance()->CAP->current_user_can( 'ee_delete_messages', 'message_list_table_bulk_actions' )
707
-			? array( 'delete_ee_messages' => __( 'Delete Messages', 'event_espresso' ) )
706
+		$delete_bulk_action = EE_Registry::instance()->CAP->current_user_can('ee_delete_messages', 'message_list_table_bulk_actions')
707
+			? array('delete_ee_messages' => __('Delete Messages', 'event_espresso'))
708 708
 			: array();
709 709
 
710 710
 
711 711
 		$this->_views = array(
712 712
 			 'all' => array(
713 713
 			    'slug' => 'all',
714
-			    'label' => __( 'All', 'event_espresso' ),
714
+			    'label' => __('All', 'event_espresso'),
715 715
 			    'count' => 0,
716
-			    'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action )
716
+			    'bulk_action' => array_merge($common_bulk_actions, $delete_bulk_action)
717 717
 			 )
718 718
 		);
719 719
 
720 720
 
721
-		foreach ( EEM_Message::instance()->all_statuses() as $status ) {
721
+		foreach (EEM_Message::instance()->all_statuses() as $status) {
722 722
 			$status_bulk_actions = $common_bulk_actions;
723 723
 			//unset bulk actions not applying to status
724
-			if ( ! empty( $status_bulk_actions ) ) {
725
-				switch ( $status ) {
724
+			if ( ! empty($status_bulk_actions)) {
725
+				switch ($status) {
726 726
 					case EEM_Message::status_idle :
727 727
 					case EEM_Message::status_resend :
728 728
 						$status_bulk_actions['send_now'] = $common_bulk_actions['send_now'];
@@ -733,20 +733,20 @@  discard block
 block discarded – undo
733 733
 						break;
734 734
 
735 735
 					case EEM_Message::status_incomplete :
736
-						unset( $status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now'] );
736
+						unset($status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now']);
737 737
 						break;
738 738
 
739 739
 					case EEM_Message::status_retry :
740 740
 					case EEM_Message::status_sent :
741
-						unset( $status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now'] );
741
+						unset($status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now']);
742 742
 						break;
743 743
 				}
744 744
 			}
745
-			$this->_views[ strtolower( $status ) ] = array(
746
-				'slug' => strtolower( $status ),
747
-				'label' => EEH_Template::pretty_status( $status, false, 'sentence' ),
745
+			$this->_views[strtolower($status)] = array(
746
+				'slug' => strtolower($status),
747
+				'label' => EEH_Template::pretty_status($status, false, 'sentence'),
748 748
 				'count' => 0,
749
-				'bulk_action' => array_merge( $status_bulk_actions, $delete_bulk_action )
749
+				'bulk_action' => array_merge($status_bulk_actions, $delete_bulk_action)
750 750
 			);
751 751
 		}
752 752
 	}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 	protected function _message_queue_list_table() {
766 766
 		$this->_search_btn_label = __('Message Activity', 'event_espresso');
767 767
 		$this->_template_args['per_column'] = 6;
768
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_message_legend_items() );
768
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_message_legend_items());
769 769
 		$this->display_admin_list_table_page_with_no_sidebar();
770 770
 	}
771 771
 
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
 
774 774
 
775 775
 	protected function _message_legend_items() {
776
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
776
+		EE_Registry::instance()->load_helper('MSG_Template');
777 777
 		$action_css_classes = EEH_MSG_Template::get_message_action_icons();
778 778
 		$action_items = array();
779 779
 
780
-		foreach( $action_css_classes as $action_item => $action_details ) {
781
-			if ( $action_item === 'see_notifications_for' ) {
780
+		foreach ($action_css_classes as $action_item => $action_details) {
781
+			if ($action_item === 'see_notifications_for') {
782 782
 				continue;
783 783
 			}
784 784
 			$action_items[$action_item] = array(
@@ -790,31 +790,31 @@  discard block
 block discarded – undo
790 790
 		/** @type array $status_items status legend setup*/
791 791
 		$status_items = array(
792 792
 			'sent_status' => array(
793
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_sent,
794
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_sent, FALSE, 'sentence' )
793
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_sent,
794
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_sent, FALSE, 'sentence')
795 795
 				),
796 796
 			'idle_status' => array(
797
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_idle,
798
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_idle, FALSE, 'sentence' )
797
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_idle,
798
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_idle, FALSE, 'sentence')
799 799
 				),
800 800
 			'failed_status' => array(
801
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_failed,
802
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_failed, FALSE, 'sentence' )
801
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_failed,
802
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_failed, FALSE, 'sentence')
803 803
 			),
804 804
 			'resend_status' => array(
805
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_resend,
806
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_resend, FALSE, 'sentence' )
805
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_resend,
806
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_resend, FALSE, 'sentence')
807 807
 				),
808 808
 			'incomplete_status' => array(
809
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_incomplete,
810
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_incomplete, FALSE, 'sentence' )
809
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_incomplete,
810
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_incomplete, FALSE, 'sentence')
811 811
 				),
812 812
 			'retry_status' => array(
813
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_retry,
814
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_retry, FALSE, 'sentence' )
813
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_retry,
814
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_retry, FALSE, 'sentence')
815 815
 				)
816 816
 		);
817
-		return array_merge( $action_items, $status_items );
817
+		return array_merge($action_items, $status_items);
818 818
 	}
819 819
 
820 820
 
@@ -824,9 +824,9 @@  discard block
 block discarded – undo
824 824
 
825 825
 	protected function _custom_mtps_preview() {
826 826
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
827
-		$this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />';
827
+		$this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />';
828 828
 		$this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso.  With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>';
829
-		$this->display_admin_caf_preview_page( 'custom_message_types', false );
829
+		$this->display_admin_caf_preview_page('custom_message_types', false);
830 830
 	}
831 831
 
832 832
 
@@ -850,31 +850,31 @@  discard block
 block discarded – undo
850 850
 	 *
851 851
 	 * @return array
852 852
 	 */
853
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true ) {
853
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true) {
854 854
 
855 855
 		$MTP = EEM_Message_Template_Group::instance();
856 856
 
857 857
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
858 858
 		$orderby = $this->_req_data['orderby'];
859 859
 
860
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
860
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
861 861
 
862
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
863
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
862
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
863
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
864 864
 
865
-		$offset = ($current_page-1)*$per_page;
866
-		$limit = $all ? null : array( $offset, $per_page );
865
+		$offset = ($current_page - 1) * $per_page;
866
+		$limit = $all ? null : array($offset, $per_page);
867 867
 
868 868
 
869 869
 		//options will match what is in the _views array property
870
-		switch( $type ) {
870
+		switch ($type) {
871 871
 
872 872
 			case 'in_use':
873
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true );
873
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true);
874 874
 				break;
875 875
 
876 876
 			default:
877
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
877
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
878 878
 
879 879
 		}
880 880
 
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 		$imts = $installed_objects['message_types'];
911 911
 		$installed = array();
912 912
 
913
-		foreach ( $imts as $message_type ) {
913
+		foreach ($imts as $message_type) {
914 914
 			$installed[$message_type->name]['obj'] = $message_type;
915 915
 		}
916 916
 
@@ -946,24 +946,24 @@  discard block
 block discarded – undo
946 946
 	 *
947 947
 	 * @throws EE_error
948 948
 	 */
949
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
949
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
950 950
 		//set values override any request data
951
-		$message_type = !empty( $message_type ) ? $message_type : '';
952
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
951
+		$message_type = ! empty($message_type) ? $message_type : '';
952
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
953 953
 
954
-		$messenger = !empty( $messenger ) ? $messenger : '';
955
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
954
+		$messenger = ! empty($messenger) ? $messenger : '';
955
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
956 956
 
957
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
958
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
957
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
958
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
959 959
 
960 960
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
961
-		if ( empty( $message_type ) || empty( $messenger )  )
962
-			{throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));}
961
+		if (empty($message_type) || empty($messenger))
962
+			{throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); }
963 963
 
964 964
 		//we need the GRP_ID for the template being used as the base for the new template
965
-		if ( empty( $GRP_ID ) )
966
-			{throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );}
965
+		if (empty($GRP_ID))
966
+			{throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso')); }
967 967
 
968 968
 		//let's just make sure the template gets generated!
969 969
 
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based
985 985
 	 *                                 off of.
986 986
 	 */
987
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
988
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
987
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
988
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
989 989
 	}
990 990
 
991 991
 
@@ -996,36 +996,36 @@  discard block
 block discarded – undo
996 996
 	 * @return void
997 997
 	 */
998 998
 	protected function _edit_message_template() {
999
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
999
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1000 1000
 
1001 1001
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
1002
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
1002
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
1003 1003
 
1004
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : false;
1004
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : false;
1005 1005
 
1006 1006
 		$this->_set_shortcodes(); //this also sets the _message_template property.
1007 1007
 		$message_template_group = $this->_message_template_group;
1008 1008
 		$c_label = $message_template_group->context_label();
1009 1009
 		$c_config = $message_template_group->contexts_config();
1010 1010
 
1011
-		reset( $c_config );
1012
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) ? strtolower($this->_req_data['context']) : key($c_config);
1011
+		reset($c_config);
1012
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) ? strtolower($this->_req_data['context']) : key($c_config);
1013 1013
 
1014 1014
 
1015
-		if ( empty($GRP_ID) ) {
1015
+		if (empty($GRP_ID)) {
1016 1016
 			$action = 'insert_message_template';
1017 1017
 			$button_both = false;
1018
-			$button_text = array( __( 'Save','event_espresso') );
1018
+			$button_text = array(__('Save', 'event_espresso'));
1019 1019
 			$button_actions = array('something_different');
1020 1020
 			$referrer = false;
1021
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => true ), EE_MSG_ADMIN_URL );
1021
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => true), EE_MSG_ADMIN_URL);
1022 1022
 		} else {
1023 1023
 			$action = 'update_message_template';
1024 1024
 			$button_both = true;
1025 1025
 			$button_text = array();
1026 1026
 			$button_actions = array();
1027 1027
 			$referrer = $this->_admin_base_url;
1028
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => true ), EE_MSG_ADMIN_URL );
1028
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => true), EE_MSG_ADMIN_URL);
1029 1029
 		}
1030 1030
 
1031 1031
 		//set active messenger for this view
@@ -1035,13 +1035,13 @@  discard block
 block discarded – undo
1035 1035
 
1036 1036
 		//Do we have any validation errors?
1037 1037
 		$validators = $this->_get_transient();
1038
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
1038
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
1039 1039
 
1040 1040
 
1041 1041
 		//we need to assemble the title from Various details
1042
-		$context_label = sprintf( __('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'] ));
1042
+		$context_label = sprintf(__('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label']));
1043 1043
 
1044
-		$title = sprintf( __(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label );
1044
+		$title = sprintf(__(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label);
1045 1045
 
1046 1046
 		$this->_template_args['GRP_ID'] = $GRP_ID;
1047 1047
 		$this->_template_args['message_template'] = $message_template_group;
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 		$MSG = new EE_messages();
1053 1053
 		$template_field_structure = $MSG->get_fields($message_template_group->messenger(), $message_template_group->message_type());
1054 1054
 
1055
-		if ( !$template_field_structure ) {
1055
+		if ( ! $template_field_structure) {
1056 1056
 			$template_field_structure = false;
1057 1057
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
1058 1058
 		}
@@ -1062,38 +1062,38 @@  discard block
 block discarded – undo
1062 1062
 
1063 1063
 
1064 1064
 		//if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array.
1065
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
1066
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
1067
-				unset( $template_field_structure[$context][$reference_field] );
1065
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
1066
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
1067
+				unset($template_field_structure[$context][$reference_field]);
1068 1068
 			}
1069 1069
 		}
1070 1070
 
1071 1071
 		//let's loop through the template_field_structure and actually assemble the input fields!
1072
-		if ( !empty($template_field_structure) ) {
1073
-			$id_prefix= 'ee-msg-edit-template-fields-';
1074
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
1072
+		if ( ! empty($template_field_structure)) {
1073
+			$id_prefix = 'ee-msg-edit-template-fields-';
1074
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
1075 1075
 				//if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them.
1076
-				if ( $template_field == 'extra' ) {
1076
+				if ($template_field == 'extra') {
1077 1077
 					$this->_template_args['is_extra_fields'] = true;
1078
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
1079
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
1078
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
1079
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
1080 1080
 							//let's verify if we need this extra field via the shortcodes parameter.
1081 1081
 							$continue = false;
1082
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
1083
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
1084
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
1085
-										{$continue = true;}
1082
+							if (isset($extra_array['shortcodes_required'])) {
1083
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
1084
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
1085
+										{$continue = true; }
1086 1086
 								}
1087
-								if ( $continue ) {continue;}
1087
+								if ($continue) {continue; }
1088 1088
 							}
1089 1089
 
1090
-							$field_id = $reference_field . '-' . $extra_field . '-content';
1090
+							$field_id = $reference_field.'-'.$extra_field.'-content';
1091 1091
 							$template_form_fields[$field_id] = $extra_array;
1092
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
1093
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
1094
-							$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array($extra_field, $v_fields) && ( is_array($validators[$extra_field] ) && isset( $validators[$extra_field]['msg'] ) ) ? 'validate-error ' . $css_class : $css_class;
1092
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
1093
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
1094
+							$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($extra_field, $v_fields) && (is_array($validators[$extra_field]) && isset($validators[$extra_field]['msg'])) ? 'validate-error '.$css_class : $css_class;
1095 1095
 							$content = $message_templates[$context][$reference_field]->get('MTP_content');
1096
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) : '';
1096
+							$template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) : '';
1097 1097
 
1098 1098
 							//do we have a validation error?  if we do then let's use that value instead
1099 1099
 							$template_form_fields[$field_id]['value'] = isset($validators[$extra_field]) ? $validators[$extra_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -1103,32 +1103,32 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
 							//shortcode selector
1105 1105
 							$field_name_to_use = $extra_field == 'main' ? 'content' : $extra_field;
1106
-							$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $field_name_to_use, $field_id );
1106
+							$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($field_name_to_use, $field_id);
1107 1107
 
1108
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
1108
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
1109 1109
 								//we want to decode the entities
1110
-								$template_form_fields[$field_id]['value'] = stripslashes( html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") );
1110
+								$template_form_fields[$field_id]['value'] = stripslashes(html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8"));
1111 1111
 
1112 1112
 							}/**/
1113 1113
 						}
1114
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
1115
-						$templatefield_templatename_id = $reference_field . '-name';
1114
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
1115
+						$templatefield_templatename_id = $reference_field.'-name';
1116 1116
 
1117 1117
 						$template_form_fields[$templatefield_MTP_id] = array(
1118
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
1118
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
1119 1119
 							'label' => null,
1120 1120
 							'input' => 'hidden',
1121 1121
 							'type' => 'int',
1122 1122
 							'required' => false,
1123 1123
 							'validation' => false,
1124
-							'value' => !empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
1124
+							'value' => ! empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
1125 1125
 							'css_class' => '',
1126 1126
 							'format' => '%d',
1127 1127
 							'db-col' => 'MTP_ID'
1128 1128
 						);
1129 1129
 
1130 1130
 						$template_form_fields[$templatefield_templatename_id] = array(
1131
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
1131
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
1132 1132
 							'label' => null,
1133 1133
 							'input' => 'hidden',
1134 1134
 							'type' => 'string',
@@ -1142,10 +1142,10 @@  discard block
 block discarded – undo
1142 1142
 					}
1143 1143
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
1144 1144
 				} else {
1145
-					$field_id = $template_field . '-content';
1145
+					$field_id = $template_field.'-content';
1146 1146
 					$template_form_fields[$field_id] = $field_setup_array;
1147
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
1148
-					$template_form_fields[$field_id]['value'] = !empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ?$message_templates[$context][$template_field]->get('MTP_content') : '';
1147
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
1148
+					$template_form_fields[$field_id]['value'] = ! empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ? $message_templates[$context][$template_field]->get('MTP_content') : '';
1149 1149
 
1150 1150
 					//do we have a validator error for this field?  if we do then we'll use that value instead
1151 1151
 					$template_form_fields[$field_id]['value'] = isset($validators[$template_field]) ? $validators[$template_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -1153,12 +1153,12 @@  discard block
 block discarded – undo
1153 1153
 
1154 1154
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
1155 1155
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
1156
-					$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array( $template_field, $v_fields ) && isset( $validators[$template_field]['msg'] ) ? 'validate-error ' . $css_class : $css_class;
1156
+					$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($template_field, $v_fields) && isset($validators[$template_field]['msg']) ? 'validate-error '.$css_class : $css_class;
1157 1157
 
1158 1158
 					//shortcode selector
1159
-					$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector( $template_field, $field_id );
1159
+					$template_form_fields[$field_id]['append_content'] = $this->_get_shortcode_selector($template_field, $field_id);
1160 1160
 
1161
-					if ( isset( $field_setup_array['input'] ) && $field_setup_array['input'] == 'wp_editor' ) {
1161
+					if (isset($field_setup_array['input']) && $field_setup_array['input'] == 'wp_editor') {
1162 1162
 						//we want to decode the entities
1163 1163
 						$template_form_fields[$field_id]['value'] = $template_form_fields[$field_id]['value'];
1164 1164
 					}/**/
@@ -1166,25 +1166,25 @@  discard block
 block discarded – undo
1166 1166
 
1167 1167
 				//k took care of content field(s) now let's take care of others.
1168 1168
 
1169
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
1170
-				$templatefield_field_templatename_id = $template_field . '-name';
1169
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
1170
+				$templatefield_field_templatename_id = $template_field.'-name';
1171 1171
 
1172 1172
 				//foreach template field there are actually two form fields created
1173 1173
 				$template_form_fields[$templatefield_MTP_id] = array(
1174
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
1174
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
1175 1175
 					'label' => null,
1176 1176
 					'input' => 'hidden',
1177 1177
 					'type' => 'int',
1178 1178
 					'required' => false,
1179 1179
 					'validation' => true,
1180
-					'value' => !empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
1180
+					'value' => ! empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
1181 1181
 					'css_class' => '',
1182 1182
 					'format' => '%d',
1183 1183
 					'db-col' => 'MTP_ID'
1184 1184
 				);
1185 1185
 
1186 1186
 				$template_form_fields[$templatefield_field_templatename_id] = array(
1187
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
1187
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
1188 1188
 					'label' => null,
1189 1189
 					'input' => 'hidden',
1190 1190
 					'type' => 'string',
@@ -1328,15 +1328,15 @@  discard block
 block discarded – undo
1328 1328
 				'value' => $GRP_ID
1329 1329
 				);
1330 1330
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1331
-				'name' => $action . '_nonce',
1331
+				'name' => $action.'_nonce',
1332 1332
 				'input' => 'hidden',
1333 1333
 				'type' => 'string',
1334
-				'value' => wp_create_nonce( $action . '_nonce')
1334
+				'value' => wp_create_nonce($action.'_nonce')
1335 1335
 				);
1336 1336
 
1337 1337
 			$sidebar_array = array('ee-msg-is-global', 'ee-msg-is-override', 'ee-msg-deleted', 'ee-msg-is-active');
1338 1338
 
1339
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1339
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1340 1340
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1341 1341
 					'name' => 'template_switch',
1342 1342
 					'input' => 'hidden',
@@ -1346,8 +1346,8 @@  discard block
 block discarded – undo
1346 1346
 			}
1347 1347
 
1348 1348
 
1349
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1350
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1349
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1350
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1351 1351
 
1352 1352
 
1353 1353
 		} //end if ( !empty($template_field_structure) )
@@ -1359,14 +1359,14 @@  discard block
 block discarded – undo
1359 1359
 			 $GRP_ID,
1360 1360
 			 false,
1361 1361
 			 add_query_arg(
1362
-			    array( 'action' => 'global_mtps' ),
1362
+			    array('action' => 'global_mtps'),
1363 1363
 			    $this->_admin_base_url
1364 1364
 			 )
1365 1365
 		);
1366 1366
 
1367 1367
 		//add preview button
1368
-		$preview_url = parent::add_query_args_and_nonce( array( 'message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context,'GRP_ID' => $GRP_ID, 'action' => 'preview_message' ), $this->_admin_base_url );
1369
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1368
+		$preview_url = parent::add_query_args_and_nonce(array('message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context, 'GRP_ID' => $GRP_ID, 'action' => 'preview_message'), $this->_admin_base_url);
1369
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1370 1370
 
1371 1371
 
1372 1372
 		//setup context switcher
@@ -1393,16 +1393,16 @@  discard block
 block discarded – undo
1393 1393
 		$this->_template_args['before_admin_page_content'] .= $this->_add_form_element_before();
1394 1394
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1395 1395
 
1396
-		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php';
1396
+		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php';
1397 1397
 
1398 1398
 		//send along EE_Message_Template_Group object for further template use.
1399 1399
 		$this->_template_args['MTP'] = $message_template_group;
1400 1400
 
1401
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, true );
1401
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, true);
1402 1402
 
1403 1403
 
1404 1404
 		//finally, let's set the admin_page title
1405
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1405
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1406 1406
 
1407 1407
 
1408 1408
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
 	}
1416 1416
 
1417 1417
 
1418
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1418
+	public function filter_tinymce_init($mceInit, $editor_id) {
1419 1419
 		return $mceInit;
1420 1420
 	}
1421 1421
 
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
 	}
1427 1427
 
1428 1428
 	public function _add_form_element_before() {
1429
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1429
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1430 1430
 	}
1431 1431
 
1432 1432
 	public function _add_form_element_after() {
@@ -1444,32 +1444,32 @@  discard block
 block discarded – undo
1444 1444
 	 * @return json json object
1445 1445
 	 */
1446 1446
 	public function switch_template_pack() {
1447
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1448
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1447
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1448
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1449 1449
 
1450 1450
 		//verify we have needed values.
1451
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1451
+		if (empty($GRP_ID) || empty($template_pack)) {
1452 1452
 			$this->_template_args['error'] = true;
1453
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1453
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1454 1454
 		} else {
1455 1455
 			//get template, set the new template_pack and then reset to default
1456
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1456
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1457 1457
 
1458
-			$mtpg->set_template_pack_name( $template_pack );
1458
+			$mtpg->set_template_pack_name($template_pack);
1459 1459
 			$this->_req_data['msgr'] = $mtpg->messenger();
1460 1460
 			$this->_req_data['mt'] = $mtpg->message_type();
1461 1461
 
1462 1462
 			$query_args = $this->_reset_to_default_template();
1463 1463
 
1464
-			if ( empty( $query_args['id'] ) ) {
1465
-				EE_Error::add_error( __('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1464
+			if (empty($query_args['id'])) {
1465
+				EE_Error::add_error(__('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1466 1466
 				$this->_template_args['error'] = true;
1467 1467
 			} else {
1468
-				$template_label =$mtpg->get_template_pack()->label;
1468
+				$template_label = $mtpg->get_template_pack()->label;
1469 1469
 				$template_pack_labels = $mtpg->messenger_obj()->get_supports_labels();
1470
-				EE_Error::add_success( sprintf( __('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack ) );
1470
+				EE_Error::add_success(sprintf(__('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack));
1471 1471
 				//generate the redirect url for js.
1472
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1472
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1473 1473
 				$this->_template_args['data']['redirect_url'] = $url;
1474 1474
 				$this->_template_args['success'] = true;
1475 1475
 			}
@@ -1491,56 +1491,56 @@  discard block
 block discarded – undo
1491 1491
 	protected function _reset_to_default_template() {
1492 1492
 		$success = true;
1493 1493
 		$templates = array();
1494
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1494
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1495 1495
 		//we need to make sure we've got the info we need.
1496
-		if ( !isset( $this->_req_data['msgr'] ) && !isset( $this->_req_data['mt'] ) && !isset( $this->_req_data['GRP_ID'] ) ) {
1497
-			EE_Error::add_error( __('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1496
+		if ( ! isset($this->_req_data['msgr']) && ! isset($this->_req_data['mt']) && ! isset($this->_req_data['GRP_ID'])) {
1497
+			EE_Error::add_error(__('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1498 1498
 			$success = false;
1499 1499
 		}
1500 1500
 
1501 1501
 		//all templates will be reset to whatever the defaults are for the global template matching the messenger and message type.
1502
-		$success = !empty( $GRP_ID ) ? true : false;
1502
+		$success = ! empty($GRP_ID) ? true : false;
1503 1503
 
1504
-		if ( $success ) {
1504
+		if ($success) {
1505 1505
 
1506 1506
 			//let's first determine if the incoming template is a global template, if it isn't then we need to get the global template matching messenger and message type.
1507
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1507
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1508 1508
 
1509 1509
 
1510 1510
 			//note this is ONLY deleteing the template fields (Message Template rows) NOT the message template group.
1511
-			$success = $this->_delete_mtp_permanently( $GRP_ID, false );
1511
+			$success = $this->_delete_mtp_permanently($GRP_ID, false);
1512 1512
 
1513
-			if ( $success ) {
1513
+			if ($success) {
1514 1514
 				//if successfully deleted, lets generate the new ones.  Note. We set GLOBAL to true, because resets on ANY template will use the related global template defaults for regeneration.  This means that if a custom template is reset it resets to whatever the related global template is.  HOWEVER, we DO keep the template pack and template variation set for the current custom template when resetting.
1515
-				$templates = $this->_generate_new_templates( $this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, true );
1515
+				$templates = $this->_generate_new_templates($this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, true);
1516 1516
 			}
1517 1517
 
1518 1518
 		}
1519 1519
 
1520 1520
 		//any error messages?
1521
-		if ( !$success ) {
1522
-			EE_Error::add_error( __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1521
+		if ( ! $success) {
1522
+			EE_Error::add_error(__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1523 1523
 		}
1524 1524
 
1525 1525
 		//all good, let's add a success message!
1526
-		if ( $success && ! empty( $templates ) ) {
1526
+		if ($success && ! empty($templates)) {
1527 1527
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1528 1528
 			EE_Error::overwrite_success();
1529
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1529
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1530 1530
 		}
1531 1531
 
1532 1532
 
1533 1533
 		$query_args = array(
1534
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : null,
1535
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : null,
1536
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'global_mtps'
1534
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : null,
1535
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : null,
1536
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'global_mtps'
1537 1537
 			);
1538 1538
 
1539 1539
 		//if called via ajax then we return query args otherwise redirect
1540
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1540
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1541 1541
 			return $query_args;
1542 1542
 		} else {
1543
-			$this->_redirect_after_action( false, '', '', $query_args, true );
1543
+			$this->_redirect_after_action(false, '', '', $query_args, true);
1544 1544
 		}
1545 1545
 
1546 1546
 	}
@@ -1553,19 +1553,19 @@  discard block
 block discarded – undo
1553 1553
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1554 1554
 	 *
1555 1555
 	 */
1556
-	public function _preview_message( $send = false ) {
1556
+	public function _preview_message($send = false) {
1557 1557
 		//first make sure we've got the necessary parameters
1558
-		if ( !isset( $this->_req_data['message_type'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['GRP_ID'] ) ) {
1559
-			EE_Error::add_error( __('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1558
+		if ( ! isset($this->_req_data['message_type']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['GRP_ID'])) {
1559
+			EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1560 1560
 		}
1561 1561
 
1562
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1562
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1563 1563
 
1564 1564
 
1565 1565
 		//get the preview!
1566
-		$preview = EED_Messages::preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1566
+		$preview = EED_Messages::preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1567 1567
 
1568
-		if ( $send ) {
1568
+		if ($send) {
1569 1569
 			return $preview;
1570 1570
 		}
1571 1571
 
@@ -1575,16 +1575,16 @@  discard block
 block discarded – undo
1575 1575
 			'context' => $this->_req_data['context'],
1576 1576
 			'action' => 'edit_message_template'
1577 1577
 			);
1578
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1579
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1578
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1579
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1580 1580
 
1581 1581
 		//let's provide a helpful title for context
1582
-		$preview_title = sprintf( __('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']) );
1582
+		$preview_title = sprintf(__('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']));
1583 1583
 
1584 1584
 
1585 1585
 		//setup display of preview.
1586 1586
 		$this->_admin_page_title = $preview_title;
1587
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1587
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1588 1588
 		$this->_template_args['data']['force_json'] = true;
1589 1589
 	}
1590 1590
 
@@ -1613,9 +1613,9 @@  discard block
 block discarded – undo
1613 1613
 	 * @return void
1614 1614
 	 */
1615 1615
 	protected function _register_edit_meta_boxes() {
1616
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1617
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1618
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1616
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1617
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1618
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1619 1619
 	}
1620 1620
 
1621 1621
 
@@ -1634,10 +1634,10 @@  discard block
 block discarded – undo
1634 1634
 
1635 1635
 		$tp_select_values = array();
1636 1636
 
1637
-		foreach ( $tp_collection as $tp ) {
1637
+		foreach ($tp_collection as $tp) {
1638 1638
 			//only include template packs that support this messenger and message type!
1639 1639
 			$supports = $tp->get_supports();
1640
-			if ( ! isset( $supports[$this->_message_template_group->messenger()] ) || ! in_array( $this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()] ) ) {
1640
+			if ( ! isset($supports[$this->_message_template_group->messenger()]) || ! in_array($this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()])) {
1641 1641
 				//not supported
1642 1642
 				continue;
1643 1643
 			}
@@ -1649,7 +1649,7 @@  discard block
 block discarded – undo
1649 1649
 		}
1650 1650
 
1651 1651
 		//if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack.  This still allows for the odd template pack to override.
1652
-		if ( empty( $tp_select_values ) ) {
1652
+		if (empty($tp_select_values)) {
1653 1653
 			$tp_select_values[] = array(
1654 1654
 				'text' => __('Default', 'event_espresso'),
1655 1655
 				'id' => 'default'
@@ -1657,27 +1657,27 @@  discard block
 block discarded – undo
1657 1657
 		}
1658 1658
 
1659 1659
 		//setup variation select values for the currently selected template.
1660
-		$variations = $this->_message_template_group->get_template_pack()->get_variations( $this->_message_template_group->messenger(), $this->_message_template_group->message_type() );
1660
+		$variations = $this->_message_template_group->get_template_pack()->get_variations($this->_message_template_group->messenger(), $this->_message_template_group->message_type());
1661 1661
 		$variations_select_values = array();
1662
-		foreach ( $variations as $variation => $label ) {
1662
+		foreach ($variations as $variation => $label) {
1663 1663
 			$variations_select_values[] = array(
1664 1664
 				'text' => $label,
1665 1665
 				'id' => $variation
1666 1666
 				);
1667 1667
 		}
1668 1668
 
1669
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1669
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1670 1670
 
1671
-		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input( 'MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name() );
1672
-		$template_args['variations_selector'] = EEH_Form_Fields::select_input( 'MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation() );
1671
+		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input('MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name());
1672
+		$template_args['variations_selector'] = EEH_Form_Fields::select_input('MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation());
1673 1673
 		$template_args['template_pack_label'] = $template_pack_labels->template_pack;
1674 1674
 		$template_args['template_variation_label'] = $template_pack_labels->template_variation;
1675 1675
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1676 1676
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1677 1677
 
1678
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1678
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1679 1679
 
1680
-		EEH_Template::display_template( $template, $template_args );
1680
+		EEH_Template::display_template($template, $template_args);
1681 1681
 	}
1682 1682
 
1683 1683
 
@@ -1698,52 +1698,52 @@  discard block
 block discarded – undo
1698 1698
 			'GRP_ID' => $this->_message_template_group->GRP_ID()
1699 1699
 			);
1700 1700
 
1701
-		$button = $this->get_action_link_or_button( 'reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button' );
1701
+		$button = $this->get_action_link_or_button('reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button');
1702 1702
 
1703 1703
 
1704 1704
 		//test button
1705 1705
 		//first we need to see if there are any fields
1706 1706
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1707 1707
 
1708
-		if ( !empty( $fields ) ) {
1708
+		if ( ! empty($fields)) {
1709 1709
 			//yup there be fields
1710
-			foreach ( $fields as $field => $config ) {
1711
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1710
+			foreach ($fields as $field => $config) {
1711
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1712 1712
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1713
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1714
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1713
+				$default = isset($config['default']) ? $config['default'] : '';
1714
+				$default = isset($config['value']) ? $config['value'] : $default;
1715 1715
 
1716 1716
 				//if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults
1717 1717
 				$fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : '';
1718
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix;
1718
+				$existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix;
1719 1719
 
1720 1720
 				$template_form_fields[$field_id] = array(
1721
-					'name' => 'test_settings_fld[' . $field . ']',
1721
+					'name' => 'test_settings_fld['.$field.']',
1722 1722
 					'label' => $config['label'],
1723 1723
 					'input' => $config['input'],
1724 1724
 					'type' => $config['type'],
1725 1725
 					'required' => $config['required'],
1726 1726
 					'validation' => $config['validation'],
1727
-					'value' => isset( $existing[$field] ) ? $existing[$field] : $default,
1727
+					'value' => isset($existing[$field]) ? $existing[$field] : $default,
1728 1728
 					'css_class' => $config['css_class'],
1729
-					'options' => isset( $config['options'] ) ? $config['options'] : array(),
1729
+					'options' => isset($config['options']) ? $config['options'] : array(),
1730 1730
 					'default' => $default,
1731 1731
 					'format' => $config['format']
1732 1732
 					);
1733 1733
 			}
1734 1734
 		}
1735 1735
 
1736
-		$test_settings_fields = !empty( $template_form_fields) ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) : '';
1736
+		$test_settings_fields = ! empty($template_form_fields) ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') : '';
1737 1737
 
1738 1738
 		$test_settings_html = '';
1739 1739
 		//print out $test_settings_fields
1740
-		if ( !empty( $test_settings_fields ) ) {
1740
+		if ( ! empty($test_settings_fields)) {
1741 1741
 			echo $test_settings_fields;
1742
-			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" /><div style="clear:both"></div>';
1742
+			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" /><div style="clear:both"></div>';
1743 1743
 		}
1744 1744
 
1745 1745
 		//and button
1746
-		echo $test_settings_html . '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>' . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>';
1746
+		echo $test_settings_html.'<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>';
1747 1747
 	}
1748 1748
 
1749 1749
 
@@ -1758,13 +1758,13 @@  discard block
 block discarded – undo
1758 1758
      * @param string $linked_input_id The css id of the input that the shortcodes get added to.
1759 1759
      * @return string
1760 1760
     */
1761
-	protected function _get_shortcode_selector( $field, $linked_input_id ) {
1761
+	protected function _get_shortcode_selector($field, $linked_input_id) {
1762 1762
 		$template_args = array(
1763
-			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
1763
+			'shortcodes' => $this->_get_shortcodes(array($field), true),
1764 1764
 			'fieldname' => $field,
1765 1765
 			'linked_input_id' => $linked_input_id
1766 1766
 		);
1767
-		return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true );
1767
+		return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true);
1768 1768
 	}
1769 1769
 
1770 1770
 
@@ -1779,13 +1779,13 @@  discard block
 block discarded – undo
1779 1779
 		$shortcodes = $this->_get_shortcodes(array(), false); //just make sure shortcodes property is set
1780 1780
 		$messenger = $this->_message_template_group->messenger_obj();
1781 1781
 		//now let's set the content depending on the status of the shortcodes array
1782
-		if ( empty( $shortcodes ) ) {
1783
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
1782
+		if (empty($shortcodes)) {
1783
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
1784 1784
 			echo $content;
1785 1785
 		} else {
1786 1786
 			$alt = 0;
1787 1787
 			?>
1788
-			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
1788
+			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p>
1789 1789
 			<?php
1790 1790
 		}
1791 1791
 
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
 	protected function _set_shortcodes() {
1803 1803
 
1804 1804
 		//no need to run this if the property is already set
1805
-		if ( !empty($this->_shortcodes ) ) {return;}
1805
+		if ( ! empty($this->_shortcodes)) {return; }
1806 1806
 
1807 1807
 		$this->_shortcodes = $this->_get_shortcodes();
1808 1808
 	}
@@ -1824,14 +1824,14 @@  discard block
 block discarded – undo
1824 1824
 	 * @return array          Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true
1825 1825
 	 *                       just an array of shortcode/label pairs.
1826 1826
 	 */
1827
-	protected function _get_shortcodes( $fields = array(), $merged = true ) {
1827
+	protected function _get_shortcodes($fields = array(), $merged = true) {
1828 1828
 		$this->_set_message_template_group();
1829 1829
 
1830 1830
 		//we need the messenger and message template to retrieve the valid shortcodes array.
1831
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : false;
1832
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
1831
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : false;
1832
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
1833 1833
 
1834
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
1834
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
1835 1835
 	}
1836 1836
 
1837 1837
 
@@ -1844,19 +1844,19 @@  discard block
 block discarded – undo
1844 1844
 	 */
1845 1845
 	protected function _set_message_template_group() {
1846 1846
 
1847
-		if ( !empty( $this->_message_template_group ) )
1848
-			{return;} //get out if this is already set.
1847
+		if ( ! empty($this->_message_template_group))
1848
+			{return; } //get out if this is already set.
1849 1849
 
1850
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : false;
1851
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
1850
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : false;
1851
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
1852 1852
 
1853 1853
 		//let's get the message templates
1854 1854
 		$MTP = EEM_Message_Template_Group::instance();
1855 1855
 
1856
-		if ( empty($GRP_ID) )
1857
-			{$this->_message_template_group = $MTP->create_default_object();}
1856
+		if (empty($GRP_ID))
1857
+			{$this->_message_template_group = $MTP->create_default_object(); }
1858 1858
 		else
1859
-			{$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );}
1859
+			{$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID); }
1860 1860
 
1861 1861
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1862 1862
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1875,7 +1875,7 @@  discard block
 block discarded – undo
1875 1875
 	 * @param array $args various things the context switcher needs.
1876 1876
 	 *
1877 1877
 	 */
1878
-	protected function _set_context_switcher( EE_Message_Template_Group $template_group_object, $args) {
1878
+	protected function _set_context_switcher(EE_Message_Template_Group $template_group_object, $args) {
1879 1879
 		$context_details = $template_group_object->contexts_config();
1880 1880
 		$context_label = $template_group_object->context_label();
1881 1881
 		ob_start();
@@ -1883,26 +1883,26 @@  discard block
 block discarded – undo
1883 1883
 		<div class="ee-msg-switcher-container">
1884 1884
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1885 1885
 				<?php
1886
-					foreach ( $args as $name => $value ) {
1887
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) {continue;}
1886
+					foreach ($args as $name => $value) {
1887
+						if ($name == 'context' || empty($value) || $name == 'extra') {continue; }
1888 1888
 						?>
1889 1889
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1890 1890
 						<?php
1891 1891
 					}
1892 1892
 					//setup nonce_url
1893
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
1893
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
1894 1894
 				?>
1895 1895
 				<select name="context">
1896 1896
 					<?php
1897 1897
 					$context_templates = $template_group_object->context_templates();
1898
-					if ( is_array($context_templates) ) :
1899
-							foreach ( $context_templates as $context => $template_fields ) :
1898
+					if (is_array($context_templates)) :
1899
+							foreach ($context_templates as $context => $template_fields) :
1900 1900
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
1901 1901
 					?>
1902 1902
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>><?php echo $context_details[$context]['label']; ?></option>
1903 1903
 					<?php endforeach; endif; ?>
1904 1904
 				</select>
1905
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
1905
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
1906 1906
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
1907 1907
 			</form>
1908 1908
 			<?php echo $args['extra']; ?>
@@ -1929,8 +1929,8 @@  discard block
 block discarded – undo
1929 1929
 	 * @return array
1930 1930
 	 */
1931 1931
 	protected function _set_message_template_column_values($index) {
1932
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
1933
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
1932
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
1933
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
1934 1934
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
1935 1935
 			}
1936 1936
 		} else {
@@ -1962,27 +1962,27 @@  discard block
 block discarded – undo
1962 1962
 
1963 1963
 
1964 1964
 
1965
-	protected function _insert_or_update_message_template($new = false ) {
1965
+	protected function _insert_or_update_message_template($new = false) {
1966 1966
 
1967
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
1967
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1968 1968
 		$success = 0;
1969 1969
 		$override = false;
1970 1970
 
1971 1971
 		//setup notices description
1972
-		$messenger = !empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'] ) ) : false;
1973
-		$message_type = !empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'] ) ) : false;
1974
-		$context = !empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'] ) ) : false;
1972
+		$messenger = ! empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) : false;
1973
+		$message_type = ! empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) : false;
1974
+		$context = ! empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) : false;
1975 1975
 
1976
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
1976
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
1977 1977
 		$item_desc .= 'Message Template';
1978 1978
 		$query_args = array();
1979 1979
 		$validates = '';
1980 1980
 
1981 1981
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
1982
-		if ( $new ) {
1983
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1984
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
1985
-				if ( empty($edit_array) ) {
1982
+		if ($new) {
1983
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1984
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
1985
+				if (empty($edit_array)) {
1986 1986
 					$success = 0;
1987 1987
 				} else {
1988 1988
 					$success = 1;
@@ -2001,34 +2001,34 @@  discard block
 block discarded – undo
2001 2001
 
2002 2002
 
2003 2003
 			//run update for each template field in displayed context
2004
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
2005
-				EE_Error::add_error( __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2004
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
2005
+				EE_Error::add_error(__('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2006 2006
 				$success = 0;
2007 2007
 				$action_desc = '';
2008 2008
 
2009 2009
 			} else {
2010 2010
 				//first validate all fields!
2011
-				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2011
+				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2012 2012
 
2013 2013
 				//if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array.  WE need to make sure there is no actual error messages in validates.
2014
-				if ( is_array($validates) && !empty($validates) ) {
2014
+				if (is_array($validates) && ! empty($validates)) {
2015 2015
 					//add the transient so when the form loads we know which fields to highlight
2016
-					$this->_add_transient( 'edit_message_template', $validates );
2016
+					$this->_add_transient('edit_message_template', $validates);
2017 2017
 
2018 2018
 					$success = 0;
2019
-					$action_desc ='';
2019
+					$action_desc = '';
2020 2020
 
2021 2021
 					//setup notices
2022
-					foreach ( $validates as $field => $error ) {
2023
-						if ( isset($error['msg'] ) )
2024
-							{EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );}
2022
+					foreach ($validates as $field => $error) {
2023
+						if (isset($error['msg']))
2024
+							{EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__); }
2025 2025
 					}
2026 2026
 
2027 2027
 				} else {
2028
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
2028
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
2029 2029
 						$set_column_values = $this->_set_message_template_column_values($template_field);
2030 2030
 
2031
-						$where_cols_n_values = array( 'MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
2031
+						$where_cols_n_values = array('MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
2032 2032
 
2033 2033
 						$message_template_fields = array(
2034 2034
 							'GRP_ID' => $set_column_values['GRP_ID'],
@@ -2036,10 +2036,10 @@  discard block
 block discarded – undo
2036 2036
 							'MTP_context' => $set_column_values['MTP_context'],
2037 2037
 							'MTP_content' => $set_column_values['MTP_content']
2038 2038
 							);
2039
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
2040
-							if ( $updated === false ) {
2041
-								$msg = sprintf( __('%s field was NOT updated for some reason', 'event_espresso'), $template_field );
2042
-								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
2039
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
2040
+							if ($updated === false) {
2041
+								$msg = sprintf(__('%s field was NOT updated for some reason', 'event_espresso'), $template_field);
2042
+								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2043 2043
 							} else {
2044 2044
 								$success = 1;
2045 2045
 							}
@@ -2056,24 +2056,24 @@  discard block
 block discarded – undo
2056 2056
 						'MTP_is_override' => $set_column_values['MTP_is_override'],
2057 2057
 						'MTP_deleted' => $set_column_values['MTP_deleted'],
2058 2058
 						'MTP_is_active' => $set_column_values['MTP_is_active'],
2059
-						'MTP_name' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_name'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
2060
-						'MTP_description' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_description'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
2059
+						'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
2060
+						'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
2061 2061
 						);
2062 2062
 
2063
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
2064
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
2063
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
2064
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
2065 2065
 
2066
-					if ( $updated === false ) {
2067
-						$msg = sprintf( __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID'] );
2068
-						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
2066
+					if ($updated === false) {
2067
+						$msg = sprintf(__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID']);
2068
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2069 2069
 					} else {
2070 2070
 						//k now we need to ensure the template_pack and template_variation fields are set.
2071
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) ? $this->_req_data['MTP_template_pack'] : 'default';
2072
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) ? $this->_req_data['MTP_template_variation'] : 'default';
2073
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
2074
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
2075
-							$mtpg_obj->set_template_pack_name( $template_pack );
2076
-							$mtpg_obj->set_template_pack_variation( $template_variation );
2071
+						$template_pack = ! empty($this->_req_data['MTP_template_pack']) ? $this->_req_data['MTP_template_pack'] : 'default';
2072
+						$template_variation = ! empty($this->_req_data['MTP_template_variation']) ? $this->_req_data['MTP_template_variation'] : 'default';
2073
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
2074
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
2075
+							$mtpg_obj->set_template_pack_name($template_pack);
2076
+							$mtpg_obj->set_template_pack_variation($template_variation);
2077 2077
 						}
2078 2078
 						$success = 1;
2079 2079
 					}
@@ -2083,7 +2083,7 @@  discard block
 block discarded – undo
2083 2083
 		}
2084 2084
 
2085 2085
 		//we return things differently if doing ajax
2086
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
2086
+		if (defined('DOING_AJAX') && DOING_AJAX) {
2087 2087
 			$this->_template_args['success'] = $success;
2088 2088
 			$this->_template_args['error'] = ! $success ? true : false;
2089 2089
 			$this->_template_args['content'] = '';
@@ -2091,9 +2091,9 @@  discard block
 block discarded – undo
2091 2091
 				'grpID' => $edit_array['GRP_ID'],
2092 2092
 				'templateName' => $edit_array['template_name']
2093 2093
 				);
2094
-			if ( $success ) {
2094
+			if ($success) {
2095 2095
 				EE_Error::overwrite_success();
2096
-				EE_Error::add_success( __('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso') );
2096
+				EE_Error::add_success(__('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso'));
2097 2097
 			}
2098 2098
 
2099 2099
 			$this->_return_json();
@@ -2101,13 +2101,13 @@  discard block
 block discarded – undo
2101 2101
 
2102 2102
 
2103 2103
 		//was a test send triggered?
2104
-		if ( isset( $this->_req_data['test_button'] ) ) {
2104
+		if (isset($this->_req_data['test_button'])) {
2105 2105
 			EE_Error::overwrite_success();
2106
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
2106
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2107 2107
 			$override = true;
2108 2108
 		}
2109 2109
 
2110
-		if ( empty( $query_args ) ) {
2110
+		if (empty($query_args)) {
2111 2111
 			$query_args = array(
2112 2112
 				'id' => $this->_req_data['GRP_ID'],
2113 2113
 				'context' => $this->_req_data['MTP_context'],
@@ -2115,7 +2115,7 @@  discard block
 block discarded – undo
2115 2115
 				);
2116 2116
 		}
2117 2117
 
2118
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
2118
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
2119 2119
 	}
2120 2120
 
2121 2121
 
@@ -2129,24 +2129,24 @@  discard block
 block discarded – undo
2129 2129
 	 * @param  string $message_type message type being tested
2130 2130
 	 *
2131 2131
 	 */
2132
-	protected function _do_test_send( $context, $messenger, $message_type ) {
2132
+	protected function _do_test_send($context, $messenger, $message_type) {
2133 2133
 		//set things up for preview
2134 2134
 		$this->_req_data['messenger'] = $messenger;
2135 2135
 		$this->_req_data['message_type'] = $message_type;
2136 2136
 		$this->_req_data['context'] = $context;
2137
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
2137
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
2138 2138
 
2139 2139
 		//let's save any existing fields that might be required by the messenger
2140
-		if ( isset( $this->_req_data['test_settings_fld'] ) ) {
2141
-			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
2140
+		if (isset($this->_req_data['test_settings_fld'])) {
2141
+			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings($this->_req_data['test_settings_fld']);
2142 2142
 		}
2143 2143
 
2144 2144
 		$success = $this->_preview_message(true);
2145 2145
 
2146
-		if ( $success ) {
2147
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
2146
+		if ($success) {
2147
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
2148 2148
 		} else {
2149
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
2149
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2150 2150
 		}
2151 2151
 	}
2152 2152
 
@@ -2173,12 +2173,12 @@  discard block
 block discarded – undo
2173 2173
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = false) {
2174 2174
 
2175 2175
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
2176
-		if ( empty( $message_types ) )
2177
-			{return true;}
2176
+		if (empty($message_types))
2177
+			{return true; }
2178 2178
 
2179
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
2179
+		EE_Registry::instance()->load_helper('MSG_Template');
2180 2180
 
2181
-		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID,  $global);
2181
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
2182 2182
 
2183 2183
 	}
2184 2184
 
@@ -2195,33 +2195,33 @@  discard block
 block discarded – undo
2195 2195
 	 *
2196 2196
 	 * @return void
2197 2197
 	 */
2198
-	protected function _trash_or_restore_message_template($trash = true, $all = false ) {
2199
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2198
+	protected function _trash_or_restore_message_template($trash = true, $all = false) {
2199
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2200 2200
 		$MTP = EEM_Message_Template_Group::instance();
2201 2201
 
2202 2202
 		$success = 1;
2203 2203
 
2204 2204
 		//incoming GRP_IDs
2205
-		if ( $all ) {
2205
+		if ($all) {
2206 2206
 			//Checkboxes
2207
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
2207
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2208 2208
 				//if array has more than one element then success message should be plural.
2209 2209
 				//todo: what about nonce?
2210
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2210
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2211 2211
 
2212 2212
 				//cycle through checkboxes
2213
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2214
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2215
-					if ( ! $trashed_or_restored ) {
2213
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2214
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2215
+					if ( ! $trashed_or_restored) {
2216 2216
 						$success = 0;
2217 2217
 					}
2218 2218
 				}
2219 2219
 			} else {
2220 2220
 				//grab single GRP_ID and handle
2221
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2222
-				if ( ! empty( $GRP_ID ) ) {
2223
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2224
-					if ( ! $trashed_or_restored ) {
2221
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2222
+				if ( ! empty($GRP_ID)) {
2223
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2224
+					if ( ! $trashed_or_restored) {
2225 2225
 						$success = 0;
2226 2226
 					}
2227 2227
 				} else {
@@ -2233,13 +2233,13 @@  discard block
 block discarded – undo
2233 2233
 
2234 2234
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2235 2235
 
2236
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2236
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2237 2237
 
2238 2238
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2239 2239
 
2240
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2240
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2241 2241
 
2242
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2242
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2243 2243
 
2244 2244
 	}
2245 2245
 
@@ -2255,26 +2255,26 @@  discard block
 block discarded – undo
2255 2255
 	 * @return void
2256 2256
 	 */
2257 2257
 	protected function _delete_message_template() {
2258
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2258
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2259 2259
 
2260 2260
 		$success = 1;
2261 2261
 
2262 2262
 		//checkboxes
2263
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2263
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2264 2264
 			//if array has more than one element then success message should be plural
2265
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2265
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2266 2266
 
2267 2267
 			//cycle through bulk action checkboxes
2268
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2269
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2268
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2269
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2270 2270
 			}
2271 2271
 		} else {
2272 2272
 			//grab single grp_id and delete
2273
-			$GRP_ID = absint($this->_req_data['id'] );
2274
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2273
+			$GRP_ID = absint($this->_req_data['id']);
2274
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2275 2275
 		}
2276 2276
 
2277
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2277
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2278 2278
 
2279 2279
 	}
2280 2280
 
@@ -2289,20 +2289,20 @@  discard block
 block discarded – undo
2289 2289
 	 *
2290 2290
 	 * @return success        boolean to indicate the success of the deletes or not.
2291 2291
 	 */
2292
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = true ) {
2292
+	private function _delete_mtp_permanently($GRP_ID, $include_group = true) {
2293 2293
 		$success = 1;
2294 2294
 		$MTPG = EEM_Message_Template_Group::instance();
2295 2295
 		//first let's GET this group
2296
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2296
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2297 2297
 		//then delete permanently all the related Message Templates
2298
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2298
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2299 2299
 
2300
-		if ( $deleted === 0 )
2301
-			{$success = 0;}
2300
+		if ($deleted === 0)
2301
+			{$success = 0; }
2302 2302
 
2303 2303
 		//now delete permanently this particular group
2304 2304
 
2305
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2305
+		if ($include_group && ! $MTG->delete_permanently()) {
2306 2306
 			$success = 0;
2307 2307
 		}
2308 2308
 		return $success;
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
 	*	@return string
2321 2321
 	*/
2322 2322
 	protected function _learn_more_about_message_templates_link() {
2323
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2323
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2324 2324
 	}
2325 2325
 
2326 2326
 
@@ -2335,14 +2335,14 @@  discard block
 block discarded – undo
2335 2335
 	 */
2336 2336
 	protected function _settings() {
2337 2337
 
2338
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
2338
+		EE_Registry::instance()->load_helper('Tabbed_Content');
2339 2339
 
2340 2340
 		$this->_set_m_mt_settings();
2341 2341
 
2342
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2342
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2343 2343
 
2344 2344
 		//let's setup the messenger tabs
2345
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2345
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2346 2346
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2347 2347
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2348 2348
 
@@ -2361,10 +2361,10 @@  discard block
 block discarded – undo
2361 2361
 	 */
2362 2362
 	protected function _set_m_mt_settings() {
2363 2363
 		//first if this is already set then lets get out no need to regenerate data.
2364
-		if ( !empty($this->_m_mt_settings) )
2365
-			{return;}
2364
+		if ( ! empty($this->_m_mt_settings))
2365
+			{return; }
2366 2366
 
2367
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2367
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2368 2368
 
2369 2369
 		//get all installed messengers and message_types
2370 2370
 		$installed_message_objects = $this->_get_installed_message_objects();
@@ -2374,10 +2374,10 @@  discard block
 block discarded – undo
2374 2374
 
2375 2375
 		//assemble the array for the _tab_text_links helper
2376 2376
 
2377
-		foreach ( $messengers as $messenger ) {
2377
+		foreach ($messengers as $messenger) {
2378 2378
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2379 2379
 				'label' => ucwords($messenger->label['singular']),
2380
-				'class' => isset( $this->_active_messengers[$messenger->name] ) ? 'messenger-active' : '',
2380
+				'class' => isset($this->_active_messengers[$messenger->name]) ? 'messenger-active' : '',
2381 2381
 				'href' => $messenger->name,
2382 2382
 				'title' => __('Modify this Messenger', 'event_espresso'),
2383 2383
 				'slug' => $messenger->name,
@@ -2387,23 +2387,23 @@  discard block
 block discarded – undo
2387 2387
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2388 2388
 
2389 2389
 			//assemble the array for the ACTIVE and INACTIVE message types with the selected messenger //note that all message types will be in the inactive box if the messenger is NOT active.
2390
-			$selected_settings = isset( $this->_active_messengers[$messenger->name]['settings'] ) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2391
-			foreach ( $message_types as $message_type ) {
2390
+			$selected_settings = isset($this->_active_messengers[$messenger->name]['settings']) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2391
+			foreach ($message_types as $message_type) {
2392 2392
 				//first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox.
2393
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2393
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2394 2394
 					continue;
2395 2395
 				}
2396 2396
 
2397
-				$a_or_i = isset( $selected_settings[$messenger->name . '-message_types'][$message_type->name] ) && $selected_settings[$messenger->name . '-message_types'][$message_type->name] ? 'active' : 'inactive';
2397
+				$a_or_i = isset($selected_settings[$messenger->name.'-message_types'][$message_type->name]) && $selected_settings[$messenger->name.'-message_types'][$message_type->name] ? 'active' : 'inactive';
2398 2398
 
2399 2399
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2400 2400
 						'label' => ucwords($message_type->label['singular']),
2401
-						'class' => 'message-type-' . $a_or_i,
2402
-						'slug_id' => $message_type->name . '-messagetype-' . $messenger->name,
2403
-						'mt_nonce' => wp_create_nonce($message_type->name . '_nonce'),
2404
-						'href' => 'espresso_' . $message_type->name . '_message_type_settings',
2401
+						'class' => 'message-type-'.$a_or_i,
2402
+						'slug_id' => $message_type->name.'-messagetype-'.$messenger->name,
2403
+						'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2404
+						'href' => 'espresso_'.$message_type->name.'_message_type_settings',
2405 2405
 						'title' => $a_or_i == 'active' ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') : __('Drag this message type to the messenger to activate', 'event_espresso'),
2406
-						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content( $message_type, $messenger, true ) : $this->_message_type_settings_content( $message_type, $messenger ),
2406
+						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content($message_type, $messenger, true) : $this->_message_type_settings_content($message_type, $messenger),
2407 2407
 						'slug' => $message_type->name,
2408 2408
 						'active' => $a_or_i == 'active' ? true : false,
2409 2409
 						'obj' => $message_type
@@ -2422,34 +2422,34 @@  discard block
 block discarded – undo
2422 2422
 	 *
2423 2423
 	 * @return string                html output for the content
2424 2424
 	 */
2425
-	protected function _message_type_settings_content( $message_type, $messenger, $active = false ) {
2425
+	protected function _message_type_settings_content($message_type, $messenger, $active = false) {
2426 2426
 		//get message type fields
2427 2427
 		$fields = $message_type->get_admin_settings_fields();
2428
-		$settings_template_args['template_form_fields']= '';
2428
+		$settings_template_args['template_form_fields'] = '';
2429 2429
 
2430
-		if ( !empty( $fields ) && $active ) {
2430
+		if ( ! empty($fields) && $active) {
2431 2431
 
2432
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2432
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2433 2433
 
2434
-			foreach( $fields as $fldname => $fldprops ) {
2435
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2434
+			foreach ($fields as $fldname => $fldprops) {
2435
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2436 2436
 				$template_form_field[$field_id] = array(
2437
-					'name' => 'message_type_settings[' . $fldname . ']',
2437
+					'name' => 'message_type_settings['.$fldname.']',
2438 2438
 					'label' => $fldprops['label'],
2439 2439
 					'input' => $fldprops['field_type'],
2440 2440
 					'type' => $fldprops['value_type'],
2441 2441
 					'required' => $fldprops['required'],
2442 2442
 					'validation' => $fldprops['validation'],
2443
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2444
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2445
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2443
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2444
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2445
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2446 2446
 					'css_class' => 'no-drag',
2447 2447
 					'format' => $fldprops['format']
2448 2448
 					);
2449 2449
 			}
2450 2450
 
2451 2451
 
2452
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2452
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2453 2453
 		}
2454 2454
 
2455 2455
 		$settings_template_args['description'] = $message_type->description;
@@ -2469,13 +2469,13 @@  discard block
 block discarded – undo
2469 2469
 					)
2470 2470
 				);
2471 2471
 
2472
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2473
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2472
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2473
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2474 2474
 
2475 2475
 
2476 2476
 
2477
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2478
-		$content = EEH_Template::display_template( $template, $settings_template_args, true );
2477
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2478
+		$content = EEH_Template::display_template($template, $settings_template_args, true);
2479 2479
 		return $content;
2480 2480
 	}
2481 2481
 
@@ -2492,21 +2492,21 @@  discard block
 block discarded – undo
2492 2492
 		$m_boxes = $mt_boxes = array();
2493 2493
 		$m_template_args = $mt_template_args = array();
2494 2494
 
2495
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2495
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2496 2496
 
2497
-		foreach ( $this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array ) {
2497
+		foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2498 2498
 
2499
-			$hide_on_message = isset( $this->_active_messengers[$messenger] ) ? '' : 'hidden';
2500
-			$hide_off_message = isset( $this->_active_messengers[$messenger] ) ? 'hidden' : '';
2499
+			$hide_on_message = isset($this->_active_messengers[$messenger]) ? '' : 'hidden';
2500
+			$hide_off_message = isset($this->_active_messengers[$messenger]) ? 'hidden' : '';
2501 2501
 
2502 2502
 			//messenger meta boxes
2503 2503
 			$active = $selected_messenger == $messenger ? true : false;
2504
-			$active_mt_tabs = isset(  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] ) ?  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2505
-			$m_boxes[$messenger . '_a_box'] = sprintf( __('%s Settings', 'event_espresso'), $tab_array['label'] );
2506
-			$m_template_args[$messenger . '_a_box'] = array(
2507
-					'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2508
-					'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2509
-					'content' => $this->_get_messenger_box_content( $tab_array['obj'] ),
2504
+			$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2505
+			$m_boxes[$messenger.'_a_box'] = sprintf(__('%s Settings', 'event_espresso'), $tab_array['label']);
2506
+			$m_template_args[$messenger.'_a_box'] = array(
2507
+					'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2508
+					'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2509
+					'content' => $this->_get_messenger_box_content($tab_array['obj']),
2510 2510
 					'hidden' => $active ? '' : ' hidden',
2511 2511
 					'hide_on_message' => $hide_on_message,
2512 2512
 					'messenger' => $messenger,
@@ -2515,10 +2515,10 @@  discard block
 block discarded – undo
2515 2515
 
2516 2516
 
2517 2517
 			//message type meta boxes (which is really just the inactive container for each messenger showing inactive message types for that messenger)
2518
-			$mt_boxes[$messenger . '_i_box'] = __('Inactive Message Types', 'event_espresso');
2519
-			$mt_template_args[$messenger . '_i_box'] = array(
2520
-				'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2521
-				'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2518
+			$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2519
+			$mt_template_args[$messenger.'_i_box'] = array(
2520
+				'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2521
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2522 2522
 				'hidden' => $active ? '' : ' hidden',
2523 2523
 				'hide_on_message' => $hide_on_message,
2524 2524
 				'hide_off_message' => $hide_off_message,
@@ -2528,19 +2528,19 @@  discard block
 block discarded – undo
2528 2528
 		}
2529 2529
 
2530 2530
 		//register messenger metaboxes
2531
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2532
-		foreach ( $m_boxes as $box => $label ) {
2533
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2534
-			$msgr = str_replace( '_a_box', '', $box );
2535
-			add_meta_box( 'espresso_' . $msgr . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args );
2531
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2532
+		foreach ($m_boxes as $box => $label) {
2533
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2534
+			$msgr = str_replace('_a_box', '', $box);
2535
+			add_meta_box('espresso_'.$msgr.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
2536 2536
 		}
2537 2537
 
2538 2538
 		//register message type metaboxes
2539
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2540
-		foreach ( $mt_boxes as $box => $label ) {
2541
-			$callback_args = array( 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] );
2542
-			$mt = str_replace( '_i_box', '', $box );
2543
-			add_meta_box( 'espresso_' . $mt . '_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args );
2539
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2540
+		foreach ($mt_boxes as $box => $label) {
2541
+			$callback_args = array('template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]);
2542
+			$mt = str_replace('_i_box', '', $box);
2543
+			add_meta_box('espresso_'.$mt.'_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args);
2544 2544
 		}
2545 2545
 
2546 2546
 	}
@@ -2553,13 +2553,13 @@  discard block
 block discarded – undo
2553 2553
 	 *
2554 2554
 	 * @return string            html formatted tabs
2555 2555
 	 */
2556
-	protected function _get_mt_tabs( $tab_array ) {
2556
+	protected function _get_mt_tabs($tab_array) {
2557 2557
 		$tab_array = (array) $tab_array;
2558
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
2558
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
2559 2559
 		$tabs = '';
2560 2560
 
2561
-		foreach ( $tab_array as $tab ) {
2562
-			$tabs .=  EEH_Template::display_template( $template, $tab, true );
2561
+		foreach ($tab_array as $tab) {
2562
+			$tabs .= EEH_Template::display_template($template, $tab, true);
2563 2563
 		}
2564 2564
 
2565 2565
 		return $tabs;
@@ -2575,7 +2575,7 @@  discard block
 block discarded – undo
2575 2575
 	 *
2576 2576
 	 * @return string            html formatted content
2577 2577
 	 */
2578
-	protected function _get_messenger_box_content( $messenger ) {
2578
+	protected function _get_messenger_box_content($messenger) {
2579 2579
 
2580 2580
 		$fields = $messenger->get_admin_settings_fields();
2581 2581
 		$settings_template_args['template_form_fields'] = '';
@@ -2584,27 +2584,27 @@  discard block
 block discarded – undo
2584 2584
 		$settings_template_args['active'] = isset($this->_active_messengers[$messenger->name]) ? true : false;
2585 2585
 
2586 2586
 
2587
-		if ( !empty( $fields ) ) {
2587
+		if ( ! empty($fields)) {
2588 2588
 
2589 2589
 			$existing_settings = $messenger->get_existing_admin_settings();
2590 2590
 
2591
-			foreach( $fields as $fldname => $fldprops ) {
2592
-				$field_id = $messenger->name . '-' . $fldname;
2591
+			foreach ($fields as $fldname => $fldprops) {
2592
+				$field_id = $messenger->name.'-'.$fldname;
2593 2593
 				$template_form_field[$field_id] = array(
2594
-					'name' => 'messenger_settings[' . $field_id . ']',
2594
+					'name' => 'messenger_settings['.$field_id.']',
2595 2595
 					'label' => $fldprops['label'],
2596 2596
 					'input' => $fldprops['field_type'],
2597 2597
 					'type' => $fldprops['value_type'],
2598 2598
 					'required' => $fldprops['required'],
2599 2599
 					'validation' => $fldprops['validation'],
2600
-					'value' => isset( $existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2600
+					'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2601 2601
 					'css_class' => '',
2602 2602
 					'format' => $fldprops['format']
2603 2603
 					);
2604 2604
 			}
2605 2605
 
2606 2606
 
2607
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) : '';
2607
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : '';
2608 2608
 		}
2609 2609
 
2610 2610
 		//we also need some hidden fields
@@ -2620,8 +2620,8 @@  discard block
 block discarded – undo
2620 2620
 			);
2621 2621
 
2622 2622
 		//make sure any active message types that are existing are included in the hidden fields
2623
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
2624
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
2623
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
2624
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
2625 2625
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
2626 2626
 						'type' => 'hidden',
2627 2627
 						'value' => $mt
@@ -2629,25 +2629,25 @@  discard block
 block discarded – undo
2629 2629
 			}
2630 2630
 		}
2631 2631
 
2632
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2632
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2633 2633
 
2634
-		$active = isset( $this->_active_messengers[$messenger->name] ) ? true : false;
2634
+		$active = isset($this->_active_messengers[$messenger->name]) ? true : false;
2635 2635
 
2636 2636
 		$settings_template_args['messenger'] = $messenger->name;
2637 2637
 		$settings_template_args['description'] = $messenger->description;
2638 2638
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
2639 2639
 
2640 2640
 
2641
-		$settings_template_args['show_hide_edit_form'] = isset( $this->_active_messengers[$messenger->name] ) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2641
+		$settings_template_args['show_hide_edit_form'] = isset($this->_active_messengers[$messenger->name]) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2642 2642
 
2643
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2643
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2644 2644
 
2645 2645
 
2646 2646
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
2647
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
2647
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
2648 2648
 		$settings_template_args['on_off_status'] = $active ? true : false;
2649
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
2650
-		$content = EEH_Template::display_template( $template, $settings_template_args, true);
2649
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
2650
+		$content = EEH_Template::display_template($template, $settings_template_args, true);
2651 2651
 		return $content;
2652 2652
 	}
2653 2653
 
@@ -2661,39 +2661,39 @@  discard block
 block discarded – undo
2661 2661
 	public function activate_messenger_toggle() {
2662 2662
 		$success = true;
2663 2663
 		//let's check that we have required data
2664
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2665
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2664
+		if ( ! isset($this->_req_data['messenger'])) {
2665
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2666 2666
 			$success = false;
2667 2667
 		}
2668 2668
 
2669 2669
 		//do a nonce check here since we're not arriving via a normal route
2670
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
2671
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
2670
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
2671
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
2672 2672
 
2673
-		$this->_verify_nonce( $nonce, $nonce_ref );
2673
+		$this->_verify_nonce($nonce, $nonce_ref);
2674 2674
 
2675 2675
 
2676 2676
 
2677
-		if ( !isset( $this->_req_data[ 'status' ])) {
2678
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2677
+		if ( ! isset($this->_req_data['status'])) {
2678
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2679 2679
 			$success = false;
2680 2680
 		}
2681 2681
 
2682 2682
 		//do check to verify we have a valid status.
2683 2683
 		$status = $this->_req_data['status'];
2684 2684
 
2685
-		if ( $status != 'off' && $status != 'on' ) {
2686
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2685
+		if ($status != 'off' && $status != 'on') {
2686
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2687 2687
 			$success = false;
2688 2688
 		}
2689 2689
 
2690
-		if ( $success ) {
2690
+		if ($success) {
2691 2691
 			//made it here?  Stop dawdling then!!
2692
-			if ( $status == 'off' ) {
2692
+			if ($status == 'off') {
2693 2693
 				//off = deactivate.  get it?
2694
-				$success = $this->_activate_messenger( $this->_req_data['messenger'], true );
2694
+				$success = $this->_activate_messenger($this->_req_data['messenger'], true);
2695 2695
 			} else {
2696
-				$success = $this->_activate_messenger( $this->_req_data['messenger'] );
2696
+				$success = $this->_activate_messenger($this->_req_data['messenger']);
2697 2697
 			}
2698 2698
 		}
2699 2699
 
@@ -2719,26 +2719,26 @@  discard block
 block discarded – undo
2719 2719
 
2720 2720
 
2721 2721
 		//let's make sure we have the necessary data
2722
-		if ( !isset( $this->_req_data[ 'message_type' ] ) ) {
2723
-			EE_Error::add_error( __('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2722
+		if ( ! isset($this->_req_data['message_type'])) {
2723
+			EE_Error::add_error(__('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2724 2724
 			$success = false;
2725 2725
 		}
2726 2726
 
2727 2727
 
2728 2728
 		//do a nonce check here since we're not arriving via a normal route
2729
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
2730
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
2729
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
2730
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
2731 2731
 
2732
-		$this->_verify_nonce( $nonce, $nonce_ref );
2732
+		$this->_verify_nonce($nonce, $nonce_ref);
2733 2733
 
2734 2734
 
2735
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2736
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2735
+		if ( ! isset($this->_req_data['messenger'])) {
2736
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2737 2737
 			$success = false;
2738 2738
 		}
2739 2739
 
2740
-		if ( !isset( $this->_req_data[ 'status' ])) {
2741
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2740
+		if ( ! isset($this->_req_data['status'])) {
2741
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2742 2742
 			$success = false;
2743 2743
 		}
2744 2744
 
@@ -2746,16 +2746,16 @@  discard block
 block discarded – undo
2746 2746
 		//do check to verify we have a valid status.
2747 2747
 		$status = $this->_req_data['status'];
2748 2748
 
2749
-		if ( $status != 'activate' && $status != 'deactivate' ) {
2750
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2749
+		if ($status != 'activate' && $status != 'deactivate') {
2750
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2751 2751
 			$success = false;
2752 2752
 		}
2753 2753
 
2754 2754
 
2755
-		if ( $success ) {
2755
+		if ($success) {
2756 2756
 			//made it here? um, what are you waiting for then?
2757 2757
 			$deactivate = $status == 'deactivate' ? true : false;
2758
-			$success = $this->_activate_messenger( $this->_req_data['messenger'], $deactivate, $this->_req_data['message_type'] );
2758
+			$success = $this->_activate_messenger($this->_req_data['messenger'], $deactivate, $this->_req_data['message_type']);
2759 2759
 		}
2760 2760
 
2761 2761
 		$this->_template_args['success'] = $success;
@@ -2786,28 +2786,28 @@  discard block
 block discarded – undo
2786 2786
 		$templates = true;
2787 2787
 		$this->_set_m_mt_settings();
2788 2788
 
2789
-		if ( !$deactivate ) {
2789
+		if ( ! $deactivate) {
2790 2790
 
2791 2791
 
2792 2792
 			//we are activating.  we can use $this->_m_mt_settings to get all the installed messengers
2793
-			$this->_active_messengers[$messenger]['settings'] = !isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2793
+			$this->_active_messengers[$messenger]['settings'] = ! isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2794 2794
 			$this->_active_messengers[$messenger]['obj'] = $this->_m_mt_settings['messenger_tabs'][$messenger]['obj'];
2795 2795
 
2796 2796
 			//get has_active so we can sure its kept up to date.
2797
-			$has_activated = get_option( 'ee_has_activated_messages' );
2797
+			$has_activated = get_option('ee_has_activated_messages');
2798 2798
 
2799
-			if ( empty( $has_activated[$messenger] ) ) {
2799
+			if (empty($has_activated[$messenger])) {
2800 2800
 				$has_activated[$messenger] = array();
2801 2801
 			}
2802 2802
 
2803 2803
 			//k we need to get what default message types are to be associated with the messenger that's been activated.
2804 2804
 			$default_types = $message_type ? (array) $message_type : $this->_active_messengers[$messenger]['obj']->get_default_message_types();
2805 2805
 
2806
-			foreach ( $default_types as $type ) {
2806
+			foreach ($default_types as $type) {
2807 2807
 				$settings_fields = $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$type]['obj']->get_admin_settings_fields();
2808
-				if ( !empty( $settings_fields ) ) {
2808
+				if ( ! empty($settings_fields)) {
2809 2809
 					//we have fields for this message type so let's get the defaults for saving.
2810
-					foreach ( $settings_fields as $field => $values ) {
2810
+					foreach ($settings_fields as $field => $values) {
2811 2811
 						$settings[$field] = $values['default'];
2812 2812
 					}
2813 2813
 					//let's set the data for reloading this message type form in ajax
@@ -2815,9 +2815,9 @@  discard block
 block discarded – undo
2815 2815
 				} else {
2816 2816
 					$settings = array();
2817 2817
 				}
2818
-				$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$type]['settings'] =  $settings;
2818
+				$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$type]['settings'] = $settings;
2819 2819
 
2820
-				if ( ! in_array( $type, $has_activated[$messenger] ) ) {
2820
+				if ( ! in_array($type, $has_activated[$messenger])) {
2821 2821
 					$has_activated[$messenger][] = $type;
2822 2822
 				}
2823 2823
 			}
@@ -2825,41 +2825,41 @@  discard block
 block discarded – undo
2825 2825
 			//any default settings for the messenger?
2826 2826
 			$msgr_settings = $this->_active_messengers[$messenger]['obj']->get_admin_settings_fields();
2827 2827
 
2828
-			if ( !empty( $msgr_settings ) ) {
2829
-				foreach ( $msgr_settings as $field => $value ) {
2828
+			if ( ! empty($msgr_settings)) {
2829
+				foreach ($msgr_settings as $field => $value) {
2830 2830
 					$this->_active_messengers[$messenger]['settings'][$field] = $value;
2831 2831
 				}
2832 2832
 			}
2833 2833
 
2834 2834
 			//update settings in database
2835
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2836
-			update_option( 'ee_has_activated_messages', $has_activated );
2835
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2836
+			update_option('ee_has_activated_messages', $has_activated);
2837 2837
 
2838 2838
 
2839 2839
 			//generate new templates (if necessary)
2840
-			$templates = $this->_generate_new_templates( $messenger, $default_types, 0, true );
2840
+			$templates = $this->_generate_new_templates($messenger, $default_types, 0, true);
2841 2841
 
2842 2842
 			EE_Error::overwrite_success();
2843 2843
 
2844 2844
 			//if generation failed then we need to remove the active messenger.
2845
-			if ( !$templates ) {
2845
+			if ( ! $templates) {
2846 2846
 				unset($this->_active_messengers[$messenger]);
2847
-				EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2847
+				EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2848 2848
 			} else {
2849 2849
 				//all is good let's do a success message
2850
-				if ( $message_type ) {
2851
-					EE_Error::add_success( sprintf( __('%s message type has been successfully activated with the %s messenger', 'event_espresso'),ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2850
+				if ($message_type) {
2851
+					EE_Error::add_success(sprintf(__('%s message type has been successfully activated with the %s messenger', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2852 2852
 
2853 2853
 					//if message type was invoice then let's make sure we activate the invoice payment method.
2854
-					if ( $message_type == 'invoice' ) {
2855
-						EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2856
-						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
2857
-						if ( $pm instanceof EE_Payment_Method ) {
2858
-							EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) );
2854
+					if ($message_type == 'invoice') {
2855
+						EE_Registry::instance()->load_lib('Payment_Method_Manager');
2856
+						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
2857
+						if ($pm instanceof EE_Payment_Method) {
2858
+							EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso'));
2859 2859
 						}
2860 2860
 					}
2861 2861
 				} else {
2862
-					EE_Error::add_success( sprintf( __('%s messenger has been successfully activated', 'event_espresso'), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2862
+					EE_Error::add_success(sprintf(__('%s messenger has been successfully activated', 'event_espresso'), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2863 2863
 				}
2864 2864
 			}
2865 2865
 
@@ -2875,36 +2875,36 @@  discard block
 block discarded – undo
2875 2875
 			$update_array = array(
2876 2876
 				'MTP_messenger' => $messenger);
2877 2877
 
2878
-			if ( $message_type ) {
2878
+			if ($message_type) {
2879 2879
 				$update_array['MTP_message_type'] = $message_type;
2880 2880
 			}
2881 2881
 
2882
-			$success = $MTP->update( array( 'MTP_is_active' => 0 ), array($update_array) );
2882
+			$success = $MTP->update(array('MTP_is_active' => 0), array($update_array));
2883 2883
 
2884 2884
 			$messenger_obj = $this->_active_messengers[$messenger]['obj'];
2885 2885
 
2886 2886
 			//if this is a message type deactivation then we're only unsetting the message type otherwise unset the messenger
2887
-			if ( $message_type ) {
2888
-				unset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] );
2887
+			if ($message_type) {
2888
+				unset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type]);
2889 2889
 			} else {
2890
-				unset( $this->_active_messengers[$messenger] );
2890
+				unset($this->_active_messengers[$messenger]);
2891 2891
 			}
2892 2892
 
2893
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2893
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2894 2894
 			EE_Error::overwrite_success();
2895
-			if ( $message_type ) {
2896
-				EE_Error::add_success( sprintf( __('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular']) ) );
2895
+			if ($message_type) {
2896
+				EE_Error::add_success(sprintf(__('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular'])));
2897 2897
 			} else {
2898
-				EE_Error::add_success( sprintf( __('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'] ) ) );
2898
+				EE_Error::add_success(sprintf(__('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'])));
2899 2899
 			}
2900 2900
 
2901 2901
 			//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
2902
-			if ( $messenger == 'html'  || $message_type == 'invoice') {
2903
-				EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2904
-				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
2905
-				if ( $count_updated > 0 ) {
2906
-					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' );
2907
-					EE_Error::add_attention( $msg );
2902
+			if ($messenger == 'html' || $message_type == 'invoice') {
2903
+				EE_Registry::instance()->load_lib('Payment_Method_Manager');
2904
+				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
2905
+				if ($count_updated > 0) {
2906
+					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso');
2907
+					EE_Error::add_attention($msg);
2908 2908
 				}
2909 2909
 			}
2910 2910
 
@@ -2921,8 +2921,8 @@  discard block
 block discarded – undo
2921 2921
 	 * @return string html data
2922 2922
 	 */
2923 2923
 	public function update_mt_form() {
2924
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
2925
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
2924
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
2925
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
2926 2926
 			$this->_return_json();
2927 2927
 		}
2928 2928
 
@@ -2931,7 +2931,7 @@  discard block
 block discarded – undo
2931 2931
 		$message_type = $message_types[$this->_req_data['message_type']]['obj'];
2932 2932
 		$messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
2933 2933
 
2934
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, true, true );
2934
+		$content = $this->_message_type_settings_content($message_type, $messenger, true, true);
2935 2935
 		$this->_template_args['success'] = true;
2936 2936
 		$this->_template_args['content'] = $content;
2937 2937
 		$this->_return_json();
@@ -2945,36 +2945,36 @@  discard block
 block discarded – undo
2945 2945
 	 * @return json success or fail message
2946 2946
 	 */
2947 2947
 	public function save_settings() {
2948
-		if ( !isset( $this->_req_data['type'] ) ) {
2949
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2948
+		if ( ! isset($this->_req_data['type'])) {
2949
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2950 2950
 			$this->_template_args['error'] = true;
2951 2951
 			$this->_return_json();
2952 2952
 		}
2953 2953
 
2954 2954
 
2955
-		if ( $this->_req_data['type'] == 'messenger' ) {
2955
+		if ($this->_req_data['type'] == 'messenger') {
2956 2956
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
2957 2957
 			$messenger = $settings['messenger'];
2958 2958
 			//let's setup the settings data
2959
-			foreach ( $settings as $key => $value ) {
2960
-				switch ( $key ) {
2959
+			foreach ($settings as $key => $value) {
2960
+				switch ($key) {
2961 2961
 					case 'messenger' :
2962
-						unset( $settings['messenger'] );
2962
+						unset($settings['messenger']);
2963 2963
 						break;
2964 2964
 					case 'message_types' :
2965
-						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2966
-							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2967
-								if ( isset( $settings['message_types'][$mt] ) )
2968
-									{$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();}
2965
+						if (isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'])) {
2966
+							foreach ($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'] as $mt => $v) {
2967
+								if (isset($settings['message_types'][$mt]))
2968
+									{$settings[$messenger.'-message_types'][$mt]['settings'] = isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) ? $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt] : array(); }
2969 2969
 							}
2970 2970
 						} else {
2971
-							foreach ( $value as $mt => $v ) {
2971
+							foreach ($value as $mt => $v) {
2972 2972
 								//let's see if this message type is already present and has settings.
2973
-								$settings[$messenger . '-message_types'][$mt]['settings'] = array();
2973
+								$settings[$messenger.'-message_types'][$mt]['settings'] = array();
2974 2974
 							}
2975 2975
 						}
2976 2976
 						//k settings are set let's get rid of the message types index
2977
-						unset( $settings['message_types'] );
2977
+						unset($settings['message_types']);
2978 2978
 						break;
2979 2979
 					default :
2980 2980
 						$settings[$key] = $value;
@@ -2984,36 +2984,36 @@  discard block
 block discarded – undo
2984 2984
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2985 2985
 		}
2986 2986
 
2987
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2987
+		else if ($this->_req_data['type'] == 'message_type') {
2988 2988
 			$settings = $this->_req_data['message_type_settings'];
2989 2989
 			$messenger = $settings['messenger'];
2990 2990
 			$message_type = $settings['message_type'];
2991 2991
 
2992
-			foreach ( $settings as $key => $value ) {
2993
-				switch ( $key ) {
2992
+			foreach ($settings as $key => $value) {
2993
+				switch ($key) {
2994 2994
 					case 'messenger' :
2995
-						unset( $settings['messenger'] );
2995
+						unset($settings['messenger']);
2996 2996
 						break;
2997 2997
 					case 'message_type' :
2998
-						unset( $settings['message_type'] );
2998
+						unset($settings['message_type']);
2999 2999
 						break;
3000 3000
 					default :
3001 3001
 						$settings['settings'][$key] = $value;
3002
-						unset( $settings[$key] );
3002
+						unset($settings[$key]);
3003 3003
 						break;
3004 3004
 				}
3005 3005
 			}
3006 3006
 
3007
-			$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] = $settings;
3007
+			$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type] = $settings;
3008 3008
 		}
3009 3009
 
3010 3010
 		//okay we should have the data all setup.  Now we just update!
3011
-		$success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
3011
+		$success = EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
3012 3012
 
3013
-		if ( $success ) {
3014
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
3013
+		if ($success) {
3014
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
3015 3015
 		} else {
3016
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
3016
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
3017 3017
 		}
3018 3018
 
3019 3019
 		$this->_template_args['success'] = $success;
@@ -3035,8 +3035,8 @@  discard block
 block discarded – undo
3035 3035
      */
3036 3036
 	protected function _generate_now() {
3037 3037
 		$msg_ids = $this->_get_msg_ids_from_request();
3038
-		EED_Messages::generate_now( $msg_ids );
3039
-		$this->_redirect_after_action( false, '', '', array(), true );
3038
+		EED_Messages::generate_now($msg_ids);
3039
+		$this->_redirect_after_action(false, '', '', array(), true);
3040 3040
 	}
3041 3041
 
3042 3042
 
@@ -3051,7 +3051,7 @@  discard block
 block discarded – undo
3051 3051
 	protected function _generate_and_send_now() {
3052 3052
 		$this->_generate_now();
3053 3053
 		$this->_send_now();
3054
-		$this->_redirect_after_action( false, '', '', array(), true );
3054
+		$this->_redirect_after_action(false, '', '', array(), true);
3055 3055
 	}
3056 3056
 
3057 3057
 
@@ -3065,8 +3065,8 @@  discard block
 block discarded – undo
3065 3065
      */
3066 3066
 	protected function _queue_for_resending() {
3067 3067
 		$msg_ids = $this->_get_msg_ids_from_request();
3068
-		EED_Messages::queue_for_resending( $msg_ids );
3069
-		$this->_redirect_after_action( false, '', '', array(), true );
3068
+		EED_Messages::queue_for_resending($msg_ids);
3069
+		$this->_redirect_after_action(false, '', '', array(), true);
3070 3070
 	}
3071 3071
 
3072 3072
 
@@ -3079,8 +3079,8 @@  discard block
 block discarded – undo
3079 3079
      */
3080 3080
 	protected function _send_now() {
3081 3081
 		$msg_ids = $this->_get_msg_ids_from_request();
3082
-		EED_Messages::send_now( $msg_ids );
3083
-		$this->_redirect_after_action( false, '', '', array(), true );
3082
+		EED_Messages::send_now($msg_ids);
3083
+		$this->_redirect_after_action(false, '', '', array(), true);
3084 3084
 	}
3085 3085
 
3086 3086
 
@@ -3094,23 +3094,23 @@  discard block
 block discarded – undo
3094 3094
 	protected function _delete_ee_messages() {
3095 3095
 		$msg_ids = $this->_get_msg_ids_from_request();
3096 3096
 		$deleted_count = 0;
3097
-		foreach ( $msg_ids as $msg_id ) {
3098
-			if ( EEM_Message::instance()->delete_by_ID( $msg_id ) ) {
3097
+		foreach ($msg_ids as $msg_id) {
3098
+			if (EEM_Message::instance()->delete_by_ID($msg_id)) {
3099 3099
 				$deleted_count++;
3100 3100
 			}
3101 3101
 		}
3102
-		if ( $deleted_count ) {
3102
+		if ($deleted_count) {
3103 3103
 			$this->_redirect_after_action(
3104 3104
 				true,
3105
-				_n( 'message', 'messages', $deleted_count, 'event_espresso' ),
3105
+				_n('message', 'messages', $deleted_count, 'event_espresso'),
3106 3106
 				__('deleted', 'event_espresso')
3107 3107
 			);
3108 3108
 		} else {
3109 3109
 			EE_Error::add_error(
3110
-				_n( 'The message was not deleted.', 'The messages were not deleted', count( $msg_ids ), 'event_espresso' ),
3110
+				_n('The message was not deleted.', 'The messages were not deleted', count($msg_ids), 'event_espresso'),
3111 3111
 				__FILE__, __FUNCTION__, __LINE__
3112 3112
 			);
3113
-			$this->_redirect_after_action( false, '', '', array(), true );
3113
+			$this->_redirect_after_action(false, '', '', array(), true);
3114 3114
 		}
3115 3115
 	}
3116 3116
 
@@ -3123,10 +3123,10 @@  discard block
 block discarded – undo
3123 3123
      *  @return array
3124 3124
      */
3125 3125
 	protected function _get_msg_ids_from_request() {
3126
-		if ( ! isset( $this->_req_data['MSG_ID'] ) ) {
3126
+		if ( ! isset($this->_req_data['MSG_ID'])) {
3127 3127
 			return array();
3128 3128
 		}
3129
-		return is_array( $this->_req_data['MSG_ID'] ) ? array_keys( $this->_req_data['MSG_ID'] ) : array( $this->_req_data['MSG_ID'] );
3129
+		return is_array($this->_req_data['MSG_ID']) ? array_keys($this->_req_data['MSG_ID']) : array($this->_req_data['MSG_ID']);
3130 3130
 	}
3131 3131
 
3132 3132
 
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/Prices_List_Table.class.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	protected $_price_types = array();
38 38
 
39
-	public function __construct( $admin_page ) {
39
+	public function __construct($admin_page) {
40 40
 		parent::__construct($admin_page);
41
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
41
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
42 42
 		$this->_PRT = EEM_Price_Type::instance();
43 43
 		$this->_price_types = $this->_PRT->get_all_deleted_and_undeleted();
44 44
 	}
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 
49 49
 	protected function _setup_data() {
50 50
 		$trashed = $this->_admin_page->get_view() == 'trashed' ? true : false;
51
-		$this->_data = $this->_admin_page->get_prices_overview_data( $this->_per_page, false, $trashed );
52
-		$this->_all_data_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, false );
53
-		$this->_trashed_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, true );
51
+		$this->_data = $this->_admin_page->get_prices_overview_data($this->_per_page, false, $trashed);
52
+		$this->_all_data_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, false);
53
+		$this->_trashed_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, true);
54 54
 	}
55 55
 
56 56
 
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 
75 75
 			$this->_sortable_columns = array(
76 76
 						// true means its already sorted
77
-						'name' => array( 'name' => false ),
78
-						'type' => array( 'type' => false ),
79
-						'amount' => array( 'amount' => false )
77
+						'name' => array('name' => false),
78
+						'type' => array('type' => false),
79
+						'amount' => array('amount' => false)
80 80
 			);
81 81
 
82 82
         $this->_hidden_columns = array(
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 	protected function _add_view_counts() {
100 100
 		$this->_views['all']['count'] = $this->_all_data_count;
101
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price') ) {
101
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) {
102 102
 			$this->_views['trashed']['count'] = $this->_trashed_count;
103 103
 		}
104 104
 	}
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
 	 * @param  object $item the current item
113 113
 	 * @return string
114 114
 	 */
115
-	protected function _get_row_class( $item ) {
115
+	protected function _get_row_class($item) {
116 116
 		static $row_class = '';
117
-		$row_class = ( $row_class == '' ? 'alternate' : '' );
117
+		$row_class = ($row_class == '' ? 'alternate' : '');
118 118
 
119 119
 		$new_row = $row_class;
120 120
 
121
-		if ( $item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4 )
121
+		if ($item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4)
122 122
 			$new_row .= ' rowsortable';
123 123
 
124
-		return ' class="' . $new_row . '"';
124
+		return ' class="'.$new_row.'"';
125 125
 	}
126 126
 
127 127
 
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 
132 132
 
133 133
 	function column_cb($item) {
134
-		if ( $item->type_obj()->base_type() !== 1 )
135
-			return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID() );
134
+		if ($item->type_obj()->base_type() !== 1)
135
+			return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID());
136 136
 		return '';
137 137
 	}
138 138
 
@@ -145,31 +145,31 @@  discard block
 block discarded – undo
145 145
 		//Build row actions
146 146
 		$actions = array();
147 147
 		// edit price link
148
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'pricing_edit_price', $item->ID() ) ) {
149
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_price', 'id'=>$item->ID() ), PRICING_ADMIN_URL );
150
-			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>';
148
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'pricing_edit_price', $item->ID())) {
149
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_price', 'id'=>$item->ID()), PRICING_ADMIN_URL);
150
+			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
151 151
 		}
152 152
 
153
-		$name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'edit_price', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . stripslashes( $item->name() ) . '</a>' : $item->name();
153
+		$name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'edit_price', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.stripslashes($item->name()).'</a>' : $item->name();
154 154
 
155
-		if ( $item->type_obj()->base_type() !== 1 ) {
155
+		if ($item->type_obj()->base_type() !== 1) {
156 156
 			if ($this->_view == 'all') {
157 157
 				// trash price link
158
-				if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_trash_price', $item->ID() ) ) {
159
-					$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL );
160
-					$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Price to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>';
158
+				if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_trash_price', $item->ID())) {
159
+					$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL);
160
+					$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Price to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>';
161 161
 				}
162 162
 			} else {
163
-				if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_restore_price', $item->ID() ) ) {
163
+				if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_restore_price', $item->ID())) {
164 164
 					// restore price link
165
-					$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL );
166
-					$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Price', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
165
+					$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL);
166
+					$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Price', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
167 167
 				}
168 168
 
169 169
 				// delete price link
170
-				if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_delete_price', $item->ID() ) ) {
171
-					$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL );
172
-					$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Price Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>';
170
+				if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_delete_price', $item->ID())) {
171
+					$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL);
172
+					$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Price Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>';
173 173
 				}
174 174
 			}
175 175
 		}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
179 179
 										/* $1%s */ $name_link,
180 180
 										/* $2%s */ $item->ID(),
181
-										/* $3%s */ $this->row_actions( $actions )
181
+										/* $3%s */ $this->row_actions($actions)
182 182
 		);
183 183
 	}
184 184
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 
197 197
 	function column_description($item) {
198
-		return stripslashes( $item->desc() );
198
+		return stripslashes($item->desc());
199 199
 	}
200 200
 
201 201
 
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 
205 205
 	function column_amount($item) {
206 206
 		if ($this->_price_types[$item->type()]->is_percent()) {
207
-			return '<div class="pad-amnt-rght">' . number_format($item->amount(), 1) . '%</div>';
207
+			return '<div class="pad-amnt-rght">'.number_format($item->amount(), 1).'%</div>';
208 208
 		} else {
209
-			return '<div class="pad-amnt-rght">' . EEH_Template::format_currency( $item->amount() ) . '</div>';
209
+			return '<div class="pad-amnt-rght">'.EEH_Template::format_currency($item->amount()).'</div>';
210 210
 		}
211 211
 	}
212 212
 
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/Pricing_Admin_Page.core.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 * @param bool $routing
32 32
 	 * @return Pricing_Admin_Page
33 33
 	 */
34
-	public function __construct( $routing = TRUE ) {
35
-		parent::__construct( $routing );
34
+	public function __construct($routing = TRUE) {
35
+		parent::__construct($routing);
36 36
 	}
37 37
 
38 38
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	protected function _ajax_hooks() {
52
-		add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' ));
52
+		add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order'));
53 53
 	}
54 54
 
55 55
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	*		@return void
83 83
 	*/
84 84
 	protected function _set_page_routes() {
85
-		$prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0;
86
-		$prt_id =  ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0;
85
+		$prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0;
86
+		$prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0;
87 87
 		$this->_page_routes = array(
88 88
 			'default' => array(
89 89
 					'func' => '_price_overview_list_table',
@@ -91,38 +91,38 @@  discard block
 block discarded – undo
91 91
 				),
92 92
 			'add_new_price'	=> array(
93 93
 					'func' => '_edit_price_details',
94
-					'args' => array( 'new_price' => TRUE ),
94
+					'args' => array('new_price' => TRUE),
95 95
 					'capability' => 'ee_edit_default_prices'
96 96
 				),
97 97
 			'edit_price'	=> array(
98 98
 					'func' => '_edit_price_details',
99
-					'args' => array( 'new_price' => FALSE ),
99
+					'args' => array('new_price' => FALSE),
100 100
 					'capability' => 'ee_edit_default_price',
101 101
 					'obj_id' => $prc_id
102 102
 				),
103 103
 			'insert_price'	=> array(
104 104
 					'func' => '_insert_or_update_price',
105
-					'args' => array( 'new_price' => TRUE ),
105
+					'args' => array('new_price' => TRUE),
106 106
 					'noheader' => TRUE,
107 107
 					'capability' => 'ee_edit_default_prices',
108 108
 				),
109 109
 			'update_price'	=> array(
110 110
 					'func' => '_insert_or_update_price',
111
-					'args' => array( 'new_price' => FALSE ),
111
+					'args' => array('new_price' => FALSE),
112 112
 					'noheader' => TRUE,
113 113
 					'capability' => 'ee_edit_default_price',
114 114
 					'obj_id' => $prc_id
115 115
 				),
116 116
 			'trash_price'	=> array(
117 117
 					'func' => '_trash_or_restore_price',
118
-					'args' => array( 'trash' => TRUE ),
118
+					'args' => array('trash' => TRUE),
119 119
 					'noheader' => TRUE,
120 120
 					'capability' => 'ee_delete_default_price',
121 121
 					'obj_id' => $prc_id
122 122
 				),
123 123
 			'restore_price'	=> array(
124 124
 					'func' => '_trash_or_restore_price',
125
-					'args' => array( 'trash' => FALSE ),
125
+					'args' => array('trash' => FALSE),
126 126
 					'noheader' => TRUE,
127 127
 					'capability' => 'ee_delete_default_price',
128 128
 					'obj_id' => $prc_id
@@ -154,27 +154,27 @@  discard block
 block discarded – undo
154 154
 				),
155 155
 			'insert_price_type'	=> array(
156 156
 					'func' => '_insert_or_update_price_type',
157
-					'args' => array( 'new_price_type' => TRUE ),
157
+					'args' => array('new_price_type' => TRUE),
158 158
 					'noheader' => TRUE,
159 159
 					'capability' => 'ee_edit_default_price_types'
160 160
 				),
161 161
 			'update_price_type' => array(
162 162
 					'func' => '_insert_or_update_price_type',
163
-					'args' => array( 'new_price_type' => FALSE ),
163
+					'args' => array('new_price_type' => FALSE),
164 164
 					'noheader' => TRUE,
165 165
 					'capability' => 'ee_edit_default_price_type',
166 166
 					'obj_id' => $prt_id
167 167
 				),
168 168
 			'trash_price_type'	=> array(
169 169
 					'func' => '_trash_or_restore_price_type',
170
-					'args' => array( 'trash' => TRUE ),
170
+					'args' => array('trash' => TRUE),
171 171
 					'noheader' => TRUE,
172 172
 					'capability' => 'ee_delete_default_price_type',
173 173
 					'obj_id' => $prt_id
174 174
 				),
175 175
 			'restore_price_type'	=> array(
176 176
 					'func' => '_trash_or_restore_price_type',
177
-					'args' => array( 'trash' => FALSE ),
177
+					'args' => array('trash' => FALSE),
178 178
 					'noheader' => TRUE,
179 179
 					'capability' => 'ee_delete_default_price_type',
180 180
 					'obj_id' => $prt_id
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 							'filename' => 'pricing_default_pricing_views_bulk_actions_search'
215 215
 							)
216 216
 						),
217
-					'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'),
217
+					'help_tour' => array('Pricing_Default_Prices_Help_Tour'),
218 218
 					'require_nonce' => FALSE
219 219
 				),
220 220
 			'add_new_price' => array(
@@ -230,24 +230,24 @@  discard block
 block discarded – undo
230 230
 							)
231 231
 						),
232 232
                     'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'),
233
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
233
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
234 234
 					'require_nonce' => FALSE
235 235
 				),
236 236
 			'edit_price' => array(
237 237
 					'nav' => array(
238 238
 							'label' => __('Edit Default Price', 'event_espresso'),
239 239
 							'order' => 20,
240
-							'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
240
+							'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url,
241 241
 							'persistent' => FALSE
242 242
 						),
243
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
243
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
244 244
                     'help_tabs' => array(
245 245
 						'edit_default_price_help_tab' => array(
246 246
 							'title' => __('Edit Default Price', 'event_espresso'),
247 247
 							'filename' => 'pricing_edit_default_price'
248 248
 							)
249 249
 						),
250
-					'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ),
250
+					'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'),
251 251
 					'require_nonce' => FALSE
252 252
 				),
253 253
 			'price_types' => array(
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 							'filename' => 'pricing_price_types_views_bulk_actions_search'
271 271
 							),
272 272
 						),
273
-					'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ),
273
+					'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'),
274 274
 					'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
275 275
 					'require_nonce' => FALSE
276 276
 				),
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 							'filename' => 'pricing_add_new_price_type'
287 287
 							)
288 288
 						),
289
-                    'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ),
290
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
289
+                    'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'),
290
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'),
291 291
 					'require_nonce' => FALSE
292 292
 				),
293 293
 			'edit_price_type' => array(
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 							'filename' => 'pricing_edit_price_type'
303 303
 							)
304 304
 						),
305
-                    'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ),
306
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
305
+                    'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'),
306
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'),
307 307
 
308 308
 					'require_nonce' => FALSE
309 309
 				)
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	public function load_scripts_styles() {
341 341
 		//styles
342 342
 		wp_enqueue_style('espresso-ui-theme');
343
-		wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION );
343
+		wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION);
344 344
 		wp_enqueue_style('espresso_PRICING');
345 345
 
346 346
 		//scripts
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 		//wp_enqueue_script('jquery-ui-dialog');
351 351
 		//wp_enqueue_script('jquery-ui-draggable');
352 352
 		//wp_enqueue_script('jquery-ui-datepicker');
353
-		wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
354
-		wp_enqueue_script( 'espresso_PRICING' );
353
+		wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
354
+		wp_enqueue_script('espresso_PRICING');
355 355
 	}
356 356
 
357 357
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 
361 361
 	public function load_scripts_styles_default() {
362
-		wp_enqueue_script( 'espresso_ajax_table_sorting' );
362
+		wp_enqueue_script('espresso_ajax_table_sorting');
363 363
 	}
364 364
 
365 365
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 				)
388 388
 		);
389 389
 
390
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) {
390
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) {
391 391
 			$this->_views['trashed'] = array(
392 392
 					'slug' => 'trashed',
393 393
 					'label' => __('Trash', 'event_espresso'),
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 				)
418 418
 		);
419 419
 
420
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) {
420
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) {
421 421
 			 $this->_views['trashed'] = array(
422 422
 					'slug' => 'trashed',
423 423
 					'label' => __('Trash', 'event_espresso'),
@@ -456,18 +456,18 @@  discard block
 block discarded – undo
456 456
 	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
457 457
 	* 	@return mixed (int|array)  int = count || array of price objects
458 458
 	*/
459
-	public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
459
+	public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) {
460 460
 
461
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
461
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
462 462
 		// start with an empty array
463 463
 		$event_pricing = array();
464 464
 
465
-		require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' );
466
-		require_once(EE_MODELS . 'EEM_Price.model.php');
465
+		require_once(PRICING_ADMIN.'Prices_List_Table.class.php');
466
+		require_once(EE_MODELS.'EEM_Price.model.php');
467 467
 		//$PRC = EEM_Price::instance();
468 468
 
469 469
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
470
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
470
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
471 471
 
472 472
 		switch ($this->_req_data['orderby']) {
473 473
 			case 'name':
@@ -480,27 +480,27 @@  discard block
 block discarded – undo
480 480
 				$orderby = array('PRC_amount'=>$order);
481 481
 				break;
482 482
 			default:
483
-				$orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order);
483
+				$orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order);
484 484
 		}
485 485
 
486
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
487
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
486
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
487
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
488 488
 
489 489
 		$_where = array(
490 490
 				'PRC_is_default' => 1,
491 491
 				'PRC_deleted' => $trashed
492 492
 				);
493 493
 
494
-		$offset = ($current_page-1)*$per_page;
495
-		$limit = array( $offset, $per_page );
494
+		$offset = ($current_page - 1) * $per_page;
495
+		$limit = array($offset, $per_page);
496 496
 
497
-		if ( isset( $this->_req_data['s'] ) ) {
498
-			$sstr = '%' . $this->_req_data['s'] . '%';
497
+		if (isset($this->_req_data['s'])) {
498
+			$sstr = '%'.$this->_req_data['s'].'%';
499 499
 			$_where['OR'] = array(
500
-				'PRC_name' => array('LIKE',$sstr ),
501
-				'PRC_desc' => array('LIKE',$sstr ),
502
-				'PRC_amount' => array( 'LIKE',$sstr ),
503
-				'Price_Type.PRT_name' => array( 'LIKE', $sstr )
500
+				'PRC_name' => array('LIKE', $sstr),
501
+				'PRC_desc' => array('LIKE', $sstr),
502
+				'PRC_amount' => array('LIKE', $sstr),
503
+				'Price_Type.PRT_name' => array('LIKE', $sstr)
504 504
 				);
505 505
 		}
506 506
 
@@ -511,9 +511,9 @@  discard block
 block discarded – undo
511 511
 			'group_by'=>'PRC_ID'
512 512
 			);
513 513
 
514
-		if($count){
515
-			return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
516
-		}else{
514
+		if ($count) {
515
+			return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
516
+		} else {
517 517
 			return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params);
518 518
 		}
519 519
 	}
@@ -529,40 +529,40 @@  discard block
 block discarded – undo
529 529
 	*		@return void
530 530
 	*/
531 531
 	protected function _edit_price_details() {
532
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
532
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
533 533
 		// grab price ID
534
-		$PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
534
+		$PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
535 535
 		// change page title based on request action
536
-		$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
536
+		$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
537 537
 		// add PRC_ID to title if editing
538
-		$this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title;
538
+		$this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title;
539 539
 
540 540
 		// get prices
541
-		require_once(EE_MODELS . 'EEM_Price.model.php');
541
+		require_once(EE_MODELS.'EEM_Price.model.php');
542 542
 		$PRC = EEM_Price::instance();
543 543
 
544
-		if ( $PRC_ID ) {
545
-			$price = $PRC->get_one_by_ID( $PRC_ID );
544
+		if ($PRC_ID) {
545
+			$price = $PRC->get_one_by_ID($PRC_ID);
546 546
 			$additional_hidden_fields = array(
547
-					'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID )
547
+					'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID)
548 548
 				);
549
-			$this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields );
549
+			$this->_set_add_edit_form_tags('update_price', $additional_hidden_fields);
550 550
 		} else {
551 551
 			$price = $PRC->get_new_price();
552
-			$this->_set_add_edit_form_tags( 'insert_price' );
552
+			$this->_set_add_edit_form_tags('insert_price');
553 553
 		}
554 554
 
555 555
 		$this->_template_args['PRC_ID'] = $PRC_ID;
556 556
 		$this->_template_args['price'] = $price;
557 557
 
558 558
 		// get price types
559
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
559
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
560 560
 		$PRT = EEM_Price_Type::instance();
561
-		$price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) );
561
+		$price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1))));
562 562
 		$price_type_names = array();
563 563
 		if (empty($price_types)) {
564
-			$msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' );
565
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
564
+			$msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso');
565
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
566 566
 			exit();
567 567
 		} else {
568 568
 			foreach ($price_types as $type) {
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		$this->_template_args['price_types'] = $price_type_names;
576 576
 		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
577 577
 
578
-		$this->_set_publish_post_box_vars( 'id', $PRC_ID );
578
+		$this->_set_publish_post_box_vars('id', $PRC_ID);
579 579
 		// the details template wrapper
580 580
 		$this->display_admin_page_with_sidebar();
581 581
 	}
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	*		@return void
592 592
 	*/
593 593
 	protected function _price_details_meta_boxes() {
594
-		add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
594
+		add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
595 595
 	}
596 596
 
597 597
 
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 	*		@return void
606 606
 	*/
607 607
 	public function _edit_price_details_meta_box() {
608
-		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE );
608
+		echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE);
609 609
 	}
610 610
 
611 611
 
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	*/
620 620
 	protected function set_price_column_values() {
621 621
 
622
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
622
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
623 623
 
624 624
 		$set_column_values = array(
625 625
 				'PRT_ID' => absint($this->_req_data['PRT_ID']),
@@ -647,12 +647,12 @@  discard block
 block discarded – undo
647 647
 	*		@access protected
648 648
 	*		@return void
649 649
 	*/
650
-	protected function _insert_or_update_price( $insert = FALSE ) {
650
+	protected function _insert_or_update_price($insert = FALSE) {
651 651
 
652 652
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
653
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
653
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
654 654
 
655
-		require_once(EE_MODELS . 'EEM_Price.model.php');
655
+		require_once(EE_MODELS.'EEM_Price.model.php');
656 656
 		$PRC = EEM_Price::instance();
657 657
 
658 658
 		// why be so pessimistic ???  : (
@@ -660,14 +660,14 @@  discard block
 block discarded – undo
660 660
 
661 661
 		$set_column_values = $this->set_price_column_values();
662 662
 		// is this a new Price ?
663
-		if ( $insert ) {
663
+		if ($insert) {
664 664
 			// run the insert
665
-			if ( $PRC_ID = $PRC->insert( $set_column_values )) {
665
+			if ($PRC_ID = $PRC->insert($set_column_values)) {
666 666
 				//make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type
667 667
 				$PR = EEM_price::instance()->get_one_by_ID($PRC_ID);
668
-				if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
668
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
669 669
 					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
670
-					$ticket->_add_relation_to( $PR, 'Price' );
670
+					$ticket->_add_relation_to($PR, 'Price');
671 671
 					$ticket->save();
672 672
 				}
673 673
 				$success = 1;
@@ -677,29 +677,29 @@  discard block
 block discarded – undo
677 677
 			}
678 678
 			$action_desc = 'created';
679 679
 		} else {
680
-			$PRC_ID = absint( $this->_req_data['PRC_ID'] );
680
+			$PRC_ID = absint($this->_req_data['PRC_ID']);
681 681
 			// run the update
682
-			$where_cols_n_values = array( 'PRC_ID' => $PRC_ID );
683
-			if ( $PRC->update( $set_column_values, array($where_cols_n_values))) {
682
+			$where_cols_n_values = array('PRC_ID' => $PRC_ID);
683
+			if ($PRC->update($set_column_values, array($where_cols_n_values))) {
684 684
 				$success = 1;
685 685
 			}
686 686
 
687 687
 			$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
688
-			if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
688
+			if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
689 689
 
690 690
 				//if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated.
691
-				if ( $PRC_ID === 1 ) {
691
+				if ($PRC_ID === 1) {
692 692
 					$ticket = $PR->get_first_related('Ticket');
693
-					if ( $ticket ) {
694
-						$ticket->set('TKT_price', $PR->get('PRC_amount') );
695
-						$ticket->set('TKT_name', $PR->get('PRC_name') );
693
+					if ($ticket) {
694
+						$ticket->set('TKT_price', $PR->get('PRC_amount'));
695
+						$ticket->set('TKT_name', $PR->get('PRC_name'));
696 696
 						$ticket->set('TKT_description', $PR->get('PRC_desc'));
697 697
 						$ticket->save();
698 698
 					}
699 699
 				} else {
700 700
 					//we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type.
701 701
 					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
702
-					$ticket->_add_relation_to( $PRC_ID, 'Price' );
702
+					$ticket->_add_relation_to($PRC_ID, 'Price');
703 703
 					$ticket->save();
704 704
 				}
705 705
 			}
@@ -707,9 +707,9 @@  discard block
 block discarded – undo
707 707
 			$action_desc = 'updated';
708 708
 		}
709 709
 
710
-		$query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID );
710
+		$query_args = array('action' => 'edit_price', 'id' => $PRC_ID);
711 711
 
712
-		$this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args );
712
+		$this->_redirect_after_action($success, 'Prices', $action_desc, $query_args);
713 713
 
714 714
 	}
715 715
 
@@ -723,12 +723,12 @@  discard block
 block discarded – undo
723 723
 	*		@access protected
724 724
 	*		@return void
725 725
 	*/
726
-	protected function _trash_or_restore_price( $trash = TRUE ) {
726
+	protected function _trash_or_restore_price($trash = TRUE) {
727 727
 
728 728
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
729
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
729
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
730 730
 
731
-		require_once(EE_MODELS . 'EEM_Price.model.php');
731
+		require_once(EE_MODELS.'EEM_Price.model.php');
732 732
 		$PRC = EEM_Price::instance();
733 733
 
734 734
 		$success = 1;
@@ -737,18 +737,18 @@  discard block
 block discarded – undo
737 737
 		//get base ticket for updating
738 738
 		$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
739 739
 		//Checkboxes
740
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
740
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
741 741
 			// if array has more than one element than success message should be plural
742
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
742
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
743 743
 			// cycle thru checkboxes
744
-			while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) {
745
-				if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) {
744
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
745
+				if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) {
746 746
 					$success = 0;
747 747
 				} else {
748 748
 					$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
749
-					if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
749
+					if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
750 750
 						//if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
751
-						if ( $PRC_deleted ) {
751
+						if ($PRC_deleted) {
752 752
 							$ticket->_remove_relation_to($PRC_ID, 'Price');
753 753
 						} else {
754 754
 							$ticket->_add_relation_to($PRC_ID, 'Price');
@@ -760,14 +760,14 @@  discard block
 block discarded – undo
760 760
 
761 761
 		} else {
762 762
 			// grab single id and delete
763
-			$PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
764
-			if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) {
763
+			$PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
764
+			if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) {
765 765
 				$success = 0;
766 766
 			} else {
767 767
 				$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
768
-				if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
768
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
769 769
 					//if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
770
-					if ( $PRC_deleted ) {
770
+					if ($PRC_deleted) {
771 771
 						$ticket->_remove_relation_to($PRC_ID, 'Price');
772 772
 					} else {
773 773
 						$ticket->_add_relation_to($PRC_ID, 'Price');
@@ -781,17 +781,17 @@  discard block
 block discarded – undo
781 781
 			'action' => 'default'
782 782
 			);
783 783
 
784
-		if ( $success ) {
785
-			if ( $trash ) {
784
+		if ($success) {
785
+			if ($trash) {
786 786
 				$msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso');
787 787
 			} else {
788 788
 				$msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso');
789 789
 			}
790 790
 
791
-			EE_Error::add_success( $msg );
791
+			EE_Error::add_success($msg);
792 792
 		}
793 793
 
794
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
794
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
795 795
 
796 796
 	}
797 797
 
@@ -808,19 +808,19 @@  discard block
 block discarded – undo
808 808
 	protected function _delete_price() {
809 809
 
810 810
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
811
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
811
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
812 812
 
813
-		require_once(EE_MODELS . 'EEM_Price.model.php');
813
+		require_once(EE_MODELS.'EEM_Price.model.php');
814 814
 		$PRC = EEM_Price::instance();
815 815
 
816 816
 		$success = 1;
817 817
 		//Checkboxes
818
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
818
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
819 819
 			// if array has more than one element than success message should be plural
820
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
820
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
821 821
 			// cycle thru bulk action checkboxes
822
-			while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) {
823
-				if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) {
822
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
823
+				if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) {
824 824
 					$success = 0;
825 825
 				}
826 826
 			}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 
835 835
 		}
836 836
 
837
-		$this->_redirect_after_action( $success, 'Prices', 'deleted', array() );
837
+		$this->_redirect_after_action($success, 'Prices', 'deleted', array());
838 838
 
839 839
 	}
840 840
 
@@ -842,16 +842,16 @@  discard block
 block discarded – undo
842 842
 
843 843
 
844 844
 	public function update_price_order() {
845
-		$success = __( 'Price order was updated successfully.', 'event_espresso' );
845
+		$success = __('Price order was updated successfully.', 'event_espresso');
846 846
 
847 847
 		// grab our row IDs
848
-		$row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE;
848
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE;
849 849
 
850
-		if ( is_array( $row_ids )) {
851
-			for ( $i = 0; $i < count( $row_ids ); $i++ ) {
850
+		if (is_array($row_ids)) {
851
+			for ($i = 0; $i < count($row_ids); $i++) {
852 852
 				//Update the prices when re-ordering
853 853
 				$id = absint($row_ids[$i]);
854
-				if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) {
854
+				if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) {
855 855
 					$success = FALSE;
856 856
 				}
857 857
 			}
@@ -859,9 +859,9 @@  discard block
 block discarded – undo
859 859
 			$success = FALSE;
860 860
 		}
861 861
 
862
-		$errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE;
862
+		$errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE;
863 863
 
864
-		echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors ));
864
+		echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors));
865 865
 		die();
866 866
 	}
867 867
 
@@ -904,46 +904,46 @@  discard block
 block discarded – undo
904 904
 	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
905 905
 	* 	@return mixed (int|array)  int = count || array of price objects
906 906
 	*/
907
-	public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
907
+	public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) {
908 908
 
909
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
909
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
910 910
 		// start with an empty array
911 911
 
912
-		require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' );
913
-		require_once( EE_MODELS . 'EEM_Price_Type.model.php' );
912
+		require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php');
913
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
914 914
 
915 915
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
916
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
916
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
917 917
 		switch ($this->_req_data['orderby']) {
918 918
 			case 'name':
919
-				$orderby = array( 'PRT_name' => $order);
919
+				$orderby = array('PRT_name' => $order);
920 920
 				break;
921 921
 			default:
922
-				$orderby = array( 'PRT_order' => $order);
922
+				$orderby = array('PRT_order' => $order);
923 923
 		}
924 924
 
925 925
 
926
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
927
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
926
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
927
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
928 928
 
929
-		$offset = ($current_page-1)*$per_page;
930
-		$limit = array( $offset, $per_page );
929
+		$offset = ($current_page - 1) * $per_page;
930
+		$limit = array($offset, $per_page);
931 931
 
932
-		$_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) );
932
+		$_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1));
933 933
 
934
-		if ( isset( $this->_req_data['s'] ) ) {
935
-			$sstr = '%' . $this->_req_data['s'] . '%';
934
+		if (isset($this->_req_data['s'])) {
935
+			$sstr = '%'.$this->_req_data['s'].'%';
936 936
 			$_where['OR'] = array(
937
-				'PRT_name' => array( 'LIKE', $sstr )
937
+				'PRT_name' => array('LIKE', $sstr)
938 938
 				);
939 939
 		}
940 940
 		$query_params = array(
941 941
 			$_where,
942 942
 			'order_by'=>$orderby,
943 943
 			'limit'=>$limit);
944
-		if($count){
944
+		if ($count) {
945 945
 			return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params);
946
-		}else{
946
+		} else {
947 947
 			return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params);
948 948
 		}
949 949
 
@@ -963,25 +963,25 @@  discard block
 block discarded – undo
963 963
 	*/
964 964
 	protected function _edit_price_type_details() {
965 965
 
966
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
966
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
967 967
 
968 968
 
969 969
 		// grab price type ID
970
-		$PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
970
+		$PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
971 971
 		// change page title based on request action
972
-		$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
972
+		$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
973 973
 		// add PRT_ID to title if editing
974
-		$this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title;
974
+		$this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title;
975 975
 
976 976
 //		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
977 977
 
978
-		if ( $PRT_ID ) {
979
-			$price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID );
980
-			$additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID ));
981
-			$this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields );
978
+		if ($PRT_ID) {
979
+			$price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID);
980
+			$additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID));
981
+			$this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields);
982 982
 		} else {
983 983
 			$price_type = EEM_Price_Type::instance()->get_new_price_type();
984
-			$this->_set_add_edit_form_tags( 'insert_price_type' );
984
+			$this->_set_add_edit_form_tags('insert_price_type');
985 985
 		}
986 986
 
987 987
 		$this->_template_args['PRT_ID'] = $PRT_ID;
@@ -990,19 +990,19 @@  discard block
 block discarded – undo
990 990
 
991 991
 		$base_types = EEM_Price_Type::instance()->get_base_types();
992 992
 		$select_values = array();
993
-		foreach ( $base_types as $ref => $text ) {
994
-			if ( $ref == EEM_Price_Type::base_type_base_price ) {
993
+		foreach ($base_types as $ref => $text) {
994
+			if ($ref == EEM_Price_Type::base_type_base_price) {
995 995
 				//do not allow creation of base_type_base_prices because that's a system only base type.
996 996
 				continue;
997 997
 			}
998
-			$values[] = array( 'id' => $ref, 'text' => $text );
998
+			$values[] = array('id' => $ref, 'text' => $text);
999 999
 		}
1000 1000
 
1001 1001
 
1002 1002
 		$this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"');
1003 1003
 		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
1004
-		$redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url );
1005
-		$this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL );
1004
+		$redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url);
1005
+		$this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL);
1006 1006
 		// the details template wrapper
1007 1007
 		$this->display_admin_page_with_sidebar();
1008 1008
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 	*		@return void
1020 1020
 	*/
1021 1021
 	protected function _price_type_details_meta_boxes() {
1022
-		add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1022
+		add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1023 1023
 	}
1024 1024
 
1025 1025
 
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 	*		@return void
1033 1033
 	*/
1034 1034
 	public function _edit_price_type_details_meta_box() {
1035
-		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE );
1035
+		echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE);
1036 1036
 	}
1037 1037
 
1038 1038
 
@@ -1045,9 +1045,9 @@  discard block
 block discarded – undo
1045 1045
 	*/
1046 1046
 	protected function set_price_type_column_values() {
1047 1047
 
1048
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1048
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1049 1049
 
1050
-		$base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price;
1050
+		$base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price;
1051 1051
 
1052 1052
 		switch ($base_type) {
1053 1053
 
@@ -1094,12 +1094,12 @@  discard block
 block discarded – undo
1094 1094
 	*		@access protected
1095 1095
 	*		@return void
1096 1096
 	*/
1097
-	protected function _insert_or_update_price_type( $new_price_type = FALSE ) {
1097
+	protected function _insert_or_update_price_type($new_price_type = FALSE) {
1098 1098
 
1099 1099
 //		echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1100
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1100
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1101 1101
 
1102
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1102
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
1103 1103
 		$PRT = EEM_Price_Type::instance();
1104 1104
 
1105 1105
 		// why be so pessimistic ???  : (
@@ -1107,24 +1107,24 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
 		$set_column_values = $this->set_price_type_column_values();
1109 1109
 		// is this a new Price ?
1110
-		if ( $new_price_type ) {
1110
+		if ($new_price_type) {
1111 1111
 			// run the insert
1112
-			if ( $PRT_ID = $PRT->insert( $set_column_values )) {
1112
+			if ($PRT_ID = $PRT->insert($set_column_values)) {
1113 1113
 				$success = 1;
1114 1114
 			}
1115 1115
 			$action_desc = 'created';
1116 1116
 		} else {
1117 1117
 			$PRT_ID = absint($this->_req_data['PRT_ID']);
1118 1118
 			// run the update
1119
-			$where_cols_n_values = array('PRT_ID' => $PRT_ID );
1120
-			if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) {
1119
+			$where_cols_n_values = array('PRT_ID' => $PRT_ID);
1120
+			if ($PRT->update($set_column_values, array($where_cols_n_values))) {
1121 1121
 				$success = 1;
1122 1122
 			}
1123 1123
 			$action_desc = 'updated';
1124 1124
 		}
1125 1125
 
1126
-		$query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID );
1127
-		$this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args );
1126
+		$query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID);
1127
+		$this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args);
1128 1128
 
1129 1129
 	}
1130 1130
 
@@ -1138,49 +1138,49 @@  discard block
 block discarded – undo
1138 1138
 	*		@access protected
1139 1139
 	*		@return void
1140 1140
 	*/
1141
-	protected function _trash_or_restore_price_type( $trash = TRUE ) {
1141
+	protected function _trash_or_restore_price_type($trash = TRUE) {
1142 1142
 
1143 1143
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1144
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1144
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1145 1145
 
1146
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1146
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
1147 1147
 		$PRT = EEM_Price_Type::instance();
1148 1148
 
1149 1149
 		$success = 1;
1150 1150
 		$PRT_deleted = $trash ? TRUE : FALSE;
1151 1151
 		//Checkboxes
1152
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1152
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1153 1153
 			// if array has more than one element than success message should be plural
1154
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1155
-			$what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type';
1154
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1155
+			$what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type';
1156 1156
 			// cycle thru checkboxes
1157
-			while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) {
1158
-				if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) {
1157
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1158
+				if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1159 1159
 					$success = 0;
1160 1160
 				}
1161 1161
 			}
1162 1162
 
1163 1163
 		} else {
1164 1164
 			// grab single id and delete
1165
-			$PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
1166
-			if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) {
1165
+			$PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
1166
+			if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1167 1167
 				$success = 0;
1168 1168
 			}
1169 1169
 			$what = 'Price Type';
1170 1170
 
1171 1171
 		}
1172 1172
 
1173
-		$query_args = array( 'action' => 'price_types' );
1174
-		if ( $success ) {
1175
-			if ( $trash ) {
1173
+		$query_args = array('action' => 'price_types');
1174
+		if ($success) {
1175
+			if ($trash) {
1176 1176
 				$msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso');
1177 1177
 			} else {
1178 1178
 				$msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso');
1179 1179
 			}
1180
-			EE_Error::add_success( $msg );
1180
+			EE_Error::add_success($msg);
1181 1181
 		}
1182 1182
 
1183
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1183
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1184 1184
 
1185 1185
 	}
1186 1186
 
@@ -1197,19 +1197,19 @@  discard block
 block discarded – undo
1197 1197
 	protected function _delete_price_type() {
1198 1198
 
1199 1199
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1200
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1200
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1201 1201
 
1202 1202
 		$PRT = EEM_Price_Type::instance();
1203 1203
 
1204 1204
 		$success = 1;
1205 1205
 		//Checkboxes
1206
-		if (!empty($this->_req_data['checkbox'])) {
1206
+		if ( ! empty($this->_req_data['checkbox'])) {
1207 1207
 			// if array has more than one element than success message should be plural
1208
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1208
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1209 1209
 			$what = $PRT->item_name($success);
1210 1210
 			// cycle thru bulk action checkboxes
1211
-			while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) {
1212
-				if (!$PRT->delete_permanently_by_ID($PRT_ID) ) {
1211
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1212
+				if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) {
1213 1213
 					$success = 0;
1214 1214
 				}
1215 1215
 			}
@@ -1217,8 +1217,8 @@  discard block
 block discarded – undo
1217 1217
 		}
1218 1218
 
1219 1219
 
1220
-		$query_args = array( 'action'=> 'price_types' );
1221
-		$this->_redirect_after_action( $success, $what, 'deleted', $query_args );
1220
+		$query_args = array('action'=> 'price_types');
1221
+		$this->_redirect_after_action($success, $what, 'deleted', $query_args);
1222 1222
 
1223 1223
 	}
1224 1224
 
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
 	*		@return string
1235 1235
 	*/
1236 1236
 	protected function _learn_more_about_pricing_link() {
1237
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>';
1237
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>';
1238 1238
 	}
1239 1239
 
1240 1240
 
Please login to merge, or discard this patch.
caffeinated/payment_methods/Paypal_Pro/EEG_Paypal_Pro.gateway.php 1 patch
Spacing   +51 added lines, -51 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
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEG_Paypal_Pro extends EE_Onsite_Gateway{
28
+class EEG_Paypal_Pro extends EE_Onsite_Gateway {
29 29
 	/**
30 30
 	 *
31 31
 	 * @var $_paypal_api_username string
@@ -88,21 +88,21 @@  discard block
 block discarded – undo
88 88
 	 * } @see parent::do_direct_payment for more info
89 89
 	 * @return \EE_Payment|\EEI_Payment
90 90
 	 */
91
-	public function do_direct_payment($payment,$billing_info = null){
91
+	public function do_direct_payment($payment, $billing_info = null) {
92 92
 		$transaction = $payment->transaction();
93 93
 		$primary_registrant = $transaction->primary_registration();
94
-		$order_description  = sprintf(__("Event Registrations from %s", "event_espresso"),get_bloginfo('name'));
94
+		$order_description  = sprintf(__("Event Registrations from %s", "event_espresso"), get_bloginfo('name'));
95 95
 		//charge for the full amount. Show itemized list
96
-		if( $this->_can_easily_itemize_transaction_for( $payment ) ){
96
+		if ($this->_can_easily_itemize_transaction_for($payment)) {
97 97
 			$item_num = 1;
98 98
 			$total_line_item = $transaction->total_line_item();
99 99
 			$order_items = array();
100 100
 			foreach ($total_line_item->get_items() as $line_item) {
101 101
 				$item = array(
102 102
 						// Item Name.  127 char max.
103
-						'l_name' => substr($line_item->name(),0,127),
103
+						'l_name' => substr($line_item->name(), 0, 127),
104 104
 						// Item description.  127 char max.
105
-						'l_desc' => substr($line_item->desc(),0,127),
105
+						'l_desc' => substr($line_item->desc(), 0, 127),
106 106
 						// Cost of individual item.
107 107
 						'l_amt' => $line_item->unit_price(),
108 108
 						// Item Number.  127 char max.
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
 			}
124 124
 			$item_amount = $total_line_item->get_items_total();
125 125
 			$tax_amount = $total_line_item->get_total_tax();
126
-		}else{
126
+		} else {
127 127
 			$order_items = array();
128 128
 			$item_amount = $payment->amount();
129
-			$single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code());
129
+			$single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code());
130 130
 			$tax_amount = 0;
131
-			array_push($order_items,array(
131
+			array_push($order_items, array(
132 132
 				// Item Name.  127 char max.
133
-				'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'),$primary_registrant->reg_code()),
133
+				'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'), $primary_registrant->reg_code()),
134 134
 				// Item description.  127 char max.
135 135
 				'l_desc' => $single_item_desc,
136 136
 				// Cost of individual item.
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 			// Payer's salutation.  20 char max.
178 178
 			'salutation' => '',
179 179
 			// Payer's first name.  25 char max.
180
-			'firstname' => substr($billing_info['first_name'],0,25),
180
+			'firstname' => substr($billing_info['first_name'], 0, 25),
181 181
 			// Payer's middle name.  25 char max.
182 182
 			'middlename' => '',
183 183
 			// Payer's last name.  25 char max.
184
-			'lastname' => substr($billing_info['last_name'],0,25),
184
+			'lastname' => substr($billing_info['last_name'], 0, 25),
185 185
 			// Payer's suffix.  12 char max.
186 186
 			'suffix' => ''
187 187
 		);
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
 			// Required.  Name of City.
195 195
 			'city' => $billing_info['city'],
196 196
 			// Required. Name of State or Province.
197
-			'state' => substr( $billing_info['state'], 0, 40 ),
197
+			'state' => substr($billing_info['state'], 0, 40),
198 198
 			// Required.  Country code.
199 199
 			'countrycode' => $billing_info['country'],
200 200
 			// Required.  Postal code of payer.
201 201
 			'zip' => $billing_info['zip'],
202 202
 			// Phone Number of payer.  20 char max.
203
-			'shiptophonenum' => substr($billing_info['phone'],0,20)
203
+			'shiptophonenum' => substr($billing_info['phone'], 0, 20)
204 204
 		);
205 205
 
206 206
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			// Required.  Three-letter currency code.  Default is USD.
211 211
 			'currencycode' => $payment->currency_code(),
212 212
 			// Required if you include itemized cart details. (L_AMTn, etc.)  Subtotal of items not including S&H, or tax.
213
-			'itemamt' => $this->format_currency($item_amount),//
213
+			'itemamt' => $this->format_currency($item_amount), //
214 214
 			// Total shipping costs for the order.  If you specify shippingamt, you must also specify itemamt.
215 215
 			'shippingamt' => '',
216 216
 			// Total handling costs for the order.  If you specify handlingamt, you must also specify itemamt.
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
 			// Free-form field for your own use.  256 char max.
223 223
 			'custom' => $primary_registrant ? $primary_registrant->ID() : '',
224 224
 			// Your own invoice or tracking number
225
-			'invnum' => wp_generate_password(12,false),//$transaction->ID(),
225
+			'invnum' => wp_generate_password(12, false), //$transaction->ID(),
226 226
 			// URL for receiving Instant Payment Notifications.  This overrides what your profile is set to use.
227 227
 			'notifyurl' => '',
228
-			'buttonsource' => 'EventEspresso_SP',//EE will blow up if you change this
228
+			'buttonsource' => 'EventEspresso_SP', //EE will blow up if you change this
229 229
 		);
230 230
 		// Wrap all data arrays into a single, "master" array which will be passed into the class function.
231 231
 		$PayPalRequestData = array(
@@ -238,32 +238,32 @@  discard block
 block discarded – undo
238 238
 				'OrderItems' => $order_items,
239 239
 		);
240 240
 		$this->_log_clean_request($PayPalRequestData, $payment);
241
-		try{
241
+		try {
242 242
 			$PayPalResult = $this->prep_and_curl_request($PayPalRequestData);
243 243
 			//remove PCI-sensitive data so it doesn't get stored
244
-			$PayPalResult = $this->_log_clean_response($PayPalResult,$payment);
244
+			$PayPalResult = $this->_log_clean_response($PayPalResult, $payment);
245 245
 
246 246
 			$message = isset($PayPalResult['L_LONGMESSAGE0']) ? $PayPalResult['L_LONGMESSAGE0'] : $PayPalResult['ACK'];
247
-			if( empty($PayPalResult[ 'RAWRESPONSE' ] ) ) {
248
-				$payment->set_status( $this->_pay_model->failed_status() ) ;
249
-				$payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) );
247
+			if (empty($PayPalResult['RAWRESPONSE'])) {
248
+				$payment->set_status($this->_pay_model->failed_status());
249
+				$payment->set_gateway_response(__('No response received from Paypal Pro', 'event_espresso'));
250 250
 				$payment->set_details($PayPalResult);
251
-			}else{
252
-				if($this->_APICallSuccessful($PayPalResult)){
251
+			} else {
252
+				if ($this->_APICallSuccessful($PayPalResult)) {
253 253
 					$payment->set_status($this->_pay_model->approved_status());
254
-				}else{
254
+				} else {
255 255
 					$payment->set_status($this->_pay_model->declined_status());
256 256
 				}
257 257
 				//make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
258
-				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval( $PayPalResult['AMT'] ) : 0);
258
+				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0);
259 259
 				$payment->set_gateway_response($message);
260
-				$payment->set_txn_id_chq_nmbr(isset( $PayPalResult['TRANSACTIONID'] )? $PayPalResult['TRANSACTIONID'] : null);
260
+				$payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : null);
261 261
 
262 262
 				$primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : '';
263 263
 				$payment->set_extra_accntng($primary_registration_code);
264 264
 				$payment->set_details($PayPalResult);
265 265
 			}
266
-		}catch(Exception $e){
266
+		} catch (Exception $e) {
267 267
 			$payment->set_status($this->_pay_model->failed_status());
268 268
 			$payment->set_gateway_response($e->getMessage());
269 269
 		}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 * @param EEI_Payment $payment
281 281
 	 * @return array
282 282
 	 */
283
-	private function _log_clean_request($request,$payment){
283
+	private function _log_clean_request($request, $payment) {
284 284
 		$cleaned_request_data = $request;
285 285
 		unset($cleaned_request_data['CCDetails']['acct']);
286 286
 		unset($cleaned_request_data['CCDetails']['cvv2']);
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
 	 * @param EEI_Payment $payment
297 297
 	 * @return array cleaned
298 298
 	 */
299
-	private function _log_clean_response($response,$payment){
299
+	private function _log_clean_response($response, $payment) {
300 300
 		unset($response['REQUESTDATA']['CREDITCARDTYPE']);
301 301
 		unset($response['REQUESTDATA']['ACCT']);
302 302
 		unset($response['REQUESTDATA']['EXPDATE']);
303 303
 		unset($response['REQUESTDATA']['CVV2']);
304 304
 		unset($response['RAWREQUEST']);
305
-		$this->log(array('Paypal Response'=>$response),$payment);
305
+		$this->log(array('Paypal Response'=>$response), $payment);
306 306
 		return $response;
307 307
 	}
308 308
 
@@ -327,32 +327,32 @@  discard block
 block discarded – undo
327 327
 		// DP Fields
328 328
 		$DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array();
329 329
 		foreach ($DPFields as $DPFieldsVar => $DPFieldsVal)
330
-			$DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal);
330
+			$DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal);
331 331
 
332 332
 		// CC Details Fields
333 333
 		$CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array();
334 334
 		foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal)
335
-			$CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal);
335
+			$CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal);
336 336
 
337 337
 		// PayerInfo Type Fields
338 338
 		$PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array();
339 339
 		foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal)
340
-			$PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal);
340
+			$PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal);
341 341
 
342 342
 		// Payer Name Fields
343 343
 		$PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array();
344 344
 		foreach ($PayerName as $PayerNameVar => $PayerNameVal)
345
-			$PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal);
345
+			$PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal);
346 346
 
347 347
 		// Address Fields (Billing)
348 348
 		$BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array();
349 349
 		foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal)
350
-			$BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal);
350
+			$BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal);
351 351
 
352 352
 		// Payment Details Type Fields
353 353
 		$PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array();
354 354
 		foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal)
355
-			$PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal);
355
+			$PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal);
356 356
 
357 357
 		// Payment Details Item Type Fields
358 358
 		$OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array();
@@ -360,22 +360,22 @@  discard block
 block discarded – undo
360 360
 		foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) {
361 361
 			$CurrentItem = $OrderItems[$OrderItemsVar];
362 362
 			foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal)
363
-				$OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal);
363
+				$OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal);
364 364
 			$n++;
365 365
 		}
366 366
 
367 367
 		// Ship To Address Fields
368 368
 		$ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array();
369 369
 		foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal)
370
-			$ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal);
370
+			$ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal);
371 371
 
372 372
 		// 3D Secure Fields
373 373
 		$Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array();
374 374
 		foreach ($Secure3D as $Secure3DVar => $Secure3DVal)
375
-			$Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal);
375
+			$Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal);
376 376
 
377 377
 		// Now that we have each chunk we need to go ahead and append them all together for our entire NVP string
378
-		$NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP;
378
+		$NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP;
379 379
 		$NVPResponse = $this->_CURLRequest($NVPRequest);
380 380
 		$NVPRequestArray = $this->_NVPToArray($NVPRequest);
381 381
 		$NVPResponseArray = $this->_NVPToArray($NVPResponse);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	private function _CURLRequest($Request) {
400 400
 		$EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';
401 401
 		$curl = curl_init();
402
-		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) );
402
+		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE));
403 403
 		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
404 404
 		curl_setopt($curl, CURLOPT_TIMEOUT, 60);
405 405
 		curl_setopt($curl, CURLOPT_URL, $EndPointURL);
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 	private function _APICallSuccessful($PayPalResult) {
450 450
 		$approved = false;
451 451
 		// check main response message from PayPal
452
-		if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) {
452
+		if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) {
453 453
 			$ack = strtoupper($PayPalResult['ACK']);
454
-			$approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? true : false;
454
+			$approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false;
455 455
 		}
456 456
 
457 457
 		return $approved;
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 
468 468
 		$Errors = array();
469 469
 		$n = 0;
470
-		while (isset($DataArray['L_ERRORCODE' . $n . ''])) {
471
-			$LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : '';
472
-			$LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : '';
473
-			$LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : '';
474
-			$LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : '';
470
+		while (isset($DataArray['L_ERRORCODE'.$n.''])) {
471
+			$LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : '';
472
+			$LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : '';
473
+			$LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : '';
474
+			$LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : '';
475 475
 
476 476
 			$CurrentItem = array(
477 477
 					'L_ERRORCODE' => $LErrorCode,
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 				elseif ($CurrentErrorVar == 'L_SEVERITYCODE')
512 512
 					$CurrentVarName = 'Severity Code';
513 513
 
514
-				$error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal;
514
+				$error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal;
515 515
 			}
516 516
 		}
517 517
 		return $error;
Please login to merge, or discard this patch.
modules/event_single/EED_Event_Single.module.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @return EED_Event_Single
41 41
 	 */
42 42
 	public static function instance() {
43
-		return parent::get_instance( __CLASS__ );
43
+		return parent::get_instance(__CLASS__);
44 44
 	}
45 45
 
46 46
 
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	 *  @return 	void
53 53
 	 */
54 54
 	public static function set_hooks() {
55
-		add_filter( 'FHEE_run_EE_wp', '__return_true' );
56
-		add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 );
57
-		EE_Config::register_route( __( 'event', 'event_espresso' ), 'Event_Single', 'run' );
55
+		add_filter('FHEE_run_EE_wp', '__return_true');
56
+		add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
57
+		EE_Config::register_route(__('event', 'event_espresso'), 'Event_Single', 'run');
58 58
 	}
59 59
 
60 60
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *  @return 	void
65 65
 	 */
66 66
 	public static function set_hooks_admin() {
67
-		add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 );
67
+		add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
68 68
 	}
69 69
 
70 70
 
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	 * @return void
79 79
 	 */
80 80
 	public static function set_definitions() {
81
-		define( 'EVENT_SINGLE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
82
-		define( 'EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS );
81
+		define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
82
+		define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS);
83 83
 	}
84 84
 
85 85
 
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @void
91 91
 	 */
92
-	protected function set_config(){
93
-		$this->set_config_section( 'template_settings' );
94
-		$this->set_config_class( 'EE_Event_Single_Config' );
95
-		$this->set_config_name( 'EED_Event_Single' );
92
+	protected function set_config() {
93
+		$this->set_config_section('template_settings');
94
+		$this->set_config_class('EE_Event_Single_Config');
95
+		$this->set_config_name('EED_Event_Single');
96 96
 	}
97 97
 
98 98
 
@@ -105,35 +105,35 @@  discard block
 block discarded – undo
105 105
 	 * @param \EE_Event_Single_Config $config
106 106
 	 * @return \EE_Template_Part_Manager
107 107
 	 */
108
-	public function initialize_template_parts( EE_Event_Single_Config $config = null ) {
108
+	public function initialize_template_parts(EE_Event_Single_Config $config = null) {
109 109
 		$config = $config instanceof EE_Event_Single_Config ? $config : $this->config();
110 110
 		EEH_Autoloader::instance()->register_template_part_autoloaders();
111 111
 		$template_parts = new EE_Template_Part_Manager();
112 112
 		$template_parts->add_template_part(
113 113
 			'tickets',
114
-			__( 'Ticket Selector', 'event_espresso' ),
114
+			__('Ticket Selector', 'event_espresso'),
115 115
 			'content-espresso_events-tickets.php',
116 116
 			$config->display_order_tickets
117 117
 		);
118 118
 		$template_parts->add_template_part(
119 119
 			'datetimes',
120
-			__( 'Dates and Times', 'event_espresso' ),
120
+			__('Dates and Times', 'event_espresso'),
121 121
 			'content-espresso_events-datetimes.php',
122 122
 			$config->display_order_datetimes
123 123
 		);
124 124
 		$template_parts->add_template_part(
125 125
 			'event',
126
-			__( 'Event Description', 'event_espresso' ),
126
+			__('Event Description', 'event_espresso'),
127 127
 			'content-espresso_events-details.php',
128 128
 			$config->display_order_event
129 129
 		);
130 130
 		$template_parts->add_template_part(
131 131
 			'venue',
132
-			__( 'Venue Information', 'event_espresso' ),
132
+			__('Venue Information', 'event_espresso'),
133 133
 			'content-espresso_events-venues.php',
134 134
 			$config->display_order_venue
135 135
 		);
136
-		do_action( 'AHEE__EED_Event_Single__initialize_template_parts', $template_parts );
136
+		do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts);
137 137
 		return $template_parts;
138 138
 	}
139 139
 
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
 	 * @param WP $WP
148 148
 	 * @return    void
149 149
 	 */
150
-	public function run( $WP ) {
150
+	public function run($WP) {
151 151
 		// ensure valid EE_Events_Single_Config() object exists
152 152
 		$this->set_config();
153 153
 		// check what template is loaded
154
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
155
-		add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
154
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
155
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
156 156
 		// load css
157
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
158
-		EE_Registry::instance()->load_helper( 'Venue_View' );
157
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
158
+		EE_Registry::instance()->load_helper('Venue_View');
159 159
 	}
160 160
 
161 161
 
@@ -167,26 +167,26 @@  discard block
 block discarded – undo
167 167
 	 * @param 	string $template
168 168
 	 * @return 	string
169 169
 	 */
170
-	public function template_include( $template ) {
170
+	public function template_include($template) {
171 171
 		global $post;
172 172
 		/** @type EE_Event_Single_Config $config */
173 173
 		$config = $this->config();
174
-		if ( $config->display_status_banner_single ) {
175
-			add_filter( 'the_title', array( 'EED_Event_Single', 'the_title' ), 100, 2 );
174
+		if ($config->display_status_banner_single) {
175
+			add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2);
176 176
 		}
177 177
 		// not a custom template?
178 178
 		if (
179 179
 			EE_Front_Controller::instance()->get_selected_template() != 'single-espresso_events.php'
180
-			&& ! post_password_required( $post )
180
+			&& ! post_password_required($post)
181 181
 		) {
182 182
 			EEH_Template::load_espresso_theme_functions();
183 183
 			// then add extra event data via hooks
184
-			add_action( 'loop_start', array( 'EED_Event_Single', 'loop_start' ));
185
-			add_filter( 'get_the_excerpt', array( 'EED_Event_Single', 'get_the_excerpt' ), 1, 1 );
186
-			add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 );
187
-			add_action( 'loop_end', array( 'EED_Event_Single', 'loop_end' ));
184
+			add_action('loop_start', array('EED_Event_Single', 'loop_start'));
185
+			add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1);
186
+			add_filter('the_content', array('EED_Event_Single', 'event_details'), 100);
187
+			add_action('loop_end', array('EED_Event_Single', 'loop_end'));
188 188
 			// don't display entry meta because the existing theme will take car of that
189
-			add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' );
189
+			add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
190 190
 		}
191 191
 		return $template;
192 192
 	}
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 * @param 	array $wp_query_array an array containing the WP_Query object
201 201
 	 * @return 	void
202 202
 	 */
203
-	public static function loop_start( $wp_query_array ) {
203
+	public static function loop_start($wp_query_array) {
204 204
 		global $post;
205
-		do_action( 'AHEE_event_details_before_post', $post, $wp_query_array );
205
+		do_action('AHEE_event_details_before_post', $post, $wp_query_array);
206 206
 	}
207 207
 
208 208
 
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 	 * @param 	int 	$id
216 216
 	 * @return 	string
217 217
 	 */
218
-	public static function the_title( $title = '', $id = 0 ) {
218
+	public static function the_title($title = '', $id = 0) {
219 219
 		global $post;
220
-		return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title :  $title;
220
+		return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title;
221 221
 	}
222 222
 
223 223
 
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 	 * @param        string $excerpt
230 230
 	 * @return        string
231 231
 	 */
232
-	public static function get_the_excerpt( $excerpt = '' ) {
232
+	public static function get_the_excerpt($excerpt = '') {
233 233
 		EED_Event_Single::$using_get_the_excerpt = true;
234
-		add_filter( 'wp_trim_excerpt', array( 'EED_Event_Single', 'end_get_the_excerpt' ), 999, 1 );
234
+		add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1);
235 235
 		return $excerpt;
236 236
 	}
237 237
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 * @param  string $text
245 245
 	 * @return string
246 246
 	 */
247
-	public static function end_get_the_excerpt( $text = '' ) {
247
+	public static function end_get_the_excerpt($text = '') {
248 248
 		EED_Event_Single::$using_get_the_excerpt = false;
249 249
 		return $text;
250 250
 	}
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 * @param 	string 	$content
259 259
 	 * @return 	string
260 260
 	 */
261
-	public static function event_details( $content ) {
261
+	public static function event_details($content) {
262 262
 		global $post;
263 263
 		static $current_post_ID = 0;
264 264
 		if (
@@ -273,15 +273,15 @@  discard block
 block discarded – undo
273 273
 			// We want to allow those plugins to still do their thing and have access to our content, but depending on
274 274
 			// how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice,
275 275
 			// so the following allows this filter to be applied multiple times, but only once for real
276
-			$current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0;
277
-			if ( EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order ) {
276
+			$current_post_ID = did_action('loop_start') ? $post->ID : 0;
277
+			if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) {
278 278
 				// we need to first remove this callback from being applied to the_content()
279 279
 				// (otherwise it will recurse and blow up the interweb)
280
-				remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 );
280
+				remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100);
281 281
 				EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts();
282
-				$content = EEH_Template::locate_template( 'content-espresso_events-details.php' );
283
-				$content = EED_Event_Single::instance()->template_parts->apply_template_part_filters( $content );
284
-				add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 );
282
+				$content = EEH_Template::locate_template('content-espresso_events-details.php');
283
+				$content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content);
284
+				add_filter('the_content', array('EED_Event_Single', 'event_details'), 100);
285 285
 			} else {
286 286
 				$content = EED_Event_Single::use_filterable_display_order();
287 287
 			}
@@ -302,19 +302,19 @@  discard block
 block discarded – undo
302 302
 		// it uses the_content() for displaying the $post->post_content
303 303
 		// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
304 304
 		// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
305
-		remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 );
305
+		remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100);
306 306
 		//now add additional content
307
-		add_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110, 1 );
308
-		add_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120, 1 );
309
-		add_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130, 1 );
310
-		do_action( 'AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters' );
307
+		add_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110, 1);
308
+		add_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120, 1);
309
+		add_filter('the_content', array('EED_Event_Single', 'event_venues'), 130, 1);
310
+		do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters');
311 311
 		// now load our template
312
-		$content = EEH_Template::locate_template( 'content-espresso_events-details.php' );
312
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
313 313
 		//now add our filter back in, plus some others
314
-		add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 );
315
-		remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 );
316
-		remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 );
317
-		remove_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130 );
314
+		add_filter('the_content', array('EED_Event_Single', 'event_details'), 100);
315
+		remove_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110);
316
+		remove_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120);
317
+		remove_filter('the_content', array('EED_Event_Single', 'event_venues'), 130);
318 318
 		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
319 319
 		return $content;
320 320
 	}
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 * @param        string $content
329 329
 	 * @return        string
330 330
 	 */
331
-	public static function event_datetimes( $content ) {
332
-		return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content;
331
+	public static function event_datetimes($content) {
332
+		return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content;
333 333
 	}
334 334
 
335 335
 
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 	 * @param        string $content
342 342
 	 * @return        string
343 343
 	 */
344
-	public static function event_tickets( $content ) {
345
-		return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content;
344
+	public static function event_tickets($content) {
345
+		return EEH_Template::locate_template('content-espresso_events-tickets.php').$content;
346 346
 	}
347 347
 
348 348
 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 	 * @param 	string $content
355 355
 	 * @return 	string
356 356
 	 */
357
-	public static function event_venue( $content ) {
358
-		return EED_Event_Single::event_venues( $content );
357
+	public static function event_venue($content) {
358
+		return EED_Event_Single::event_venues($content);
359 359
 	}
360 360
 
361 361
 
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 * @param        string $content
368 368
 	 * @return        string
369 369
 	 */
370
-	public static function event_venues( $content ) {
371
-		return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' );
370
+	public static function event_venues($content) {
371
+		return $content.EEH_Template::locate_template('content-espresso_events-venues.php');
372 372
 	}
373 373
 
374 374
 
@@ -380,9 +380,9 @@  discard block
 block discarded – undo
380 380
 	 * 	@param		array 	$wp_query_array an array containing the WP_Query object
381 381
 	 *  	@return 		void
382 382
 	 */
383
-	public static function loop_end( $wp_query_array ) {
383
+	public static function loop_end($wp_query_array) {
384 384
 		global $post;
385
-		do_action( 'AHEE_event_details_after_post', $post, $wp_query_array );
385
+		do_action('AHEE_event_details_after_post', $post, $wp_query_array);
386 386
 	}
387 387
 
388 388
 
@@ -395,18 +395,18 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	public function wp_enqueue_scripts() {
397 397
 		// get some style
398
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && apply_filters( 'FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE )) {
399
-			EE_Registry::instance()->load_helper( 'File' );
398
+		if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)) {
399
+			EE_Registry::instance()->load_helper('File');
400 400
 			// first check uploads folder
401
-			if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
402
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ));
401
+			if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
402
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
403 403
 			} else {
404
-				wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ));
404
+				wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
405 405
 			}
406
-			wp_enqueue_script( $this->theme );
407
-			if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) {
408
-				EE_Registry::instance()->load_helper( 'Maps' );
409
-				add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 );
406
+			wp_enqueue_script($this->theme);
407
+			if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
408
+				EE_Registry::instance()->load_helper('Maps');
409
+				add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
410 410
 			}
411 411
 		}
412 412
 	}
@@ -425,12 +425,12 @@  discard block
 block discarded – undo
425 425
 	 *  @return 	bool
426 426
 	 */
427 427
 	public static function display_venue() {
428
-		EE_Registry::instance()->load_helper( 'Venue_View' );
428
+		EE_Registry::instance()->load_helper('Venue_View');
429 429
 		/** @type EE_Event_Single_Config $config */
430 430
 		$config = EED_Event_Single::instance()->config();
431
-		$display_venue= isset( $config->display_venue ) ? $config->display_venue : TRUE;
431
+		$display_venue = isset($config->display_venue) ? $config->display_venue : TRUE;
432 432
 		$venue_name = EEH_Venue_View::venue_name();
433
-		return $display_venue && ! empty( $venue_name ) ? TRUE : FALSE;
433
+		return $display_venue && ! empty($venue_name) ? TRUE : FALSE;
434 434
 	}
435 435
 
436 436
 
Please login to merge, or discard this patch.
modules/events_archive/EED_Events_Archive.module.php 1 patch
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return EED_Events_Archive
44 44
 	 */
45 45
 	public static function instance() {
46
-		return parent::get_instance( __CLASS__ );
46
+		return parent::get_instance(__CLASS__);
47 47
 	}
48 48
 
49 49
 
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	 *  @return 	void
56 56
 	 */
57 57
 	public static function set_hooks() {
58
-		EE_Config::register_route( EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run' );
59
-		EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' );
60
-		add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 );
58
+		EE_Config::register_route(EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run');
59
+		EE_Config::register_route('event_list', 'Events_Archive', 'event_list');
60
+		add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2);
61 61
 	}
62 62
 
63 63
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 *  @return 	void
68 68
 	 */
69 69
 	public static function set_hooks_admin() {
70
-		add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 );
70
+		add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2);
71 71
 	}
72 72
 
73 73
 
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 *  @return 	void
81 81
 	 */
82 82
 	public static function set_definitions() {
83
-		define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
84
-		define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
83
+		define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
84
+		define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
85 85
 	}
86 86
 
87 87
 
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return \EE_Events_Archive_Config
93 93
 	 */
94
-	protected function set_config(){
95
-		$this->set_config_section( 'template_settings' );
96
-		$this->set_config_class( 'EE_Events_Archive_Config' );
97
-		$this->set_config_name( 'EED_Events_Archive' );
94
+	protected function set_config() {
95
+		$this->set_config_section('template_settings');
96
+		$this->set_config_class('EE_Events_Archive_Config');
97
+		$this->set_config_name('EED_Events_Archive');
98 98
 	}
99 99
 
100 100
 
@@ -106,35 +106,35 @@  discard block
 block discarded – undo
106 106
 	 * @param \EE_Events_Archive_Config $config
107 107
 	 * @return \EE_Template_Part_Manager
108 108
 	 */
109
-	public function initialize_template_parts( EE_Events_Archive_Config $config = null ) {
109
+	public function initialize_template_parts(EE_Events_Archive_Config $config = null) {
110 110
 		$config = $config instanceof EE_Events_Archive_Config ? $config : $this->config();
111 111
 		EEH_Autoloader::instance()->register_template_part_autoloaders();
112 112
 		$template_parts = new EE_Template_Part_Manager();
113 113
 		$template_parts->add_template_part(
114 114
 			'tickets',
115
-			__( 'Ticket Selector', 'event_espresso' ),
115
+			__('Ticket Selector', 'event_espresso'),
116 116
 			'content-espresso_events-tickets.php',
117 117
 			$config->display_order_tickets
118 118
 		);
119 119
 		$template_parts->add_template_part(
120 120
 			'datetimes',
121
-			__( 'Dates and Times', 'event_espresso' ),
121
+			__('Dates and Times', 'event_espresso'),
122 122
 			'content-espresso_events-datetimes.php',
123 123
 			$config->display_order_datetimes
124 124
 		);
125 125
 		$template_parts->add_template_part(
126 126
 			'event',
127
-			__( 'Event Description', 'event_espresso' ),
127
+			__('Event Description', 'event_espresso'),
128 128
 			'content-espresso_events-details.php',
129 129
 			$config->display_order_event
130 130
 		);
131 131
 		$template_parts->add_template_part(
132 132
 			'venue',
133
-			__( 'Venue Information', 'event_espresso' ),
133
+			__('Venue Information', 'event_espresso'),
134 134
 			'content-espresso_events-venues.php',
135 135
 			$config->display_order_venue
136 136
 		);
137
-		do_action( 'AHEE__EED_Event_Archive__initialize_template_parts', $template_parts );
137
+		do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts);
138 138
 		return $template_parts;
139 139
 	}
140 140
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @param WP $WP
148 148
 	 * @return    void
149 149
 	 */
150
-	public function run( $WP ) {
151
-		do_action( 'AHEE__EED_Events_Archive__before_run' );
150
+	public function run($WP) {
151
+		do_action('AHEE__EED_Events_Archive__before_run');
152 152
 		// ensure valid EE_Events_Archive_Config() object exists
153 153
 		$this->set_config();
154 154
 		/** @type EE_Events_Archive_Config $config */
@@ -156,19 +156,19 @@  discard block
 block discarded – undo
156 156
 		// load other required components
157 157
 		$this->load_event_list_assets();
158 158
 		// filter the WP posts_join, posts_where, and posts_orderby SQL clauses
159
-		EE_Registry::instance()->load_helper( 'Event_Query' );
159
+		EE_Registry::instance()->load_helper('Event_Query');
160 160
 		//add query filters
161 161
 		EEH_Event_Query::add_query_filters();
162 162
 		// set params that will get used by the filters
163 163
 		EEH_Event_Query::set_query_params(
164
-			'', 	// month
165
-			'', 	// category
166
-			$config->display_expired_events, 	// show_expired
167
-			'start_date', 	// orderby
164
+			'', // month
165
+			'', // category
166
+			$config->display_expired_events, // show_expired
167
+			'start_date', // orderby
168 168
 			'ASC' 	// sort
169 169
 		);
170 170
 		// check what template is loaded
171
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
171
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
172 172
 	}
173 173
 
174 174
 
@@ -200,30 +200,30 @@  discard block
 block discarded – undo
200 200
 	 * @param string $template
201 201
 	 * @return    string
202 202
 	 */
203
-	public function template_include( $template = '' ) {
203
+	public function template_include($template = '') {
204 204
 		// don't add content filter for dedicated EE child themes or private posts
205
-		EE_Registry::instance()->load_helper( 'Template' );
206
-		if ( ! EEH_Template::is_espresso_theme() ) {
205
+		EE_Registry::instance()->load_helper('Template');
206
+		if ( ! EEH_Template::is_espresso_theme()) {
207 207
 			/** @type EE_Events_Archive_Config $config */
208 208
 			$config = $this->config();
209 209
 			// add status banner ?
210
-			if ( $config->display_status_banner ) {
211
-				add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 );
210
+			if ($config->display_status_banner) {
211
+				add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2);
212 212
 			}
213 213
 			// if NOT a custom template
214
-			if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' ) {
214
+			if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php') {
215 215
 				// don't display entry meta because the existing theme will take care of that
216
-				add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' );
216
+				add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true');
217 217
 				// load functions.php file for the theme (loaded by WP if using child theme)
218 218
 				EEH_Template::load_espresso_theme_functions();
219 219
 				// because we don't know if the theme is using the_excerpt()
220
-				add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
220
+				add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1);
221 221
 				// or the_content
222
-				add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
222
+				add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1);
223 223
 				// and just in case they are running get_the_excerpt() which DESTROYS things
224
-				add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
224
+				add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
225 225
 				// don't display entry meta because the existing theme will take care of that
226
-				add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' );
226
+				add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
227 227
 			}
228 228
 		}
229 229
 		return $template;
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
 	 * 	@param		string 	$excerpt
239 239
 	 * 	@return 		string
240 240
 	 */
241
-	public static function get_the_excerpt( $excerpt = '' ) {
242
-		if ( post_password_required() ) {
241
+	public static function get_the_excerpt($excerpt = '') {
242
+		if (post_password_required()) {
243 243
 			return $excerpt;
244 244
 		}
245
-		if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) {
246
-			remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 );
247
-			remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 );
248
-			$excerpt = EED_Events_Archive::event_details( $excerpt );
245
+		if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) {
246
+			remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100);
247
+			remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100);
248
+			$excerpt = EED_Events_Archive::event_details($excerpt);
249 249
 		} else {
250 250
 			EED_Events_Archive::$using_get_the_excerpt = true;
251
-			add_filter( 'wp_trim_excerpt', array( 'EED_Events_Archive', 'end_get_the_excerpt' ), 999, 1 );
251
+			add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1);
252 252
 		}
253 253
 		return $excerpt;
254 254
 	}
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @param  string $text
263 263
 	 * @return string
264 264
 	 */
265
-	public static function end_get_the_excerpt( $text = '' ) {
265
+	public static function end_get_the_excerpt($text = '') {
266 266
 		EED_Events_Archive::$using_get_the_excerpt = false;
267 267
 		return $text;
268 268
 	}
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
 	 * @param 		string 		$id
278 278
 	 * @return 		string
279 279
 	 */
280
-	public static function the_title( $title = '', $id = '' ) {
280
+	public static function the_title($title = '', $id = '') {
281 281
 	global $post;
282
-	if ( $post instanceof WP_Post ) {
283
-		return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID  ) . $title :  $title;
282
+	if ($post instanceof WP_Post) {
283
+		return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title;
284 284
 	}
285 285
 	return $title;
286 286
 }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 * 	@param		string 	$content
295 295
 	 * 	@return 		string
296 296
 	 */
297
-	public static function event_details( $content ) {
297
+	public static function event_details($content) {
298 298
 		global $post;
299 299
 		static $current_post_ID = 0;
300 300
 		if (
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 			&& ! EED_Events_Archive::$using_get_the_excerpt
304 304
 			&& ! post_password_required()
305 305
 			&& (
306
-				apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', false )
307
-				|| ! apply_filters( 'FHEE__content_espresso_events__template_loaded', false )
306
+				apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false)
307
+				|| ! apply_filters('FHEE__content_espresso_events__template_loaded', false)
308 308
 			)
309 309
 		) {
310 310
 			// Set current post ID to prevent showing content twice, but only if headers have definitely been sent.
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 			// We want to allow those plugins to still do their thing and have access to our content, but depending on
314 314
 			// how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice,
315 315
 			// so the following allows this filter to be applied multiple times, but only once for real
316
-			$current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0;
317
-			if ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order ) {
316
+			$current_post_ID = did_action('loop_start') ? $post->ID : 0;
317
+			if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) {
318 318
 				$content = \EED_Events_Archive::use_sortable_display_order();
319 319
 			} else {
320 320
 				$content = \EED_Events_Archive::use_filterable_display_order();
@@ -333,20 +333,20 @@  discard block
 block discarded – undo
333 333
 	 */
334 334
 	protected static function use_sortable_display_order() {
335 335
 		// no further password checks required atm
336
-		add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' );
336
+		add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true');
337 337
 		// we need to first remove this callback from being applied to the_content() or the_excerpt() (otherwise it will recurse and blow up the interweb)
338
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 );
339
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 );
340
-		remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
338
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100);
339
+		remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100);
340
+		remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1);
341 341
 		// now add additional content depending on whether event is using the_excerpt() or the_content()
342 342
 		EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts();
343
-		$content = EEH_Template::locate_template( 'content-espresso_events-details.php' );
344
-		$content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content );
343
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
344
+		$content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content);
345 345
 		// re-add our main filters (or else the next event won't have them)
346
-		add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
347
-		add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
348
-		add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
349
-		remove_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' );
346
+		add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1);
347
+		add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1);
348
+		add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
349
+		remove_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true');
350 350
 		return $content;
351 351
 	}
352 352
 
@@ -361,22 +361,22 @@  discard block
 block discarded – undo
361 361
 	protected static function use_filterable_display_order() {
362 362
 		// we need to first remove this callback from being applied to the_content()
363 363
 		// (otherwise it will recurse and blow up the interweb)
364
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 );
365
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 );
366
-		remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
364
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100);
365
+		remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100);
366
+		remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1);
367 367
 		//now add additional content depending on whether event is using the_excerpt() or the_content()
368 368
 		EED_Events_Archive::_add_additional_excerpt_filters();
369 369
 		EED_Events_Archive::_add_additional_content_filters();
370
-		do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters' );
370
+		do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters');
371 371
 		// now load our template
372
-		$content = EEH_Template::locate_template( 'content-espresso_events-details.php' );
372
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
373 373
 		// re-add our main filters (or else the next event won't have them)
374
-		add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
375
-		add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 );
376
-		add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
374
+		add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1);
375
+		add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1);
376
+		add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
377 377
 		// but remove the other filters so that they don't get applied to the next post
378 378
 		EED_Events_Archive::_remove_additional_events_archive_filters();
379
-		do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters' );
379
+		do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters');
380 380
 		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
381 381
 		//return ! empty( $template ) ? $template : $content;
382 382
 		return $content;
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
 	 * 	@param		string 	$content
392 392
 	 *  	@return 		string
393 393
 	 */
394
-	public static function event_datetimes( $content ) {
395
-		if ( post_password_required() ) {
394
+	public static function event_datetimes($content) {
395
+		if (post_password_required()) {
396 396
 			return $content;
397 397
 		}
398
-		return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content;
398
+		return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content;
399 399
 	}
400 400
 
401 401
 	/**
@@ -405,11 +405,11 @@  discard block
 block discarded – undo
405 405
 	 * 	@param		string 	$content
406 406
 	 *  	@return 		string
407 407
 	 */
408
-	public static function event_tickets( $content ) {
409
-		if ( post_password_required() ) {
408
+	public static function event_tickets($content) {
409
+		if (post_password_required()) {
410 410
 			return $content;
411 411
 		}
412
-		return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content;
412
+		return EEH_Template::locate_template('content-espresso_events-tickets.php').$content;
413 413
 	}
414 414
 
415 415
 
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 	 * @param    string $content
422 422
 	 * @return    string
423 423
 	 */
424
-	public static function event_venue( $content ) {
425
-		return EED_Events_Archive::event_venues( $content );
424
+	public static function event_venue($content) {
425
+		return EED_Events_Archive::event_venues($content);
426 426
 	}
427 427
 
428 428
 	/**
@@ -432,11 +432,11 @@  discard block
 block discarded – undo
432 432
 	 * 	@param		string 	$content
433 433
 	 *  	@return 		string
434 434
 	 */
435
-	public static function event_venues( $content ) {
436
-		if ( post_password_required() ) {
435
+	public static function event_venues($content) {
436
+		if (post_password_required()) {
437 437
 			return $content;
438 438
 		}
439
-		return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' );
439
+		return $content.EEH_Template::locate_template('content-espresso_events-venues.php');
440 440
 	}
441 441
 
442 442
 
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
 	 * @return        void
449 449
 	 */
450 450
 	private static function _add_additional_excerpt_filters() {
451
-		add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 );
452
-		add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 );
453
-		add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 );
451
+		add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1);
452
+		add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1);
453
+		add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1);
454 454
 	}
455 455
 
456 456
 
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
 	 * @return        void
463 463
 	 */
464 464
 	private static function _add_additional_content_filters() {
465
-		add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 );
466
-		add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 );
467
-		add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 );
465
+		add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1);
466
+		add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1);
467
+		add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1);
468 468
 	}
469 469
 
470 470
 
@@ -476,12 +476,12 @@  discard block
 block discarded – undo
476 476
 	 * @return        void
477 477
 	 */
478 478
 	private static function _remove_additional_events_archive_filters() {
479
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 );
480
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 );
481
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 );
482
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 );
483
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 );
484
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 );
479
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110);
480
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120);
481
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130);
482
+		remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110);
483
+		remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120);
484
+		remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130);
485 485
 	}
486 486
 
487 487
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
 	 */
495 495
 	public static function remove_all_events_archive_filters() {
496 496
 		//remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
497
-		remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100 );
498
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 );
499
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 );
500
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 );
501
-		remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 );
502
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 );
503
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 );
504
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 );
505
-		remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 );
497
+		remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100);
498
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100);
499
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110);
500
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120);
501
+		remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130);
502
+		remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100);
503
+		remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110);
504
+		remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120);
505
+		remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130);
506 506
 		// don't display entry meta because the existing theme will take care of that
507
-		remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' );
507
+		remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
508 508
 	}
509 509
 
510 510
 
@@ -519,15 +519,15 @@  discard block
 block discarded – undo
519 519
 	 *  @return 	void
520 520
 	 */
521 521
 	public function load_event_list_assets() {
522
-		do_action( 'AHEE__EED_Events_Archive__before_load_assets' );
523
-		add_filter( 'FHEE_load_EE_Session', '__return_true' );
524
-		add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
525
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
526
-		if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) {
527
-			EE_Registry::instance()->load_helper( 'Maps' );
528
-			add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 );
522
+		do_action('AHEE__EED_Events_Archive__before_load_assets');
523
+		add_filter('FHEE_load_EE_Session', '__return_true');
524
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
525
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
526
+		if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
527
+			EE_Registry::instance()->load_helper('Maps');
528
+			add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
529 529
 		}
530
-		EE_Registry::instance()->load_helper( 'Event_View' );
530
+		EE_Registry::instance()->load_helper('Event_View');
531 531
 	}
532 532
 
533 533
 
@@ -543,14 +543,14 @@  discard block
 block discarded – undo
543 543
 	 */
544 544
 	public function wp_enqueue_scripts() {
545 545
 		// get some style
546
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) {
546
+		if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) {
547 547
 			// first check uploads folder
548
-			EE_Registry::instance()->load_helper( 'File' );
549
-			if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
550
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ));
548
+			EE_Registry::instance()->load_helper('File');
549
+			if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
550
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
551 551
 			} else {
552 552
 		}
553
-		wp_enqueue_style( $this->theme );
553
+		wp_enqueue_style($this->theme);
554 554
 
555 555
 	}
556 556
 }
@@ -568,8 +568,8 @@  discard block
 block discarded – undo
568 568
 	 */
569 569
 	public static function template_settings_form() {
570 570
 	$template_settings = EE_Registry::instance()->CFG->template_settings;
571
-	$template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
572
-	$template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive );
571
+	$template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
572
+	$template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive);
573 573
 	$events_archive_settings = array(
574 574
 		'display_status_banner' => 0,
575 575
 		'display_description' => 1,
@@ -578,8 +578,8 @@  discard block
 block discarded – undo
578 578
 		'display_venue' => 0,
579 579
 		'display_expired_events' => 0
580 580
 	);
581
-	$events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive );
582
-	EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings );
581
+	$events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive);
582
+	EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings);
583 583
 }
584 584
 
585 585
 
@@ -595,16 +595,16 @@  discard block
 block discarded – undo
595 595
 	 *  @param 	EE_Request_Handler $REQ
596 596
 	 *  @return 	EE_Template_Config
597 597
 	 */
598
-	public static function update_template_settings( $CFG, $REQ ) {
598
+	public static function update_template_settings($CFG, $REQ) {
599 599
 		$CFG->EED_Events_Archive = new EE_Events_Archive_Config();
600 600
 		// unless we are resetting the config...
601
-		if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) {
602
-			$CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0;
603
-			$CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1;
604
-			$CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0;
605
-			$CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1;
606
-			$CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0;
607
-			$CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0;			}
601
+		if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) {
602
+			$CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0;
603
+			$CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1;
604
+			$CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0;
605
+			$CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1;
606
+			$CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0;
607
+			$CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; }
608 608
 		return $CFG;
609 609
 	}
610 610
 
@@ -617,10 +617,10 @@  discard block
 block discarded – undo
617 617
 	 * @param string $extra_class
618 618
 	 * @return    string
619 619
 	 */
620
-	public static function event_list_css( $extra_class = '' ) {
621
-		$event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array();
620
+	public static function event_list_css($extra_class = '') {
621
+		$event_list_css = ! empty($extra_class) ? array($extra_class) : array();
622 622
 		$event_list_css[] = 'espresso-event-list-event';
623
-		return implode( ' ', $event_list_css );
623
+		return implode(' ', $event_list_css);
624 624
 	}
625 625
 
626 626
 
@@ -647,9 +647,9 @@  discard block
 block discarded – undo
647 647
 	 * @param $value
648 648
 	 * @return    bool
649 649
 	 */
650
-	public static function display_description( $value ) {
650
+	public static function display_description($value) {
651 651
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
652
-		$display_description= isset( $config->display_description ) ? $config->display_description : 1;
652
+		$display_description = isset($config->display_description) ? $config->display_description : 1;
653 653
 		return $display_description === $value ? TRUE : FALSE;
654 654
 	}
655 655
 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	 */
663 663
 	public static function display_ticket_selector() {
664 664
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
665
-		return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE;
665
+		return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE;
666 666
 	}
667 667
 
668 668
 
@@ -674,9 +674,9 @@  discard block
 block discarded – undo
674 674
 	 *  @return 	bool
675 675
 	 */
676 676
 	public static function display_venue() {
677
-		EE_Registry::instance()->load_helper( 'Venue_View' );
677
+		EE_Registry::instance()->load_helper('Venue_View');
678 678
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
679
-		return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE;
679
+		return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE;
680 680
 	}
681 681
 
682 682
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	 */
689 689
 	public static function display_datetimes() {
690 690
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
691
-		return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE;
691
+		return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE;
692 692
 }
693 693
 
694 694
 
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	 *  @return 	string
704 704
 	 */
705 705
 	public static function event_list_title() {
706
-		return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' ));
706
+		return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso'));
707 707
 	}
708 708
 
709 709
 
@@ -712,11 +712,11 @@  discard block
 block discarded – undo
712 712
 	/**
713 713
 	 * 	@since 4.4.0
714 714
 	 */
715
-	public static function _doing_it_wrong_notice( $function = '' ) {
715
+	public static function _doing_it_wrong_notice($function = '') {
716 716
 		EE_Error::doing_it_wrong(
717 717
 			__FUNCTION__,
718 718
 			sprintf(
719
-				__( 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso' ),
719
+				__('EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso'),
720 720
 				$function,
721 721
 				'<br />',
722 722
 				'4.6.0'
@@ -732,107 +732,107 @@  discard block
 block discarded – undo
732 732
 	 * 	@since 4.4.0
733 733
 	 */
734 734
 	public function get_post_data() {
735
-		EE_Registry::instance()->load_helper( 'Event_Query' );
735
+		EE_Registry::instance()->load_helper('Event_Query');
736 736
 		EEH_Event_Query::set_query_params();
737 737
 	}
738 738
 	/**
739 739
 	 * 	@deprecated
740 740
 	 * 	@since 4.4.0
741 741
 	 */
742
-	public function posts_fields( $SQL, WP_Query $wp_query ) {
743
-		EE_Registry::instance()->load_helper( 'Event_Query' );
744
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
745
-		return EEH_Event_Query::posts_fields( $SQL, $wp_query );
742
+	public function posts_fields($SQL, WP_Query $wp_query) {
743
+		EE_Registry::instance()->load_helper('Event_Query');
744
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
745
+		return EEH_Event_Query::posts_fields($SQL, $wp_query);
746 746
 	}
747 747
 	/**
748 748
 	 * 	@deprecated
749 749
 	 * 	@since 4.4.0
750 750
 	 */
751
-	public static function posts_fields_sql_for_orderby( $orderby_params = array() ) {
752
-		EE_Registry::instance()->load_helper( 'Event_Query' );
753
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
754
-		return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params );
751
+	public static function posts_fields_sql_for_orderby($orderby_params = array()) {
752
+		EE_Registry::instance()->load_helper('Event_Query');
753
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
754
+		return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params);
755 755
 	}
756 756
 	/**
757 757
 	 * 	@deprecated
758 758
 	 * 	@since 4.4.0
759 759
 	 */
760
-	public function posts_join( $SQL, WP_Query $wp_query ) {
761
-		EE_Registry::instance()->load_helper( 'Event_Query' );
762
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
763
-		return EEH_Event_Query::posts_join( $SQL, $wp_query );
760
+	public function posts_join($SQL, WP_Query $wp_query) {
761
+		EE_Registry::instance()->load_helper('Event_Query');
762
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
763
+		return EEH_Event_Query::posts_join($SQL, $wp_query);
764 764
 	}
765 765
 	/**
766 766
 	 * 	@deprecated
767 767
 	 * 	@since 4.4.0
768 768
 	 */
769
-	public static function posts_join_sql_for_terms( $join_terms = NULL ) {
770
-		EE_Registry::instance()->load_helper( 'Event_Query' );
771
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
772
-		return EEH_Event_Query::posts_join_sql_for_terms( $join_terms );
769
+	public static function posts_join_sql_for_terms($join_terms = NULL) {
770
+		EE_Registry::instance()->load_helper('Event_Query');
771
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
772
+		return EEH_Event_Query::posts_join_sql_for_terms($join_terms);
773 773
 	}
774 774
 	/**
775 775
 	 * 	@deprecated
776 776
 	 * 	@since 4.4.0
777 777
 	 */
778
-	public static function posts_join_for_orderby( $orderby_params = array() ) {
779
-		EE_Registry::instance()->load_helper( 'Event_Query' );
780
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
781
-		return EEH_Event_Query::posts_join_for_orderby( $orderby_params );
778
+	public static function posts_join_for_orderby($orderby_params = array()) {
779
+		EE_Registry::instance()->load_helper('Event_Query');
780
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
781
+		return EEH_Event_Query::posts_join_for_orderby($orderby_params);
782 782
 	}
783 783
 	/**
784 784
 	 * 	@deprecated
785 785
 	 * 	@since 4.4.0
786 786
 	 */
787
-	public function posts_where( $SQL, WP_Query $wp_query ) {
788
-		EE_Registry::instance()->load_helper( 'Event_Query' );
789
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
790
-		return EEH_Event_Query::posts_where( $SQL, $wp_query );
787
+	public function posts_where($SQL, WP_Query $wp_query) {
788
+		EE_Registry::instance()->load_helper('Event_Query');
789
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
790
+		return EEH_Event_Query::posts_where($SQL, $wp_query);
791 791
 	}
792 792
 	/**
793 793
 	 * 	@deprecated
794 794
 	 * 	@since 4.4.0
795 795
 	 */
796
-	public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) {
797
-		EE_Registry::instance()->load_helper( 'Event_Query' );
798
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
799
-		return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired );
796
+	public static function posts_where_sql_for_show_expired($show_expired = FALSE) {
797
+		EE_Registry::instance()->load_helper('Event_Query');
798
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
799
+		return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired);
800 800
 	}
801 801
 	/**
802 802
 	 * 	@deprecated
803 803
 	 * 	@since 4.4.0
804 804
 	 */
805
-	public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) {
806
-		EE_Registry::instance()->load_helper( 'Event_Query' );
807
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
808
-		return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug );
805
+	public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) {
806
+		EE_Registry::instance()->load_helper('Event_Query');
807
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
808
+		return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug);
809 809
 	}
810 810
 	/**
811 811
 	 * 	@deprecated
812 812
 	 * 	@since 4.4.0
813 813
 	 */
814
-	public static function posts_where_sql_for_event_list_month( $month = NULL ) {
815
-		EE_Registry::instance()->load_helper( 'Event_Query' );
816
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
817
-		return EEH_Event_Query::posts_where_sql_for_event_list_month( $month );
814
+	public static function posts_where_sql_for_event_list_month($month = NULL) {
815
+		EE_Registry::instance()->load_helper('Event_Query');
816
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
817
+		return EEH_Event_Query::posts_where_sql_for_event_list_month($month);
818 818
 	}
819 819
 	/**
820 820
 	 * 	@deprecated
821 821
 	 * 	@since 4.4.0
822 822
 	 */
823
-	public function posts_orderby( $SQL, WP_Query $wp_query ) {
824
-		EE_Registry::instance()->load_helper( 'Event_Query' );
825
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
826
-		return EEH_Event_Query::posts_orderby( $SQL, $wp_query );
823
+	public function posts_orderby($SQL, WP_Query $wp_query) {
824
+		EE_Registry::instance()->load_helper('Event_Query');
825
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
826
+		return EEH_Event_Query::posts_orderby($SQL, $wp_query);
827 827
 	}
828 828
 	/**
829 829
 	 * 	@deprecated
830 830
 	 * 	@since 4.4.0
831 831
 	 */
832
-	public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) {
833
-		EE_Registry::instance()->load_helper( 'Event_Query' );
834
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
835
-		return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort );
832
+	public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') {
833
+		EE_Registry::instance()->load_helper('Event_Query');
834
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
835
+		return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort);
836 836
 	}
837 837
 
838 838
 
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
  * @param string $extra_class
864 864
  * @return string
865 865
  */
866
-function espresso_event_list_css( $extra_class = '' ) {
867
-	return EED_Events_Archive::event_list_css( $extra_class );
866
+function espresso_event_list_css($extra_class = '') {
867
+	return EED_Events_Archive::event_list_css($extra_class);
868 868
 }
869 869
 
870 870
 /**
@@ -878,14 +878,14 @@  discard block
 block discarded – undo
878 878
  * @return bool
879 879
  */
880 880
 function espresso_display_full_description_in_event_list() {
881
-	return EED_Events_Archive::display_description( 2 );
881
+	return EED_Events_Archive::display_description(2);
882 882
 }
883 883
 
884 884
 /**
885 885
  * @return bool
886 886
  */
887 887
 function espresso_display_excerpt_in_event_list() {
888
-	return EED_Events_Archive::display_description( 1 );
888
+	return EED_Events_Archive::display_description(1);
889 889
 }
890 890
 
891 891
 /**
Please login to merge, or discard this patch.
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.
core/db_models/EEM_Transaction.model.php 1 patch
Spacing   +42 added lines, -42 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
  * Transaction Model
@@ -68,36 +68,36 @@  discard block
 block discarded – undo
68 68
 	 * 		Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
69 69
 	 *	@return EEM_Transaction
70 70
 	 */
71
-	protected function __construct( $timezone ) {
72
-		$this->singular_item = __('Transaction','event_espresso');
73
-		$this->plural_item = __('Transactions','event_espresso');
71
+	protected function __construct($timezone) {
72
+		$this->singular_item = __('Transaction', 'event_espresso');
73
+		$this->plural_item = __('Transactions', 'event_espresso');
74 74
 
75 75
 		$this->_tables = array(
76
-			'Transaction'=>new EE_Primary_Table('esp_transaction','TXN_ID')
76
+			'Transaction'=>new EE_Primary_Table('esp_transaction', 'TXN_ID')
77 77
 		);
78 78
 		$this->_fields = array(
79 79
 			'Transaction'=>array(
80
-				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso')),
81
-				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created','event_espresso'), false, time(), $timezone ),
82
-				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction','event_espresso'), false, 0),
83
-				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date','event_espresso'), false, 0),
84
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
85
-				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data','event_espresso'), true, ''),
86
-				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt','event_espresso'), true, ''),
80
+				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')),
81
+				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, time(), $timezone),
82
+				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0),
83
+				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0),
84
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
85
+				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''),
86
+				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, ''),
87 87
 				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Last Used Payment Method", 'event_espresso'), true, NULL, 'Payment_Method'),
88
-				'TXN_reg_steps' => new EE_Serialized_Text_Field( 'TXN_reg_steps', __( 'Registration Steps', 'event_espresso' ), FALSE, array() ),
88
+				'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', __('Registration Steps', 'event_espresso'), FALSE, array()),
89 89
 			)
90 90
 		);
91 91
 		$this->_model_relations = array(
92 92
 			'Registration'=>new EE_Has_Many_Relation(),
93 93
 			'Payment'=>new EE_Has_Many_Relation(),
94 94
 			'Status'=>new EE_Belongs_To_Relation(),
95
-			'Line_Item'=>new EE_Has_Many_Relation(false),//you can delete a transaction without needing to delete its line items
95
+			'Line_Item'=>new EE_Has_Many_Relation(false), //you can delete a transaction without needing to delete its line items
96 96
 			'Payment_Method'=>new EE_Belongs_To_Relation(),
97 97
 			'Message' => new EE_Has_Many_Relation()
98 98
 		);
99 99
 		$this->_model_chain_to_wp_user = 'Registration.Event';
100
-		parent::__construct( $timezone );
100
+		parent::__construct($timezone);
101 101
 
102 102
 	}
103 103
 
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 	 * @param string $period
109 109
 	 * @return \stdClass[]
110 110
 	 */
111
-	public function get_revenue_per_day_report( $period = '-1 month' ) {
111
+	public function get_revenue_per_day_report($period = '-1 month') {
112 112
 
113
-		$sql_date = $this->convert_datetime_for_query( 'TXN_timestamp', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' );
113
+		$sql_date = $this->convert_datetime_for_query('TXN_timestamp', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC');
114 114
 		$results = $this->_get_all_wpdb_results(
115 115
 			array(
116 116
 				array(
117 117
 					'TXN_timestamp' => array('>=', $sql_date)),
118 118
 				'group_by' => 'txnDate',
119
-				'order_by' => array('TXN_timestamp' => 'DESC' )
119
+				'order_by' => array('TXN_timestamp' => 'DESC')
120 120
 			),
121 121
 			OBJECT,
122 122
 			array(
123
-				'txnDate' => array('DATE(Transaction.TXN_timestamp)','%s'),
123
+				'txnDate' => array('DATE(Transaction.TXN_timestamp)', '%s'),
124 124
 				'revenue' => array('SUM(Transaction.TXN_paid)', '%d')
125 125
 			));
126 126
 		return $results;
@@ -136,22 +136,22 @@  discard block
 block discarded – undo
136 136
 	 * @throws \EE_Error
137 137
 	 * @return mixed
138 138
 	 */
139
-	public function get_revenue_per_event_report( $period = 'month' ) {
139
+	public function get_revenue_per_event_report($period = 'month') {
140 140
 		/** @type WPDB $wpdb */
141 141
 		global $wpdb;
142
-		$date_mod = strtotime( '-1 ' . $period );
142
+		$date_mod = strtotime('-1 '.$period);
143 143
 
144 144
 		$SQL = 'SELECT post_title as event_name, SUM(TXN_paid) AS revenue';
145
-		$SQL .= ' FROM ' . $this->_get_main_table()->get_table_name() . ' txn';
146
-		$SQL .= ' LEFT JOIN ' . $wpdb->prefix . 'esp_registration reg ON reg.TXN_ID = txn.TXN_ID';
147
-		$SQL .= ' LEFT JOIN ' . $wpdb->posts . ' evt ON evt.ID = reg.EVT_ID';
145
+		$SQL .= ' FROM '.$this->_get_main_table()->get_table_name().' txn';
146
+		$SQL .= ' LEFT JOIN '.$wpdb->prefix.'esp_registration reg ON reg.TXN_ID = txn.TXN_ID';
147
+		$SQL .= ' LEFT JOIN '.$wpdb->posts.' evt ON evt.ID = reg.EVT_ID';
148 148
 		$SQL .= ' WHERE REG_count = 1';
149 149
 		$SQL .= ' AND REG_date >= %d';
150 150
 		$SQL .= ' GROUP BY event_name';
151 151
 		$SQL .= ' ORDER BY event_name';
152 152
 		$SQL .= ' LIMIT 0, 24';
153 153
 
154
-		return $this->_do_wpdb_query( 'get_results', array(  $wpdb->prepare( $SQL, $date_mod ) ) );
154
+		return $this->_do_wpdb_query('get_results', array($wpdb->prepare($SQL, $date_mod)));
155 155
 
156 156
 	}
157 157
 
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 	 * @param string $reg_url_link
168 168
 	 * @return EE_Transaction
169 169
 	 */
170
-	public function get_transaction_from_reg_url_link( $reg_url_link = '' ){
171
-		return $this->get_one( array(
170
+	public function get_transaction_from_reg_url_link($reg_url_link = '') {
171
+		return $this->get_one(array(
172 172
 			array(
173
-				'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' )
173
+				'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '')
174 174
 			)
175 175
 		));
176 176
 	}
@@ -190,15 +190,15 @@  discard block
 block discarded – undo
190 190
 	 * @param boolean $save_txn whether or not to save the transaction during this function call
191 191
 	 * @return boolean
192 192
 	 */
193
-	public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){
193
+	public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) {
194 194
 		EE_Error::doing_it_wrong(
195
-			__CLASS__ . '::' . __FUNCTION__,
196
-			sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ),
195
+			__CLASS__.'::'.__FUNCTION__,
196
+			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
197 197
 			'4.6.0'
198 198
 		);
199 199
 		/** @type EE_Transaction_Processor $transaction_processor */
200
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
201
-		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this->ensure_is_obj( $transaction_obj_or_id ));
200
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
201
+		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this->ensure_is_obj($transaction_obj_or_id));
202 202
 	}
203 203
 
204 204
 	/**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			array(
230 230
 				0 => array(
231 231
 					'STS_ID' => EEM_Transaction::failed_status_code,
232
-					'TXN_timestamp' => array( '<', time() - $time_to_leave_alone )
232
+					'TXN_timestamp' => array('<', time() - $time_to_leave_alone)
233 233
 				)
234 234
 			),
235 235
 			$time_to_leave_alone
@@ -242,26 +242,26 @@  discard block
 block discarded – undo
242 242
 		 */
243 243
 		$txn_ids = apply_filters(
244 244
 			'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete',
245
-			EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ),
245
+			EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'),
246 246
 			$time_to_leave_alone
247 247
 		);
248 248
 
249 249
 		//now that we have the ids to delete, let's get deletin'
250 250
 		//Why no wpdb->prepare?  Because the data is trusted.  We got the ids from the original query to get them FROM
251 251
 		//the db (which is sanitized) so no need to prepare them again.
252
-		if ( $txn_ids ) {
253
-			$query   = '
252
+		if ($txn_ids) {
253
+			$query = '
254 254
 				DELETE
255
-				FROM ' . $this->table() . '
255
+				FROM ' . $this->table().'
256 256
 				WHERE
257
-					TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')';
258
-			$deleted = $wpdb->query( $query );
257
+					TXN_ID IN ( ' . implode(",", $txn_ids).')';
258
+			$deleted = $wpdb->query($query);
259 259
 		}
260
-		if ( $deleted ) {
260
+		if ($deleted) {
261 261
 			/**
262 262
 			 * Allows code to do something after the transactions have been deleted.
263 263
 			 */
264
-			do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids );
264
+			do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids);
265 265
 		}
266 266
 		return $deleted;
267 267
 	}
Please login to merge, or discard this patch.
core/db_models/fields/EE_Post_Content_Field.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@
 block discarded – undo
3 3
  * Field to only allow tags that are normally allowed on post_content:
4 4
  * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var
5 5
  */
6
-class EE_Post_Content_Field extends EE_Full_HTML_Field{
6
+class EE_Post_Content_Field extends EE_Full_HTML_Field {
7 7
 	/**
8 8
 	 * removes all tags which a WP Post wouldn't allow in its content normally
9 9
 	 * @param string $value_inputted_for_field_on_model_object
10 10
 	 * @return string
11 11
 	 */
12 12
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
13
-		$value_with_select_tags =  wp_kses("$value_inputted_for_field_on_model_object",wp_kses_allowed_html( 'post' ));
13
+		$value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object", wp_kses_allowed_html('post'));
14 14
 		return parent::prepare_for_set($value_with_select_tags);
15 15
 	}
16 16
 	
17
-	function prepare_for_set_from_db($value_found_in_db_for_model_object){
17
+	function prepare_for_set_from_db($value_found_in_db_for_model_object) {
18 18
 		return $value_found_in_db_for_model_object;
19 19
 	}
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.