Completed
Branch BUG-9680-compress-dompdf-files... (43e183)
by
unknown
577:38 queued 559:24
created
core/data_migration_scripts/EE_DMS_Core_4_3_0.dms.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@  discard block
 block discarded – undo
10 10
 //(all other times it gets resurrected from a wordpress option)
11 11
 $stages = glob(EE_CORE.'data_migration_scripts/4_3_0_stages/*');
12 12
 $class_to_filepath = array();
13
-if ( ! empty( $stages ) ) {
14
-	foreach($stages as $filepath){
13
+if ( ! empty($stages)) {
14
+	foreach ($stages as $filepath) {
15 15
 		$matches = array();
16
-		preg_match('~4_3_0_stages/(.*).dmsstage.php~',$filepath,$matches);
16
+		preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches);
17 17
 		$class_to_filepath[$matches[1]] = $filepath;
18 18
 	}
19 19
 }
20 20
 //give addons a chance to autoload their stages too
21
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages',$class_to_filepath);
21
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages', $class_to_filepath);
22 22
 EEH_Autoloader::register_autoloader($class_to_filepath);
23 23
 
24
-class EE_DMS_Core_4_3_0 extends EE_Data_Migration_Script_Base{
24
+class EE_DMS_Core_4_3_0 extends EE_Data_Migration_Script_Base {
25 25
 
26 26
 
27 27
 
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 	public function can_migrate_from_version($version_array) {
39 39
 		$version_string = $version_array['Core'];
40
-		if($version_string <= '4.3.0' && $version_string >= '4.2.0' ){
40
+		if ($version_string <= '4.3.0' && $version_string >= '4.2.0') {
41 41
 //			echo "$version_string can be migrated fro";
42 42
 			return true;
43
-		}elseif( ! $version_string ){
43
+		}elseif ( ! $version_string) {
44 44
 //			echo "no version string provided: $version_string";
45 45
 			//no version string provided... this must be pre 4.2
46
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
47
-		}else{
46
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
47
+		} else {
48 48
 //			echo "$version_string doesnt apply";
49 49
 			return false;
50 50
 		}
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 	}
55 55
 	public function schema_changes_before_migration() {
56 56
 		//relies on 4.1's EEH_Activation::create_table
57
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
58
-		$table_name='esp_answer';
59
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
57
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
58
+		$table_name = 'esp_answer';
59
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
60 60
 					REG_ID INT UNSIGNED NOT NULL,
61 61
 					QST_ID INT UNSIGNED NOT NULL,
62 62
 					ANS_value TEXT NOT NULL,
63 63
 					PRIMARY KEY  (ANS_ID)";
64
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
64
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
65 65
 
66 66
 		$table_name = 'esp_attendee_meta';
67 67
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
101 101
 					  CNT_active TINYINT(1) DEFAULT '0',
102 102
 					  PRIMARY KEY  (CNT_ISO)";
103
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
103
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
104 104
 
105 105
 
106 106
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 
125 125
 
126
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
126
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
127 127
 		$table_name = 'esp_event_meta';
128 128
 		$sql = "
129 129
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -140,41 +140,41 @@  discard block
 block discarded – undo
140 140
 			EVT_external_URL VARCHAR(200) NULL,
141 141
 			EVT_donations TINYINT(1) NULL,
142 142
 			PRIMARY KEY  (EVTM_ID)";
143
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
143
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
144 144
 
145 145
 
146 146
 
147
-		$table_name='esp_event_question_group';
148
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
147
+		$table_name = 'esp_event_question_group';
148
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
149 149
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
150 150
 					QSG_ID INT UNSIGNED NOT NULL,
151 151
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
152 152
 					PRIMARY KEY  (EQG_ID)";
153
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
153
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
154 154
 
155 155
 
156 156
 
157
-		$table_name='esp_event_venue';
158
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
157
+		$table_name = 'esp_event_venue';
158
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
159 159
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
160 160
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
161 161
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
162 162
 				PRIMARY KEY  (EVV_ID)";
163
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
163
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
164 164
 
165 165
 
166 166
 
167
-		$table_name='esp_extra_meta';
168
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
167
+		$table_name = 'esp_extra_meta';
168
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
169 169
 				OBJ_ID INT(11) DEFAULT NULL,
170 170
 				EXM_type VARCHAR(45) DEFAULT NULL,
171 171
 				EXM_key VARCHAR(45) DEFAULT NULL,
172 172
 				EXM_value TEXT,
173 173
 				PRIMARY KEY  (EXM_ID)";
174
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
174
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
175 175
 
176
-		$table_name='esp_line_item';
177
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
176
+		$table_name = 'esp_line_item';
177
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
178 178
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
179 179
 				TXN_ID INT(11) DEFAULT NULL,
180 180
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				OBJ_ID INT(11) DEFAULT NULL,
191 191
 				OBJ_type VARCHAR(45)DEFAULT NULL,
192 192
 				PRIMARY KEY  (LIN_ID)";
193
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
193
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
194 194
 
195 195
 		$table_name = 'esp_message_template';
196 196
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 					KEY GRP_ID (GRP_ID)";
203 203
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
204 204
 
205
-		EEH_Activation::drop_index( 'esp_message_template_group', 'EVT_ID' );
205
+		EEH_Activation::drop_index('esp_message_template_group', 'EVT_ID');
206 206
 
207 207
 		$table_name = 'esp_message_template_group';
208 208
 		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
218 218
 					PRIMARY KEY  (GRP_ID),
219 219
 					KEY MTP_user_id (MTP_user_id)";
220
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
220
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
221 221
 
222 222
 		$table_name = 'esp_event_message_template';
223 223
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 					PRIMARY KEY  (EMT_ID),
227 227
 					KEY EVT_ID (EVT_ID),
228 228
 					KEY GRP_ID (GRP_ID)";
229
-		$this->_table_is_new_in_this_version( $table_name, $sql, 'ENGINE=InnoDB');
229
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
230 230
 
231 231
 
232 232
 
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
 
336 336
 
337 337
 
338
-		$table_name='esp_question';
339
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
338
+		$table_name = 'esp_question';
339
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
340 340
 					QST_display_text TEXT NOT NULL,
341 341
 					QST_admin_label VARCHAR(255) NOT NULL,
342 342
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -348,12 +348,12 @@  discard block
 block discarded – undo
348 348
 					QST_wp_user BIGINT UNSIGNED NULL,
349 349
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
350 350
 					PRIMARY KEY  (QST_ID)';
351
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
351
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
352 352
 
353
-		EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' );
353
+		EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE');
354 354
 
355 355
 		$table_name = 'esp_question_group';
356
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
356
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
357 357
 					QSG_name VARCHAR(255) NOT NULL,
358 358
 					QSG_identifier VARCHAR(100) NOT NULL,
359 359
 					QSG_desc TEXT NULL,
@@ -364,29 +364,29 @@  discard block
 block discarded – undo
364 364
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
365 365
 					PRIMARY KEY  (QSG_ID),
366 366
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
367
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
367
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
368 368
 
369 369
 
370 370
 
371
-		$table_name='esp_question_group_question';
372
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
371
+		$table_name = 'esp_question_group_question';
372
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
373 373
 					QSG_ID INT UNSIGNED NOT NULL,
374 374
 					QST_ID INT UNSIGNED NOT NULL,
375 375
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
376 376
 					PRIMARY KEY  (QGQ_ID) ";
377
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
377
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
378 378
 
379 379
 
380 380
 
381
-		$table_name='esp_question_option';
382
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
381
+		$table_name = 'esp_question_option';
382
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
383 383
 					QSO_value VARCHAR(255) NOT NULL,
384 384
 					QSO_desc TEXT NOT NULL,
385 385
 					QST_ID INT UNSIGNED NOT NULL,
386 386
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
387 387
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
388 388
 					PRIMARY KEY  (QSO_ID)";
389
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
389
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
390 390
 
391 391
 
392 392
 
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 
420 420
 
421 421
 
422
-		$table_name='esp_checkin';
423
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
422
+		$table_name = 'esp_checkin';
423
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
424 424
 					REG_ID INT(10) UNSIGNED NOT NULL,
425 425
 					DTT_ID INT(10) UNSIGNED NOT NULL,
426 426
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
495 495
 
496 496
 
497
-		$script_with_defaults = EE_Registry::instance()->load_dms( 'Core_4_1_0' );
497
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
498 498
 		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
499 499
 		//(because many need to convert old string states to foreign keys into the states table)
500 500
 		$script_with_defaults->insert_default_states();
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 		return true;
517 517
 	}
518 518
 
519
-	public function migration_page_hooks(){
519
+	public function migration_page_hooks() {
520 520
 
521 521
 	}
522 522
 
@@ -532,34 +532,34 @@  discard block
 block discarded – undo
532 532
 
533 533
 		global $wpdb;
534 534
 		$ticket_table = $wpdb->prefix."esp_ticket";
535
-		if ( EEH_Activation::table_exists( $ticket_table ) ) {
535
+		if (EEH_Activation::table_exists($ticket_table)) {
536 536
 
537
-			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
537
+			$SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
538 538
 			$tickets_exist = $wpdb->get_var($SQL);
539 539
 
540
-			if ( ! $tickets_exist ) {
540
+			if ( ! $tickets_exist) {
541 541
 				$SQL = "INSERT INTO $ticket_table
542 542
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_deleted ) VALUES
543
-					( 1, 0, '" . __("Free Ticket", "event_espresso") . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
544
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL );
543
+					( 1, 0, '".__("Free Ticket", "event_espresso")."', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
544
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
545 545
 				$wpdb->query($SQL);
546 546
 			}
547 547
 		}
548 548
 		$ticket_price_table = $wpdb->prefix."esp_ticket_price";
549 549
 
550
-		if ( EEH_Activation::table_exists( $ticket_price_table ) ) {
550
+		if (EEH_Activation::table_exists($ticket_price_table)) {
551 551
 
552
-			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
552
+			$SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
553 553
 			$ticket_prc_exist = $wpdb->get_var($SQL);
554 554
 
555
-			if ( ! $ticket_prc_exist ) {
555
+			if ( ! $ticket_prc_exist) {
556 556
 
557 557
 				$SQL = "INSERT INTO $ticket_price_table
558 558
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
559 559
 				( 1, 1, 1 )
560 560
 				";
561 561
 
562
-				$SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL );
562
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
563 563
 				$wpdb->query($SQL);
564 564
 			}
565 565
 		}
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Repository.lib.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('No direct script access allowed');
4 4
 
5 5
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @return bool
34 34
 	 */
35
-	public function add( $message, $info = null ) {
36
-		$attached = parent::add( $message );
35
+	public function add($message, $info = null) {
36
+		$attached = parent::add($message);
37 37
 		//ensure $info is an array if not already
38 38
 		$info = $info === null ? $info = array() : (array) $info;
39
-		$data = $this->_init_data( $info, $attached, $message );
40
-		if ( $attached ) {
41
-			$this->set_info( $message, $data );
39
+		$data = $this->_init_data($info, $attached, $message);
40
+		if ($attached) {
41
+			$this->set_info($message, $data);
42 42
 		}
43 43
 		return $attached;
44 44
 	}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @param EE_Message $message
52 52
 	 * @return array
53 53
 	 */
54
-	protected function _init_data( $info, $attached, $message ) {
54
+	protected function _init_data($info, $attached, $message) {
55 55
 		$data = array(
56 56
 			'test_send' => false,
57 57
 			'preview' => false,
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 				'MSG_generation_data' => array()
61 61
 			)
62 62
 		);
63
-		if ( isset( $info['preview'] ) ) {
63
+		if (isset($info['preview'])) {
64 64
 			$data['preview'] = $info['preview'];
65
-			unset( $info['preview'] );
65
+			unset($info['preview']);
66 66
 		}
67
-		if ( isset( $info['test_send'] ) ) {
67
+		if (isset($info['test_send'])) {
68 68
 			$data['test_send'] = $info['test_send'];
69
-			unset( $info['test_send'] );
69
+			unset($info['test_send']);
70 70
 		}
71
-		if ( isset( $info['data_handler_class_name'] ) ) {
71
+		if (isset($info['data_handler_class_name'])) {
72 72
 			$data['data_handler_class_name'] = $info['data_handler_class_name'];
73
-			unset( $info['data_handler_class_name'] );
73
+			unset($info['data_handler_class_name']);
74 74
 		}
75
-		if ( $attached && $message->STS_ID() === EEM_Message::status_incomplete ) {
76
-			$generation_data = isset( $info['MSG_generation_data'] ) ? $info['MSG_generation_data'] : array();
75
+		if ($attached && $message->STS_ID() === EEM_Message::status_incomplete) {
76
+			$generation_data = isset($info['MSG_generation_data']) ? $info['MSG_generation_data'] : array();
77 77
 			//if data isn't in $info...let's see if its available via the message object
78 78
 			$generation_data = ! $generation_data ? $message->get_generation_data() : $generation_data;
79 79
 			//still empty then let's just use info
@@ -96,19 +96,19 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function saveAll() {
98 98
 		$this->rewind();
99
-		$save_tracking = array( 'updated' => 0, 'notupdated' => 0, 'errors' => array() );
99
+		$save_tracking = array('updated' => 0, 'notupdated' => 0, 'errors' => array());
100 100
 
101 101
 		//exit early if there is nothing to save.
102
-		if ( ! $this->count() > 0 ) {
102
+		if ( ! $this->count() > 0) {
103 103
 			return $save_tracking;
104 104
 		}
105 105
 
106
-		while( $this->valid() ) {
106
+		while ($this->valid()) {
107 107
 
108 108
 			$saved = $this->current()->save();
109
-			if ( $saved === false ) {
109
+			if ($saved === false) {
110 110
 				$save_tracking['errors'][] = $this->current()->MSG_token();
111
-			} elseif ( $saved ) {
111
+			} elseif ($saved) {
112 112
 				$save_tracking['updated']++;
113 113
 			} else {
114 114
 				$save_tracking['notupdated']++;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 			$this->next();
120 120
 		}
121
-		do_action( 'AHEE__EE_Message_Repository__saveAll__after', $save_tracking, $this );
121
+		do_action('AHEE__EE_Message_Repository__saveAll__after', $save_tracking, $this);
122 122
 		return $save_tracking;
123 123
 	}
124 124
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	 * @param string   $token   Token.
134 134
 	 * @return EE_Message | null
135 135
 	 */
136
-	public function getMessageByToken( $token ) {
136
+	public function getMessageByToken($token) {
137 137
 		$this->rewind();
138
-		while( $this->valid() ) {
139
-			if ( $this->current()->MSG_token() === $token ) {
138
+		while ($this->valid()) {
139
+			if ($this->current()->MSG_token() === $token) {
140 140
 				$message = $this->current();
141 141
 				$this->rewind();
142 142
 				return $message;
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function get_generation_data() {
159 159
 		//first verify we're at a valid iterator point.
160
-		if ( ! $this->valid() ) {
160
+		if ( ! $this->valid()) {
161 161
 			return array();
162 162
 		}
163 163
 		$info = $this->getInfo();
164
-		return isset( $info['data'] ) && isset( $info['data']['MSG_generation_data'] ) ? $info['data']['MSG_generation_data'] : array();
164
+		return isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array();
165 165
 	}
166 166
 
167 167
 
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 	 * @return string
173 173
 	 */
174 174
 	public function get_data_handler() {
175
-		if ( ! $this->valid() ) {
175
+		if ( ! $this->valid()) {
176 176
 			return '';
177 177
 		}
178 178
 		$info = $this->getInfo();
179
-		return isset( $info['data_handler_class_name'] ) ? $info['data_handler_class_name'] : '';
179
+		return isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : '';
180 180
 	}
181 181
 
182 182
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @return bool
187 187
 	 */
188 188
 	public function is_preview() {
189
-		if ( ! $this->valid() ) {
189
+		if ( ! $this->valid()) {
190 190
 			return false;
191 191
 		}
192 192
 		$info = $this->getInfo();
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @return bool
200 200
 	 */
201 201
 	public function is_test_send() {
202
-		if ( ! $this->valid() ) {
202
+		if ( ! $this->valid()) {
203 203
 			return false;
204 204
 		}
205 205
 		$info = $this->getInfo();
@@ -214,16 +214,16 @@  discard block
 block discarded – undo
214 214
 	 *  data is attached for later retrieval (batch generation).
215 215
 	 */
216 216
 	protected function _maybe_persist_attached_data() {
217
-		if ( ! $this->valid() ) {
217
+		if ( ! $this->valid()) {
218 218
 			return;
219 219
 		}
220 220
 
221 221
 		$info = $this->getInfo();
222
-		$data_handler_class_name = isset( $info['data_handler_class_name'] ) ? $info['data_handler_class_name'] : '';
223
-		$data = isset( $info['data'] ) && isset( $info['data']['MSG_generation_data'] ) ? $info['data']['MSG_generation_data'] : array();
224
-		if ( $data && $this->current()->STS_ID() === EEM_Message::status_incomplete ) {
225
-			$this->current()->set_generation_data( $data );
226
-			$this->current()->set_field_or_extra_meta( 'data_handler_class_name', $data_handler_class_name );
222
+		$data_handler_class_name = isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : '';
223
+		$data = isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array();
224
+		if ($data && $this->current()->STS_ID() === EEM_Message::status_incomplete) {
225
+			$this->current()->set_generation_data($data);
226
+			$this->current()->set_field_or_extra_meta('data_handler_class_name', $data_handler_class_name);
227 227
 		}
228 228
 	}
229 229
 
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
 	 * @param array $status the optional status(es) that will also be filtered by when priority matches.
237 237
 	 * @return int  count of messages in the queue matching the conditions.
238 238
 	 */
239
-	public function count_by_priority_and_status( $priority, $status = array() ) {
240
-		if ( ! empty( $status ) ) {
241
-			$status = is_array( $status ) ? $status : array( $status );
239
+	public function count_by_priority_and_status($priority, $status = array()) {
240
+		if ( ! empty($status)) {
241
+			$status = is_array($status) ? $status : array($status);
242 242
 		}
243 243
 
244 244
 		$count = 0;
245 245
 		$this->rewind();
246
-		while ( $this->valid() ) {
247
-			if ( $this->current()->priority() === $priority && ( ( $status && in_array( $this->current()->STS_ID(), $status ) ) || ! $status ) ) {
246
+		while ($this->valid()) {
247
+			if ($this->current()->priority() === $priority && (($status && in_array($this->current()->STS_ID(), $status)) || ! $status)) {
248 248
 				$count++;
249 249
 			}
250 250
 			$this->next();
Please login to merge, or discard this patch.
core/db_models/EEM_Payment_Method.model.php 1 patch
Spacing   +93 added lines, -93 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
  *
@@ -37,33 +37,33 @@  discard block
 block discarded – undo
37 37
 	 * @access   protected
38 38
 	 * @return EEM_Payment_Method
39 39
 	 */
40
-	protected function __construct( $timezone = NULL ) {
41
-		$this->singlular_item = __( 'Payment Method', 'event_espresso' );
42
-		$this->plural_item = __( 'Payment Methods', 'event_espresso' );
43
-		$this->_tables = array( 'Payment_Method' => new EE_Primary_Table( 'esp_payment_method', 'PMD_ID' ) );
40
+	protected function __construct($timezone = NULL) {
41
+		$this->singlular_item = __('Payment Method', 'event_espresso');
42
+		$this->plural_item = __('Payment Methods', 'event_espresso');
43
+		$this->_tables = array('Payment_Method' => new EE_Primary_Table('esp_payment_method', 'PMD_ID'));
44 44
 		$this->_fields = array(
45 45
 			'Payment_Method' => array(
46
-				'PMD_ID' => new EE_Primary_Key_Int_Field( 'PMD_ID', __( "ID", 'event_espresso' ) ),
47
-				'PMD_type' => new EE_Plain_Text_Field( 'PMD_type', __( "Payment Method Type", 'event_espresso' ), FALSE, 'Admin_Only' ),
48
-				'PMD_name' => new EE_Plain_Text_Field( 'PMD_name', __( "Name", 'event_espresso' ), FALSE ),
49
-				'PMD_desc' => new EE_Post_Content_Field( 'PMD_desc', __( "Description", 'event_espresso' ), FALSE, '' ),
50
-				'PMD_admin_name' => new EE_Plain_Text_Field( 'PMD_admin_name', __( "Admin-Only Name", 'event_espresso' ), TRUE ),
51
-				'PMD_admin_desc' => new EE_Post_Content_Field( 'PMD_admin_desc', __( "Admin-Only Description", 'event_espresso' ), TRUE ),
52
-				'PMD_slug' => new EE_Slug_Field( 'PMD_slug', __( "Slug", 'event_espresso' ), FALSE ),
53
-				'PMD_order' => new EE_Integer_Field( 'PMD_order', __( "Order", 'event_espresso' ), FALSE, 0 ),
54
-				'PMD_debug_mode' => new EE_Boolean_Field( 'PMD_debug_mode', __( "Debug Mode On?", 'event_espresso' ), FALSE, FALSE ),
55
-				'PMD_wp_user' => new EE_WP_User_Field( 'PMD_wp_user', __( "Payment Method Creator ID", 'event_espresso' ), FALSE ),
56
-				'PMD_open_by_default' => new EE_Boolean_Field( 'PMD_open_by_default', __( "Open by Default?", 'event_espresso' ), FALSE, FALSE ), 'PMD_button_url' => new EE_Plain_Text_Field( 'PMD_button_url', __( "Button URL", 'event_espresso' ), TRUE, '' ),
57
-				'PMD_scope' => new EE_Serialized_Text_Field( 'PMD_scope', __( "Usable From?", 'event_espresso' ), FALSE, array() ), //possible values currently are 'CART','ADMIN','API'
46
+				'PMD_ID' => new EE_Primary_Key_Int_Field('PMD_ID', __("ID", 'event_espresso')),
47
+				'PMD_type' => new EE_Plain_Text_Field('PMD_type', __("Payment Method Type", 'event_espresso'), FALSE, 'Admin_Only'),
48
+				'PMD_name' => new EE_Plain_Text_Field('PMD_name', __("Name", 'event_espresso'), FALSE),
49
+				'PMD_desc' => new EE_Post_Content_Field('PMD_desc', __("Description", 'event_espresso'), FALSE, ''),
50
+				'PMD_admin_name' => new EE_Plain_Text_Field('PMD_admin_name', __("Admin-Only Name", 'event_espresso'), TRUE),
51
+				'PMD_admin_desc' => new EE_Post_Content_Field('PMD_admin_desc', __("Admin-Only Description", 'event_espresso'), TRUE),
52
+				'PMD_slug' => new EE_Slug_Field('PMD_slug', __("Slug", 'event_espresso'), FALSE),
53
+				'PMD_order' => new EE_Integer_Field('PMD_order', __("Order", 'event_espresso'), FALSE, 0),
54
+				'PMD_debug_mode' => new EE_Boolean_Field('PMD_debug_mode', __("Debug Mode On?", 'event_espresso'), FALSE, FALSE),
55
+				'PMD_wp_user' => new EE_WP_User_Field('PMD_wp_user', __("Payment Method Creator ID", 'event_espresso'), FALSE),
56
+				'PMD_open_by_default' => new EE_Boolean_Field('PMD_open_by_default', __("Open by Default?", 'event_espresso'), FALSE, FALSE), 'PMD_button_url' => new EE_Plain_Text_Field('PMD_button_url', __("Button URL", 'event_espresso'), TRUE, ''),
57
+				'PMD_scope' => new EE_Serialized_Text_Field('PMD_scope', __("Usable From?", 'event_espresso'), FALSE, array()), //possible values currently are 'CART','ADMIN','API'
58 58
 		) );
59 59
 		$this->_model_relations = array(
60 60
  //			'Event'=>new EE_HABTM_Relation('Event_Payment_Method'),
61 61
 			'Payment' => new EE_Has_Many_Relation(),
62
-			'Currency' => new EE_HABTM_Relation( 'Currency_Payment_Method' ),
62
+			'Currency' => new EE_HABTM_Relation('Currency_Payment_Method'),
63 63
 			'Transaction' => new EE_Has_Many_Relation(),
64 64
 			'WP_User' => new EE_Belongs_To_Relation(),
65 65
 		);
66
-		parent::__construct( $timezone );
66
+		parent::__construct($timezone);
67 67
 	}
68 68
 
69 69
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 * @param string $slug
74 74
 	 * @return EE_Payment_Method
75 75
 	 */
76
-	public function get_one_by_slug( $slug ) {
77
-		return $this->get_one( array( array( 'PMD_slug' => $slug ) ) );
76
+	public function get_one_by_slug($slug) {
77
+		return $this->get_one(array(array('PMD_slug' => $slug)));
78 78
 	}
79 79
 
80 80
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 		return apply_filters(
89 89
 			'FHEE__EEM_Payment_Method__scopes',
90 90
 			array(
91
-				self::scope_cart 		=> __( "Front-end Registration Page", 'event_espresso' ),
92
-				self::scope_admin 	=> __( "Admin Registration Page (no online processing)", 'event_espresso' )
91
+				self::scope_cart 		=> __("Front-end Registration Page", 'event_espresso'),
92
+				self::scope_admin 	=> __("Admin Registration Page (no online processing)", 'event_espresso')
93 93
 			)
94 94
 		);
95 95
 	}
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @param string $scope like one of EEM_Payment_Method::instance()->scopes()
102 102
 	 * @return boolean
103 103
 	 */
104
-	public function is_valid_scope( $scope ) {
104
+	public function is_valid_scope($scope) {
105 105
 		$scopes = $this->scopes();
106
-		if ( isset( $scopes[ $scope ] ) ) {
106
+		if (isset($scopes[$scope])) {
107 107
 			return TRUE;
108 108
 		} else {
109 109
 			return FALSE;
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @throws EE_Error
120 120
 	 * @return EE_Payment_Method[]
121 121
 	 */
122
-	public function get_all_active( $scope = NULL, $query_params = array() ) {
123
-		if( ! isset( $query_params[ 'order_by' ] ) && ! isset( $query_params[ 'order' ] ) ) {
124
-			$query_params = array( 'order_by' => array( 'PMD_order' => 'ASC', 'PMD_ID' => 'ASC' ) );
122
+	public function get_all_active($scope = NULL, $query_params = array()) {
123
+		if ( ! isset($query_params['order_by']) && ! isset($query_params['order'])) {
124
+			$query_params = array('order_by' => array('PMD_order' => 'ASC', 'PMD_ID' => 'ASC'));
125 125
 		}
126
-		return $this->get_all( $this->_get_query_params_for_all_active( $scope, $query_params ) );
126
+		return $this->get_all($this->_get_query_params_for_all_active($scope, $query_params));
127 127
 	}
128 128
 
129 129
 	/**
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param array $query_params
133 133
 	 * @return int
134 134
 	 */
135
-	public function count_active( $scope = NULL, $query_params = array() ){
136
-		return $this->count( $this->_get_query_params_for_all_active( $scope, $query_params ) );
135
+	public function count_active($scope = NULL, $query_params = array()) {
136
+		return $this->count($this->_get_query_params_for_all_active($scope, $query_params));
137 137
 	}
138 138
 
139 139
 	/**
@@ -144,21 +144,21 @@  discard block
 block discarded – undo
144 144
 	 * @return array like param of EEM_Base::get_all()
145 145
 	 * @throws EE_Error
146 146
 	 */
147
-	protected function _get_query_params_for_all_active( $scope = NULL, $query_params = array() ){
148
-		if ( $scope ) {
149
-			if ( $this->is_valid_scope( $scope ) ) {
150
-				return array_replace_recursive( array( array( 'PMD_scope' => array( 'LIKE', "%$scope%" ) ) ), $query_params );
147
+	protected function _get_query_params_for_all_active($scope = NULL, $query_params = array()) {
148
+		if ($scope) {
149
+			if ($this->is_valid_scope($scope)) {
150
+				return array_replace_recursive(array(array('PMD_scope' => array('LIKE', "%$scope%"))), $query_params);
151 151
 			} else {
152
-				throw new EE_Error( sprintf( __( "'%s' is not a valid scope for a payment method", "event_espresso" ), $scope ) );
152
+				throw new EE_Error(sprintf(__("'%s' is not a valid scope for a payment method", "event_espresso"), $scope));
153 153
 			}
154 154
 		} else {
155 155
 			$acceptable_scopes = array();
156 156
 			$count = 0;
157
-			foreach ( $this->scopes() as $scope_name => $desc ) {
157
+			foreach ($this->scopes() as $scope_name => $desc) {
158 158
 				$count++;
159
-				$acceptable_scopes[ 'PMD_scope*' . $count ] = array( 'LIKE', '%' . $scope_name . '%' );
159
+				$acceptable_scopes['PMD_scope*'.$count] = array('LIKE', '%'.$scope_name.'%');
160 160
 			}
161
-			return array_replace_recursive( array( array( 'OR*active_scope' => $acceptable_scopes ) ), $query_params );
161
+			return array_replace_recursive(array(array('OR*active_scope' => $acceptable_scopes)), $query_params);
162 162
 		}
163 163
 	}
164 164
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @return array like param of EEM_Base::get_all()
171 171
 	 * @throws EE_Error
172 172
 	 */
173
-	public function get_query_params_for_all_active( $scope = NULL, $query_params = array() ) {
174
-		return $this->_get_query_params_for_all_active( $scope, $query_params );
173
+	public function get_query_params_for_all_active($scope = NULL, $query_params = array()) {
174
+		return $this->_get_query_params_for_all_active($scope, $query_params);
175 175
 	}
176 176
 
177 177
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @param array  $query_params
182 182
 	 * @return EE_Payment_Method
183 183
 	 */
184
-	public function get_one_active( $scope = NULL, $query_params = array() ) {
185
-		return $this->get_one( $this->_get_query_params_for_all_active( $scope, $query_params ) );
184
+	public function get_one_active($scope = NULL, $query_params = array()) {
185
+		return $this->get_one($this->_get_query_params_for_all_active($scope, $query_params));
186 186
 	}
187 187
 
188 188
 
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * @param string $type
193 193
 	 * @return EE_Payment_Method
194 194
 	 */
195
-	public function get_one_of_type( $type ) {
196
-		return $this->get_one( array( array( 'PMD_type' => $type ) ) );
195
+	public function get_one_of_type($type) {
196
+		return $this->get_one(array(array('PMD_type' => $type)));
197 197
 	}
198 198
 
199 199
 
@@ -206,22 +206,22 @@  discard block
 block discarded – undo
206 206
 	 * @return EE_Payment_Method
207 207
 	 * @throws EE_Error
208 208
 	 */
209
-	public function ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db = FALSE ) {
209
+	public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = FALSE) {
210 210
 		//first: check if it's a slug
211
-		if( is_string( $base_class_obj_or_id ) ) {
212
-			$obj = $this->get_one_by_slug( $base_class_obj_or_id );
213
-			if( $obj ) {
211
+		if (is_string($base_class_obj_or_id)) {
212
+			$obj = $this->get_one_by_slug($base_class_obj_or_id);
213
+			if ($obj) {
214 214
 				return $obj;
215 215
 			}
216 216
 		}
217 217
 		//ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID)
218 218
 		try {
219
-			return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db );
219
+			return parent::ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db);
220 220
 		}
221
-		catch ( EE_Error $e ) {
221
+		catch (EE_Error $e) {
222 222
 			//handle it outside the catch
223 223
 		}
224
-		throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) );
224
+		throw new EE_Error(sprintf(__("'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso"), $base_class_obj_or_id));
225 225
 	}
226 226
 
227 227
 
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
 	 * @param mixed $base_obj_or_id_or_slug
233 233
 	 * @return int
234 234
 	 */
235
-	function ensure_is_ID( $base_obj_or_id_or_slug ) {
236
-		if ( is_string( $base_obj_or_id_or_slug ) ) {
235
+	function ensure_is_ID($base_obj_or_id_or_slug) {
236
+		if (is_string($base_obj_or_id_or_slug)) {
237 237
 			//assume it's a slug
238
-			$base_obj_or_id_or_slug = $this->get_one_by_slug( $base_obj_or_id_or_slug );
238
+			$base_obj_or_id_or_slug = $this->get_one_by_slug($base_obj_or_id_or_slug);
239 239
 		}
240
-		return parent::ensure_is_ID( $base_obj_or_id_or_slug );
240
+		return parent::ensure_is_ID($base_obj_or_id_or_slug);
241 241
 	}
242 242
 
243 243
 
@@ -246,36 +246,36 @@  discard block
 block discarded – undo
246 246
 	 * Verifies the button urls on all the passed payment methods have a valid button url. If not, resets them to their default.
247 247
 	 * @param EE_Payment_Method[] $payment_methods. If NULL is provided defaults to all payment methods active in the cart
248 248
 	 */
249
-	function verify_button_urls( $payment_methods = NULL ) {
250
-		$payment_methods = is_array( $payment_methods ) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
251
-		foreach ( $payment_methods as $payment_method ) {
249
+	function verify_button_urls($payment_methods = NULL) {
250
+		$payment_methods = is_array($payment_methods) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
251
+		foreach ($payment_methods as $payment_method) {
252 252
 			try {
253 253
 				$current_button_url = $payment_method->button_url();
254
-				$buttons_urls_to_try = apply_filters( 'FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
255
-					'current_ssl' => str_replace( "http://", "https://", $current_button_url ),
256
-					'current' => str_replace( "https://", "http://", $current_button_url ),
257
-					'default_ssl' => str_replace( "http://", "https://", $payment_method->type_obj()->default_button_url() ),
258
-					'default' => str_replace( "https://", "http://", $payment_method->type_obj()->default_button_url() ),
259
-				) );
260
-				foreach( $buttons_urls_to_try as $button_url_to_try ) {
261
-					if(
254
+				$buttons_urls_to_try = apply_filters('FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
255
+					'current_ssl' => str_replace("http://", "https://", $current_button_url),
256
+					'current' => str_replace("https://", "http://", $current_button_url),
257
+					'default_ssl' => str_replace("http://", "https://", $payment_method->type_obj()->default_button_url()),
258
+					'default' => str_replace("https://", "http://", $payment_method->type_obj()->default_button_url()),
259
+				));
260
+				foreach ($buttons_urls_to_try as $button_url_to_try) {
261
+					if (
262 262
 							(//this is the current url and it exists, regardless of SSL issues
263 263
 								$button_url_to_try == $current_button_url &&
264 264
 								EEH_URL::remote_file_exists(
265 265
 										$button_url_to_try,
266 266
 										array(
267 267
 											'sslverify' => false,
268
-											'limit_response_size' => 4095,//we don't really care for a full response, but we do want headers at least. Lets just ask for a one block
268
+											'limit_response_size' => 4095, //we don't really care for a full response, but we do want headers at least. Lets just ask for a one block
269 269
 											) )
270 270
 							)
271 271
 							||
272 272
 							(//this is NOT the current url and it exists with a working SSL cert
273 273
 								$button_url_to_try != $current_button_url &&
274
-								EEH_URL::remote_file_exists( $button_url_to_try )
274
+								EEH_URL::remote_file_exists($button_url_to_try)
275 275
 							) ) {
276
-						if( $current_button_url != $button_url_to_try ){
277
-							$payment_method->save( array( 'PMD_button_url' => $button_url_to_try ) );
278
-							EE_Error::add_attention( sprintf( __( "Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso" ), $payment_method->name(), $button_url_to_try ) );
276
+						if ($current_button_url != $button_url_to_try) {
277
+							$payment_method->save(array('PMD_button_url' => $button_url_to_try));
278
+							EE_Error::add_attention(sprintf(__("Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso"), $payment_method->name(), $button_url_to_try));
279 279
 						}
280 280
 						//this image exists. So if wasn't set before, now it is;
281 281
 						//or if it was already set, we have nothing to do
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 					}
284 284
 				}
285 285
 			}
286
-			catch ( EE_Error $e ) {
287
-				$payment_method->set_active( FALSE );
286
+			catch (EE_Error $e) {
287
+				$payment_method->set_active(FALSE);
288 288
 			}
289 289
 		}
290 290
 	}
@@ -298,29 +298,29 @@  discard block
 block discarded – undo
298 298
 	 * @param array $rows
299 299
 	 * @return EE_Payment_Method[]
300 300
 	 */
301
-	protected function _create_objects( $rows = array() ) {
302
-		EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
303
-		$payment_methods = parent::_create_objects( $rows );
301
+	protected function _create_objects($rows = array()) {
302
+		EE_Registry::instance()->load_lib('Payment_Method_Manager');
303
+		$payment_methods = parent::_create_objects($rows);
304 304
 		/* @var $payment_methods EE_Payment_Method[] */
305 305
 		$usable_payment_methods = array();
306
-		foreach ( $payment_methods as $key => $payment_method ) {
307
-			if ( EE_Payment_Method_Manager::instance()->payment_method_type_exists( $payment_method->type() ) ) {
308
-				$usable_payment_methods[ $key ] = $payment_method;
306
+		foreach ($payment_methods as $key => $payment_method) {
307
+			if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($payment_method->type())) {
308
+				$usable_payment_methods[$key] = $payment_method;
309 309
 				//some payment methods enqueue their scripts in EE_PMT_*::__construct
310 310
 				//which is kinda a no-no (just because it's being constructed doesn't mean we need to enqueue
311 311
 				//its scripts). but for backwards-compat we should continue to do that
312 312
 				$payment_method->type_obj();
313
-			} elseif( $payment_method->active() ) {				
313
+			} elseif ($payment_method->active()) {				
314 314
 				//only deactivate and notify the admin if the payment is active somewhere
315 315
 				$payment_method->deactivate();
316 316
 				$payment_method->save();
317 317
 				EE_Error::add_persistent_admin_notice(
318
-					'auto-deactivated-' . $payment_method->type(),
318
+					'auto-deactivated-'.$payment_method->type(),
319 319
 					sprintf(
320
-						__( 'The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso' ),
320
+						__('The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso'),
321 321
 						$payment_method->admin_name(),
322 322
 						'<br />',
323
-						'<a href="' . admin_url('plugins.php') . '">',
323
+						'<a href="'.admin_url('plugins.php').'">',
324 324
 						'</a>'
325 325
 					),
326 326
 					true
@@ -340,16 +340,16 @@  discard block
 block discarded – undo
340 340
 	 * @param string 	$scope @see EEM_Payment_Method::get_all_for_events
341 341
 	 * @return EE_Payment_Method[]
342 342
 	 */
343
-	public function get_all_for_transaction( $transaction, $scope ) {
343
+	public function get_all_for_transaction($transaction, $scope) {
344 344
 		//@todo take relations between events and payment methods into account, once that relation exists
345
-		if ( $transaction instanceof EE_Transaction ) {
345
+		if ($transaction instanceof EE_Transaction) {
346 346
 			//@todo take the relation between transaction and currencies into account
347 347
 		}
348
-		$currencies_for_events = array( EE_Config::instance()->currency->code );
348
+		$currencies_for_events = array(EE_Config::instance()->currency->code);
349 349
 		//give addons a chance to override what payment methods are chosen based on the transaction
350 350
 		return apply_filters(
351 351
 			'FHEE__EEM_Payment_Method__get_all_for_transaction__payment_methods',
352
-			$this->get_all_active( $scope, array( array( 'Currency.CUR_code' => array( 'IN', $currencies_for_events ) ) ) ),
352
+			$this->get_all_active($scope, array(array('Currency.CUR_code' => array('IN', $currencies_for_events)))),
353 353
 			$transaction,
354 354
 			$scope
355 355
 		);
@@ -365,16 +365,16 @@  discard block
 block discarded – undo
365 365
 	 * @param EE_Registration|int $registration_or_reg_id  Either the EE_Registration object or the id for the registration.
366 366
 	 * @return EE_Payment|null
367 367
 	 */
368
-	public function get_last_used_for_registration( $registration_or_reg_id ) {
369
-		$registration_id = EEM_Registration::instance()->ensure_is_ID( $registration_or_reg_id );
368
+	public function get_last_used_for_registration($registration_or_reg_id) {
369
+		$registration_id = EEM_Registration::instance()->ensure_is_ID($registration_or_reg_id);
370 370
 
371 371
 		$query_params = array(
372 372
 			0 => array(
373 373
 				'Payment.Registration.REG_ID' => $registration_id,
374 374
 			),
375
-			'order_by' => array( 'Payment.PAY_ID' => 'DESC' )
375
+			'order_by' => array('Payment.PAY_ID' => 'DESC')
376 376
 		);
377
-		return $this->get_one( $query_params );
377
+		return $this->get_one($query_params);
378 378
 	}
379 379
 
380 380
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Transaction_Shortcodes.lib.php 1 patch
Spacing   +139 added lines, -139 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
 /**
@@ -42,25 +42,25 @@  discard block
 block discarded – undo
42 42
 		$this->_shortcodes = array(
43 43
 			'[TXN_ID]' => __('The transaction id for the purchase.', 'event_espresso'),
44 44
 			'[PAYMENT_URL]' => __('This is a link to make a payment for the event', 'event_espresso'),
45
-			'[PAYMENT_LINK_IF_NEEDED_*]' => __('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso') . '<ul>'
46
-				. '<li>' . sprintf( __('%class:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
47
-				. '<li>' . sprintf( __('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
48
-				. '<li>' . sprintf( __('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
45
+			'[PAYMENT_LINK_IF_NEEDED_*]' => __('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso').'<ul>'
46
+				. '<li>'.sprintf(__('%class:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso'), '<strong>', '</strong>').'</li>'
47
+				. '<li>'.sprintf(__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso'), '<strong>', '</strong>').'</li>'
48
+				. '<li>'.sprintf(__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso'), '<strong>', '</strong>').'</li>'
49 49
 				. '</ul>',
50
-			'[PAYMENT_DUE_DATE_*]' => __( 'This is a special dynamic shortcode that allows one to output a payment due date.  It will only result in a date shown if there is money owing.  Three parameters are available on this shortcode:', 'event_espresso' )
50
+			'[PAYMENT_DUE_DATE_*]' => __('This is a special dynamic shortcode that allows one to output a payment due date.  It will only result in a date shown if there is money owing.  Three parameters are available on this shortcode:', 'event_espresso')
51 51
 				. '<ul>'
52
-				. '<li>' . sprintf( __( '%sformat:%s This is used to indicate what format the date is in.  Default is whatever is set as date formats for your website.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
53
-				. '<li>' . sprintf( __( '%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due.  Defaults to 30.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
54
-				. '<li>' . sprintf( __( '%sprefix_text:%s You can use this to indicate what text will prefix the date string.  Defaults to "Payment in full due by:"', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>',
52
+				. '<li>'.sprintf(__('%sformat:%s This is used to indicate what format the date is in.  Default is whatever is set as date formats for your website.', 'event_espresso'), '<strong>', '</strong>').'</li>'
53
+				. '<li>'.sprintf(__('%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due.  Defaults to 30.', 'event_espresso'), '<strong>', '</strong>').'</li>'
54
+				. '<li>'.sprintf(__('%sprefix_text:%s You can use this to indicate what text will prefix the date string.  Defaults to "Payment in full due by:"', 'event_espresso'), '<strong>', '</strong>').'</li>',
55 55
 			'[INVOICE_LINK]' => __('This is a full html link to the invoice', 'event_espresso'),
56 56
 			'[INVOICE_URL]' => __('This is just the url for the invoice', 'event_espresso'),
57 57
 			'[INVOICE_LOGO_URL]' => __('This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso'),
58 58
 			'[INVOICE_LOGO]' => __('This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso'),
59 59
 			'[INVOICE_PAYEE_NAME]' => __('This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
60
-			'[INVOICE_PAYEE_ADDRESS]' => __('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ),
61
-			'[INVOICE_PAYMENT_INSTRUCTIONS]' => __('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso' ),
62
-			'[INVOICE_PAYEE_EMAIL]' => __('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ),
63
-			'[INVOICE_PAYEE_TAX_NUMBER_*]' => __('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: <code>[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]</code> and that will ouptut: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso' ),
60
+			'[INVOICE_PAYEE_ADDRESS]' => __('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
61
+			'[INVOICE_PAYMENT_INSTRUCTIONS]' => __('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso'),
62
+			'[INVOICE_PAYEE_EMAIL]' => __('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
63
+			'[INVOICE_PAYEE_TAX_NUMBER_*]' => __('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: <code>[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]</code> and that will ouptut: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso'),
64 64
 			'[TOTAL_COST]' => __('The total cost for the transaction', 'event_espresso'),
65 65
 			'[TXN_STATUS]' => __('The transaction status for the transaction.', 'event_espresso'),
66 66
 			'[TXN_STATUS_ID]' => __('The ID representing the transaction status as saved in the db.  This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso'),
@@ -71,52 +71,52 @@  discard block
 block discarded – undo
71 71
 			'[TOTAL_OWING]' => __('The total owing on a transaction with no attributes.', 'event_espresso'),
72 72
 			'[TXN_SUBTOTAL]' => __('The subtotal for all txn line items.', 'event_espresso'),
73 73
 			'[TXN_TAX_SUBTOTAL]' => __('The subtotal for all tax line items.', 'event_espresso'),
74
-			'[OWING_STATUS_MESSAGE_*]' => __('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso') . '<p></ul>' .
75
-				'<li><strong>still_owing</strong>:' . __('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso' ) . sprintf( __( '%sPlease make a payment.%s', 'event_espresso'),  '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ) . '</li>' .
76
-				'<li><strong>none_owing</strong>:' . __('If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total oweing.', 'event_espresso') . '</li></ul></p>',
74
+			'[OWING_STATUS_MESSAGE_*]' => __('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso').'<p></ul>'.
75
+				'<li><strong>still_owing</strong>:'.__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso').sprintf(__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>').'</li>'.
76
+				'<li><strong>none_owing</strong>:'.__('If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total oweing.', 'event_espresso').'</li></ul></p>',
77 77
 			'[TXN_TOTAL_TICKETS]' => __('The total number of all tickets purchased in a transaction', 'event_espresso'),
78 78
 			'[TKT_QTY_PURCHASED]' => __('The total number of all tickets purchased in a transaction. <strong>NOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.</strong>', 'event_espresso'),
79 79
 			'[TRANSACTION_ADMIN_URL]' => __('The url to the admin page for this transaction', 'event_espresso'),
80 80
 			'[RECEIPT_URL]' => __('This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso'),
81
-			'[INVOICE_RECEIPT_SWITCHER_URL]' => __( 'This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active  then will parse to an empty string.', 'event_espresso'),
82
-			'[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf( __( 'The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso' ), '<code>', '</code>' )
81
+			'[INVOICE_RECEIPT_SWITCHER_URL]' => __('This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active  then will parse to an empty string.', 'event_espresso'),
82
+			'[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf(__('The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso'), '<code>', '</code>')
83 83
 			);
84 84
 	}
85 85
 
86 86
 
87
-	protected function _parser( $shortcode ) {
87
+	protected function _parser($shortcode) {
88 88
 
89 89
 		//attempt to get the transaction.  Since this is potentially used in more fields, we may have to look in the _extra_data for the transaction.
90 90
 		$transaction = $this->_data->txn instanceof EE_Transaction ? $this->_data->txn : null;
91
-		$transaction = ! $transaction instanceof EE_Transaction && is_array( $this->_extra_data ) &&  isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn: $transaction;
91
+		$transaction = ! $transaction instanceof EE_Transaction && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn : $transaction;
92 92
 
93 93
 		//payment
94 94
 		$payment = $this->_data->payment instanceof EE_Payment ? $this->_data->payment : null;
95
-		$payment = ! $payment instanceof EE_Payment && is_array( $this->_extra_data ) &&  isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment: $payment;
95
+		$payment = ! $payment instanceof EE_Payment && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment : $payment;
96 96
 
97 97
 
98
-		if ( ! $transaction instanceof EE_Transaction )
98
+		if ( ! $transaction instanceof EE_Transaction)
99 99
 			return '';
100 100
 
101
-		switch ( $shortcode ) {
101
+		switch ($shortcode) {
102 102
 			case '[TXN_ID]' :
103 103
 				return $transaction->ID();
104 104
 				break;
105 105
 
106 106
 			case '[PAYMENT_URL]' :
107 107
 				$payment_url = $transaction->payment_overview_url();
108
-				return empty( $payment_url ) ? __( 'http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url;
108
+				return empty($payment_url) ? __('http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url;
109 109
 				break;
110 110
 
111 111
 			case '[INVOICE_LINK]' :
112 112
 				$invoice_url = $transaction->invoice_url();
113
-				$invoice_url = empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
114
-				return sprintf( __('%sClick here for Invoice%s', 'event_espresso'), '<a href="' . $invoice_url . '">', '</a>' );
113
+				$invoice_url = empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
114
+				return sprintf(__('%sClick here for Invoice%s', 'event_espresso'), '<a href="'.$invoice_url.'">', '</a>');
115 115
 				break; /**/
116 116
 
117 117
 			case '[INVOICE_URL]' :
118 118
 				$invoice_url = $transaction->invoice_url();
119
-				return empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
119
+				return empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
120 120
 				break;
121 121
 
122 122
 			case '[INVOICE_LOGO_URL]' :
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				break;
125 125
 
126 126
 			case '[INVOICE_LOGO]' :
127
-				return $this->_get_invoice_logo( TRUE );
127
+				return $this->_get_invoice_logo(TRUE);
128 128
 				break;
129 129
 
130 130
 			case '[INVOICE_PAYEE_NAME]' :
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
 
147 147
 			case "[TOTAL_COST]" :
148 148
 				$total = $transaction->total();
149
-				return ! empty($total) ? EEH_Template::format_currency( $total ) : '';
149
+				return ! empty($total) ? EEH_Template::format_currency($total) : '';
150 150
 				break;
151 151
 
152 152
 			case "[PAYMENT_STATUS]" :
153 153
 				$status = $transaction->pretty_status();
154
-				return !empty($status) ? $status : __('Unknown', 'event_espresso');
154
+				return ! empty($status) ? $status : __('Unknown', 'event_espresso');
155 155
 				break; /**/
156 156
 
157 157
 			// note the [payment_status] shortcode is kind of misleading because payment status might be different from txn status so I'm adding this here for clarity.
158 158
 			case "[TXN_STATUS]" :
159 159
 				$status = $transaction->pretty_status();
160
-				return !empty( $status ) ? $status : __('Unknown', 'event_espresso');
160
+				return ! empty($status) ? $status : __('Unknown', 'event_espresso');
161 161
 				break;
162 162
 
163 163
 			case "[TXN_STATUS_ID]" :
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
 				break;
166 166
 
167 167
 			case "[PAYMENT_GATEWAY]" :
168
-				return $this->_get_payment_gateway( $transaction );
168
+				return $this->_get_payment_gateway($transaction);
169 169
 				break;
170 170
 
171 171
 			case "[AMOUNT_PAID]" :
172 172
 				$amount = $payment instanceof EE_Payment ? $payment->amount() : 0;
173
-				return EEH_Template::format_currency( $amount );
173
+				return EEH_Template::format_currency($amount);
174 174
 				break;
175 175
 
176 176
 			case "[TOTAL_AMOUNT_PAID]" :
177
-				return EEH_Template::format_currency( $transaction->paid() );
177
+				return EEH_Template::format_currency($transaction->paid());
178 178
 				break;
179 179
 
180 180
 			case "[TOTAL_OWING]" :
181 181
 				$total_owing = $transaction->remaining();
182
-				return EEH_Template::format_currency( $total_owing );
182
+				return EEH_Template::format_currency($total_owing);
183 183
 				break;
184 184
 
185 185
 			case "[TXN_SUBTOTAL]" :
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				break;
188 188
 
189 189
 			case "[TXN_TAX_SUBTOTAL]" :
190
-				return EEH_Template::format_currency($this->_get_subtotal( TRUE ));
190
+				return EEH_Template::format_currency($this->_get_subtotal(TRUE));
191 191
 				break;
192 192
 
193 193
 			case "[TKT_QTY_PURCHASED]" :
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 				break;
197 197
 
198 198
 			case "[TRANSACTION_ADMIN_URL]" :
199
-				require_once EE_CORE . 'admin/EE_Admin_Page.core.php';
200
-				$query_args = array( 'page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() );
201
-				$url = EE_Admin_Page::add_query_args_and_nonce( $query_args, admin_url('admin.php') );
199
+				require_once EE_CORE.'admin/EE_Admin_Page.core.php';
200
+				$query_args = array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID());
201
+				$url = EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php'));
202 202
 				return $url;
203 203
 				break;
204 204
 
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 				//get primary_registration
207 207
 				$reg = $this->_data->primary_reg_obj;
208 208
 
209
-				if ( ! $reg instanceof EE_Registration ) {
209
+				if ( ! $reg instanceof EE_Registration) {
210 210
 					return '';
211 211
 				}
212 212
 				return $reg->receipt_url();
213 213
 				break;
214 214
 
215 215
 			case "[INVOICE_RECEIPT_SWITCHER_URL]" :
216
-				return $this->_get_invoice_receipt_switcher( FALSE );
216
+				return $this->_get_invoice_receipt_switcher(FALSE);
217 217
 				break;
218 218
 
219 219
 			case "[INVOICE_RECEIPT_SWITCHER_BUTTON]" :
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
 
224 224
 		}
225 225
 
226
-		if ( strpos( $shortcode, '[OWING_STATUS_MESSAGE_*' ) !== FALSE ) {
227
-			return $this->_get_custom_total_oweing( $shortcode );
226
+		if (strpos($shortcode, '[OWING_STATUS_MESSAGE_*') !== FALSE) {
227
+			return $this->_get_custom_total_oweing($shortcode);
228 228
 		}
229 229
 
230
-		if ( strpos( $shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*' ) !== FALSE ) {
231
-			return $this->_get_invoice_payee_tax_number( $shortcode );
230
+		if (strpos($shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*') !== FALSE) {
231
+			return $this->_get_invoice_payee_tax_number($shortcode);
232 232
 		}
233 233
 
234
-		if ( strpos( $shortcode, '[PAYMENT_LINK_IF_NEEDED_*' ) !== FALSE ) {
235
-			return $this->_get_payment_link_if_needed( $shortcode );
234
+		if (strpos($shortcode, '[PAYMENT_LINK_IF_NEEDED_*') !== FALSE) {
235
+			return $this->_get_payment_link_if_needed($shortcode);
236 236
 		}
237 237
 
238
-		if ( strpos( $shortcode, '[PAYMENT_DUE_DATE_*' ) !== false ) {
239
-			return $this->_get_payment_due_date( $shortcode, $transaction );
238
+		if (strpos($shortcode, '[PAYMENT_DUE_DATE_*') !== false) {
239
+			return $this->_get_payment_due_date($shortcode, $transaction);
240 240
 		}
241 241
 
242 242
 		return '';
@@ -253,19 +253,19 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return string parsed.
255 255
 	 */
256
-	private function _get_custom_total_oweing( $shortcode ) {
257
-		$valid_shortcodes = array( 'transaction' );
258
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
256
+	private function _get_custom_total_oweing($shortcode) {
257
+		$valid_shortcodes = array('transaction');
258
+		$attrs = $this->_get_shortcode_attrs($shortcode);
259 259
 
260 260
 		//ensure default is set.
261 261
 		$addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
262 262
 		$total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;
263 263
 
264
-		if ( $total_owing > 0 ) {
265
-			$owing_content = ! empty( $attrs['still_owing'] ) ? $attrs['still_owing'] : sprintf( __( '%sPlease make a payment.%s', 'event_espresso'),  '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' );
266
-			$owing_content = $this->_shortcode_helper->parse_message_template( $owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
264
+		if ($total_owing > 0) {
265
+			$owing_content = ! empty($attrs['still_owing']) ? $attrs['still_owing'] : sprintf(__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>');
266
+			$owing_content = $this->_shortcode_helper->parse_message_template($owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);
267 267
 		} else {
268
-			$owing_content = !empty( $attrs['none_owing']) ? $attrs['none_owing'] : '';
268
+			$owing_content = ! empty($attrs['none_owing']) ? $attrs['none_owing'] : '';
269 269
 		}
270 270
 
271 271
 		return $owing_content;
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 
274 274
 
275 275
 
276
-	private function _get_payment_gateway( $transaction ) {
277
-		$pm = $this->_get_payment_method( $transaction );
276
+	private function _get_payment_gateway($transaction) {
277
+		$pm = $this->_get_payment_method($transaction);
278 278
 		return $pm instanceof EE_Payment_Method ? $pm->name() : '';
279 279
 	}
280 280
 
@@ -289,37 +289,37 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string url or html
291 291
 	 */
292
-	private function _get_invoice_logo( $img_tags = FALSE ) {
292
+	private function _get_invoice_logo($img_tags = FALSE) {
293 293
 		//try to get the invoice payment method's logo for this transaction image first
294 294
 		$pm = $this->_get_payment_method();
295
-		if ( $pm instanceof EE_Payment_Method ){
296
-			$invoice_logo_url = $pm->get_extra_meta( 'pdf_logo_image', TRUE );
297
-		}else{
295
+		if ($pm instanceof EE_Payment_Method) {
296
+			$invoice_logo_url = $pm->get_extra_meta('pdf_logo_image', TRUE);
297
+		} else {
298 298
 			$invoice_logo_url = NULL;
299 299
 		}
300
-		if( empty( $invoice_logo_url ) ){
300
+		if (empty($invoice_logo_url)) {
301 301
 			$invoice_logo_url = EE_Registry::instance()->CFG->organization->logo_url;
302 302
 		}
303 303
 
304
-		if ( empty( $invoice_logo_url ) ) {
304
+		if (empty($invoice_logo_url)) {
305 305
 			return '';
306 306
 		}
307 307
 
308
-		if ( ! $img_tags ) {
308
+		if ( ! $img_tags) {
309 309
 			return $invoice_logo_url;
310 310
 		}
311 311
 
312 312
 		//image tags have been requested.
313
-		$image_size = getimagesize( $invoice_logo_url );
313
+		$image_size = getimagesize($invoice_logo_url);
314 314
 		
315 315
 		//if image is wider than 200px, set the wideth to 200
316
-		if ( $image_size[0] > 300 ) {
316
+		if ($image_size[0] > 300) {
317 317
 			$image_width = 300;
318
-		}else{
318
+		} else {
319 319
 			$image_width = $image_size[0];
320 320
 		}
321 321
 
322
-		return '<img class="logo screen" src="' . $invoice_logo_url . '" width="' . $image_width . '" alt="logo" />';
322
+		return '<img class="logo screen" src="'.$invoice_logo_url.'" width="'.$image_width.'" alt="logo" />';
323 323
 	}
324 324
 
325 325
 
@@ -336,26 +336,26 @@  discard block
 block discarded – undo
336 336
 	private function _get_invoice_payee_name() {
337 337
 		$payee_name = NULL;
338 338
 		$pm = $this->_get_payment_method();
339
-		if( $pm instanceof EE_Payment_Method ){
340
-			$payee_name = $pm->get_extra_meta( 'pdf_payee_name', TRUE );
339
+		if ($pm instanceof EE_Payment_Method) {
340
+			$payee_name = $pm->get_extra_meta('pdf_payee_name', TRUE);
341 341
 		}
342
-		$payee_name = empty( $payee_name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : $payee_name;
342
+		$payee_name = empty($payee_name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : $payee_name;
343 343
 		return $payee_name;
344 344
 	}
345 345
 
346 346
 	/**
347 347
 	 * gets the payment method for this transaction. Otherwise gets a default one.
348 348
 	 */
349
-	private function _get_payment_method( $transaction = null ){
350
-		if( $transaction instanceof EE_Transaction ) {
349
+	private function _get_payment_method($transaction = null) {
350
+		if ($transaction instanceof EE_Transaction) {
351 351
 			$payment_method = $transaction->payment_method();
352
-			if ( empty( $payment_method ) ) {
353
-				return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
352
+			if (empty($payment_method)) {
353
+				return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
354 354
 			}
355 355
 			return $payment_method;
356
-		}else{
356
+		} else {
357 357
 			//get the first payment method we can find
358
-			return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
358
+			return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
359 359
 		}
360 360
 	}
361 361
 
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
 	private function _get_invoice_payee_email() {
373 373
 		$payee_email = NULL;
374 374
 		$pm = $this->_get_payment_method();
375
-		if( $pm instanceof EE_Payment_Method ){
376
-			$payee_email = $pm->get_extra_meta( 'pdf_payee_email', TRUE );
375
+		if ($pm instanceof EE_Payment_Method) {
376
+			$payee_email = $pm->get_extra_meta('pdf_payee_email', TRUE);
377 377
 		}
378
-		$payee_email = empty( $payee_email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : $payee_email;
378
+		$payee_email = empty($payee_email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : $payee_email;
379 379
 		return $payee_email;
380 380
 	}
381 381
 
@@ -391,24 +391,24 @@  discard block
 block discarded – undo
391 391
 	 *
392 392
 	 * @return string
393 393
 	 */
394
-	private function _get_invoice_payee_tax_number( $shortcode ) {
394
+	private function _get_invoice_payee_tax_number($shortcode) {
395 395
 		$payee_tax_number = NULL;
396 396
 		$pm = $this->_get_payment_method();
397
-		if( $pm instanceof EE_Payment_Method ){
398
-			$payee_tax_number = $pm->get_extra_meta( 'pdf_payee_tax_number', TRUE );
397
+		if ($pm instanceof EE_Payment_Method) {
398
+			$payee_tax_number = $pm->get_extra_meta('pdf_payee_tax_number', TRUE);
399 399
 		}
400
-		$payee_tax_number = empty( $payee_tax_number ) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;
400
+		$payee_tax_number = empty($payee_tax_number) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;
401 401
 
402
-		if ( empty( $payee_tax_number ) ) {
402
+		if (empty($payee_tax_number)) {
403 403
 			return '';
404 404
 		}
405 405
 
406 406
 		//any attributes?
407
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
407
+		$attrs = $this->_get_shortcode_attrs($shortcode);
408 408
 
409 409
 		//prefix?
410
-		$prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : __( 'VAT/Tax Number: ', 'event_espresso' );
411
-		return $prefix . $payee_tax_number;
410
+		$prefix = isset($attrs['prefix']) ? $attrs['prefix'] : __('VAT/Tax Number: ', 'event_espresso');
411
+		return $prefix.$payee_tax_number;
412 412
 	}
413 413
 
414 414
 
@@ -425,22 +425,22 @@  discard block
 block discarded – undo
425 425
 	private function _get_invoice_payee_address() {
426 426
 		$payee_address = NULL;
427 427
 		$pm = $this->_get_payment_method();
428
-		if( $pm instanceof EE_Payment_Method ){
429
-			$payee_address = $pm->get_extra_meta( 'pdf_payee_address', TRUE );
428
+		if ($pm instanceof EE_Payment_Method) {
429
+			$payee_address = $pm->get_extra_meta('pdf_payee_address', TRUE);
430 430
 		}
431
-		if ( empty( $payee_address ) ) {
431
+		if (empty($payee_address)) {
432 432
 			$organization = EE_Registry::instance()->CFG->organization;
433
-			$payee_address = $organization->get_pretty( 'address_1' ) . '<br>';
434
-			$payee_address .= !empty( $organization->address_2 ) ? $organization->get_pretty( 'address_2' ) . '<br>' : '';
435
-			$payee_address .= $organization->get_pretty( 'city' ) . '<br>';
433
+			$payee_address = $organization->get_pretty('address_1').'<br>';
434
+			$payee_address .= ! empty($organization->address_2) ? $organization->get_pretty('address_2').'<br>' : '';
435
+			$payee_address .= $organization->get_pretty('city').'<br>';
436 436
 
437 437
 			//state
438
-			$state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $organization->STA_ID );
439
-			$payee_address .= $state instanceof EE_State ? $state->name()  : '';
438
+			$state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID);
439
+			$payee_address .= $state instanceof EE_State ? $state->name() : '';
440 440
 
441 441
 			//Country
442
-			$payee_address .= ! empty( $organization->CNT_ISO ) ? ', ' . $organization->CNT_ISO . '<br>' : '';
443
-			$payee_address .= ! empty( $organization->zip ) ? $organization->zip : '';
442
+			$payee_address .= ! empty($organization->CNT_ISO) ? ', '.$organization->CNT_ISO.'<br>' : '';
443
+			$payee_address .= ! empty($organization->zip) ? $organization->zip : '';
444 444
 		}
445 445
 		return $payee_address;
446 446
 	}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	private function _get_invoice_payment_instructions() {
459 459
 		$instructions = NULL;
460 460
 		$pm = $this->_get_payment_method();
461
-		return ( $pm instanceof EE_Payment_Method ) ? $pm->get_extra_meta( 'pdf_instructions', TRUE) : '';
461
+		return ($pm instanceof EE_Payment_Method) ? $pm->get_extra_meta('pdf_instructions', TRUE) : '';
462 462
 	}
463 463
 
464 464
 
@@ -472,27 +472,27 @@  discard block
 block discarded – undo
472 472
 	 *
473 473
 	 * @return string
474 474
 	 */
475
-	protected function _get_invoice_receipt_switcher( $button = TRUE ) {
475
+	protected function _get_invoice_receipt_switcher($button = TRUE) {
476 476
 		$reg = $this->_data->primary_reg_obj;
477
-		$message_type = isset( $this->_extra_data['message_type'] ) ? $this->_extra_data['message_type'] : '';
478
-		if ( ! $reg instanceof EE_Registration || empty( $message_type ) ) {
477
+		$message_type = isset($this->_extra_data['message_type']) ? $this->_extra_data['message_type'] : '';
478
+		if ( ! $reg instanceof EE_Registration || empty($message_type)) {
479 479
 			return '';
480 480
 		}
481 481
 
482
-		$switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type  ? true : false;
483
-		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? __('View Invoice', 'event_espresso' ) : __( 'Switch to Invoice', 'event_espresso' );
484
-		$switch_to_label = ! $switch_to_invoice ? __( 'Switch to Receipt', 'event_espresso' ) : $switch_to_label;
482
+		$switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false;
483
+		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? __('View Invoice', 'event_espresso') : __('Switch to Invoice', 'event_espresso');
484
+		$switch_to_label = ! $switch_to_invoice ? __('Switch to Receipt', 'event_espresso') : $switch_to_label;
485 485
 		$switch_to_url = $switch_to_invoice ? $reg->invoice_url() : $reg->receipt_url();
486 486
 
487
-		if ( ! $button ) {
487
+		if ( ! $button) {
488 488
 			return $switch_to_url;
489 489
 		}
490 490
 
491
-		if ( ! empty( $switch_to_url ) ) {
491
+		if ( ! empty($switch_to_url)) {
492 492
 
493 493
 			return  '
494
-	<form method="post" action="' . $switch_to_url . '" >
495
-		<input class="print_button" type="submit" value="' . $switch_to_label . '" />
494
+	<form method="post" action="' . $switch_to_url.'" >
495
+		<input class="print_button" type="submit" value="' . $switch_to_label.'" />
496 496
 	</form>
497 497
 			';
498 498
 		}
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
 	 *
513 513
 	 * @return string
514 514
 	 */
515
-	private function _get_receipt_url( EE_Transaction $transaction ) {
515
+	private function _get_receipt_url(EE_Transaction $transaction) {
516 516
 		//get primary_registration
517 517
 		$reg = $this->_data->primary_reg_obj;
518 518
 
519
-		if ( ! $reg instanceof EE_Registration ) {
519
+		if ( ! $reg instanceof EE_Registration) {
520 520
 			return '';
521 521
 		}
522 522
 
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return int
534 534
 	 */
535
-	private function _get_subtotal( $tax = FALSE ) {
536
-		$grand_total = isset( $this->_data->grand_total_line_item ) ? $this->_data->grand_total_line_item : NULL;
535
+	private function _get_subtotal($tax = FALSE) {
536
+		$grand_total = isset($this->_data->grand_total_line_item) ? $this->_data->grand_total_line_item : NULL;
537 537
 
538
-		if ( ! $grand_total instanceof EE_Line_Item ) {
538
+		if ( ! $grand_total instanceof EE_Line_Item) {
539 539
 			return 0;
540 540
 		}
541 541
 
@@ -554,26 +554,26 @@  discard block
 block discarded – undo
554 554
 	 *
555 555
 	 * @return string parsed.
556 556
 	 */
557
-	private function _get_payment_link_if_needed( $shortcode ) {
558
-		$valid_shortcodes = array( 'transaction' );
559
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
557
+	private function _get_payment_link_if_needed($shortcode) {
558
+		$valid_shortcodes = array('transaction');
559
+		$attrs = $this->_get_shortcode_attrs($shortcode);
560 560
 
561 561
 		//ensure default is set.
562 562
 		$addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
563 563
 		$total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;
564 564
 
565
-		if ( $total_owing > 0 ) {
566
-			$class = isset( $attrs['class'] ) ? $attrs['class'] : 'callout';
567
-			$custom_text = isset( $attrs['custom_text'] ) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';
568
-			$container_tag = isset( $attrs['container_tag'] ) ? $attrs['container_tag'] : 'p';
569
-			$opening_tag = ! empty( $container_tag ) ? '<' . $container_tag : '';
570
-			$opening_tag .= ! empty( $opening_tag ) && !empty( $class ) ? ' class="' . $class . '"' : $opening_tag;
571
-			$opening_tag .= !empty( $opening_tag ) ? '>' : $opening_tag;
572
-			$closing_tag = ! empty( $container_tag ) ? '</' . $container_tag .'>' : '';
573
-			$content = $opening_tag . sprintf( $custom_text, '<a href="[PAYMENT_URL]">', '</a>' ) . $closing_tag;
565
+		if ($total_owing > 0) {
566
+			$class = isset($attrs['class']) ? $attrs['class'] : 'callout';
567
+			$custom_text = isset($attrs['custom_text']) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';
568
+			$container_tag = isset($attrs['container_tag']) ? $attrs['container_tag'] : 'p';
569
+			$opening_tag = ! empty($container_tag) ? '<'.$container_tag : '';
570
+			$opening_tag .= ! empty($opening_tag) && ! empty($class) ? ' class="'.$class.'"' : $opening_tag;
571
+			$opening_tag .= ! empty($opening_tag) ? '>' : $opening_tag;
572
+			$closing_tag = ! empty($container_tag) ? '</'.$container_tag.'>' : '';
573
+			$content = $opening_tag.sprintf($custom_text, '<a href="[PAYMENT_URL]">', '</a>').$closing_tag;
574 574
 
575 575
 			//we need to re run this string through the parser to catch any shortcodes that are in it.
576
-			$owing_content = $this->_shortcode_helper->parse_message_template( $content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
576
+			$owing_content = $this->_shortcode_helper->parse_message_template($content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);
577 577
 		} else {
578 578
 			return '';
579 579
 		}
@@ -593,31 +593,31 @@  discard block
 block discarded – undo
593 593
 	 * @param EE_Transaction $transaction
594 594
 	 * @return string
595 595
 	 */
596
-	protected function _get_payment_due_date( $shortcode, EE_Transaction $transaction ) {
596
+	protected function _get_payment_due_date($shortcode, EE_Transaction $transaction) {
597 597
 		//if transaction is paid in full then we can just return an empty string
598
-		if ( $transaction->remaining() === 0 ) {
598
+		if ($transaction->remaining() === 0) {
599 599
 			return '';
600 600
 		}
601 601
 
602
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
603
-		$format = isset( $attrs['format'] ) ? $attrs['format'] : get_option( 'date_format' );
604
-		$days_until_due = isset( $attrs['days_until_due'] ) ? (int) $attrs['days_until_due'] : 30;
605
-		$prefix_text = isset( $attrs['prefix_text'] ) ? $attrs['prefix_text'] : __( 'Payment in full due by: ', 'event_espresso' );
606
-		$transaction_created = $transaction->get_DateTime_object( 'TXN_timestamp' );
602
+		$attrs = $this->_get_shortcode_attrs($shortcode);
603
+		$format = isset($attrs['format']) ? $attrs['format'] : get_option('date_format');
604
+		$days_until_due = isset($attrs['days_until_due']) ? (int) $attrs['days_until_due'] : 30;
605
+		$prefix_text = isset($attrs['prefix_text']) ? $attrs['prefix_text'] : __('Payment in full due by: ', 'event_espresso');
606
+		$transaction_created = $transaction->get_DateTime_object('TXN_timestamp');
607 607
 
608 608
 		//setup date due:
609 609
 		try {
610
-			if ( $transaction_created instanceof DateTime ) {
611
-				$date_due = $transaction_created->add( new DateInterval( 'P' . $days_until_due . 'D' ) )->format( $format );
610
+			if ($transaction_created instanceof DateTime) {
611
+				$date_due = $transaction_created->add(new DateInterval('P'.$days_until_due.'D'))->format($format);
612 612
 			} else {
613 613
 				throw new Exception();
614 614
 			}
615
-		} catch( Exception $e ) {
615
+		} catch (Exception $e) {
616 616
 			//format was likely invalid.
617 617
 			$date_due = 'Unable to calculate date due, likely the format string is invalid.';
618 618
 		}
619 619
 
620
-		return $prefix_text . $date_due;
620
+		return $prefix_text.$date_due;
621 621
 	}
622 622
 
623 623
 } //end EE_Transaction Shortcodes library
Please login to merge, or discard this patch.
libraries/form_sections/strategies/EE_Form_Input_Strategy_Base.strategy.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
  * base class for all strategies which operate on form inputs. Generally, they
4 4
  * all need to know about the form input they are operating on.
5 5
  */
6
-abstract class EE_Form_Input_Strategy_Base{
6
+abstract class EE_Form_Input_Strategy_Base {
7 7
 	/**
8 8
 	 * Form Input to display
9 9
 	 * @var EE_Form_Input_Base
10 10
 	 */
11 11
 	protected $_input;
12 12
 	
13
-	function __construct(){
13
+	function __construct() {
14 14
 		
15 15
 	}
16 16
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * The form input on which this strategy is to perform
19 19
 	 * @param EE_Form_Input_Base $form_input
20 20
 	 */
21
-	function _construct_finalize(EE_Form_Input_Base $form_input){
21
+	function _construct_finalize(EE_Form_Input_Base $form_input) {
22 22
 		$this->_input = $form_input;
23 23
 	}
24 24
 	
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 1 patch
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 	/**
55 55
 	 * @param \Registrations_Admin_Page $admin_page
56 56
 	 */
57
-	public function __construct( Registrations_Admin_Page $admin_page ){
58
-		if ( ! empty( $_GET['event_id'] ) ) {
57
+	public function __construct(Registrations_Admin_Page $admin_page) {
58
+		if ( ! empty($_GET['event_id'])) {
59 59
 			$extra_query_args = array();
60
-			foreach ( $admin_page->get_views() as $key => $view_details ) {
61
-				$extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] );
60
+			foreach ($admin_page->get_views() as $key => $view_details) {
61
+				$extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
62 62
 			}
63
-			$this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args );
63
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
64 64
 		}
65 65
 		parent::__construct($admin_page);
66 66
 		$this->_status = $this->_admin_page->get_registration_status_array();
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 * @return void
76 76
 	 */
77 77
 	protected function _setup_data() {
78
-		$this->_data = $this->_admin_page->get_registrations( $this->_per_page );
79
-		$this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE );
78
+		$this->_data = $this->_admin_page->get_registrations($this->_per_page);
79
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE);
80 80
 	}
81 81
 
82 82
 
@@ -93,30 +93,30 @@  discard block
 block discarded – undo
93 93
 			'ajax' => TRUE,
94 94
 			'screen' => $this->_admin_page->get_current_screen()->id
95 95
 			);
96
-		$ID_column_name = __( 'ID', 'event_espresso' );
96
+		$ID_column_name = __('ID', 'event_espresso');
97 97
 		$ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">';
98
-		$ID_column_name .= __( 'Registrant Name', 'event_espresso' );
98
+		$ID_column_name .= __('Registrant Name', 'event_espresso');
99 99
 		$ID_column_name .= '</span> ';
100
-		if ( isset( $_GET['event_id'] )) {
100
+		if (isset($_GET['event_id'])) {
101 101
 			$this->_columns = array(
102 102
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
103 103
 				'_REG_ID' => $ID_column_name,
104
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
104
+				'ATT_fname' => __('Name', 'event_espresso'),
105 105
 				'ATT_email' =>  __('Email', 'event_espresso'),
106
-				'_REG_date' => __( 'Reg Date', 'event_espresso' ),
107
-				'PRC_amount' => __( 'TKT Price', 'event_espresso' ),
108
-				'_REG_final_price' => __( 'Final Price', 'event_espresso' ),
109
-				'TXN_total' => __( 'Total Txn', 'event_espresso' ),
106
+				'_REG_date' => __('Reg Date', 'event_espresso'),
107
+				'PRC_amount' => __('TKT Price', 'event_espresso'),
108
+				'_REG_final_price' => __('Final Price', 'event_espresso'),
109
+				'TXN_total' => __('Total Txn', 'event_espresso'),
110 110
 				'TXN_paid' => __('Paid', 'event_espresso'),
111
-				'actions' => __( 'Actions', 'event_espresso' )
111
+				'actions' => __('Actions', 'event_espresso')
112 112
 				);
113 113
 			$this->_bottom_buttons = array(
114 114
 					'report'=> array(
115 115
 					'route' => 'registrations_report',
116 116
 					'extra_request' =>
117 117
 						array(
118
-							'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null,
119
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" )
118
+							'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
119
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}")
120 120
 						)
121 121
 				),
122 122
 			);
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 			$this->_columns = array(
125 125
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
126 126
 				'_REG_ID' => $ID_column_name,
127
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
128
-				'_REG_date' => __( 'TXN Date', 'event_espresso' ),
129
-				'event_name' => __( 'Event', 'event_espresso' ),
130
-				'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ),
131
-				'_REG_final_price' => __( 'Price', 'event_espresso' ),
132
-				'_REG_paid' => __( 'Paid', 'event_espresso' ),
133
-				'actions' => __( 'Actions', 'event_espresso' )
127
+				'ATT_fname' => __('Name', 'event_espresso'),
128
+				'_REG_date' => __('TXN Date', 'event_espresso'),
129
+				'event_name' => __('Event', 'event_espresso'),
130
+				'DTT_EVT_start' => __('Event Date', 'event_espresso'),
131
+				'_REG_final_price' => __('Price', 'event_espresso'),
132
+				'_REG_paid' => __('Paid', 'event_espresso'),
133
+				'actions' => __('Actions', 'event_espresso')
134 134
 			);
135 135
 			$this->_bottom_buttons = array(
136 136
 				'report_all'=> array(
137 137
 				'route' => 'registrations_report',
138 138
 				'extra_request' => array(
139
-					'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) )
139
+					'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
140 140
 				),
141 141
 			);
142 142
 		}
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 		$this->_primary_column = '_REG_ID';
145 145
 
146 146
 		$this->_sortable_columns = array(
147
-			'_REG_date' => array( '_REG_date' => TRUE ),   //true means its already sorted
148
-			'ATT_fname' => array( 'ATT_fname' => FALSE ),
149
-			'event_name' => array( 'event_name' => FALSE ),
150
-			'DTT_EVT_start'	=> array( 'DTT_EVT_start' => FALSE ),
151
-			'_REG_ID' => array( '_REG_ID' => FALSE ),
147
+			'_REG_date' => array('_REG_date' => TRUE), //true means its already sorted
148
+			'ATT_fname' => array('ATT_fname' => FALSE),
149
+			'event_name' => array('event_name' => FALSE),
150
+			'DTT_EVT_start'	=> array('DTT_EVT_start' => FALSE),
151
+			'_REG_ID' => array('_REG_ID' => FALSE),
152 152
 		);
153 153
 
154 154
 		$this->_hidden_columns = array();
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 	 * @param  EE_Registration $item the current item
163 163
 	 * @return string
164 164
 	 */
165
-	protected function _get_row_class( $item ) {
166
-		$class = parent::_get_row_class( $item );
165
+	protected function _get_row_class($item) {
166
+		$class = parent::_get_row_class($item);
167 167
 		//add status class
168
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
169
-		if ( $this->_has_checkbox_column ) {
168
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
169
+		if ($this->_has_checkbox_column) {
170 170
 			$class .= ' has-checkbox-column';
171 171
 		}
172 172
 		return $class;
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
 	 * @param EE_Registration $registration
181 181
 	 * @throws \EE_Error
182 182
 	 */
183
-	protected function _set_related_details( EE_Registration $registration ) {
183
+	protected function _set_related_details(EE_Registration $registration) {
184 184
 
185
-		$transaction = $registration->get_first_related( 'Transaction' );
185
+		$transaction = $registration->get_first_related('Transaction');
186 186
 		$status = $transaction instanceof EE_Transaction
187 187
 			? $transaction->status_ID()
188 188
 			: EEM_Transaction::failed_status_code;
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 			'status' => $status,
192 192
 			'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
193 193
 			'title_attr' => sprintf(
194
-				__( 'View Transaction Details (%s)', 'event_espresso' ),
195
-				EEH_Template::pretty_status( $status, false, 'sentence' )
194
+				__('View Transaction Details (%s)', 'event_espresso'),
195
+				EEH_Template::pretty_status($status, false, 'sentence')
196 196
 			)
197 197
 		);
198 198
 
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 			'status' => $status,
204 204
 			'id' => $event instanceof EE_Event ? $event->ID() : 0,
205 205
 			'title_attr' => sprintf(
206
-				__( 'Edit Event (%s)', 'event_espresso' ),
207
-				EEH_Template::pretty_status( $status, false, 'sentence' )
206
+				__('Edit Event (%s)', 'event_espresso'),
207
+				EEH_Template::pretty_status($status, false, 'sentence')
208 208
 			)
209 209
 		);
210 210
 	}
@@ -221,30 +221,30 @@  discard block
 block discarded – undo
221 221
 
222 222
 		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
223 223
 
224
-		$cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : '';
225
-		$cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
226
-		$reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : '';
224
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
225
+		$cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
226
+		$reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
227 227
 
228
-		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category );
229
-		$filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category );
228
+		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
229
+		$filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
230 230
 
231 231
 		$status = array();
232
-		$status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') );
233
-		foreach ( $this->_status as $key => $value ) {
234
-			$status[] = array( 'id' => $key, 'text' => $value );
232
+		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
233
+		foreach ($this->_status as $key => $value) {
234
+			$status[] = array('id' => $key, 'text' => $value);
235 235
 		}
236
-		if ( $this->_view !== 'incomplete' ) {
236
+		if ($this->_view !== 'incomplete') {
237 237
 			$filters[] = EEH_Form_Fields::select_input(
238 238
 				'_reg_status',
239 239
 				$status,
240
-				isset( $this->_req_data['_reg_status'] )
241
-					? strtoupper( sanitize_key( $this->_req_data['_reg_status'] ))
240
+				isset($this->_req_data['_reg_status'])
241
+					? strtoupper(sanitize_key($this->_req_data['_reg_status']))
242 242
 					: ''
243 243
 			);
244 244
 		}
245 245
 
246
-		if ( isset( $this->_req_data['event_id'] ) ) {
247
-			$filters[] = EEH_Form_Fields::hidden_input( 'event_id',  $this->_req_data['event_id'], 'reg_event_id' );
246
+		if (isset($this->_req_data['event_id'])) {
247
+			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
248 248
 		}
249 249
 
250 250
 		return $filters;
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 		$this->_views['all']['count'] = $this->_total_registrations();
264 264
 		$this->_views['month']['count'] = $this->_total_registrations_this_month();
265 265
 		$this->_views['today']['count'] = $this->_total_registrations_today();
266
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) {
267
-			$this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' );
268
-			$this->_views['trash']['count'] = $this->_total_registrations( 'trash' );
266
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) {
267
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
268
+			$this->_views['trash']['count'] = $this->_total_registrations('trash');
269 269
 		}
270 270
 	}
271 271
 
@@ -279,23 +279,23 @@  discard block
 block discarded – undo
279 279
 	 * @return int
280 280
 	 * @throws \EE_Error
281 281
 	 */
282
-	protected function _total_registrations( $view = '' ){
282
+	protected function _total_registrations($view = '') {
283 283
 		$_where = array();
284
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
285
-		if( $EVT_ID ) {
284
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
285
+		if ($EVT_ID) {
286 286
 			$_where['EVT_ID'] = $EVT_ID;
287 287
 		}
288
-		switch ( $view ) {
288
+		switch ($view) {
289 289
 			case 'trash' :
290
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
290
+				return EEM_Registration::instance()->count_deleted(array($_where));
291 291
 				break;
292 292
 			case 'incomplete' :
293 293
 				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
294 294
 				break;
295 295
 			default :
296
-				$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
296
+				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
297 297
 		}
298
-		return EEM_Registration::instance()->count( array( $_where ));
298
+		return EEM_Registration::instance()->count(array($_where));
299 299
 	}
300 300
 
301 301
 
@@ -307,32 +307,32 @@  discard block
 block discarded – undo
307 307
 	 * @return int
308 308
 	 * @throws \EE_Error
309 309
 	 */
310
-	protected function _total_registrations_this_month(){
311
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
312
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
310
+	protected function _total_registrations_this_month() {
311
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
312
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
313 313
 		$this_year_r = date('Y', current_time('timestamp'));
314 314
 		$time_start = ' 00:00:00';
315 315
 		$time_end = ' 23:59:59';
316 316
 		$this_month_r = date('m', current_time('timestamp'));
317
-		$days_this_month = date( 't', current_time('timestamp') );
317
+		$days_this_month = date('t', current_time('timestamp'));
318 318
 		//setup date query.
319 319
 		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query(
320 320
 			'REG_date',
321
-			$this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
321
+			$this_year_r.'-'.$this_month_r.'-01'.' '.$time_start,
322 322
 			'Y-m-d H:i:s'
323 323
 		);
324 324
 		$end_string = EEM_Registration::instance()->convert_datetime_for_query(
325 325
 			'REG_date',
326
-			$this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
326
+			$this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end,
327 327
 			'Y-m-d H:i:s'
328 328
 		);
329
-		$_where['REG_date']= array('BETWEEN',
329
+		$_where['REG_date'] = array('BETWEEN',
330 330
 			array(
331 331
 				$beginning_string,
332 332
 				$end_string
333 333
 		));
334
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
335
-		return EEM_Registration::instance()->count(array( $_where ) );
334
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
335
+		return EEM_Registration::instance()->count(array($_where));
336 336
 	}
337 337
 
338 338
 
@@ -344,20 +344,20 @@  discard block
 block discarded – undo
344 344
 	 * @return int
345 345
 	 * @throws \EE_Error
346 346
 	 */
347
-	protected function _total_registrations_today(){
347
+	protected function _total_registrations_today() {
348 348
 
349
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
350
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
349
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
350
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
351 351
 		$current_date = date('Y-m-d', current_time('timestamp'));
352 352
 		$time_start = ' 00:00:00';
353 353
 		$time_end = ' 23:59:59';
354
-		$_where['REG_date']= array('BETWEEN',
354
+		$_where['REG_date'] = array('BETWEEN',
355 355
 			array(
356
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ),
357
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' )
356
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'),
357
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s')
358 358
 		));
359
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
360
-		return EEM_Registration::instance()->count(array( $_where ) );
359
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
360
+		return EEM_Registration::instance()->count(array($_where));
361 361
 	}
362 362
 
363 363
 
@@ -370,12 +370,12 @@  discard block
 block discarded – undo
370 370
 	 * @return string
371 371
 	 * @throws \EE_Error
372 372
 	 */
373
-    public function column_cb($item){
373
+    public function column_cb($item) {
374 374
 	/** checkbox/lock **/
375
-	$transaction = $item->get_first_related( 'Transaction' );
376
-	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
375
+	$transaction = $item->get_first_related('Transaction');
376
+	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
377 377
 	    return $payment_count > 0
378
-		    ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() )
378
+		    ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID())
379 379
 		      . '<span class="ee-lock-icon"></span>'
380 380
 		    : sprintf(
381 381
 			    '<input type="checkbox" name="_REG_ID[]" value="%1$s" />',
@@ -393,14 +393,14 @@  discard block
 block discarded – undo
393 393
 	 * @return string
394 394
 	 * @throws \EE_Error
395 395
 	 */
396
-	public function column__REG_ID(EE_Registration $item){
396
+	public function column__REG_ID(EE_Registration $item) {
397 397
 		$attendee = $item->attendee();
398 398
 		$content = $item->ID();
399 399
 		$content .= '<div class="show-on-mobile-view-only">';
400 400
 		$content .= '<br>';
401 401
 		$content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
402
-		$content .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
403
-		$content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
402
+		$content .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
403
+		$content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
404 404
 		$content .= '</div>';
405 405
 		return $content;
406 406
 	}
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
 	 * @return string
416 416
 	 * @throws \EE_Error
417 417
 	 */
418
-	public function column__REG_date(EE_Registration $item){
418
+	public function column__REG_date(EE_Registration $item) {
419 419
 		$this->_set_related_details($item);
420 420
        		 //Build row actions
421
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
422
-		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
423
-		$view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>';
421
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL);
422
+		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date');
423
+		$view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>';
424 424
 		return $view_link;
425 425
 	}
426 426
 
@@ -434,18 +434,18 @@  discard block
 block discarded – undo
434 434
 	 * @return string
435 435
 	 * @throws \EE_Error
436 436
 	 */
437
-	public function column_event_name(EE_Registration $item){
438
-		$this->_set_related_details( $item );
437
+	public function column_event_name(EE_Registration $item) {
438
+		$this->_set_related_details($item);
439 439
 		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
440
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL );
440
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL);
441 441
 		$event_name = $item->event_name();
442 442
 		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
443
-		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ;
443
+		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...');
444 444
 
445
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL );
446
-		$actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' .  __( 'View Registrations', 'event_espresso' ) . '</a>';
445
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL);
446
+		$actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>';
447 447
 
448
-		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) );
448
+		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
449 449
 	}
450 450
 
451 451
 
@@ -458,18 +458,18 @@  discard block
 block discarded – undo
458 458
 	 * @return string
459 459
 	 * @throws \EE_Error
460 460
 	 */
461
-   	public function column_DTT_EVT_start(EE_Registration $item){
461
+   	public function column_DTT_EVT_start(EE_Registration $item) {
462 462
 		$datetime_strings = array();
463
-		$ticket = $item->ticket( TRUE );
464
-		if ( $ticket instanceof EE_Ticket ) {
463
+		$ticket = $item->ticket(TRUE);
464
+		if ($ticket instanceof EE_Ticket) {
465 465
 			$remove_defaults = array('default_where_conditions' => 'none');
466 466
 			$datetimes = $ticket->datetimes($remove_defaults);
467
-			foreach($datetimes as $datetime){
468
-				$datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' );
467
+			foreach ($datetimes as $datetime) {
468
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
469 469
 			}
470
-			return implode("<br />",$datetime_strings);
470
+			return implode("<br />", $datetime_strings);
471 471
 		} else {
472
-			return __( 'There is no ticket on this registration', 'event_espresso' );
472
+			return __('There is no ticket on this registration', 'event_espresso');
473 473
 		}
474 474
     }
475 475
 
@@ -483,45 +483,45 @@  discard block
 block discarded – undo
483 483
 	 * @return string
484 484
 	 * @throws \EE_Error
485 485
 	 */
486
-   	public function column_ATT_fname(EE_Registration $item){
486
+   	public function column_ATT_fname(EE_Registration $item) {
487 487
    		$attendee = $item->attendee();
488 488
 
489
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
489
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
490 490
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
491
-		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name;
491
+		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name;
492 492
 		$link .= $item->count() === 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
493 493
 
494 494
 		$t = $item->get_first_related('Transaction');
495 495
 		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
496 496
 
497 497
 	    //append group count to name
498
-	    $link .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
498
+	    $link .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
499 499
 
500 500
 	    //append reg_code
501
-	    $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
501
+	    $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
502 502
 
503 503
 	    //reg status text for accessibility
504
-	    $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
504
+	    $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
505 505
 
506 506
 		//trash/restore/delete actions
507 507
 		$actions = array();
508
-		if ( $this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) {
509
-			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
510
-			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>';
511
-		} elseif ( $this->_view === 'trash' ) {
508
+		if ($this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) {
509
+			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
510
+			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
511
+		} elseif ($this->_view === 'trash') {
512 512
 			// restore registration link
513
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) {
514
-				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
515
-				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
513
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) {
514
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
515
+				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
516 516
 			}
517
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) {
518
-				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
517
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) {
518
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
519 519
 
520
-				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>';
520
+				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>';
521 521
 			}
522 522
 		}
523 523
 
524
-		return sprintf('%1$s %2$s', $link, $this->row_actions($actions) );
524
+		return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
525 525
 	}
526 526
 
527 527
 
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	 * @return string
535 535
 	 * @throws \EE_Error
536 536
 	 */
537
-	public function column_ATT_email( EE_Registration $item ) {
537
+	public function column_ATT_email(EE_Registration $item) {
538 538
 		$attendee = $item->get_first_related('Attendee');
539 539
 		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email();
540 540
 	}
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 	 * @param \EE_Registration $item
549 549
 	 * @return string
550 550
 	 */
551
-	public function column__REG_count(EE_Registration $item){
552
-		return  sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size());
551
+	public function column__REG_count(EE_Registration $item) {
552
+		return  sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
553 553
 	}
554 554
 
555 555
 
@@ -561,16 +561,16 @@  discard block
 block discarded – undo
561 561
 	 * @param \EE_Registration $item
562 562
 	 * @return string
563 563
 	 */
564
-	public function column_PRC_amount(EE_Registration $item){
564
+	public function column_PRC_amount(EE_Registration $item) {
565 565
 		$ticket = $item->ticket();
566 566
 
567
-		$content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : '';
567
+		$content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : '';
568 568
 
569
-		if ( $item->final_price() > 0 ) {
570
-			$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
569
+		if ($item->final_price() > 0) {
570
+			$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
571 571
 		} else {
572 572
 			// free event
573
-			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>';
573
+			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>';
574 574
 		}
575 575
 
576 576
 		return $content;
@@ -586,11 +586,11 @@  discard block
 block discarded – undo
586 586
 	 * @param \EE_Registration $item
587 587
 	 * @return string
588 588
 	 */
589
-	public function column__REG_final_price(EE_Registration $item){
589
+	public function column__REG_final_price(EE_Registration $item) {
590 590
 		$ticket = $item->ticket();
591
-		$content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />';
591
+		$content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />';
592 592
 
593
-		$content .= '<span class="reg-pad-rght">' .  $item->pretty_final_price() . '</span>';
593
+		$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
594 594
 		return $content;
595 595
 
596 596
 	}
@@ -604,13 +604,13 @@  discard block
 block discarded – undo
604 604
 	 * @param \EE_Registration $item
605 605
 	 * @return string
606 606
 	 */
607
-	public function column__REG_paid(EE_Registration $item){
607
+	public function column__REG_paid(EE_Registration $item) {
608 608
 		$payment_method = $item->payment_method();
609
-		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );
609
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso');
610 610
 
611
-		$content = '<span class="reg-pad-rght">' .  $item->pretty_paid() . '</span>';
612
-		if ( $item->paid() > 0 ) {
613
-			$content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>';
611
+		$content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>';
612
+		if ($item->paid() > 0) {
613
+			$content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>';
614 614
 		}
615 615
 		return $content;
616 616
 	}
@@ -625,11 +625,11 @@  discard block
 block discarded – undo
625 625
 	 * @return string
626 626
 	 * @throws \EE_Error
627 627
 	 */
628
-	public function column_TXN_total(EE_Registration $item){
629
-		if($item->transaction()){
630
-			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
631
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">'  . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
632
-		}else{
628
+	public function column_TXN_total(EE_Registration $item) {
629
+		if ($item->transaction()) {
630
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
631
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>';
632
+		} else {
633 633
 			return __("None", "event_espresso");
634 634
 		}
635 635
 	}
@@ -644,15 +644,15 @@  discard block
 block discarded – undo
644 644
 	 * @return string
645 645
 	 * @throws \EE_Error
646 646
 	 */
647
-	public function column_TXN_paid(EE_Registration $item){
647
+	public function column_TXN_paid(EE_Registration $item) {
648 648
 
649
-		if ( $item->count() === 1 ) {
649
+		if ($item->count() === 1) {
650 650
 			$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
651
-			if ( $transaction->paid() >= $transaction->total() ) {
651
+			if ($transaction->paid() >= $transaction->total()) {
652 652
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
653 653
 			} else {
654
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
655
-				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
654
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
655
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
656 656
 			}
657 657
 		}
658 658
 
@@ -672,44 +672,44 @@  discard block
 block discarded – undo
672 672
 	 */
673 673
 	public function column_actions(EE_Registration $item) {
674 674
 		$attendee = $item->attendee();
675
-		$this->_set_related_details( $item );
675
+		$this->_set_related_details($item);
676 676
 
677 677
 		//Build row actions
678
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
679
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL );
678
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
679
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL);
680 680
 
681 681
 		// page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
682 682
 		//$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
683
-		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true );
683
+		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true);
684 684
 
685 685
 
686 686
 		//Build row actions
687
-		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '
687
+		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '
688 688
 			<li>
689
-			<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
689
+			<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
690 690
 				<div class="dashicons dashicons-clipboard"></div>
691 691
 			</a>
692 692
 			</li>' : '';
693 693
 
694
-		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) &&  $attendee instanceof EE_Attendee ?'
694
+		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? '
695 695
 			<li>
696
-			<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text">
696
+			<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text">
697 697
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
698 698
 			</a>
699 699
 			</li>' : '';
700 700
 
701
-		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? '
701
+		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? '
702 702
 			<li>
703
-			<a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text">
703
+			<a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text">
704 704
 				<div class="dashicons dashicons-email-alt"></div>
705 705
 			</a>
706 706
 			</li>' : '';
707 707
 
708 708
 		// page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
709
-		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL );
710
-		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? '
709
+		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL);
710
+		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
711 711
 			<li>
712
-			<a class="ee-status-color-' . $this->_transaction_details['status'] . ' tiny-text" href="'.$view_txn_lnk_url.'"  title="' . $this->_transaction_details['title_attr'] . '">
712
+			<a class="ee-status-color-' . $this->_transaction_details['status'].' tiny-text" href="'.$view_txn_lnk_url.'"  title="'.$this->_transaction_details['title_attr'].'">
713 713
 				<div class="dashicons dashicons-cart"></div>
714 714
 			</a>
715 715
 			</li>' : '';
@@ -718,10 +718,10 @@  discard block
 block discarded – undo
718 718
 		$dl_invoice_lnk = '';
719 719
 		$dl_invoice_lnk_url = $item->invoice_url();
720 720
 		//only show invoice link if message type is active.
721
-		if ( $attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
721
+		if ($attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active('invoice')) {
722 722
 			$dl_invoice_lnk = '
723 723
 		<li>
724
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
724
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
725 725
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
726 726
 			</a>
727 727
 		</li>';
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 
730 730
 		$filtered_messages_link = '';
731 731
 		//message list table link (filtered by REG_ID
732
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
732
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
733 733
 			$filtered_messages_link = '<li>'
734 734
 			                          . EEH_MSG_Template::get_message_action_link(
735 735
 											'see_notifications_for',
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 			                          . '</li>';
742 742
 		}
743 743
 
744
-		return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk . $filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul' );
744
+		return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk.$filtered_messages_link, $item, 'ul', 'reg-overview-actions-ul');
745 745
 	}
746 746
 
747 747
 }
Please login to merge, or discard this patch.
admin_pages/transactions/EE_Admin_Transactions_List_Table.class.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	/**
32 32
 	 * @param \Transactions_Admin_Page $admin_page
33 33
 	 */
34
-	public function __construct( \Transactions_Admin_Page $admin_page ){
35
-		parent::__construct( $admin_page );
34
+	public function __construct(\Transactions_Admin_Page $admin_page) {
35
+		parent::__construct($admin_page);
36 36
 		$this->_status = $this->_admin_page->get_transaction_status_array();
37 37
 	}
38 38
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	 *_setup_data
43 43
 	 */
44 44
 	protected function _setup_data() {
45
-		$this->_data = $this->_admin_page->get_transactions( $this->_per_page );
46
-		$status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all';
47
-		$this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status );
45
+		$this->_data = $this->_admin_page->get_transactions($this->_per_page);
46
+		$status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';
47
+		$this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status);
48 48
 	}
49 49
 
50 50
 
@@ -59,25 +59,25 @@  discard block
 block discarded – undo
59 59
 			'ajax' => TRUE,
60 60
 			'screen' => $this->_admin_page->get_current_screen()->id
61 61
 			);
62
-		$ID_column_name = __( 'ID', 'event_espresso' );
62
+		$ID_column_name = __('ID', 'event_espresso');
63 63
 		$ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">';
64
-		$ID_column_name .= __( 'Transaction Date', 'event_espresso' );
64
+		$ID_column_name .= __('Transaction Date', 'event_espresso');
65 65
 		$ID_column_name .= '</span> ';
66 66
 		$this->_columns = array(
67 67
 			'TXN_ID' => $ID_column_name,
68
-			'TXN_timestamp'	=> __( 'Transaction Date', 'event_espresso' ),
69
-			'TXN_total' => __( 'Total', 'event_espresso' ),
70
-			'TXN_paid' => __( 'Paid', 'event_espresso' ),
71
-			'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ),
72
-			'event_name' => __( 'Event', 'event_espresso' ),
73
-			'actions' => __( 'Actions', 'event_espresso' )
68
+			'TXN_timestamp'	=> __('Transaction Date', 'event_espresso'),
69
+			'TXN_total' => __('Total', 'event_espresso'),
70
+			'TXN_paid' => __('Paid', 'event_espresso'),
71
+			'ATT_fname' => __('Primary Registrant', 'event_espresso'),
72
+			'event_name' => __('Event', 'event_espresso'),
73
+			'actions' => __('Actions', 'event_espresso')
74 74
 		);
75 75
 
76 76
 		$this->_sortable_columns = array(
77
-			'TXN_ID' => array( 'TXN_ID' => FALSE ),
78
-			'event_name' => array( 'event_name'=> FALSE ),
79
-			'ATT_fname'	=> array( 'ATT_fname'=> FALSE ),
80
-			'TXN_timestamp'	=> array( 'TXN_timestamp'=> TRUE ) //true means its already sorted
77
+			'TXN_ID' => array('TXN_ID' => FALSE),
78
+			'event_name' => array('event_name'=> FALSE),
79
+			'ATT_fname'	=> array('ATT_fname'=> FALSE),
80
+			'TXN_timestamp'	=> array('TXN_timestamp'=> TRUE) //true means its already sorted
81 81
 		);
82 82
 
83 83
 		$this->_primary_column = 'TXN_ID';
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @return string
96 96
 	 * @throws \EE_Error
97 97
 	 */
98
-	protected function _get_row_class( $item ) {
99
-		$class = parent::_get_row_class( $item );
98
+	protected function _get_row_class($item) {
99
+		$class = parent::_get_row_class($item);
100 100
 		//add status class
101
-		$class .= ' ee-status-strip txn-status-' . $item->status_ID();
102
-		if ( $this->_has_checkbox_column ) {
101
+		$class .= ' ee-status-strip txn-status-'.$item->status_ID();
102
+		if ($this->_has_checkbox_column) {
103 103
 			$class .= ' has-checkbox-column';
104 104
 		}
105 105
 		return $class;
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	protected function _get_table_filters() {
118 118
 		$filters = array();
119
-		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
120
-		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
119
+		$start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
120
+		$end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y');
121 121
 		ob_start();
122 122
 		?>
123 123
 		<label for="txn-filter-start-date">Display Transactions from </label>
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 	 *_add_view_counts
137 137
 	 */
138 138
 	protected function _add_view_counts() {
139
-		$this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' );
140
-		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' );
141
-		$this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' );
139
+		$this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all');
140
+		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned');
141
+		$this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed');
142 142
 	}
143 143
 
144 144
 
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	 * @return string
151 151
 	 * @throws \EE_Error
152 152
 	 */
153
-	public function column_TXN_ID( EE_Transaction $item ){
154
-    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
155
-	   $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';
153
+	public function column_TXN_ID(EE_Transaction $item) {
154
+    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
155
+	   $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>';
156 156
 
157 157
 	   //txn timestamp
158
-	   $content .= '  <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>';
158
+	   $content .= '  <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>';
159 159
 	   return $content;
160 160
 	}
161 161
 
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
 	 * @return mixed|string|void
167 167
 	 * @throws \EE_Error
168 168
 	 */
169
-	protected function _get_txn_timestamp( EE_Transaction $item ) {
169
+	protected function _get_txn_timestamp(EE_Transaction $item) {
170 170
 		//txn timestamp
171 171
 		// is TXN less than 2 hours old ?
172 172
 		if (
173
-			( $item->failed() || $item->is_abandoned() )
173
+			($item->failed() || $item->is_abandoned())
174 174
 			&& (
175
-				( time() - EE_Registry::instance()->SSN->lifespan() ) < $item->datetime( false, true )
175
+				(time() - EE_Registry::instance()->SSN->lifespan()) < $item->datetime(false, true)
176 176
 			)
177 177
 		) {
178
-			$timestamp = __( 'TXN in progress...', 'event_espresso' );
178
+			$timestamp = __('TXN in progress...', 'event_espresso');
179 179
 	   } else {
180
-			$timestamp = $item->get_i18n_datetime( 'TXN_timestamp' );
180
+			$timestamp = $item->get_i18n_datetime('TXN_timestamp');
181 181
 		}
182 182
 		return $timestamp;
183 183
 	}
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 	 * @return string
192 192
 	 * @throws \EE_Error
193 193
 	 */
194
-	public function column_cb($item ){
195
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'],  $item->ID());
194
+	public function column_cb($item) {
195
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID());
196 196
 	}
197 197
 
198 198
 
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 	 * @return string
205 205
 	 * @throws \EE_Error
206 206
 	 */
207
-	public function column_TXN_timestamp( EE_Transaction $item ){
208
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
209
-		$txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>';
207
+	public function column_TXN_timestamp(EE_Transaction $item) {
208
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
209
+		$txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>';
210 210
 		//status
211
-		$txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
211
+		$txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
212 212
 		return $txn_date;
213 213
 	}
214 214
 
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 	 * @return string
222 222
 	 * @throws \EE_Error
223 223
 	 */
224
-	public function column_TXN_total( EE_Transaction $item ){
225
-		if ( $item->get('TXN_total') > 0 ) {
226
-			return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>';
224
+	public function column_TXN_total(EE_Transaction $item) {
225
+		if ($item->get('TXN_total') > 0) {
226
+			return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>';
227 227
 		} else {
228
-			return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>';
228
+			return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>';
229 229
 		}
230 230
 	}
231 231
 
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
 	 * @return mixed|string
239 239
 	 * @throws \EE_Error
240 240
 	 */
241
-	public function column_TXN_paid( EE_Transaction $item ){
241
+	public function column_TXN_paid(EE_Transaction $item) {
242 242
 		$transaction_total = $item->get('TXN_total');
243 243
 		$transaction_paid = $item->get('TXN_paid');
244 244
 
245
-		if ( \EEH_Money::compare_floats( $transaction_total, 0,'>' ) ) {
245
+		if (\EEH_Money::compare_floats($transaction_total, 0, '>')) {
246 246
 			// monies owing
247 247
 			$span_class = 'txn-overview-part-payment-spn';
248
-			if ( \EEH_Money::compare_floats( $transaction_paid, $transaction_total, '>=' ) ) {
248
+			if (\EEH_Money::compare_floats($transaction_paid, $transaction_total, '>=')) {
249 249
 				// paid in full
250 250
 				$span_class = 'txn-overview-full-payment-spn';
251
-			} elseif ( \EEH_Money::compare_floats( $transaction_paid, 0, '==' ) ) {
251
+			} elseif (\EEH_Money::compare_floats($transaction_paid, 0, '==')) {
252 252
 				// no payments made
253 253
 				$span_class = 'txn-overview-no-payment-spn';
254 254
 			}
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 		}
259 259
 
260 260
 		$payment_method = $item->payment_method();
261
-		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );
261
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso');
262 262
 
263
-		$content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>';
264
-		if ( $transaction_paid > 0 ) {
265
-			$content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>';
263
+		$content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>';
264
+		if ($transaction_paid > 0) {
265
+			$content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>';
266 266
 		}
267 267
 		return $content;
268 268
 	}
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
 	 * @return string|void
277 277
 	 * @throws \EE_Error
278 278
 	 */
279
-	public function column_ATT_fname( EE_Transaction $item ){
279
+	public function column_ATT_fname(EE_Transaction $item) {
280 280
 		$primary_reg = $item->primary_registration();
281 281
 		$attendee = $primary_reg->get_first_related('Attendee');
282
-		if ( $attendee instanceof EE_Attendee ) {
283
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL );
284
-			$content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name();
285
-			$content .= '<br>' . $attendee->email();
282
+		if ($attendee instanceof EE_Attendee) {
283
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL);
284
+			$content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name();
285
+			$content .= '<br>'.$attendee->email();
286 286
 			return $content;
287 287
 		}
288 288
 		return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
 	 * @return string|void
298 298
 	 * @throws \EE_Error
299 299
 	 */
300
-	public function column_ATT_email( EE_Transaction $item ){
300
+	public function column_ATT_email(EE_Transaction $item) {
301 301
 		$attendee = $item->primary_registration()->get_first_related('Attendee');
302
-		if ( ! empty( $attendee ) ) {
303
-			return '<a href="mailto:' . $attendee->get( 'ATT_email' ) . '">' . $attendee->get( 'ATT_email' ) . '</a>';
302
+		if ( ! empty($attendee)) {
303
+			return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>';
304 304
 		} else {
305 305
 			return $item->failed() || $item->is_abandoned()
306
-				? __( 'no contact record.', 'event_espresso' )
306
+				? __('no contact record.', 'event_espresso')
307 307
 				: __(
308 308
 					'No contact record, because the transaction was abandoned or the registration process failed.',
309 309
 					'event_espresso'
@@ -320,20 +320,20 @@  discard block
 block discarded – undo
320 320
 	 * @return string|void
321 321
 	 * @throws \EE_Error
322 322
 	 */
323
- 	public function column_event_name( EE_Transaction $item ){
323
+ 	public function column_event_name(EE_Transaction $item) {
324 324
     	$actions = array();
325 325
 		$event = $item->primary_registration()->get_first_related('Event');
326
-		if ( !empty( $event ) ) {
327
-			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );
326
+		if ( ! empty($event)) {
327
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL);
328 328
 			$event_name = $event->get('EVT_name');
329 329
 
330 330
 			//filter this view by transactions for this event
331
-			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) );
332
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) {
333
-				$actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>';
331
+			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID()));
332
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) {
333
+				$actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>';
334 334
 			}
335 335
 
336
-			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) );
336
+			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions));
337 337
 		} else {
338 338
 			return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso');
339 339
 		}
@@ -348,35 +348,35 @@  discard block
 block discarded – undo
348 348
 	 * @return string
349 349
 	 * @throws \EE_Error
350 350
 	 */
351
- 	public function column_actions( EE_Transaction $item ){
351
+ 	public function column_actions(EE_Transaction $item) {
352 352
 
353 353
     	$registration = $item->primary_registration();
354 354
     	$attendee = $registration->attendee();
355 355
 
356 356
         //Build row actions
357
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
357
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
358 358
 		$dl_invoice_lnk_url = $registration->invoice_url();
359 359
 		$dl_receipt_lnk_url = $registration->receipt_url();
360
-		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
361
-		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
362
-	    $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array(
360
+		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
361
+		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
362
+	    $related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array(
363 363
 		    'TXN_ID' => $item->ID()
364 364
 	    ));
365 365
 
366 366
 		//Build row actions
367 367
 		$view_lnk = '
368 368
 			<li>
369
-				<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text">
369
+				<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text">
370 370
 					<span class="dashicons dashicons-cart"></span>
371 371
 				</a>
372 372
 			</li>';
373 373
 
374 374
 		$dl_invoice_lnk = '';
375 375
 		//only show invoice link if message type is active.
376
-		if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
376
+		if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
377 377
 			$dl_invoice_lnk = '
378 378
 			<li>
379
-				<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
379
+				<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
380 380
 					<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
381 381
 				</a>
382 382
 			</li>';
@@ -384,17 +384,17 @@  discard block
 block discarded – undo
384 384
 
385 385
 		$dl_receipt_lnk = '';
386 386
 		//only show receipt link if message type is active.
387
-		if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) {
387
+		if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) {
388 388
 			$dl_receipt_lnk = '
389 389
 			<li>
390
-				<a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
390
+				<a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
391 391
 					<span class="dashicons dashicons-media-default ee-icon-size-18"></span>
392 392
 				</a>
393 393
 			</li>';
394 394
 		}
395 395
 
396 396
 		//only show payment reminder link if the message type is active.
397
-		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
397
+		if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
398 398
 			$send_pay_lnk = $attendee instanceof EE_Attendee
399 399
 							&& EE_Registry::instance()->CAP->current_user_can(
400 400
 								'ee_send_message',
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 							)
403 403
 				? '
404 404
 				<li>
405
-					<a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">
405
+					<a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text">
406 406
 						<span class="dashicons dashicons-email-alt"></span>
407 407
 					</a>
408 408
 				</li>'
@@ -422,18 +422,18 @@  discard block
 block discarded – undo
422 422
 		)
423 423
 			? '
424 424
 				<li>
425
-					<a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
425
+					<a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
426 426
 						<span class="dashicons dashicons-clipboard"></span>
427 427
 					</a>
428 428
 				</li>'
429 429
 			: '';
430 430
 
431 431
 		$view_related_messages_lnk = '';
432
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
433
-			$view_related_messages_lnk = '<li>' . $related_messages_link . '</li>';
432
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
433
+			$view_related_messages_lnk = '<li>'.$related_messages_link.'</li>';
434 434
 		}
435 435
 
436
-		return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' );
436
+		return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk.$view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul');
437 437
     }
438 438
 
439 439
 
Please login to merge, or discard this patch.
strategies/display/EE_Compound_Input_Display_Strategy.strategy.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 	 * @param bool   $add_pound_sign
28 28
 	 * @return string
29 29
 	 */
30
-	public function get_sub_input_id( $option_value, $add_pound_sign = false ) {
31
-		return $this->_append_chars( $this->_input->html_id( $add_pound_sign ), '-' ) . sanitize_key( $option_value );
30
+	public function get_sub_input_id($option_value, $add_pound_sign = false) {
31
+		return $this->_append_chars($this->_input->html_id($add_pound_sign), '-').sanitize_key($option_value);
32 32
 	}
33 33
 
34 34
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	 * @return array
41 41
 	 * @throws \EE_Error
42 42
 	 */
43
-	public function get_html_input_ids( $add_pound_sign = false ) {
43
+	public function get_html_input_ids($add_pound_sign = false) {
44 44
 		$html_input_ids = array();
45
-		foreach( $this->get_input()->options() as $value => $display ) {
46
-			$html_input_ids[] = $this->get_sub_input_id( $value, $add_pound_sign );
45
+		foreach ($this->get_input()->options() as $value => $display) {
46
+			$html_input_ids[] = $this->get_sub_input_id($value, $add_pound_sign);
47 47
 		}
48 48
 		return $html_input_ids;
49 49
 	}
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @throws \EE_Error
59 59
 	 */
60 60
 	public function get_input() {
61
-		if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base ){
61
+		if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) {
62 62
 			throw new EE_Error(
63 63
 				sprintf(
64 64
 					__(
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_To_Generate_From_Queue.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 	 * @param EE_Messages_Queue $queue
26 26
 	 * @param string            $custom_subject  Used if a custom subject is desired for the generated aggregate EE_Message object
27 27
 	 */
28
-	public function __construct( $messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '' ) {
28
+	public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '') {
29 29
 		$this->queue = $queue;
30
-		parent::__construct( $messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle );
31
-		if ( $this->valid() ) {
32
-			$this->_message->set_content( $this->_get_content() );
33
-			$this->_message->set_subject( $this->_get_subject( $custom_subject ) );
30
+		parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle);
31
+		if ($this->valid()) {
32
+			$this->_message->set_content($this->_get_content());
33
+			$this->_message->set_subject($this->_get_subject($custom_subject));
34 34
 		}
35 35
 	}
36 36
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	protected function _get_content() {
45 45
 		$content = '';
46 46
 		$this->queue->get_message_repository()->rewind();
47
-		while ( $this->queue->get_message_repository()->valid() ) {
47
+		while ($this->queue->get_message_repository()->valid()) {
48 48
 			$content .= $this->queue->get_message_repository()->current()->content();
49 49
 			$this->queue->get_message_repository()->next();
50 50
 		}
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return string
60 60
 	 */
61
-	protected function _get_subject( $custom_subject = '' ) {
62
-		if ( ! empty( $custom_subject ) ) {
61
+	protected function _get_subject($custom_subject = '') {
62
+		if ( ! empty($custom_subject)) {
63 63
 			return $custom_subject;
64 64
 		}
65 65
 		$this->queue->get_message_repository()->rewind();
66 66
 		$count_of_items = $this->queue->get_message_repository()->count();
67 67
 
68 68
 		//if $count of items in queue == 1, then let's just return the subject for that item.
69
-		if ( $count_of_items === 1 ) {
69
+		if ($count_of_items === 1) {
70 70
 			return $this->queue->get_message_repository()->current()->subject();
71 71
 		}
72 72
 
Please login to merge, or discard this patch.