Completed
Branch BUG-9583-fix-fetching-term-rel... (646110)
by
unknown
539:15 queued 523:53
created
core/libraries/shortcodes/EE_Attendee_Shortcodes.lib.php 2 patches
Spacing   +11 added lines, -11 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
 /**
@@ -60,34 +60,34 @@  discard block
 block discarded – undo
60 60
 			'[ADDRESS2]' => __('Whatever was in the address 2 field for the registration.', 'event_espresso'),
61 61
 			'[CITY]' => __('The city for the registration.', 'event_espresso'),
62 62
 			'[ZIP_PC]' => __('The ZIP (or Postal) Code for the Registration.', 'event_espresso'),
63
-			'[ADDRESS_STATE]' => __('The state/province for the registration.', 'event_espresso' ),
63
+			'[ADDRESS_STATE]' => __('The state/province for the registration.', 'event_espresso'),
64 64
 			'[COUNTRY]' => __('The country for the registration.', 'event_espresso')
65 65
 			);
66 66
 	}
67 67
 
68 68
 
69
-	protected function _parser( $shortcode ) {
69
+	protected function _parser($shortcode) {
70 70
 
71 71
 
72
-		$this->_xtra = !empty($this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL;
72
+		$this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL;
73 73
 
74 74
 		//incoming object should only be a registration object.
75 75
 		$registration = ! $this->_data instanceof EE_Registration ? NULL : $this->_data;
76 76
 
77
-		if ( ! $registration instanceof EE_Registration ) {
77
+		if ( ! $registration instanceof EE_Registration) {
78 78
 			//let's attempt to get the txn_id for the error message.
79
-			$txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso' );
80
-			throw new EE_Error( __('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso' ) . '|' . sprintf( __('The transaction ID for this request is: %s', 'event_espresso' ), $txn_id ) );
79
+			$txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso');
80
+			throw new EE_Error(__('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso').'|'.sprintf(__('The transaction ID for this request is: %s', 'event_espresso'), $txn_id));
81 81
 		}
82 82
 
83 83
 		//attendee obj for this registration
84
-		$attendee = isset( $this->_xtra->registrations[$registration->ID()]['att_obj'] ) ?  $this->_xtra->registrations[$registration->ID()]['att_obj'] : null ;
84
+		$attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj']) ? $this->_xtra->registrations[$registration->ID()]['att_obj'] : null;
85 85
 
86
-		if ( ! $attendee instanceof EE_Attendee ) {
87
-			throw new EE_Error( __('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso' ) . '|' . sprintf( __('The registration ID for this request is: %s', 'event_espresso' ), $registration->ID() ) );
86
+		if ( ! $attendee instanceof EE_Attendee) {
87
+			throw new EE_Error(__('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso').'|'.sprintf(__('The registration ID for this request is: %s', 'event_espresso'), $registration->ID()));
88 88
 		}
89 89
 
90
-		switch ( $shortcode ) {
90
+		switch ($shortcode) {
91 91
 
92 92
 			case '[FNAME]' :
93 93
 				return $attendee->fname();
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Datetime_List_Shortcodes.lib.php 2 patches
Spacing   +12 added lines, -12 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
 /**
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 
45 45
 
46 46
 
47
-	protected function _parser( $shortcode ) {
48
-		switch ( $shortcode ) {
47
+	protected function _parser($shortcode) {
48
+		switch ($shortcode) {
49 49
 			case '[DATETIME_LIST]' :
50 50
 				return $this->_get_datetime_list();
51 51
 				break;
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 		$this->_validate_list_requirements();
64 64
 		$this->_set_shortcode_helper();
65 65
 
66
-		if ( $this->_data['data'] instanceof EE_Ticket )
66
+		if ($this->_data['data'] instanceof EE_Ticket)
67 67
 			return $this->_get_datetime_list_for_ticket();
68 68
 
69
-		else if ( $this->_data['data'] instanceof EE_Event )
69
+		else if ($this->_data['data'] instanceof EE_Event)
70 70
 			return $this->_get_datetime_list_for_event();
71 71
 
72
-		else if ( $this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration ) {
72
+		else if ($this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration) {
73 73
 			return $this->_get_datetime_list_for_registration();
74 74
 		}
75 75
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	private function _get_datetime_list_for_event() {
88 88
 		$valid_shortcodes = array('datetime', 'attendee');
89
-		$template = is_array($this->_data['template'] ) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list'];
89
+		$template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list'];
90 90
 		$event = $this->_data['data'];
91 91
 
92 92
 		//here we're setting up the datetimes for the datetime list template for THIS event.
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		$datetimes = $this->_get_datetimes_from_event($event);
95 95
 
96 96
 		//each datetime in this case should be an datetime object.
97
-		foreach ( $datetimes as $datetime ) {
97
+		foreach ($datetimes as $datetime) {
98 98
 			$dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template($template, $datetime, $valid_shortcodes, $this->_extra_data);
99 99
 		}
100 100
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	private function _get_datetime_list_for_ticket() {
111 111
 		$valid_shortcodes = array('datetime', 'attendee');
112 112
 
113
-		$template = is_array($this->_data['template'] ) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list'];
113
+		$template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list'];
114 114
 		$ticket = $this->_data['data'];
115 115
 
116 116
 		//here we're setting up the datetimes for the datetime list template for THIS ticket.
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		$datetimes = $this->_get_datetimes_from_ticket($ticket);
119 119
 
120 120
 		//each datetime in this case should be an datetime object.
121
-		foreach ( $datetimes as $datetime ) {
121
+		foreach ($datetimes as $datetime) {
122 122
 			$dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template($template, $datetime, $valid_shortcodes, $this->_extra_data);
123 123
 		}
124 124
 
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 
144 144
 
145 145
 
146
-	private function _get_datetimes_from_event( EE_Event $event, $att = NULL ) {
146
+	private function _get_datetimes_from_event(EE_Event $event, $att = NULL) {
147 147
 		 return isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID()]['dtt_objs'] : array();
148 148
 	}
149 149
 
150
-	private function _get_datetimes_from_ticket( EE_Ticket $ticket, $att = NULL ) {
150
+	private function _get_datetimes_from_ticket(EE_Ticket $ticket, $att = NULL) {
151 151
 		return isset($this->_extra_data['data']->tickets) ? $this->_extra_data['data']->tickets[$ticket->ID()]['dtt_objs'] : array();
152 152
 	}
153 153
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
4 4
 	exit('NO direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -63,19 +64,18 @@  discard block
 block discarded – undo
63 64
 		$this->_validate_list_requirements();
64 65
 		$this->_set_shortcode_helper();
65 66
 
66
-		if ( $this->_data['data'] instanceof EE_Ticket )
67
-			return $this->_get_datetime_list_for_ticket();
68
-
69
-		else if ( $this->_data['data'] instanceof EE_Event )
70
-			return $this->_get_datetime_list_for_event();
71
-
72
-		else if ( $this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration ) {
67
+		if ( $this->_data['data'] instanceof EE_Ticket ) {
68
+					return $this->_get_datetime_list_for_ticket();
69
+		} else if ( $this->_data['data'] instanceof EE_Event ) {
70
+					return $this->_get_datetime_list_for_event();
71
+		} else if ( $this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration ) {
73 72
 			return $this->_get_datetime_list_for_registration();
74 73
 		}
75 74
 
76 75
 		//prevent recursive loop
77
-		else
78
-			return '';
76
+		else {
77
+					return '';
78
+		}
79 79
 	}
80 80
 
81 81
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Email_Shortcodes.lib.php 2 patches
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
4 4
 	exit('NO direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -101,8 +102,9 @@  discard block
 block discarded – undo
101 102
 	private function _get_event_admin_emails( $fancy_headers = TRUE ) {
102 103
 
103 104
 		if ( !empty( $this->_data->admin_email ) ) {
104
-			if ( ! $fancy_headers )
105
-				return $this->_data->admin_email;
105
+			if ( ! $fancy_headers ) {
106
+							return $this->_data->admin_email;
107
+			}
106 108
 			return !empty( $this->_data->fname ) ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $this->_data->admin_email . '>';
107 109
 		}
108 110
 
@@ -142,7 +144,9 @@  discard block
 block discarded – undo
142 144
 
143 145
 		foreach ( $admin_details as $admin ) {
144 146
 			//only add an admin email if it is present.
145
-			if ( empty( $admin->email ) || $admin->email == '' ) continue;
147
+			if ( empty( $admin->email ) || $admin->email == '' ) {
148
+				continue;
149
+			}
146 150
 
147 151
 			if ( ! $fancy_headers ) {
148 152
 				$admin_email[] = $admin->email;
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 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
 /**
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
 		$this->description = __('All shortcodes related to emails', 'event_espresso');
44 44
 		$this->_shortcodes = array(
45 45
 			'[SITE_ADMIN_EMAIL]' => __('Will be replaced with the admin email for the site that Event Espresso is installed on', 'event_espresso'),
46
-			'[EVENT_AUTHOR_FORMATTED_EMAIL]' => __('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'),'<strong>','</strong>',
46
+			'[EVENT_AUTHOR_FORMATTED_EMAIL]' => __('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'), '<strong>', '</strong>',
47 47
 			'[EVENT_AUTHOR_EMAIL]' => __('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]',
48
-			'[CO_FORMATTED_EMAIL]' => __('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso' ),
48
+			'[CO_FORMATTED_EMAIL]' => __('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso'),
49 49
 			'[CO_EMAIL]' => __('This will parse to the email address only for the organization set in Your Organization Settings.', 'event_espresso'),
50
-			'[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => __('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso' ),
50
+			'[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => __('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso'),
51 51
 			'[ESPRESSO_ADMIN_EMAIL]' => __('This parses to the email address only for the organization set in Your Organization Settings page.', 'event_espresso')
52 52
 			);
53 53
 	}
54 54
 
55 55
 
56
-	protected function _parser( $shortcode ) {
56
+	protected function _parser($shortcode) {
57 57
 
58
-		switch ( $shortcode ) {
58
+		switch ($shortcode) {
59 59
 
60 60
 			case '[SITE_ADMIN_EMAIL]' :
61 61
 				return $this->_get_site_admin_email();
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
 				break;
67 67
 
68 68
 			case '[EVENT_AUTHOR_EMAIL]' :
69
-				return $this->_get_event_admin_emails( FALSE );
69
+				return $this->_get_event_admin_emails(FALSE);
70 70
 				break;
71 71
 
72 72
 			case '[CO_FORMATTED_EMAIL]' :
73 73
 			case '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' :
74
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) . '>';
74
+				return EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.EE_Registry::instance()->CFG->organization->get_pretty('email').'>';
75 75
 				break;
76 76
 
77 77
 			case '[CO_EMAIL]' :
78 78
 			case '[ESPRESSO_ADMIN_EMAIL]' :
79
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'email' );
79
+				return EE_Registry::instance()->CFG->organization->get_pretty('email');
80 80
 				break;
81 81
 
82 82
 			default :
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 
101
-	private function _get_event_admin_emails( $fancy_headers = TRUE ) {
101
+	private function _get_event_admin_emails($fancy_headers = TRUE) {
102 102
 
103
-		if ( !empty( $this->_data->admin_email ) ) {
104
-			if ( ! $fancy_headers )
103
+		if ( ! empty($this->_data->admin_email)) {
104
+			if ( ! $fancy_headers)
105 105
 				return $this->_data->admin_email;
106
-			return !empty( $this->_data->fname ) ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $this->_data->admin_email . '>';
106
+			return ! empty($this->_data->fname) ? $this->_data->fname.' '.$this->_data->lname.' <'.$this->_data->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$this->_data->admin_email.'>';
107 107
 		}
108 108
 
109 109
 		//k this shortcode has been used else where.  Since we don't know what particular event this is for, let's loop through the events and get an array of event admins for the events.  We'll return the formatted list of admin emails and let the messenger make sure we only pick one if this is for a field that can only have ONE!.
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 		$admin_email = array();
112 112
 
113 113
 		//loop through events and set the list of event_ids to retrieve so we can do ONE query.
114
-		foreach ( $this->_data->events as $event ) {
114
+		foreach ($this->_data->events as $event) {
115 115
 			$ids[] = $event['ID'];
116 116
 		}
117 117
 
118 118
 		//get all the events
119
-		$events = EE_Registry::instance()->load_model('Event')->get_all( array(array('EVT_ID' => array('IN', $ids ) ) ) );
119
+		$events = EE_Registry::instance()->load_model('Event')->get_all(array(array('EVT_ID' => array('IN', $ids))));
120 120
 
121 121
 		//now loop through each event and setup the details
122 122
 		$admin_details = array();
123 123
 		$cnt = 0;
124
-		foreach ( $events as $event ) {
125
-			$user = get_userdata($event->get('EVT_wp_user') );
124
+		foreach ($events as $event) {
125
+			$user = get_userdata($event->get('EVT_wp_user'));
126 126
 			$admin_details[$cnt] = new stdClass();
127 127
 			$admin_details[$cnt]->email = $user->user_email;
128 128
 			$admin_details[$cnt]->first_name = $user->user_firstname;
@@ -131,28 +131,28 @@  discard block
 block discarded – undo
131 131
 		}
132 132
 
133 133
 		//results?
134
-		if ( empty($admin_details) || !is_array($admin_details) ) {
134
+		if (empty($admin_details) || ! is_array($admin_details)) {
135 135
 			$msg[] = __('The admin details could not be retrieved from the database.', 'event_espresso');
136
-			$msg[] = sprintf( __('Query: %s', 'event_espresso'), $sql );
137
-			$msg[] = sprintf( __('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE) );
138
-			$msg[] = sprintf( __('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE) );
139
-			$msg[] = sprintf( __('Query Results: %s', 'event_espresso'), var_export($admin_details) );
140
-			do_action( 'AHEE_log', __FILE__, __FUNCTION__, implode( PHP_EOL, $msg ), 'shortcode_parser' );
136
+			$msg[] = sprintf(__('Query: %s', 'event_espresso'), $sql);
137
+			$msg[] = sprintf(__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE));
138
+			$msg[] = sprintf(__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE));
139
+			$msg[] = sprintf(__('Query Results: %s', 'event_espresso'), var_export($admin_details));
140
+			do_action('AHEE_log', __FILE__, __FUNCTION__, implode(PHP_EOL, $msg), 'shortcode_parser');
141 141
 		}
142 142
 
143
-		foreach ( $admin_details as $admin ) {
143
+		foreach ($admin_details as $admin) {
144 144
 			//only add an admin email if it is present.
145
-			if ( empty( $admin->email ) || $admin->email == '' ) continue;
145
+			if (empty($admin->email) || $admin->email == '') continue;
146 146
 
147
-			if ( ! $fancy_headers ) {
147
+			if ( ! $fancy_headers) {
148 148
 				$admin_email[] = $admin->email;
149 149
 				continue;
150 150
 			}
151 151
 
152
-			$admin_email[] = !empty( $admin->first_name ) ? $admin->first_name . ' ' . $admin->last_name . ' <' . $admin->email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $admin->email . '>';
152
+			$admin_email[] = ! empty($admin->first_name) ? $admin->first_name.' '.$admin->last_name.' <'.$admin->email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$admin->email.'>';
153 153
 		}
154 154
 
155
-		$admin_email = implode( ',', $admin_email );
155
+		$admin_email = implode(',', $admin_email);
156 156
 		return $admin_email;
157 157
 	}
158 158
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Event_Author_Shortcodes.lib.php 2 patches
Spacing   +22 added lines, -22 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
 /**
@@ -49,54 +49,54 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 
52
-	protected function _parser( $shortcode ) {
52
+	protected function _parser($shortcode) {
53 53
 		//make sure we end up with a copy of the EE_Messages_Addressee object
54 54
 		$recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
55
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient;
56
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
55
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient;
56
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
57 57
 
58 58
 		//now it's possible that $recipient is not an instance of EE_Messages_Addressee in which case we need to see if $this->_data is an instance of $event.
59 59
 		$event = $this->_data instanceof EE_Event ? $this->_data : NULL;
60 60
 
61
-		if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event )
61
+		if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event)
62 62
 			return '';
63 63
 
64
-		switch ( $shortcode ) {
64
+		switch ($shortcode) {
65 65
 			case '[EVENT_AUTHOR_FNAME]' :
66
-				$fname =  !empty( $recipient ) ? $recipient->fname : NULL;
67
-				if ( empty( $fname ) && !empty( $event ) ) {
68
-					$user = $this->_get_author_for_event( $event );
66
+				$fname = ! empty($recipient) ? $recipient->fname : NULL;
67
+				if (empty($fname) && ! empty($event)) {
68
+					$user = $this->_get_author_for_event($event);
69 69
 					$fname = $user->first_name;
70 70
 				}
71 71
 				return $fname;
72 72
 				break;
73 73
 
74 74
 			case '[EVENT_AUTHOR_LNAME]' :
75
-				$lname =  !empty( $recipient ) ? $recipient->lname : NULL;
76
-				if ( empty( $lname ) && !empty( $event ) ) {
77
-					$user = $this->_get_author_for_event( $event );
75
+				$lname = ! empty($recipient) ? $recipient->lname : NULL;
76
+				if (empty($lname) && ! empty($event)) {
77
+					$user = $this->_get_author_for_event($event);
78 78
 					$lname = $user->last_name;
79 79
 				}
80 80
 				return $lname;
81 81
 				break;
82 82
 
83 83
 			case '[EVENT_AUTHOR_FORMATTED_EMAIL]' :
84
-				if ( !empty( $recipient ) ) {
85
-					$email =  !empty( $recipient->fname ) ? $recipient->fname . ' ' . $recipient->lname . '<' . $recipient->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . '<' . $recipient->admin_email . '>';
84
+				if ( ! empty($recipient)) {
85
+					$email = ! empty($recipient->fname) ? $recipient->fname.' '.$recipient->lname.'<'.$recipient->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').'<'.$recipient->admin_email.'>';
86 86
 				} else {
87 87
 					$email = NULL;
88 88
 				}
89
-				if ( empty( $email ) && ! empty( $event ) ) {
90
-					$user = $this->_get_author_for_event( $event );
91
-					$email = ! empty( $user->first_name ) ? $user->first_name . ' ' . $user->last_name . '<' . $user->user_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . '<' . $user->user_email . '>';
89
+				if (empty($email) && ! empty($event)) {
90
+					$user = $this->_get_author_for_event($event);
91
+					$email = ! empty($user->first_name) ? $user->first_name.' '.$user->last_name.'<'.$user->user_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').'<'.$user->user_email.'>';
92 92
 				}
93 93
 				return $email;
94 94
 				break;
95 95
 
96 96
 			case '[EVENT_AUTHOR_EMAIL]' :
97
-				$email = ! empty( $recipient ) ? $recipient->admin_email : NULL;
98
-				if ( empty( $email ) && !empty( $event ) ) {
99
-					$user = $this->_get_author_for_event( $event );
97
+				$email = ! empty($recipient) ? $recipient->admin_email : NULL;
98
+				if (empty($email) && ! empty($event)) {
99
+					$user = $this->_get_author_for_event($event);
100 100
 					$email = $user->user_email;
101 101
 				}
102 102
 				return $email;
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 	 *
118 118
 	 * @return WP_User
119 119
 	 */
