Completed
Branch BUG-9680-compress-dompdf-files... (43e183)
by
unknown
67:53 queued 55:02
created
strategies/validation/EE_Many_Valued_Validation_Strategy.strategy.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 	/**
28 28
 	 * Applies all teh individual item validation strategies on each item in the array
29 29
 	 * @param array $normalized_value
30
-	 * @return boolean
30
+	 * @return boolean|null
31 31
 	 */
32 32
 	function validate($normalized_value) {
33 33
 		if( is_array($normalized_value)){
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
  * @since 				4.6
12 12
  *
13 13
  */
14
-class EE_Many_Valued_Validation_Strategy extends EE_Validation_Strategy_Base{
14
+class EE_Many_Valued_Validation_Strategy extends EE_Validation_Strategy_Base {
15 15
 	protected $_individual_item_validation_strategies = array();
16 16
 	/**
17 17
 	 *
18 18
 	 * @param EE_Validation_Strategy_Base[] $individual_item_validation_strategies (or a single EE_Validation_Strategy_Base)
19 19
 	 */
20 20
 	public function __construct($individual_item_validation_strategies) {
21
-		if( ! is_array($individual_item_validation_strategies)){
21
+		if ( ! is_array($individual_item_validation_strategies)) {
22 22
 			$individual_item_validation_strategies = array($individual_item_validation_strategies);
23 23
 		}
24 24
 		$this->_individual_item_validation_strategies = $individual_item_validation_strategies;
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 	 * @return boolean
31 31
 	 */
32 32
 	function validate($normalized_value) {
33
-		if( is_array($normalized_value)){
33
+		if (is_array($normalized_value)) {
34 34
 			$items_to_validate = $normalized_value;
35
-		}else{
35
+		} else {
36 36
 			$items_to_validate = array($normalized_value);
37 37
 		}
38
-		foreach($items_to_validate as $individual_item){
39
-			foreach($this->_individual_item_validation_strategies as $validation_strategy){
40
-				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
38
+		foreach ($items_to_validate as $individual_item) {
39
+			foreach ($this->_individual_item_validation_strategies as $validation_strategy) {
40
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
41 41
 					$validation_strategy->validate($individual_item);
42 42
 				}
43 43
 			}
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	function _construct_finalize(\EE_Form_Input_Base $form_input) {
52 52
 		parent::_construct_finalize($form_input);
53
-		foreach($this->_individual_item_validation_strategies as $item_validation_strategy){
54
-			if ( $item_validation_strategy instanceof EE_Validation_Strategy_Base ) {
53
+		foreach ($this->_individual_item_validation_strategies as $item_validation_strategy) {
54
+			if ($item_validation_strategy instanceof EE_Validation_Strategy_Base) {
55 55
 				$item_validation_strategy->_construct_finalize($form_input);
56 56
 			}
57 57
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 	function validate($normalized_value) {
33 33
 		if( is_array($normalized_value)){
34 34
 			$items_to_validate = $normalized_value;
35
-		}else{
35
+		} else{
36 36
 			$items_to_validate = array($normalized_value);
37 37
 		}
38 38
 		foreach($items_to_validate as $individual_item){
Please login to merge, or discard this patch.
form_sections/strategies/validation/EE_URL_Validation_Strategy.strategy.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 	 * just checks the field isn't blank
27 27
 	 *
28 28
 	 * @param $normalized_value
29
-	 * @return bool
29
+	 * @return boolean|null
30 30
 	 * @throws \EE_Validation_Error
31 31
 	 */
32 32
 	function validate($normalized_value) {
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -8,16 +8,16 @@  discard block
 block discarded – undo
8 8
  * @since 				4.6
9 9
  *
10 10
  */
11
-class EE_URL_Validation_Strategy extends EE_Validation_Strategy_Base{
11
+class EE_URL_Validation_Strategy extends EE_Validation_Strategy_Base {
12 12
 
13 13
 	/**
14 14
 	 * @param null $validation_error_message
15 15
 	 */
16
-	public function __construct( $validation_error_message = NULL ) {
17
-		if( ! $validation_error_message ){
16
+	public function __construct($validation_error_message = NULL) {
17
+		if ( ! $validation_error_message) {
18 18
 			$validation_error_message = __("Please enter a valid URL. Eg https://eventespresso.com", "event_espresso");
19 19
 		}
20
-		parent::__construct( $validation_error_message );
20
+		parent::__construct($validation_error_message);
21 21
 	}
22 22
 
23 23
 
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	 * @throws \EE_Validation_Error
31 31
 	 */
32 32
 	function validate($normalized_value) {
33
-		if( $normalized_value ){
34
-			if (filter_var($normalized_value, FILTER_VALIDATE_URL) === false){
35
-				throw new EE_Validation_Error( $this->get_validation_error_message(), 'invalid_url');
36
-			}else{
37
-				if( ! EEH_URL::remote_file_exists(
33
+		if ($normalized_value) {
34
+			if (filter_var($normalized_value, FILTER_VALIDATE_URL) === false) {
35
+				throw new EE_Validation_Error($this->get_validation_error_message(), 'invalid_url');
36
+			} else {
37
+				if ( ! EEH_URL::remote_file_exists(
38 38
 						$normalized_value,
39 39
 						array(
40 40
 							'sslverify' => false, 
41
-							'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
42
-						))){
41
+							'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
42
+						))) {
43 43
 					throw new EE_Validation_Error(sprintf(__("That URL seems to be broken. Please enter a valid URL", "event_espresso")));
44 44
 				}
45 45
 			}
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	/**
52 52
 	 * @return array
53 53
 	 */
54
-	function get_jquery_validation_rule_array(){
55
-		return array( 'validUrl'=>true, 'messages' => array( 'validUrl' => $this->get_validation_error_message() ) );
54
+	function get_jquery_validation_rule_array() {
55
+		return array('validUrl'=>true, 'messages' => array('validUrl' => $this->get_validation_error_message()));
56 56
 	}
57 57
 }
58 58
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 		if( $normalized_value ){
34 34
 			if (filter_var($normalized_value, FILTER_VALIDATE_URL) === false){
35 35
 				throw new EE_Validation_Error( $this->get_validation_error_message(), 'invalid_url');
36
-			}else{
36
+			} else{
37 37
 				if( ! EEH_URL::remote_file_exists(
38 38
 						$normalized_value,
39 39
 						array(
Please login to merge, or discard this patch.
line_item_display/EE_Admin_Table_Line_Item_Display_Strategy.strategy.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * This is used to output a single
48 48
 	 * @param EE_Line_Item $line_item
49 49
 	 * @param array        $options
50
-	 * @return mixed
50
+	 * @return string
51 51
 	 */
52 52
 	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
53 53
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @param EE_Line_Item $line_item
165 165
 	 * @param array        $options
166
-	 * @return mixed
166
+	 * @return string
167 167
 	 */
168 168
 	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
169 169
 		$line_item_related_object = $line_item->get_object();
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 *
230 230
 	 * @param EE_Line_Item $line_item
231 231
 	 * @param array        $options
232
-	 * @return mixed
232
+	 * @return string
233 233
 	 */
234 234
 	protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
235 235
 		//for now we're not showing sub-items
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @param EE_Line_Item $line_item
245 245
 	 * @param array        $options
246
-	 * @return mixed
246
+	 * @return string
247 247
 	 */
248 248
 	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
249 249
 		// start of row
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 * @param EE_Line_Item $line_item
267 267
 	 * @param string       $text
268 268
 	 * @param array        $options
269
-	 * @return mixed
269
+	 * @return string
270 270
 	 */
271 271
 	protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
272 272
 		//currently not showing subtotal row
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @param EE_Line_Item $line_item
282 282
 	 * @param array        $options
283
-	 * @return mixed
283
+	 * @return string
284 284
 	 */
285 285
 	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
286 286
 		// start of row
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param array        $options
50 50
 	 * @return mixed
51 51
 	 */
52
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
52
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
53 53
 
54 54
 		$html = '';
55 55
 		// set some default options and merge with incoming
@@ -60,40 +60,40 @@  discard block
 block discarded – undo
60 60
 			'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr',
61 61
 			'total_tr_css_class' => 'admin-primary-mbox-total-tr'
62 62
 		);
63
-		$options = array_merge( $default_options, (array)$options );
63
+		$options = array_merge($default_options, (array) $options);
64 64
 
65
-		switch( $line_item->type() ) {
65
+		switch ($line_item->type()) {
66 66
 
67 67
 			case EEM_Line_Item::type_line_item:
68 68
 				// item row
69
-				$html .= $this->_item_row( $line_item, $options );
69
+				$html .= $this->_item_row($line_item, $options);
70 70
 				break;
71 71
 
72 72
 			case EEM_Line_Item::type_sub_line_item:
73
-				$html .= $this->_sub_item_row( $line_item, $options );
73
+				$html .= $this->_sub_item_row($line_item, $options);
74 74
 				break;
75 75
 
76 76
 			case EEM_Line_Item::type_sub_total:
77 77
 				//loop through children
78 78
 				$child_line_items = $line_item->children();
79 79
 				//loop through children
80
-				foreach ( $child_line_items as $child_line_item ) {
80
+				foreach ($child_line_items as $child_line_item) {
81 81
 					//recursively feed children back into this method
82
-					$html .= $this->display_line_item( $child_line_item, $options );
82
+					$html .= $this->display_line_item($child_line_item, $options);
83 83
 				}
84
-				$html .= $this->_sub_total_row( $line_item, $options );
84
+				$html .= $this->_sub_total_row($line_item, $options);
85 85
 				break;
86 86
 
87 87
 			case EEM_Line_Item::type_tax:
88
-				if ( $this->_show_taxes ) {
89
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
88
+				if ($this->_show_taxes) {
89
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
90 90
 				}
91 91
 				break;
92 92
 
93 93
 			case EEM_Line_Item::type_tax_sub_total:
94
-				foreach( $line_item->children() as $child_line_item ) {
95
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax ) {
96
-						$this->display_line_item( $child_line_item, $options );
94
+				foreach ($line_item->children() as $child_line_item) {
95
+					if ($child_line_item->type() == EEM_Line_Item::type_tax) {
96
+						$this->display_line_item($child_line_item, $options);
97 97
 					}
98 98
 				}
99 99
 				break;
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 				$children = $line_item->children();
106 106
 
107 107
 				// loop thru all non-tax child line items
108
-				foreach( $children as $child_line_item ) {
109
-						$html .= $this->display_line_item( $child_line_item, $options );
108
+				foreach ($children as $child_line_item) {
109
+						$html .= $this->display_line_item($child_line_item, $options);
110 110
 				}
111 111
 
112 112
 				$html .= $this->_taxes_html;
113
-				$html .= $this->_total_row( $line_item, $options );
114
-				if ( $options['use_table_wrapper'] ) {
115
-					$html = $this->_table_header( $options ) . $html . $this->_table_footer( $options );
113
+				$html .= $this->_total_row($line_item, $options);
114
+				if ($options['use_table_wrapper']) {
115
+					$html = $this->_table_header($options).$html.$this->_table_footer($options);
116 116
 				}
117 117
 				break;
118 118
 
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 * @param array $options
130 130
 	 * @return string
131 131
 	 */
132
-	protected function _table_header( $options ) {
133
-		$html = EEH_HTML::table( '','', $options['table_css_class'] );
132
+	protected function _table_header($options) {
133
+		$html = EEH_HTML::table('', '', $options['table_css_class']);
134 134
 		$html .= EEH_HTML::thead();
135 135
 		$html .= EEH_HTML::tr();
136
-		$html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' );
137
-		$html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' );
138
-		$html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' );
139
-		$html .= EEH_HTML::th( __( 'Qty', 'event_espresso' ), '', 'jst-cntr' );
140
-		$html .= EEH_HTML::th( __( 'Line Total', 'event_espresso'), '', 'jst-cntr' );
136
+		$html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
137
+		$html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
138
+		$html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
139
+		$html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr');
140
+		$html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr');
141 141
 		$html .= EEH_HTML::tbody();
142 142
 		return $html;
143 143
 	}
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param array $options array of options for the table.
150 150
 	 * @return string
151 151
 	 */
152
-	protected function _table_footer( $options ) {
153
-		return EEH_HTML::tbodyx() .  EEH_HTML::tablex();
152
+	protected function _table_footer($options) {
153
+		return EEH_HTML::tbodyx().EEH_HTML::tablex();
154 154
 	}
155 155
 
156 156
 
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 	 * @param array        $options
163 163
 	 * @return mixed
164 164
 	 */
165
-	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
165
+	protected function _item_row(EE_Line_Item $line_item, $options = array()) {
166 166
 		$line_item_related_object = $line_item->get_object();
167 167
 		$parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null;
168 168
 		// start of row
169 169
 		$row_class = $options['odd'] ? 'item odd' : 'item';
170
-		$html = EEH_HTML::tr( '', '', $row_class );
170
+		$html = EEH_HTML::tr('', '', $row_class);
171 171
 
172 172
 
173 173
 		//Name Column
@@ -175,44 +175,44 @@  discard block
 block discarded – undo
175 175
 
176 176
 		//related object scope.
177 177
 		$parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : '';
178
-		$parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
178
+		$parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
179 179
 		$parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : '';
180 180
 
181 181
 
182 182
 		$name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name();
183
-		$name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;
183
+		$name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html;
184 184
 		$name_html .= $line_item->is_taxable() ? ' *' : '';
185 185
 		//maybe preface with icon?
186
-		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html;
187
-		$name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
188
-		$name_html .=  sprintf(
189
-			_x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
186
+		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html;
187
+		$name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';
188
+		$name_html .= sprintf(
189
+			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
190 190
 			'<span class="ee-line-item-related-parent-object">',
191
-			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __( 'Item:', 'event_espresso' ),
192
-			$parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name,
191
+			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'),
192
+			$parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name,
193 193
 			'</span>'
194 194
 		);
195
-		$html .= EEH_HTML::td( $name_html, '', 'jst-left' );
195
+		$html .= EEH_HTML::td($name_html, '', 'jst-left');
196 196
 
197 197
 		//Type Column
198
-		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . '<br />' : '';
198
+		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n().'<br />' : '';
199 199
 		$code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
200
-		$type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : '';
201
-		$html .= EEH_HTML::td( $type_html, '', 'jst-left' );
200
+		$type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : '';
201
+		$html .= EEH_HTML::td($type_html, '', 'jst-left');
202 202
 
203 203
 
204 204
 		//Amount Column
205
-		if ( $line_item->is_percent() ) {
206
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' );
205
+		if ($line_item->is_percent()) {
206
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght');
207 207
 		} else {
208
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' );
208
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
209 209
 		}
210 210
 
211 211
 		//QTY column
212
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'jst-rght' );
212
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght');
213 213
 
214 214
 		//total column
215
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
215
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
216 216
 
217 217
 		//finish things off and return
218 218
 		$html .= EEH_HTML::trx();
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 * @param array        $options
229 229
 	 * @return mixed
230 230
 	 */
231
-	protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
231
+	protected function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
232 232
 		//for now we're not showing sub-items
233 233
 		return '';
234 234
 	}
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
 	 * @param array        $options
243 243
 	 * @return mixed
244 244
 	 */
245
-	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
245
+	protected function _tax_row(EE_Line_Item $line_item, $options = array()) {
246 246
 		// start of row
247
-		$html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' );
247
+		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
248 248
 		// name th
249
-		$html .= EEH_HTML::th(  $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '',  'jst-rght', '', ' colspan="4"' );
249
+		$html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="4"');
250 250
 		// total th
251
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
251
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
252 252
 		// end of row
253 253
 		$html .= EEH_HTML::trx();
254 254
 		return $html;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 * @param array        $options
266 266
 	 * @return mixed
267 267
 	 */
268
-	protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
268
+	protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
269 269
 		//currently not showing subtotal row
270 270
 		return '';
271 271
 	}
@@ -279,15 +279,15 @@  discard block
 block discarded – undo
279 279
 	 * @param array        $options
280 280
 	 * @return mixed
281 281
 	 */
282
-	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
282
+	protected function _total_row(EE_Line_Item $line_item, $options = array()) {
283 283
 		// start of row
284
-		$html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' );
284
+		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
285 285
 		// Total th label
286
-		$total_label = sprintf( __( 'Transaction Total %s', 'event_espresso' ),  '(' . EE_Registry::instance()->CFG->currency->code . ')' );
287
-		$html .= EEH_HTML::th( $total_label, '',  'jst-rght',  '',  ' colspan="4"' );
286
+		$total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
287
+		$html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');
288 288
 		// total th
289 289
 
290
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'jst-rght' );
290
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
291 291
 		// end of row
292 292
 		$html .= EEH_HTML::trx();
293 293
 		return $html;
Please login to merge, or discard this patch.
line_item_display/EE_Receipt_Line_Item_Display_Strategy.strategy.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	/**
32 32
 	 * @param EE_Line_Item $line_item
33 33
 	 * @param array        $options
34
-	 * @return mixed
34
+	 * @return string
35 35
 	 */
36 36
 	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
37 37
 
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,17 +14,17 @@
 block discarded – undo
14 14
  * ------------------------------------------------------------------------
15 15
  */
16 16
  /**
17
- *
18
- * Class EE_Receipt_Line_Item_Display_Strategy
19
- *
20
- * Description
21
- *
22
- * @package         Event Espresso
23
- * @subpackage    core
24
- * @author				Brent Christensen
25
- * @since		 	   $VID:$
26
- *
27
- */
17
+  *
18
+  * Class EE_Receipt_Line_Item_Display_Strategy
19
+  *
20
+  * Description
21
+  *
22
+  * @package         Event Espresso
23
+  * @subpackage    core
24
+  * @author				Brent Christensen
25
+  * @since		 	   $VID:$
26
+  *
27
+  */
28 28
 
29 29
 class EE_Receipt_Line_Item_Display_Strategy  implements EEI_Line_Item_Display {
30 30
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @param array        $options
34 34
 	 * @return mixed
35 35
 	 */
36
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
36
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
37 37
 
38 38
 		$html = '';
39 39
 		// set some default options and merge with incoming
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 			'show_desc' => TRUE,
42 42
 			'odd' => FALSE
43 43
 		);
44
-		$options = array_merge( $default_options, (array)$options );
45
-		switch( $line_item->type() ) {
44
+		$options = array_merge($default_options, (array) $options);
45
+		switch ($line_item->type()) {
46 46
 
47 47
 			case EEM_Line_Item::type_total:
48 48
 				// loop thru children
49
-				foreach( $line_item->children() as $child_line_item ) {
49
+				foreach ($line_item->children() as $child_line_item) {
50 50
 					// recursively feed children back into this method
51 51
 //					$html .= $this->display_line_item( $child_line_item, $options );
52 52
 				}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 			case EEM_Line_Item::type_sub_total:
59 59
 				// loop thru children
60
-				foreach( $line_item->children() as $child_line_item ) {
60
+				foreach ($line_item->children() as $child_line_item) {
61 61
 					// recursively feed children back into this method
62 62
 //					$html .= $this->display_line_item( $child_line_item, $options );
63 63
 				}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 			case EEM_Line_Item::type_tax_sub_total:
69 69
 				// loop thru children
70
-				foreach( $line_item->children() as $child_line_item ) {
70
+				foreach ($line_item->children() as $child_line_item) {
71 71
 					// recursively feed children back into this method
72 72
 //					$html .= $this->display_line_item( $child_line_item, $options );
73 73
 				}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 				// item row
80 80
 //				$html .= $this->_item_row( $line_item, $options );
81 81
 				// got any kids?
82
-				foreach( $line_item->children() as $child_line_item ) {
82
+				foreach ($line_item->children() as $child_line_item) {
83 83
 //					$this->display_line_item( $child_line_item, $options );
84 84
 				}
85 85
 				break;
Please login to merge, or discard this patch.
core/libraries/messages/messenger/EE_Pdf_messenger.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -332,7 +332,7 @@
 block discarded – undo
332 332
 
333 333
 
334 334
 	/**
335
-	 * @return string
335
+	 * @return boolean|null
336 336
 	 */
337 337
 	protected function _preview() { return $this->_send_message(); }
338 338
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 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
 /**
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @subpackage		messages
21 21
  * @author			Darren Ethier
22 22
  */
23
-class EE_Pdf_messenger extends EE_messenger  {
23
+class EE_Pdf_messenger extends EE_messenger {
24 24
 
25 25
 
26 26
 	/**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @see abstract declaration in EE_messenger for details.
66 66
 	 */
67 67
 	protected function _set_admin_pages() {
68
-		$this->admin_registered_pages = array( 'events_edit' => false );
68
+		$this->admin_registered_pages = array('events_edit' => false);
69 69
 	}
70 70
 
71 71
 
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 	protected function _set_validator_config() {
86 86
 		$this->_validator_config = array(
87 87
 			'subject' => array(
88
-				'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email','event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime')
88
+				'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime')
89 89
 				),
90 90
 			'content' => array(
91
-				'shortcodes' => array( 'recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email','event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime')
91
+				'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime')
92 92
 				),
93 93
 			'attendee_list' => array(
94 94
 				'shortcodes' => array('attendee', 'event_list', 'ticket_list'),
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				'required' => array('[EVENT_LIST]')
100 100
 				),
101 101
 			'ticket_list' => array(
102
-				'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list','primary_registration_details', 'recipient_details'),
102
+				'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'),
103 103
 				'required' => array('[TICKET_LIST]')
104 104
 				),
105 105
 			'datetime_list' => array(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public  function enqueue_scripts_styles() {
121 121
 		parent::enqueue_scripts_styles();
122
-		do_action( 'AHEE__EE_Pdf_messenger__enqueue_scripts_styles');
122
+		do_action('AHEE__EE_Pdf_messenger__enqueue_scripts_styles');
123 123
 	}
124 124
 
125 125
 
@@ -245,18 +245,18 @@  discard block
 block discarded – undo
245 245
 	 */
246 246
 	protected function _send_message() {
247 247
 		$this->_template_args = array(
248
-			'page_title' => html_entity_decode( stripslashes( $this->_subject ), ENT_QUOTES, "UTF-8"),
249
-			'base_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'base', $this->_variation ),
250
-			'print_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'print', $this->_variation ),
251
-			'main_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'main', $this->_variation ),
252
-			'extra_css' => EE_LIBRARIES_URL . 'messages/defaults/default/variations/pdf_base_default.css',
253
-			'main_body' => apply_filters( 'FHEE__EE_Pdf_messenger___send_message__main_body', wpautop(stripslashes_deep( html_entity_decode($this->_content,  ENT_QUOTES,"UTF-8" ) )), $this->_content )
248
+			'page_title' => html_entity_decode(stripslashes($this->_subject), ENT_QUOTES, "UTF-8"),
249
+			'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'base', $this->_variation),
250
+			'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'print', $this->_variation),
251
+			'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'main', $this->_variation),
252
+			'extra_css' => EE_LIBRARIES_URL.'messages/defaults/default/variations/pdf_base_default.css',
253
+			'main_body' => apply_filters('FHEE__EE_Pdf_messenger___send_message__main_body', wpautop(stripslashes_deep(html_entity_decode($this->_content, ENT_QUOTES, "UTF-8"))), $this->_content)
254 254
 			);
255 255
 		$this->_deregister_wp_hooks();
256
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) );
256
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
257 257
 		$content = $this->_get_main_template();
258 258
 //		die( $content );
259
-		$this->_do_pdf( $content );
259
+		$this->_do_pdf($content);
260 260
 		exit(0);
261 261
 	}
262 262
 
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 
281 281
 		//just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load.
282 282
 		add_action('wp_head', 'wp_enqueue_scripts');
283
-		add_action( 'wp_footer', 'wp_print_footer_scripts' );
284
-		add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
283
+		add_action('wp_footer', 'wp_print_footer_scripts');
284
+		add_action('wp_print_footer_scripts', '_wp_footer_scripts');
285 285
 	}
286 286
 
287 287
 
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
 	 * @param bool $preview
295 295
 	 * @return string
296 296
 	 */
297
-	protected function _get_main_template( $preview = FALSE ) {
298
-		$wrapper_template = $this->_tmp_pack->get_wrapper( 'html', 'main' );
297
+	protected function _get_main_template($preview = FALSE) {
298
+		$wrapper_template = $this->_tmp_pack->get_wrapper('html', 'main');
299 299
 		//add message type to template_args
300 300
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
301
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE );
301
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE);
302 302
 	}
303 303
 
304 304
 
@@ -311,21 +311,21 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @return void
313 313
 	 */
314
-	protected function _do_pdf( $content = '' ) {
315
-		$invoice_name = html_entity_decode( $this->_subject, ENT_QUOTES, "UTF-8");
314
+	protected function _do_pdf($content = '') {
315
+		$invoice_name = html_entity_decode($this->_subject, ENT_QUOTES, "UTF-8");
316 316
 
317 317
 		//only load dompdf if nobody else has yet...
318
-		if( ! defined('DOMPDF_DIR')){
318
+		if ( ! defined('DOMPDF_DIR')) {
319 319
 			define('DOMPDF_ENABLE_REMOTE', TRUE);
320 320
 			define('DOMPDF_ENABLE_JAVASCRIPT', FALSE);
321 321
 			define('DOMPDF_ENABLE_CSS_FLOAT', TRUE);
322
-			require_once(EE_THIRD_PARTY . 'dompdf/dompdf_config.inc.php');
322
+			require_once(EE_THIRD_PARTY.'dompdf/dompdf_config.inc.php');
323 323
 		}
324 324
 		$dompdf = new DOMPDF();
325 325
 		$dompdf->load_html($content);
326 326
 		$dompdf->render();
327 327
 		//forcing the browser to open a download dialog.
328
-		$dompdf->stream($invoice_name . ".pdf", array( 'Attachment' => TRUE ));
328
+		$dompdf->stream($invoice_name.".pdf", array('Attachment' => TRUE));
329 329
 	}
330 330
 
331 331
 
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/qtips/EE_Qtip_Config.lib.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@
 block discarded – undo
200 200
 	 * return the _qtips property contents
201 201
 	 *
202 202
 	 * @access public
203
-	 * @return EE_Qtip[]
203
+	 * @return EE_Qtip
204 204
 	 */
205 205
 	public function get_tips() {
206 206
 		return $this->_qtips;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -177,8 +177,9 @@  discard block
 block discarded – undo
177 177
 	protected function _construct_tips() {
178 178
 		foreach ( $this->_qtipsa as $qt ) {
179 179
 			//make sure we have what we need.
180
-			if ( !isset( $qt['content_id'] ) || !isset( $qt['target'] ) || !isset( $qt['content'] ) )
181
-				throw new EE_Error( sprintf( __('There is something wrong with the _qtipsa property setup for the %s qtip config class.  The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', 'event_espresso'), get_class($this), var_export($qt, true) ) );
180
+			if ( !isset( $qt['content_id'] ) || !isset( $qt['target'] ) || !isset( $qt['content'] ) ) {
181
+							throw new EE_Error( sprintf( __('There is something wrong with the _qtipsa property setup for the %s qtip config class.  The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', 'event_espresso'), get_class($this), var_export($qt, true) ) );
182
+			}
182 183
 
183 184
 			//make sure the options include defaults and just override via set config.
184 185
 			$options_override = isset( $qt['options'] ) ? (array) $qt['options'] : array();
@@ -266,8 +267,9 @@  discard block
 block discarded – undo
266 267
 
267 268
 	public function __construct( $setup_array ) {
268 269
 		foreach ( $setup_array as $prop => $value ) {
269
-			if ( EEH_Class_Tools::has_property( $this, $prop ) )
270
-				$this->{$prop} = $value;
270
+			if ( EEH_Class_Tools::has_property( $this, $prop ) ) {
271
+							$this->{$prop} = $value;
272
+			}
271 273
 		}
272 274
 	}
273 275
 }
274 276
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 				'event' => 'mouseleave', //similar as what you do for show.event.
143 143
 				'target' => false, //Options jQuery::#selector. which html element will trigger hide event. When false, the element the .qtip() method was called upon is used.
144 144
 				'delay' => 0, //set time in milliseconds for delaying the hide of the tooltip
145
-				'inactive' => false,  //if integer, time in millisecons in which the tooltip should be hidden if remains inactive (not interacted with)
145
+				'inactive' => false, //if integer, time in millisecons in which the tooltip should be hidden if remains inactive (not interacted with)
146 146
 				'fixed' => false, //when set to true, the tooltip will not hide if moused over.
147 147
 				'leave' => 'window', //specify whether the tooltip will hide when leaving the window it's conained within.
148 148
 				'distance' => false, //if integer, distance in pixels that the tooltip hides when the mouse is moved from the point it triggered the tooltip.
@@ -175,21 +175,21 @@  discard block
 block discarded – undo
175 175
 	 * @return void
176 176
 	 */
177 177
 	protected function _construct_tips() {
178
-		foreach ( $this->_qtipsa as $qt ) {
178
+		foreach ($this->_qtipsa as $qt) {
179 179
 			//make sure we have what we need.
180
-			if ( !isset( $qt['content_id'] ) || !isset( $qt['target'] ) || !isset( $qt['content'] ) )
181
-				throw new EE_Error( sprintf( __('There is something wrong with the _qtipsa property setup for the %s qtip config class.  The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', 'event_espresso'), get_class($this), var_export($qt, true) ) );
180
+			if ( ! isset($qt['content_id']) || ! isset($qt['target']) || ! isset($qt['content']))
181
+				throw new EE_Error(sprintf(__('There is something wrong with the _qtipsa property setup for the %s qtip config class.  The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', 'event_espresso'), get_class($this), var_export($qt, true)));
182 182
 
183 183
 			//make sure the options include defaults and just override via set config.
184
-			$options_override = isset( $qt['options'] ) ? (array) $qt['options'] : array();
185
-			$options = array_merge( $this->_default_options, $options_override );
184
+			$options_override = isset($qt['options']) ? (array) $qt['options'] : array();
185
+			$options = array_merge($this->_default_options, $options_override);
186 186
 			$setup = array(
187 187
 				'content_id' => $qt['content_id'],
188 188
 				'options' => $options,
189 189
 				'target' => $qt['target'],
190 190
 				'content' => $qt['content']
191 191
 				);
192
-			$this->_qtips[] = new EE_Qtip( $setup );
192
+			$this->_qtips[] = new EE_Qtip($setup);
193 193
 		}
194 194
 	}
195 195
 
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 	public $target;
265 265
 	public $content;
266 266
 
267
-	public function __construct( $setup_array ) {
268
-		foreach ( $setup_array as $prop => $value ) {
269
-			if ( EEH_Class_Tools::has_property( $this, $prop ) )
267
+	public function __construct($setup_array) {
268
+		foreach ($setup_array as $prop => $value) {
269
+			if (EEH_Class_Tools::has_property($this, $prop))
270 270
 				$this->{$prop} = $value;
271 271
 		}
272 272
 	}
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Event_Shortcodes.lib.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -179,6 +179,7 @@
 block discarded – undo
179 179
 	/**
180 180
 	 * returns the link to the event
181 181
 	 * @param  boolean $full_link if TRUE (default) we return the html for the name of the event linked to the event.  Otherwise we just return the url of the event.
182
+	 * @param EE_Event $event
182 183
 	 * @return string
183 184
 	 */
184 185
 	private function _get_event_link( $event, $full_link = TRUE ) {
Please login to merge, or discard this patch.
Braces   +11 added lines, -7 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
@@ -85,8 +86,9 @@  discard block
 block discarded – undo
85 86
 
86 87
 
87 88
 		//If there is no event objecdt by now then get out.
88
-		if ( ! $this->_event instanceof EE_Event )
89
-			return '';
89
+		if ( ! $this->_event instanceof EE_Event ) {
90
+					return '';
91
+		}
90 92
 
91 93
 		switch ( $shortcode ) {
92 94
 
@@ -125,14 +127,16 @@  discard block
 block discarded – undo
125 127
 
126 128
 			case '[VIRTUAL_URL]' :
127 129
 				$venue = $this->_event->get_first_related('Venue');
128
-				if ( empty( $venue ) )
129
-					return '';
130
+				if ( empty( $venue ) ) {
131
+									return '';
132
+				}
130 133
 				return $venue->get('VNU_virtual_url');
131 134
 
132 135
 			case '[VIRTUAL_PHONE]' :
133 136
 				$venue = $this->_event->get_first_related('Venue');
134
-				if ( empty( $venue ) )
135
-					return '';
137
+				if ( empty( $venue ) ) {
138
+									return '';
139
+				}
136 140
 				return $venue->get('VNU_virtual_phone');
137 141
 				break;
138 142
 
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 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
 /**
@@ -55,33 +55,33 @@  discard block
 block discarded – undo
55 55
 			'[EVENT_NAME]' => __("This also can be used for the name of the event", 'event_espresso'),
56 56
 			'[EVENT_PHONE]' => __('The phone number for the event (usually an info number)', 'event_espresso'),
57 57
 			'[EVENT_DESCRIPTION]' => __('The description of the event', 'event_espresso'),
58
-			'[EVENT_EXCERPT]' => __( 'This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso' ),
58
+			'[EVENT_EXCERPT]' => __('This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso'),
59 59
 			'[EVENT_LINK]' => __('A link associated with the event', 'event_espresso'),
60 60
 			'[EVENT_URL]' => __('A link to the event set up on the host site.', 'event_espresso'),
61 61
 			'[VIRTUAL_URL]' => __('What was used for the "URL of Event" field in the Venue settings', 'event_espresso'),
62 62
 			'[VIRTUAL_PHONE]' => __('An alternate phone number for the event. Typically used as a "call-in" number', 'event_espresso'),
63 63
 			'[EVENT_IMAGE]' => __('This will parse to the Feature image for the event.', 'event_espresso'),
64 64
 			'[EVENT_TOTAL_AVAILABLE_SPACES_*]' => sprintf(
65
-				__( 'This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event.  There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode).  %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso' ),
65
+				__('This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event.  There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode).  %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso'),
66 66
 				'<code>',
67 67
 				'</code>'
68 68
 				),
69
-			'[EVENT_TOTAL_SPOTS_TAKEN]' => __( 'This shortcode will parse to the output the total approved registrations for this event', 'event_espresso' ),
69
+			'[EVENT_TOTAL_SPOTS_TAKEN]' => __('This shortcode will parse to the output the total approved registrations for this event', 'event_espresso'),
70 70
 			'[EVENT_FACEBOOK_URL]' => __('This will return the Facebook URL for the event if you have it set via custom field in your event, otherwise it will use the Facebook URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_facebook</code> and the value as your facebook url.', 'event_espresso'),
71 71
 			'[EVENT_TWITTER_URL]' => __('This will return the Twitter URL for the event if you have it set via custom field in your event, otherwise it will use the Twitter URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_twitter</code> and the value as your facebook url', 'event_espresso'),
72 72
 			'[EVENT_META_*]' => __('This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the event then it will be output in place of this shortcode.', 'event_espresso'),
73
-			'[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __( 'This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso' ),
73
+			'[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __('This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso'),
74 74
 			);
75 75
 	}
76 76
 
77 77
 
78
-	protected function _parser( $shortcode ) {
78
+	protected function _parser($shortcode) {
79 79
 
80 80
 
81 81
 		$this->_event = $this->_data instanceof EE_Event ? $this->_data : null;
82 82
 
83 83
 		//if no event, then let's see if there is a reg_obj.  If there IS, then we'll try and grab the event from the reg_obj instead.
84
-		if ( empty( $this->_event ) ) {
84
+		if (empty($this->_event)) {
85 85
 			$aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
86 86
 			$aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee;
87 87
 
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 
91 91
 
92 92
 		//If there is no event objecdt by now then get out.
93
-		if ( ! $this->_event instanceof EE_Event )
93
+		if ( ! $this->_event instanceof EE_Event)
94 94
 			return '';
95 95
 
96
-		switch ( $shortcode ) {
96
+		switch ($shortcode) {
97 97
 
98 98
 			case '[EVENT_ID]' :
99 99
 				return $this->_event->ID();
@@ -126,41 +126,41 @@  discard block
 block discarded – undo
126 126
 
127 127
 			case '[VIRTUAL_URL]' :
128 128
 				$venue = $this->_event->get_first_related('Venue');
129
-				if ( empty( $venue ) )
129
+				if (empty($venue))
130 130
 					return '';
131 131
 				return $venue->get('VNU_virtual_url');
132 132
 
133 133
 			case '[VIRTUAL_PHONE]' :
134 134
 				$venue = $this->_event->get_first_related('Venue');
135
-				if ( empty( $venue ) )
135
+				if (empty($venue))
136 136
 					return '';
137 137
 				return $venue->get('VNU_virtual_phone');
138 138
 				break;
139 139
 
140 140
 			case '[EVENT_IMAGE]' :
141
-				$image = $this->_event->feature_image_url(array(600,300) );
141
+				$image = $this->_event->feature_image_url(array(600, 300));
142 142
 				// @todo: eventually we should make this an attribute shortcode so that em can send along what size they want returned.
143
-				return !empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '" />' : '';
143
+				return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'" />' : '';
144 144
 				break;
145 145
 
146 146
 			case '[EVENT_FACEBOOK_URL]' :
147
-				$facebook_url = $this->_event->get_post_meta('event_facebook', true );
148
-				return empty( $facebook_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : $facebook_url;
147
+				$facebook_url = $this->_event->get_post_meta('event_facebook', true);
148
+				return empty($facebook_url) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : $facebook_url;
149 149
 				break;
150 150
 
151 151
 			case '[EVENT_TWITTER_URL]' :
152 152
 				$twitter_url = $this->_event->get_post_meta('event_twitter', true);
153
-				return empty( $twitter_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : $twitter_url;
153
+				return empty($twitter_url) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : $twitter_url;
154 154
 				break;
155 155
 
156 156
 			case '[EVENT_AUTHOR_EMAIL]' :
157 157
 				$author_id = $this->_event->get('EVT_wp_user');
158
-				$user_data = get_userdata( (int) $author_id );
158
+				$user_data = get_userdata((int) $author_id);
159 159
 				return $user_data->user_email;
160 160
 				break;
161 161
 
162 162
 			case '[EVENT_TOTAL_SPOTS_TAKEN]' :
163
-				return EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true );
163
+				return EEM_Registration::instance()->count(array(array('EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true);
164 164
 				break;
165 165
 
166 166
 			case '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' :
@@ -170,26 +170,26 @@  discard block
 block discarded – undo
170 170
 						'page' => 'espresso_registrations',
171 171
 						'action' => 'default'
172 172
 					),
173
-					admin_url( 'admin.php' ),
173
+					admin_url('admin.php'),
174 174
 					true
175 175
 				);
176 176
 				break;
177 177
 		}
178 178
 
179
-		if ( strpos( $shortcode, '[EVENT_META_*' ) !== false ) {
180
-			$shortcode = str_replace( '[EVENT_META_*', '', $shortcode );
181
-			$shortcode = trim( str_replace( ']', '', $shortcode ) );
179
+		if (strpos($shortcode, '[EVENT_META_*') !== false) {
180
+			$shortcode = str_replace('[EVENT_META_*', '', $shortcode);
181
+			$shortcode = trim(str_replace(']', '', $shortcode));
182 182
 
183 183
 			//pull the meta value from the event post
184
-			$event_meta = $this->_event->get_post_meta( $shortcode, true );
184
+			$event_meta = $this->_event->get_post_meta($shortcode, true);
185 185
 
186
-			return !empty( $event_meta ) ? $this->_event->get_post_meta( $shortcode, true ) : '';
186
+			return ! empty($event_meta) ? $this->_event->get_post_meta($shortcode, true) : '';
187 187
 
188 188
 		}
189 189
 
190
-		if ( strpos( $shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*' ) !== false ) {
191
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
192
-			$method = empty( $attrs['method'] ) ? 'current' : $attrs['method'];
190
+		if (strpos($shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*') !== false) {
191
+			$attrs = $this->_get_shortcode_attrs($shortcode);
192
+			$method = empty($attrs['method']) ? 'current' : $attrs['method'];
193 193
 			$method = $method === 'current';
194 194
 			$available = $this->_event->total_available_spaces($method);
195 195
 			return $available === EE_INF ? '&infin;' : $available;
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
 	 * @param  boolean $full_link if TRUE (default) we return the html for the name of the event linked to the event.  Otherwise we just return the url of the event.
206 206
 	 * @return string
207 207
 	 */
208
-	private function _get_event_link( $event, $full_link = TRUE ) {
208
+	private function _get_event_link($event, $full_link = TRUE) {
209 209
 		$url = get_permalink($event->ID());
210 210
 
211
-		return $full_link ? '<a href="' . $url . '">' . $event->get('EVT_name') . '</a>' : $url;
211
+		return $full_link ? '<a href="'.$url.'">'.$event->get('EVT_name').'</a>' : $url;
212 212
 	}
213 213
 
214 214
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Primary_Registration_List_Shortcodes.lib.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -109,6 +109,9 @@  discard block
 block discarded – undo
109 109
 	}
110 110
 
111 111
 
112
+	/**
113
+	 * @param EE_Registration $reg
114
+	 */
112 115
 	private function _get_tickets_from_event( EE_Event $event, $reg = NULL ) {
113 116
 		$evt_tkts = isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID()]['tkt_objs'] : array();
114 117
 
@@ -177,6 +180,9 @@  discard block
 block discarded – undo
177 180
 
178 181
 
179 182
 
183
+	/**
184
+	 * @param EE_Registration $reg
185
+	 */
180 186
 	private function _get_datetimes_from_event( EE_Event $event, $reg = NULL ) {
181 187
 		$evt_dtts = isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID()]['dtt_objs'] : array();
182 188
 
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 
44 44
 
45 45
 
46
-	protected function _parser( $shortcode ) {
47
-		switch ( $shortcode ) {
46
+	protected function _parser($shortcode) {
47
+		switch ($shortcode) {
48 48
 
49 49
 			case '[PRIMARY_REGISTRANT_TICKET_LIST]' :
50
-				return $this->_get_recipient_ticket_list( TRUE );
50
+				return $this->_get_recipient_ticket_list(TRUE);
51 51
 				break;
52 52
 
53 53
 			case '[PRIMARY_REGISTRANT_DATETIME_LIST]' :
54
-				return $this->_get_recipient_datetime_list( TRUE );
54
+				return $this->_get_recipient_datetime_list(TRUE);
55 55
 				break;
56 56
 		}
57 57
 		return '';
@@ -65,57 +65,57 @@  discard block
 block discarded – undo
65 65
 	 * @param  boolean $primary whether we're getting the primary registrant ticket_list.
66 66
 	 * @return string
67 67
 	 */
68
-	private function _get_recipient_ticket_list( $primary = FALSE ) {
68
+	private function _get_recipient_ticket_list($primary = FALSE) {
69 69
 		$this->_validate_list_requirements();
70 70
 
71
-		if ( $this->_data['data'] instanceof EE_Messages_Addressee )
72
-			return $this->_get_recipient_ticket_list_parsed( $this->_data['data'], $primary );
71
+		if ($this->_data['data'] instanceof EE_Messages_Addressee)
72
+			return $this->_get_recipient_ticket_list_parsed($this->_data['data'], $primary);
73 73
 
74
-		else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee )
75
-			return $this->_get_recipient_ticket_list_parsed( $this->_extra_data['data'], $primary );
74
+		else if ($this->_extra_data['data'] instanceof EE_Messages_Addressee)
75
+			return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data'], $primary);
76 76
 
77 77
 		else
78 78
 			return '';
79 79
 	}
80 80
 
81 81
 
82
-	private function _get_recipient_ticket_list_parsed( EE_Messages_Addressee $data, $primary = FALSE ) {
82
+	private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data, $primary = FALSE) {
83 83
 		$registration = $primary ? $data->primary_reg_obj : $data->reg_obj;
84
-			if ( ! $registration instanceof EE_Registration ) return '';
84
+			if ( ! $registration instanceof EE_Registration) return '';
85 85
 		//setup valid shortcodes depending on what the status of the $this->_data property is
86
-		if ( $this->_data['data'] instanceof EE_Messages_Addressee ) {
87
-			$valid_shortcodes = array('ticket', 'event_list', 'attendee_list','datetime_list', 'registration_details', 'attendee');
86
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
87
+			$valid_shortcodes = array('ticket', 'event_list', 'attendee_list', 'datetime_list', 'registration_details', 'attendee');
88 88
 			$template = $this->_data['template'];
89 89
 			$tkts = array($data->registrations[$registration->ID()]['tkt_obj']);
90 90
 			$data = $this->_data;
91
-		} elseif ( $this->_data['data'] instanceof EE_Event ) {
91
+		} elseif ($this->_data['data'] instanceof EE_Event) {
92 92
 			$valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee');
93
-			$template = is_array($this->_data['template'] ) && isset($this->_data['template']['ticket_list']) ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list'];
93
+			$template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list'];
94 94
 			//let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion.
95 95
 			$template = str_replace('[EVENT_LIST]', '', $template);
96 96
 			//data will be tickets for this event for this recipient.
97
-			$tkts = $this->_get_tickets_from_event( $this->_data['data'], $registration );
97
+			$tkts = $this->_get_tickets_from_event($this->_data['data'], $registration);
98 98
 			$data = $this->_extra_data;
99 99
 		} else {
100 100
 			return '';
101 101
 		}
102 102
 
103 103
 		$tktparsed = '';
104
-		foreach ( $tkts as $ticket ) {
105
-			$tktparsed .= $this->_shortcode_helper->parse_ticket_list_template( $template, $ticket, $valid_shortcodes, $data );
104
+		foreach ($tkts as $ticket) {
105
+			$tktparsed .= $this->_shortcode_helper->parse_ticket_list_template($template, $ticket, $valid_shortcodes, $data);
106 106
 		}
107 107
 		return $tktparsed;
108 108
 	}
109 109
 
110 110
 
111
-	private function _get_tickets_from_event( EE_Event $event, $reg = NULL ) {
111
+	private function _get_tickets_from_event(EE_Event $event, $reg = NULL) {
112 112
 		$evt_tkts = isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID()]['tkt_objs'] : array();
113 113
 
114
-		if ( $reg instanceof EE_Registration && $this->_extra_data['data'] instanceof EE_Messages_Addressee ) {
114
+		if ($reg instanceof EE_Registration && $this->_extra_data['data'] instanceof EE_Messages_Addressee) {
115 115
 			$adj_tkts = array();
116 116
 			//return only tickets for the given attendee
117
-			foreach ( $evt_tkts as $tkt ) {
118
-				if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj'] ) && $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj']->ID() == $tkt->ID() )
117
+			foreach ($evt_tkts as $tkt) {
118
+				if (isset($this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj']) && $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj']->ID() == $tkt->ID())
119 119
 					$adj_tkts[] = $tkt;
120 120
 			}
121 121
 			$evt_tkts = $adj_tkts;
@@ -132,57 +132,57 @@  discard block
 block discarded – undo
132 132
 	 * @param  boolean $primary whether we're getting the primary registrant ticket_list.
133 133
 	 * @return string
134 134
 	 */
135
-	private function _get_recipient_datetime_list( $primary = FALSE ) {
135
+	private function _get_recipient_datetime_list($primary = FALSE) {
136 136
 		$this->_validate_list_requirements();
137 137
 
138
-		if ( $this->_data['data'] instanceof EE_Messages_Addressee )
139
-			return $this->_get_recipient_datetime_list_parsed( $this->_data['data'], $primary );
138
+		if ($this->_data['data'] instanceof EE_Messages_Addressee)
139
+			return $this->_get_recipient_datetime_list_parsed($this->_data['data'], $primary);
140 140
 
141
-		else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee )
142
-			return $this->_get_recipient_datetime_list_parsed( $this->_extra_data['data'], $primary );
141
+		else if ($this->_extra_data['data'] instanceof EE_Messages_Addressee)
142
+			return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data'], $primary);
143 143
 
144 144
 		else
145 145
 			return '';
146 146
 
147
-		return $this->_get_recipient_datetime_list_parsed( $this->_data['data'], $primary);
147
+		return $this->_get_recipient_datetime_list_parsed($this->_data['data'], $primary);
148 148
 	}
149 149
 
150 150
 
151
-	private function _get_recipient_datetime_list_parsed( EE_Messages_Addressee $data, $primary = FALSE ) {
151
+	private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data, $primary = FALSE) {
152 152
 		$registration = $primary ? $data->primary_reg_obj : $data->reg_obj;
153
-		if ( ! $registration instanceof EE_Registration ) return '';
153
+		if ( ! $registration instanceof EE_Registration) return '';
154 154
 		//setup valid shortcodes depending on what the status of the $this->_data property is
155
-		if ( $this->_data['data'] instanceof EE_Messages_Addressee ) {
155
+		if ($this->_data['data'] instanceof EE_Messages_Addressee) {
156 156
 			$valid_shortcodes = array('datetime', 'attendee');
157 157
 			$template = $this->_data['template'];
158 158
 			$dtts = $data->registrations[$registration->ID()]['dtt_objs'];
159 159
 			$data = $this->_data;
160
-		} elseif ( $this->_data['data'] instanceof EE_Event ) {
160
+		} elseif ($this->_data['data'] instanceof EE_Event) {
161 161
 			$valid_shortcodes = array('datetime', 'attendee');
162
-			$template = is_array($this->_data['template'] ) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list'];
163
-			$dtts = $this->_get_datetimes_from_event( $this->_data['data'], $registration );
162
+			$template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list'];
163
+			$dtts = $this->_get_datetimes_from_event($this->_data['data'], $registration);
164 164
 			$data = $this->_extra_data;
165 165
 		} else {
166 166
 			return '';
167 167
 		}
168 168
 
169 169
 		$dtt_parsed = '';
170
-		foreach ( $dtts as $datetime ) {
171
-			$dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( $template, $datetime, $valid_shortcodes, $this->_extra_data );
170
+		foreach ($dtts as $datetime) {
171
+			$dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template($template, $datetime, $valid_shortcodes, $this->_extra_data);
172 172
 		}
173 173
 		return $dtt_parsed;
174 174
 	}
175 175
 
176 176
 
177 177
 
178
-	private function _get_datetimes_from_event( EE_Event $event, $reg = NULL ) {
178
+	private function _get_datetimes_from_event(EE_Event $event, $reg = NULL) {
179 179
 		$evt_dtts = isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID()]['dtt_objs'] : array();
180 180
 
181
-		if ( $reg instanceof EE_Registration && $this->_extra_data['data'] instanceof EE_Messages_Addressee ) {
181
+		if ($reg instanceof EE_Registration && $this->_extra_data['data'] instanceof EE_Messages_Addressee) {
182 182
 			$adj_dtts = array();
183 183
 			//return only dtts for the given attendee
184
-			foreach ( $evt_dtts as $dtt ) {
185
-				if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['dtt_objs'][$dtt->ID()] ) )
184
+			foreach ($evt_dtts as $dtt) {
185
+				if (isset($this->_extra_data['data']->registrations[$reg->ID()]['dtt_objs'][$dtt->ID()]))
186 186
 					$adj_dtts[] = $dtt;
187 187
 			}
188 188
 			$evt_dtts = $adj_dtts;
Please login to merge, or discard this patch.
Braces   +26 added lines, -22 removed lines patch added patch discarded remove patch
@@ -68,20 +68,21 @@  discard block
 block discarded – undo
68 68
 	private function _get_recipient_ticket_list( $primary = FALSE ) {
69 69
 		$this->_validate_list_requirements();
70 70
 
71
-		if ( $this->_data['data'] instanceof EE_Messages_Addressee )
72
-			return $this->_get_recipient_ticket_list_parsed( $this->_data['data'], $primary );
73
-
74
-		else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee )
75
-			return $this->_get_recipient_ticket_list_parsed( $this->_extra_data['data'], $primary );
76
-
77
-		else
78
-			return '';
71
+		if ( $this->_data['data'] instanceof EE_Messages_Addressee ) {
72
+					return $this->_get_recipient_ticket_list_parsed( $this->_data['data'], $primary );
73
+		} else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) {
74
+					return $this->_get_recipient_ticket_list_parsed( $this->_extra_data['data'], $primary );
75
+		} else {
76
+					return '';
77
+		}
79 78
 	}
80 79
 
81 80
 
82 81
 	private function _get_recipient_ticket_list_parsed( EE_Messages_Addressee $data, $primary = FALSE ) {
83 82
 		$registration = $primary ? $data->primary_reg_obj : $data->reg_obj;
84
-			if ( ! $registration instanceof EE_Registration ) return '';
83
+			if ( ! $registration instanceof EE_Registration ) {
84
+				return '';
85
+			}
85 86
 		//setup valid shortcodes depending on what the status of the $this->_data property is
86 87
 		if ( $this->_data['data'] instanceof EE_Messages_Addressee ) {
87 88
 			$valid_shortcodes = array('ticket', 'event_list', 'attendee_list','datetime_list', 'registration_details', 'attendee');
@@ -115,8 +116,9 @@  discard block
 block discarded – undo
115 116
 			$adj_tkts = array();
116 117
 			//return only tickets for the given attendee
117 118
 			foreach ( $evt_tkts as $tkt ) {
118
-				if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj'] ) && $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj']->ID() == $tkt->ID() )
119
-					$adj_tkts[] = $tkt;
119
+				if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj'] ) && $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj']->ID() == $tkt->ID() ) {
120
+									$adj_tkts[] = $tkt;
121
+				}
120 122
 			}
121 123
 			$evt_tkts = $adj_tkts;
122 124
 		}
@@ -135,14 +137,13 @@  discard block
 block discarded – undo
135 137
 	private function _get_recipient_datetime_list( $primary = FALSE ) {
136 138
 		$this->_validate_list_requirements();
137 139
 
138
-		if ( $this->_data['data'] instanceof EE_Messages_Addressee )
139
-			return $this->_get_recipient_datetime_list_parsed( $this->_data['data'], $primary );
140
-
141
-		else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee )
142
-			return $this->_get_recipient_datetime_list_parsed( $this->_extra_data['data'], $primary );
143
-
144
-		else
145
-			return '';
140
+		if ( $this->_data['data'] instanceof EE_Messages_Addressee ) {
141
+					return $this->_get_recipient_datetime_list_parsed( $this->_data['data'], $primary );
142
+		} else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) {
143
+					return $this->_get_recipient_datetime_list_parsed( $this->_extra_data['data'], $primary );
144
+		} else {
145
+					return '';
146
+		}
146 147
 
147 148
 		return $this->_get_recipient_datetime_list_parsed( $this->_data['data'], $primary);
148 149
 	}
@@ -150,7 +151,9 @@  discard block
 block discarded – undo
150 151
 
151 152
 	private function _get_recipient_datetime_list_parsed( EE_Messages_Addressee $data, $primary = FALSE ) {
152 153
 		$registration = $primary ? $data->primary_reg_obj : $data->reg_obj;
153
-		if ( ! $registration instanceof EE_Registration ) return '';
154
+		if ( ! $registration instanceof EE_Registration ) {
155
+			return '';
156
+		}
154 157
 		//setup valid shortcodes depending on what the status of the $this->_data property is
155 158
 		if ( $this->_data['data'] instanceof EE_Messages_Addressee ) {
156 159
 			$valid_shortcodes = array('datetime', 'attendee');
@@ -182,8 +185,9 @@  discard block
 block discarded – undo
182 185
 			$adj_dtts = array();
183 186
 			//return only dtts for the given attendee
184 187
 			foreach ( $evt_dtts as $dtt ) {
185
-				if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['dtt_objs'][$dtt->ID()] ) )
186
-					$adj_dtts[] = $dtt;
188
+				if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['dtt_objs'][$dtt->ID()] ) ) {
189
+									$adj_dtts[] = $dtt;
190
+				}
187 191
 			}
188 192
 			$evt_dtts = $adj_dtts;
189 193
 		}
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Transaction_Shortcodes.lib.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -269,6 +269,9 @@
 block discarded – undo
269 269
 
270 270
 
271 271
 
272
+	/**
273
+	 * @param EE_Transaction $transaction
274
+	 */
272 275
 	private function _get_payment_gateway( $transaction ) {
273 276
 		$pm = $this->_get_payment_method( $transaction );
274 277
 		return $pm instanceof EE_Payment_Method ? $pm->name() : '';
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 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
@@ -92,8 +93,9 @@  discard block
 block discarded – undo
92 93
 		$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;
93 94
 
94 95
 
95
-		if ( ! $transaction instanceof EE_Transaction )
96
-			return '';
96
+		if ( ! $transaction instanceof EE_Transaction ) {
97
+					return '';
98
+		}
97 99
 
98 100
 		switch ( $shortcode ) {
99 101
 			case '[TXN_ID]' :
@@ -290,7 +292,7 @@  discard block
 block discarded – undo
290 292
 		$pm = $this->_get_payment_method();
291 293
 		if ( $pm instanceof EE_Payment_Method ){
292 294
 			$invoice_logo_url = $pm->get_extra_meta( 'pdf_logo_image', TRUE );
293
-		}else{
295
+		} else{
294 296
 			$invoice_logo_url = NULL;
295 297
 		}
296 298
 		if( empty( $invoice_logo_url ) ){
@@ -311,7 +313,7 @@  discard block
 block discarded – undo
311 313
 		//if image is wider than 200px, set the wideth to 200
312 314
 		if ( $image_size[0] > 300 ) {
313 315
 			$image_width = 300;
314
-		}else{
316
+		} else{
315 317
 			$image_width = $image_size[0];
316 318
 		}
317 319
 
@@ -349,7 +351,7 @@  discard block
 block discarded – undo
349 351
 				return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
350 352
 			}
351 353
 			return $payment_method;
352
-		}else{
354
+		} else{
353 355
 			//get the first payment method we can find
354 356
 			return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
355 357
 		}
Please login to merge, or discard this 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.