120
-	private function _get_author_for_event( EE_Event $event ) {
120
+	private function _get_author_for_event(EE_Event $event) {
121 121
 		$author_id = $event->wp_user();
122
-		$user_data = get_userdata( (int) $author_id );
122
+		$user_data = get_userdata((int) $author_id);
123 123
 		return $user_data;
124 124
 		break;
125 125
 	}
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
4 4
 	exit('NO direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -58,8 +59,9 @@  discard block
 block discarded – undo
58 59
 		//now it's possible that $recipient is not an instance of EE_Messages_Addressee in which case we need to see if $this->_data is an instance of $event.
59 60
 		$event = $this->_data instanceof EE_Event ? $this->_data : NULL;
60 61
 
61
-		if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event )
62
-			return '';
62
+		if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event ) {
63
+					return '';
64
+		}
63 65
 
64 66
 		switch ( $shortcode ) {
65 67
 			case '[EVENT_AUTHOR_FNAME]' :
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Event_List_Shortcodes.lib.php 2 patches
Spacing   +10 added lines, -10 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
 /**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 
49 49
 
50 50
 
51
-	protected function _parser( $shortcode ) {
52
-		switch ( $shortcode ) {
51
+	protected function _parser($shortcode) {
52
+		switch ($shortcode) {
53 53
 			case '[EVENT_LIST]' :
54 54
 				return $this->_get_event_list();
55 55
 				break;
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		$this->_set_shortcode_helper();
68 68
 
69 69
 
70
-		if ( $this->_data['data'] instanceof EE_Messages_Addressee )
70
+		if ($this->_data['data'] instanceof EE_Messages_Addressee)
71 71
 			return $this->_get_event_list_for_main();
72 72
 
73
-		else if ( $this->_data['data'] instanceof EE_Registration )
73
+		else if ($this->_data['data'] instanceof EE_Registration)
74 74
 			return $this->_get_event_list_for_registration();
75 75
 
76 76
 		//prevent recursive loop
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		$events = '';
92 92
 
93 93
 		//now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper.
94
-		foreach ( $data->events as $event ) {
94
+		foreach ($data->events as $event) {
95 95
 			$events .= $this->_shortcode_helper->parse_event_list_template($template, $event['event'], $valid_shortcodes, $this->_extra_data);
96 96
 		}
97 97
 		return $events;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	private function _get_event_list_for_registration() {
109 109
 		$valid_shortcodes = array('event', 'ticket_list', 'datetime_list', 'attendee', 'event_author', 'recipient_details', 'recipient_list', 'venue');
110
-		$template = is_array( $this->_data['template'] ) && isset($this->_data['template']['event_list']) ? $this->_data['template']['event_list'] : $this->_extra_data['template']['event_list'];
110
+		$template = is_array($this->_data['template']) && isset($this->_data['template']['event_list']) ? $this->_data['template']['event_list'] : $this->_extra_data['template']['event_list'];
111 111
 		$registration = $this->_data['data'];
112 112
 
113 113
 		//let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion.
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		//we're NOT going to prepare a list of attendees this time around
121 121
 		$events = '';
122 122
 
123
-		foreach ( (array) $all_events as $event ) {
123
+		foreach ((array) $all_events as $event) {
124 124
 			$events .= $this->_shortcode_helper->parse_event_list_template($template, $event, $valid_shortcodes, $this->_extra_data);
125 125
 		}
126 126
 
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 
130 130
 
131 131
 
132
-	private function _get_events_from_registration( EE_Registration $registration ) {
133
-		return isset( $this->_extra_data['data']->registrations ) ? array($this->_extra_data['data']->registrations[$registration->ID()]['evt_obj']) : array();
132
+	private function _get_events_from_registration(EE_Registration $registration) {
133
+		return isset($this->_extra_data['data']->registrations) ? array($this->_extra_data['data']->registrations[$registration->ID()]['evt_obj']) : array();
134 134
 	}
135 135
 
136 136
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
4 4
 	exit('NO direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -67,15 +68,16 @@  discard block
 block discarded – undo
67 68
 		$this->_set_shortcode_helper();
68 69
 
69 70
 
70
-		if ( $this->_data['data'] instanceof EE_Messages_Addressee )
71
-			return $this->_get_event_list_for_main();
72
-
73
-		else if ( $this->_data['data'] instanceof EE_Registration )
74
-			return $this->_get_event_list_for_registration();
71
+		if ( $this->_data['data'] instanceof EE_Messages_Addressee ) {
72
+					return $this->_get_event_list_for_main();
73
+		} else if ( $this->_data['data'] instanceof EE_Registration ) {
74
+					return $this->_get_event_list_for_registration();
75
+		}
75 76
 
76 77
 		//prevent recursive loop
77
-		else
78
-			return '';
78
+		else {
79
+					return '';
80
+		}
79 81
 	}
80 82
 
81 83
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Event_Meta_Shortcodes.lib.php 2 patches
Spacing   +5 added lines, -5 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
 /**
@@ -51,19 +51,19 @@  discard block
 block discarded – undo
51 51
 	 * @param  mixed (array|object) $data      incoming data object/array
52 52
 	 * @return string            parsed code.
53 53
 	 */
54
-	public function parser( $shortcode, $data, $extra_data = array() ) {
54
+	public function parser($shortcode, $data, $extra_data = array()) {
55 55
 		
56 56
 		//all shortcodes will be checked in the post_meta table (assuming the shortcode matches the post_meta key);
57
-		if ( empty( $this->_data['ID'] ) )
57
+		if (empty($this->_data['ID']))
58 58
 			return ''; //need the event id to do anything!
59 59
 
60 60
 		$meta = get_post_meta($this->_data['ID'], $shortcode, true);
61 61
 
62
-		return !empty( $meta ) ? $meta : '';
62
+		return ! empty($meta) ? $meta : '';
63 63
 	}
64 64
 
65 65
 
66
-	protected function _parser( $shortcode ) {}
66
+	protected function _parser($shortcode) {}
67 67
 
68 68
 
69 69
 } //end EE_Event_Meta_Shortcodes class
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
4 4
 	exit('NO direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -54,8 +55,10 @@  discard block
 block discarded – undo
54 55
 	public function parser( $shortcode, $data, $extra_data = array() ) {
55 56
 		
56 57
 		//all shortcodes will be checked in the post_meta table (assuming the shortcode matches the post_meta key);
57
-		if ( empty( $this->_data['ID'] ) )
58
-			return ''; //need the event id to do anything!
58
+		if ( empty( $this->_data['ID'] ) ) {
59
+					return '';
60
+		}
61
+		//need the event id to do anything!
59 62
 
60 63
 		$meta = get_post_meta($this->_data['ID'], $shortcode, true);
61 64
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Line_Item_List_Shortcodes.lib.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
10 10
 	exit('NO direct script access allowed');
11 11
 
12 12
 /**
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
 		$this->_shortcodes = array(
35 35
 			'[TICKET_LINE_ITEM_LIST]' => __('Outputs a list of ticket line items.', 'event_espresso'),
36 36
 			'[TAX_LINE_ITEM_LIST]' => __('Outputs a list of tax line items.', 'event_espresso'),
37
-			'[ADDITIONAL_LINE_ITEM_LIST]' => __( 'Outputs a list of additional line items (other charges or discounts)', 'event_espresso' ),
37
+			'[ADDITIONAL_LINE_ITEM_LIST]' => __('Outputs a list of additional line items (other charges or discounts)', 'event_espresso'),
38 38
 			'[PRICE_MODIFIER_LINE_ITEM_LIST]' => __('Outputs a list of price modifier line items', 'event_espresso')
39 39
 			);
40 40
 	}
41 41
 
42 42
 
43 43
 
44
-	protected function _parser( $shortcode ) {
44
+	protected function _parser($shortcode) {
45 45
 
46
-		switch ( $shortcode ) {
46
+		switch ($shortcode) {
47 47
 			case '[TICKET_LINE_ITEM_LIST]' :
48 48
 				return $this->_get_ticket_line_item_list();
49 49
 				break;
@@ -80,28 +80,28 @@  discard block
 block discarded – undo
80 80
 		$this->_validate_list_requirements();
81 81
 		$this->_set_shortcode_helper();
82 82
 
83
-		if ( ! $this->_data['data'] instanceof EE_Ticket ) {
83
+		if ( ! $this->_data['data'] instanceof EE_Ticket) {
84 84
 			return '';
85 85
 		}
86 86
 
87
-		$valid_shortcodes = array( 'line_item', 'line_item_list', 'ticket' );
87
+		$valid_shortcodes = array('line_item', 'line_item_list', 'ticket');
88 88
 
89 89
 		$ticket = $this->_data['data'];
90 90
 		$templates = $this->_extra_data['template'];
91 91
 		$addressee_obj = $this->_extra_data['data'];
92 92
 
93 93
 		//made it here so we have an EE_Ticket, so we should have what we need.
94
-		$ticket_line_item = isset( $addressee_obj->tickets[$ticket->ID()]['line_item'] ) ? $addressee_obj->tickets[$ticket->ID()]['line_item'] : null;
95
-		$sub_line_items = isset( $addressee_obj->tickets[$ticket->ID()]['sub_line_items'] ) ? $addressee_obj->tickets[$ticket->ID()]['sub_line_items'] : array();
94
+		$ticket_line_item = isset($addressee_obj->tickets[$ticket->ID()]['line_item']) ? $addressee_obj->tickets[$ticket->ID()]['line_item'] : null;
95
+		$sub_line_items = isset($addressee_obj->tickets[$ticket->ID()]['sub_line_items']) ? $addressee_obj->tickets[$ticket->ID()]['sub_line_items'] : array();
96 96
 
97
-		$template = count( $sub_line_items ) < 2 ? $templates['ticket_line_item_no_pms'] : $templates['ticket_line_item_pms'];
97
+		$template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms'] : $templates['ticket_line_item_pms'];
98 98
 
99
-		if ( empty( $ticket_line_item ) || empty( $sub_line_items ) ) {
99
+		if (empty($ticket_line_item) || empty($sub_line_items)) {
100 100
 			return '';
101 101
 		}
102 102
 
103 103
 		//now we just return the appropriate template parsed for each ticket.
104
-		return $this->_shortcode_helper->parse_line_item_list_template( $template, $ticket_line_item, $valid_shortcodes, $this->_extra_data );
104
+		return $this->_shortcode_helper->parse_line_item_list_template($template, $ticket_line_item, $valid_shortcodes, $this->_extra_data);
105 105
 	}
106 106
 
107 107
 
@@ -119,18 +119,18 @@  discard block
 block discarded – undo
119 119
 		$this->_validate_list_requirements();
120 120
 		$this->_set_shortcode_helper();
121 121
 
122
-		if ( ! $this->_data['data'] instanceof EE_Messages_Addressee ) {
122
+		if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) {
123 123
 			return '';
124 124
 		}
125 125
 
126 126
 		//made it here so we're good to go.
127
-		$valid_shortcodes = array( 'line_item' );
127
+		$valid_shortcodes = array('line_item');
128 128
 		$templates = $this->_data['template'];
129 129
 
130 130
 		$tax_line_items = $this->_data['data']->tax_line_items;
131 131
 		$line_item_list = '';
132
-		foreach ( $tax_line_items as $line_item ) {
133
-			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( $templates['tax_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data );
132
+		foreach ($tax_line_items as $line_item) {
133
+			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template($templates['tax_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data);
134 134
 		}
135 135
 
136 136
 		return $line_item_list;
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
 		$this->_validate_list_requirements();
149 149
 		$this->_set_shortcode_helper();
150 150
 
151
-		if ( ! $this->_data['data'] instanceof EE_Messages_Addressee ) {
151
+		if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) {
152 152
 			return '';
153 153
 		}
154 154
 
155 155
 		//made it here so we're good to go.
156
-		$valid_shortcodes = array( 'line_item' );
156
+		$valid_shortcodes = array('line_item');
157 157
 		$templates = $this->_data['template'];
158 158
 
159 159
 		$additional_line_items = $this->_data['data']->additional_line_items;
160 160
 		$line_item_list = '';
161
-		foreach ( $additional_line_items as $line_item ) {
162
-			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( $templates['additional_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data );
161
+		foreach ($additional_line_items as $line_item) {
162
+			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template($templates['additional_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data);
163 163
 		}
164 164
 
165 165
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		$this->_validate_list_requirements();
183 183
 		$this->_set_shortcode_helper();
184 184
 
185
-		if ( ! $this->_data['data'] instanceof EE_Line_Item ) {
185
+		if ( ! $this->_data['data'] instanceof EE_Line_Item) {
186 186
 			return '';
187 187
 		}
188 188
 
@@ -191,16 +191,16 @@  discard block
 block discarded – undo
191 191
 		$templates = $this->_extra_data['template'];
192 192
 		$addressee_obj = $this->_extra_data['data'];
193 193
 
194
-		$valid_shortcodes = array( 'line_item' );
194
+		$valid_shortcodes = array('line_item');
195 195
 
196 196
 		$main_line_item_id = $main_line_item->ID();
197 197
 
198
-		$price_mod_line_items = ! empty( $addressee_obj->line_items_with_children[$main_line_item_id]['children'] ) ? $addressee_obj->line_items_with_children[$main_line_item_id]['children'] : array();
198
+		$price_mod_line_items = ! empty($addressee_obj->line_items_with_children[$main_line_item_id]['children']) ? $addressee_obj->line_items_with_children[$main_line_item_id]['children'] : array();
199 199
 
200 200
 		$line_item_list = '';
201 201
 
202
-		foreach( $price_mod_line_items as $line_item ) {
203
-			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( $templates['price_modifier_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data  );
202
+		foreach ($price_mod_line_items as $line_item) {
203
+			$line_item_list .= $this->_shortcode_helper->parse_line_item_list_template($templates['price_modifier_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data);
204 204
 		}
205 205
 
206 206
 		return $line_item_list;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Line_Item_Shortcodes.lib.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
10 10
 	exit('NO direct script access allowed');
11 11
 
12 12
 /**
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
 			'[LINE_ITEM_NAME]' => __('Outputs the line item name.', 'event_espresso'),
35 35
 			'[LINE_ITEM_DESCRIPTION]' => __('Outputs a the description for the line item.', 'event_espresso'),
36 36
 			'[LINE_ITEM_QUANTITY]' => __('Outputs the quantity for this line item.', 'event_espresso'),
37
-			'[LINE_ITEM_AMOUNT]' => __('This will either output the unit price for a line item if its not a percent, or the percent of the line item (if it is percent).', 'event_espresso' ),
37
+			'[LINE_ITEM_AMOUNT]' => __('This will either output the unit price for a line item if its not a percent, or the percent of the line item (if it is percent).', 'event_espresso'),
38 38
 			'[LINE_ITEM_TOTAL]' => __('This outputs the line item total.', 'event_espresso'),
39
-			'[LINE_ITEM_TAXABLE_*]' => __('This attribute type shortcode allows users to indicate what to output if a line item is taxable or not.  One can use the key "symbol=" with the shortcode to indicate what they\'d like to represent a taxable line item.  So doing something like <code>[LINE_ITEM_TAXABLE_* symbol="*"]</code> means that when the line item is parsed, if it\'s taxable the "*" symbol will be returned.  The default symbol if no attribute is included is the "*" symbol.', 'event_espresso' )
39
+			'[LINE_ITEM_TAXABLE_*]' => __('This attribute type shortcode allows users to indicate what to output if a line item is taxable or not.  One can use the key "symbol=" with the shortcode to indicate what they\'d like to represent a taxable line item.  So doing something like <code>[LINE_ITEM_TAXABLE_* symbol="*"]</code> means that when the line item is parsed, if it\'s taxable the "*" symbol will be returned.  The default symbol if no attribute is included is the "*" symbol.', 'event_espresso')
40 40
 			);
41 41
 	}
42 42
 
43 43
 
44 44
 
45
-	protected function _parser( $shortcode ) {
45
+	protected function _parser($shortcode) {
46 46
 		//ensure that the incoming object IS a line item.  If it isn't then bail early.
47
-		if ( ! $this->_data instanceof EE_Line_Item ) {
47
+		if ( ! $this->_data instanceof EE_Line_Item) {
48 48
 			return '';
49 49
 		}
50 50
 
51 51
 		$line_item = $this->_data;
52 52
 
53
-		switch ( $shortcode ) {
53
+		switch ($shortcode) {
54 54
 			case '[LINE_ITEM_NAME]' :
55 55
 				return $line_item->name();
56 56
 				break;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				break;
65 65
 
66 66
 			case '[LINE_ITEM_AMOUNT]' :
67
-				return $line_item->is_percent() ? $line_item->percent() . '%' : $line_item->unit_price_no_code();
67
+				return $line_item->is_percent() ? $line_item->percent().'%' : $line_item->unit_price_no_code();
68 68
 				break;
69 69
 
70 70
 			case '[LINE_ITEM_TOTAL]' :
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 				break;
73 73
 		}
74 74
 
75
-		if ( strpos( $shortcode, '[LINE_ITEM_TAXABLE_*' ) !== FALSE ) {
76
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
77
-			if ( $line_item->is_taxable() ) {
78
-				return !empty( $attrs['symbol'] ) ? $attrs['symbol'] : '*';
75
+		if (strpos($shortcode, '[LINE_ITEM_TAXABLE_*') !== FALSE) {
76
+			$attrs = $this->_get_shortcode_attrs($shortcode);
77
+			if ($line_item->is_taxable()) {
78
+				return ! empty($attrs['symbol']) ? $attrs['symbol'] : '*';
79 79
 			}
80 80
 		}
81 81
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Messenger_Shortcodes.lib.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage shortcodes library
8 8
  */
9
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10
+	exit('No direct script access allowed');
11
+}
10 12
 /**
11 13
  * EE_Messenger_Shortcodes
12 14
  *
@@ -69,8 +71,9 @@  discard block
 block discarded – undo
69 71
 		$recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient;
70 72
 		$recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
71 73
 
72
-		if ( ! $recipient instanceof EE_Messages_Addressee )
73
-			return '';
74
+		if ( ! $recipient instanceof EE_Messages_Addressee ) {
75
+					return '';
76
+		}
74 77
 
75 78
 		switch ( $shortcode ) {
76 79
 			case '[DISPLAY_HTML_URL]' :
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
 		$this->label = __('Messenger Shortcodes', 'event_espresso');
42 42
 		$this->description = __('All shortcodes that are messenger specific.', 'event_espresso');
43 43
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
44
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
44
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
45 45
 		//add messages about what happens  when the messenger is active.
46 46
 		$this->_active_messengers = $message_resource_manager->active_messengers();
47 47
 
48
-		$this->_shortcodes['[DISPLAY_HTML_URL]'] =__('This will return a link to view the template in a browser if the html messenger is active.', 'event_espresso');
49
-		$this->_shortcodes['[DISPLAY_PDF_URL]'] = __('This will return a link to generate a pdf for the template if the pdf messenger is active.', 'event_espresso' );
48
+		$this->_shortcodes['[DISPLAY_HTML_URL]'] = __('This will return a link to view the template in a browser if the html messenger is active.', 'event_espresso');
49
+		$this->_shortcodes['[DISPLAY_PDF_URL]'] = __('This will return a link to generate a pdf for the template if the pdf messenger is active.', 'event_espresso');
50 50
 		$this->_shortcodes['[DISPLAY_PDF_BUTTON]'] = __('This will return html for a download pdf button trigger if the pdf messenger is active.', 'event_espresso');
51 51
 
52 52
 		//show error message about buttons/urls not working as expected if messenger deactivated.
53
-		if ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'update_message_template' ) {
54
-			if ( ! isset( $this->_active_messengers['pdf'] ) ) {
55
-				EE_Error::add_attention( __('Be aware that the pdf messenger is inactive.  This means that any pdf related shortcodes will parse to an empty string.', 'event_espresso' ) );
53
+		if (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'update_message_template') {
54
+			if ( ! isset($this->_active_messengers['pdf'])) {
55
+				EE_Error::add_attention(__('Be aware that the pdf messenger is inactive.  This means that any pdf related shortcodes will parse to an empty string.', 'event_espresso'));
56 56
 			}
57 57
 
58
-			if ( !isset( $this->_active_messengers['html'] ) ) {
59
-				EE_Error::add_attention( __('Be aware that the html messenger is inactive. This means that any html related shortcodes will parse to an empty string.', 'event_espresso' ) );
58
+			if ( ! isset($this->_active_messengers['html'])) {
59
+				EE_Error::add_attention(__('Be aware that the html messenger is inactive. This means that any html related shortcodes will parse to an empty string.', 'event_espresso'));
60 60
 			}
61 61
 		}
62 62
 
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
 
65 65
 
66 66
 
67
-	protected function _parser( $shortcode ) {
67
+	protected function _parser($shortcode) {
68 68
 		//make sure we end up with a copy of the EE_Messages_Addressee object
69 69
 		$recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
70
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient;
71
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
70
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $recipient;
71
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $recipient;
72 72
 
73
-		if ( ! $recipient instanceof EE_Messages_Addressee )
73
+		if ( ! $recipient instanceof EE_Messages_Addressee)
74 74
 			return '';
75 75
 
76
-		switch ( $shortcode ) {
76
+		switch ($shortcode) {
77 77
 			case '[DISPLAY_HTML_URL]' :
78
-				return  isset( $this->_active_messengers['html'] ) ? $this->_get_url( $recipient, 'html' ) : '';
78
+				return  isset($this->_active_messengers['html']) ? $this->_get_url($recipient, 'html') : '';
79 79
 				break;
80 80
 			case '[DISPLAY_PDF_URL]' :
81
-				return  isset( $this->_active_messengers['pdf'] ) ? $this->_get_url( $recipient, 'pdf' ) : '';
81
+				return  isset($this->_active_messengers['pdf']) ? $this->_get_url($recipient, 'pdf') : '';
82 82
 				break;
83 83
 			case '[DISPLAY_PDF_BUTTON]' :
84
-				return  isset( $this->_active_messengers['pdf'] ) ? $this->_get_button( $recipient, 'pdf' ) : '';
84
+				return  isset($this->_active_messengers['pdf']) ? $this->_get_button($recipient, 'pdf') : '';
85 85
 				break;
86 86
 		}
87 87
 		return '';
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return string                Generated html
101 101
 	 */
102
-	private function _get_button( EE_Messages_Addressee $recipient, $sending_messenger ) {
103
-		$download_text = $sending_messenger == 'pdf' ? __('Download PDF', 'event_espresso') : __('Show HTML', 'event_espresso' );
102
+	private function _get_button(EE_Messages_Addressee $recipient, $sending_messenger) {
103
+		$download_text = $sending_messenger == 'pdf' ? __('Download PDF', 'event_espresso') : __('Show HTML', 'event_espresso');
104 104
 		$content = '
105
-<form method="post" action="' . $this->_get_url( $recipient, $sending_messenger ) . '" >
106
-	<input class="print_button" type="submit" value="' . $download_text . '" />
105
+<form method="post" action="' . $this->_get_url($recipient, $sending_messenger).'" >
106
+	<input class="print_button" type="submit" value="' . $download_text.'" />
107 107
 </form>
108 108
 		';
109 109
 		return $content;
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
 	 * @return string The generated url for displaying the link.
123 123
 	 * @throws EE_Error
124 124
 	 */
125
-	private function _get_url( EE_Messages_Addressee $recipient, $sending_messenger ) {
125
+	private function _get_url(EE_Messages_Addressee $recipient, $sending_messenger) {
126 126
 
127 127
 		$reg = $recipient->reg_obj;
128 128
 		$reg = ! $reg instanceof EE_Registration ? $recipient->primary_reg_obj : $reg;
129 129
 
130 130
 
131
-		if ( $this->_message_type instanceof EE_message_type && $this->_message instanceof EE_Message ) {
132
-			EE_Registry::instance()->load_helper( 'MSG_Template' );
131
+		if ($this->_message_type instanceof EE_message_type && $this->_message instanceof EE_Message) {
132
+			EE_Registry::instance()->load_helper('MSG_Template');
133 133
 			try {
134
-				return EEH_MSG_Template::get_url_trigger( $this->_message_type, $this->_message, $reg, $sending_messenger );
135
-			} catch( EE_Error $e ) {
136
-				if ( WP_DEBUG ) {
134
+				return EEH_MSG_Template::get_url_trigger($this->_message_type, $this->_message, $reg, $sending_messenger);
135
+			} catch (EE_Error $e) {
136
+				if (WP_DEBUG) {
137 137
 					$e->get_error();
138 138
 				}
139 139
 			}
Please login to merge, or discard this patch.