Completed
Branch BUG-10434-reg-cancel-shortcode... (f76056)
by
unknown
14:04
created
core/db_models/EEM_Question_Option.model.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once( EE_CLASSES . 'EE_Question_Option.class.php');
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once(EE_CLASSES.'EE_Question_Option.class.php');
26 26
 
27 27
 
28 28
 class EEM_Question_Option extends EEM_Soft_Delete_Base {
@@ -30,22 +30,22 @@  discard block
 block discarded – undo
30 30
   	// private instance of the Attendee object
31 31
 	protected static $_instance = NULL;
32 32
 
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singular_item = __('Question Option','event_espresso');
35
-		$this->plural_item = __('Question Options','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singular_item = __('Question Option', 'event_espresso');
35
+		$this->plural_item = __('Question Options', 'event_espresso');
36 36
 
37 37
 		$this->_tables = array(
38
-			'Question_Option'=>new EE_Primary_Table('esp_question_option','QSO_ID')
38
+			'Question_Option'=>new EE_Primary_Table('esp_question_option', 'QSO_ID')
39 39
 		);
40 40
 		$this->_fields = array(
41 41
 			'Question_Option'=>array(
42
-					'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID','event_espresso')),
43
-					'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'),
44
-					'QSO_value'=>new EE_Plain_Text_Field('QSO_value',  __("Question Option Value", "event_espresso"),false,''),
45
-					'QSO_desc'=>new EE_Post_Content_Field('QSO_desc', __('Question Option Description','event_espresso'), false, ''),
46
-					'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso' ), false, 0 ),
47
-					'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option','event_espresso'), TRUE, NULL ),
48
-					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed','event_espresso'), false, false)
42
+					'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID', 'event_espresso')),
43
+					'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
44
+					'QSO_value'=>new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"), false, ''),
45
+					'QSO_desc'=>new EE_Post_Content_Field('QSO_desc', __('Question Option Description', 'event_espresso'), false, ''),
46
+					'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso'), false, 0),
47
+					'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option', 'event_espresso'), TRUE, NULL),
48
+					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed', 'event_espresso'), false, false)
49 49
 				)
50 50
 		);
51 51
 		$this->_model_relations = array(
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$this->_model_chain_to_wp_user = 'Question';
56 56
 		//this model is generally available for reading
57
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
58
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
57
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
58
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('Question_Option');
59
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('Question_Option');
60
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('Question_Option');
61 61
 		$this->_caps_slug = 'questions';
62
-		parent::__construct( $timezone );
62
+		parent::__construct($timezone);
63 63
 	}
64 64
 
65 65
 
Please login to merge, or discard this patch.
core/db_models/EEM_Soft_Delete_Base.model.php 4 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * EEH_URL helper
4 6
  * Helper class for URL-related PHP functions
@@ -62,7 +64,7 @@  discard block
 block discarded – undo
62 64
 				isset($results['response']['code']) &&
63 65
 				$results['response']['code'] == '200'){
64 66
 			return true;
65
-		}else{
67
+		} else{
66 68
 			return false;
67 69
 		}
68 70
 	}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * Sum all the deleted items.
147 147
 	 * @param array $query_params like EEM_Base::get_all
148 148
 	 * @param string $field_to_sum
149
-	 * @return int
149
+	 * @return double
150 150
 	 */
151 151
 	public function sum_deleted($query_params = null, $field_to_sum = null){
152 152
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param boolean $allow_blocking if TRUE, matched objects will only be deleted if there is no related model info
196 196
 	 * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects
197 197
 	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
198
-	 * @return boolean success
198
+	 * @return integer success
199 199
 	 */
200 200
 	public function delete_permanently($query_params = array(), $allow_blocking = true){
201 201
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -111,14 +111,14 @@
 block discarded – undo
111 111
 
112 112
 
113 113
 
114
-    /**
115
-     * Alters the query params so that only trashed/soft-deleted items are considered
116
-     * @param array $query_params like EEM_Base::get_all's $query_params
117
-     * @return array like EEM_Base::get_all's $query_params
118
-     */
114
+	/**
115
+	 * Alters the query params so that only trashed/soft-deleted items are considered
116
+	 * @param array $query_params like EEM_Base::get_all's $query_params
117
+	 * @return array like EEM_Base::get_all's $query_params
118
+	 */
119 119
 	public function alter_query_params_so_only_trashed_items_included($query_params){
120
-	    return $this->_alter_query_params_so_only_trashed_items_included($query_params);
121
-    }
120
+		return $this->_alter_query_params_so_only_trashed_items_included($query_params);
121
+	}
122 122
 
123 123
 	/**
124 124
 	 * Alters the query params so each item's deleted status is ignored.
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once( EE_MODELS . 'EEM_Base.model.php');
2
+require_once(EE_MODELS.'EEM_Base.model.php');
3 3
 /**
4 4
  * EEM_Soft_Delete_Base
5 5
  *
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
  * @subpackage		includes/models/
26 26
  * @author				Michael Nelson
27 27
  */
28
-abstract class EEM_Soft_Delete_Base extends EEM_Base{
28
+abstract class EEM_Soft_Delete_Base extends EEM_Base {
29 29
 
30 30
 	/**
31 31
 	 * @param null $timezone
32 32
 	 */
33 33
 	protected function __construct($timezone = NULL) {
34
-		if( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions ){
34
+		if ( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions) {
35 35
 			$this->_default_where_conditions_strategy = new EE_Soft_Delete_Where_Conditions();
36 36
 		}
37 37
 		parent::__construct($timezone);
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 	 * @return string
43 43
 	 * @throws EE_Error
44 44
 	 */
45
-	public function deleted_field_name(){
45
+	public function deleted_field_name() {
46 46
 		$field = $this->get_a_field_of_type('EE_Trashed_Flag_Field');
47
-		if($field){
47
+		if ($field) {
48 48
 			return $field->get_name();
49
-		}else{
50
-			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this)));
49
+		} else {
50
+			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this)));
51 51
 		}
52 52
 	}
53 53
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param array $query_params like EEM_Base::get_all's $query_params
58 58
 	 * @return EE_Soft_Delete_Base_Class
59 59
 	 */
60
-	public function get_one_deleted($query_params = array()){
60
+	public function get_one_deleted($query_params = array()) {
61 61
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
62 62
 		return parent::get_one($query_params);
63 63
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @param array $query_params like EEM_base::get_all's $query_params
68 68
 	 * @return EE_Soft_Delete_Base_Class
69 69
 	 */
70
-	public function get_one_deleted_or_undeleted($query_params = array()){
70
+	public function get_one_deleted_or_undeleted($query_params = array()) {
71 71
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
72 72
 		return parent::get_one($query_params);
73 73
 	}
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
 	 * @param int|string $id
78 78
 	 * @return EE_Soft_Delete_Base_Class
79 79
 	 */
80
-	public function get_one_by_ID_but_ignore_deleted($id){
80
+	public function get_one_by_ID_but_ignore_deleted($id) {
81 81
 		return $this->get_one(
82 82
 			$this->alter_query_params_to_restrict_by_ID(
83 83
 				$id,
84
-				array( 'default_where_conditions' => 'default' )
84
+				array('default_where_conditions' => 'default')
85 85
 			)
86 86
 		);
87 87
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param bool 	 $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE;
94 94
 	 * @return int
95 95
 	 */
96
-	public function count_deleted($query_params = null, $field_to_count = null, $distinct = FALSE){
96
+	public function count_deleted($query_params = null, $field_to_count = null, $distinct = FALSE) {
97 97
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
98 98
 		return parent::count($query_params, $field_to_count, $distinct);
99 99
 	}
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	 * @param array $query_params like EEM_Base::get_all's $query_params
104 104
 	 * @return array like EEM_Base::get_all's $query_params
105 105
 	 */
106
-	protected function _alter_query_params_so_only_trashed_items_included($query_params){
107
-		$deletedFlagFieldName=$this->deleted_field_name();
108
-		$query_params[0][$deletedFlagFieldName]=true;
106
+	protected function _alter_query_params_so_only_trashed_items_included($query_params) {
107
+		$deletedFlagFieldName = $this->deleted_field_name();
108
+		$query_params[0][$deletedFlagFieldName] = true;
109 109
 		return $query_params;
110 110
 	}
111 111
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      * @param array $query_params like EEM_Base::get_all's $query_params
117 117
      * @return array like EEM_Base::get_all's $query_params
118 118
      */
119
-	public function alter_query_params_so_only_trashed_items_included($query_params){
119
+	public function alter_query_params_so_only_trashed_items_included($query_params) {
120 120
 	    return $this->_alter_query_params_so_only_trashed_items_included($query_params);
121 121
     }
122 122
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @param array $query_params
126 126
 	 * @return array
127 127
 	 */
128
-	public function alter_query_params_so_deleted_and_undeleted_items_included( $query_params = array() ){
128
+	public function alter_query_params_so_deleted_and_undeleted_items_included($query_params = array()) {
129 129
 		return $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
130 130
 	}
131 131
 
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 * @param array $query_params
135 135
 	 * @return array
136 136
 	 */
137
-	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params){
138
-		if( ! isset( $query_params[ 'default_where_conditions' ] ) ) {
137
+	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params) {
138
+		if ( ! isset($query_params['default_where_conditions'])) {
139 139
 			$query_params['default_where_conditions'] = 'minimum';
140 140
 		}
141 141
 		return $query_params;
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 * @param bool 	 $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE;
149 149
 	 * @return int
150 150
 	 */
151
-	public function count_deleted_and_undeleted($query_params = null, $field_to_count = null, $distinct = FALSE){
151
+	public function count_deleted_and_undeleted($query_params = null, $field_to_count = null, $distinct = FALSE) {
152 152
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
153
-		return parent::count($query_params,$field_to_count, $distinct);
153
+		return parent::count($query_params, $field_to_count, $distinct);
154 154
 	}
155 155
 
156 156
 	/**
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param string $field_to_sum
160 160
 	 * @return int
161 161
 	 */
162
-	public function sum_deleted($query_params = null, $field_to_sum = null){
162
+	public function sum_deleted($query_params = null, $field_to_sum = null) {
163 163
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
164 164
 		return parent::sum($query_params, $field_to_sum);
165 165
 	}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @param string $field_to_sum
171 171
 	 * @return int
172 172
 	 */
173
-	public function sum_deleted_and_undeleted($query_params = null, $field_to_sum = null){
173
+	public function sum_deleted_and_undeleted($query_params = null, $field_to_sum = null) {
174 174
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
175 175
 		parent::sum($query_params, $field_to_sum);
176 176
 	}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 * @param array $query_params like EEM_Base::get_all
181 181
 	 * @return EE_Soft_Delete_Base_Class[]
182 182
 	 */
183
-	public function get_all_deleted_and_undeleted($query_params = array()){
183
+	public function get_all_deleted_and_undeleted($query_params = array()) {
184 184
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
185 185
 		return parent::get_all($query_params);
186 186
 	}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 * @param array $query_params like EEM_Base::get_all
191 191
 	 * @return EE_Soft_Delete_Base_Class[]
192 192
 	 */
193
-	public function get_all_deleted($query_params = array()){
193
+	public function get_all_deleted($query_params = array()) {
194 194
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
195 195
 		return parent::get_all($query_params);
196 196
 	}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
209 209
 	 * @return boolean success
210 210
 	 */
211
-	public function delete_permanently($query_params = array(), $allow_blocking = true){
211
+	public function delete_permanently($query_params = array(), $allow_blocking = true) {
212 212
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
213 213
 		return parent::delete_permanently($query_params, $allow_blocking);
214 214
 	}
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	 * @param mixed $ID int if primary key is an int, string otherwise
220 220
 	 * @return boolean success
221 221
 	 */
222
-	public function restore_by_ID($ID=FALSE){
223
-		return $this->delete_or_restore_by_ID(false,$ID);
222
+	public function restore_by_ID($ID = FALSE) {
223
+		return $this->delete_or_restore_by_ID(false, $ID);
224 224
 	}
225 225
 	/**
226 226
 	 * For deleting or restoring a particular item. Note that this model is a SOFT-DELETABLE model! However,
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
 	 * @param mixed $ID int if primary key is an int, string otherwise
230 230
 	 * @return boolean
231 231
 	 */
232
-	public function delete_or_restore_by_ID($delete=true,$ID=FALSE){
233
-		if ( ! $ID ) {
232
+	public function delete_or_restore_by_ID($delete = true, $ID = FALSE) {
233
+		if ( ! $ID) {
234 234
 			return FALSE;
235 235
 		}
236 236
 		if (
237 237
 			$this->delete_or_restore(
238 238
 				$delete,
239
-				$this->alter_query_params_to_restrict_by_ID( $ID )
239
+				$this->alter_query_params_to_restrict_by_ID($ID)
240 240
 			)
241 241
 		) {
242 242
 			return TRUE;
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @param bool  $block_deletes
257 257
 	 * @return boolean
258 258
 	 */
259
-	public function delete($query_params = array(), $block_deletes = false){
259
+	public function delete($query_params = array(), $block_deletes = false) {
260 260
 		//no matter what, we WON'T block soft deletes.
261 261
 		return $this->delete_or_restore(true, $query_params);
262 262
 	}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 * @param array $query_params like EEM_Base::get_all
268 268
 	 * @return boolean
269 269
 	 */
270
-	public function restore($query_params = array()){
270
+	public function restore($query_params = array()) {
271 271
 		return $this->delete_or_restore(false, $query_params);
272 272
 	}
273 273
 	/**
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
 	 * @param array $query_params like EEM_Base::get_all
277 277
 	 * @return boolean
278 278
 	 */
279
-	function delete_or_restore($delete=true,$query_params = array()){
280
-		$deletedFlagFieldName=$this->deleted_field_name();
279
+	function delete_or_restore($delete = true, $query_params = array()) {
280
+		$deletedFlagFieldName = $this->deleted_field_name();
281 281
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
282
-		if ( $this->update (array($deletedFlagFieldName=>$delete), $query_params )) {
282
+		if ($this->update(array($deletedFlagFieldName=>$delete), $query_params)) {
283 283
 			return TRUE;
284 284
 		} else {
285 285
 			return FALSE;
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * be aware that model objects being used could get out-of-sync with the database
298 298
 	 * @return int number of items updated
299 299
 	 */
300
-	public function update_deleted_and_undeleted($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE ){
300
+	public function update_deleted_and_undeleted($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE) {
301 301
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
302
-		return $this->update($fields_n_values, $query_params, $keep_model_objs_in_sync );
302
+		return $this->update($fields_n_values, $query_params, $keep_model_objs_in_sync);
303 303
 	}
304 304
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Term_Taxonomy.model.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
24
+require_once (EE_MODELS.'EEM_Base.model.php');
25 25
 
26 26
 class EEM_Term_Taxonomy extends EEM_Base {
27 27
 
@@ -29,68 +29,68 @@  discard block
 block discarded – undo
29 29
 	protected static $_instance = NULL;
30 30
 
31 31
 
32
-	protected function __construct( $timezone = NULL ) {
33
-		$this->singular_item = __('Term Taxonomy','event_espresso');
34
-		$this->plural_item = __('Term Taxonomy','event_espresso');
32
+	protected function __construct($timezone = NULL) {
33
+		$this->singular_item = __('Term Taxonomy', 'event_espresso');
34
+		$this->plural_item = __('Term Taxonomy', 'event_espresso');
35 35
 		$this->_tables = array(
36 36
 			'Term_Taxonomy'=> new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id')
37 37
 		);
38 38
 		$this->_fields = array(
39 39
 			'Term_Taxonomy'=>array(
40
-				'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID','event_espresso')),
41
-				'term_id'=>new EE_Foreign_Key_Int_Field('term_id',  __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
42
-				'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name','event_espresso'), false, 'category'),
43
-				'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false,''),
44
-				'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false,0),
40
+				'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID', 'event_espresso')),
41
+				'term_id'=>new EE_Foreign_Key_Int_Field('term_id', __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
42
+				'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name', 'event_espresso'), false, 'category'),
43
+				'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false, ''),
44
+				'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false, 0),
45 45
 				'term_count'=> new EE_Integer_Field('count', __("Count of Objects attached", 'event_espresso'), false, 0)
46 46
 			));
47 47
 		$this->_model_relations = array(
48 48
 			'Term_Relationship'=>new EE_Has_Many_Relation(),
49 49
 			'Term'=>new EE_Belongs_To_Relation(),
50 50
 		);
51
-		$cpt_models = array_keys( EE_Registry::instance()->cpt_models() );
52
-		foreach( $cpt_models  as $model_name ) {
53
-			$this->_model_relations[ $model_name ] = new EE_HABTM_Relation( 'Term_Relationship' );
51
+		$cpt_models = array_keys(EE_Registry::instance()->cpt_models());
52
+		foreach ($cpt_models  as $model_name) {
53
+			$this->_model_relations[$model_name] = new EE_HABTM_Relation('Term_Relationship');
54 54
 		}
55 55
 		$this->_indexes = array(
56
-			'term_id_taxonomy'=>new EE_Unique_Index(array('term_id','taxonomy'))
56
+			'term_id_taxonomy'=>new EE_Unique_Index(array('term_id', 'taxonomy'))
57 57
 		);
58 58
 		$path_to_tax_model = '';
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( $path_to_tax_model );
61
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
62
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
59
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
60
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected($path_to_tax_model);
61
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = false;
62
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = false;
63 63
 
64 64
 		//add cap restrictions for editing relating to the "ee_edit_*"
65
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
65
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
66 66
 				array(
67
-					$path_to_tax_model . 'taxonomy*ee_edit_event_category' => array( '!=', 'espresso_event_categories' )
67
+					$path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories')
68 68
 				));
69
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
69
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
70 70
 				array(
71
-					$path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array( '!=', 'espresso_venue_categories' )
71
+					$path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories')
72 72
 				));
73
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
73
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
74 74
 				array(
75
-					$path_to_tax_model . 'taxonomy*ee_edit_event_type' => array( '!=', 'espresso_event_type' )
75
+					$path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type')
76 76
 				));
77 77
 
78 78
 		//add cap restrictions for deleting relating to the "ee_deleting_*"
79
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
79
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
80 80
 				array(
81
-					$path_to_tax_model . 'taxonomy*ee_delete_event_category' => array( '!=', 'espresso_event_categories' )
81
+					$path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories')
82 82
 				));
83
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
83
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
84 84
 				array(
85
-					$path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array( '!=', 'espresso_venue_categories' )
85
+					$path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories')
86 86
 				));
87
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
87
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
88 88
 				array(
89
-					$path_to_tax_model . 'taxonomy*ee_delete_event_type' => array( '!=', 'espresso_event_type' )
89
+					$path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type')
90 90
 				));
91 91
 
92
-		parent::__construct( $timezone );
93
-		add_filter( 'FHEE__Read__create_model_query_params', array( 'EEM_Term_Taxonomy', 'rest_api_query_params' ), 10, 3 );
92
+		parent::__construct($timezone);
93
+		add_filter('FHEE__Read__create_model_query_params', array('EEM_Term_Taxonomy', 'rest_api_query_params'), 10, 3);
94 94
 	}
95 95
 	
96 96
 	/**
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 * @param EEM_Base $model
102 102
 	 * @return array
103 103
 	 */
104
-	public static function rest_api_query_params( $model_query_params, $querystring_query_params, $model ) {
105
-		if( $model === EEM_Term_Taxonomy::instance() ) {
106
-			$taxonomies = get_taxonomies( array( 'show_in_rest' => true) );
107
-			if( ! empty( $taxonomies ) ) {
108
-				$model_query_params[0][ 'taxonomy' ] = array( 'IN', $taxonomies );
104
+	public static function rest_api_query_params($model_query_params, $querystring_query_params, $model) {
105
+		if ($model === EEM_Term_Taxonomy::instance()) {
106
+			$taxonomies = get_taxonomies(array('show_in_rest' => true));
107
+			if ( ! empty($taxonomies)) {
108
+				$model_query_params[0]['taxonomy'] = array('IN', $taxonomies);
109 109
 			}
110 110
 		}
111 111
 		return $model_query_params;
Please login to merge, or discard this patch.
core/db_models/EEM_WP_User.model.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -22,24 +22,24 @@  discard block
 block discarded – undo
22 22
 	 * @param null $timezone
23 23
 	 * @throws \EE_Error
24 24
 	 */
25
-	protected function __construct( $timezone = NULL ){
26
-		$this->singular_item = __('WP_User','event_espresso');
27
-		$this->plural_item = __('WP_Users','event_espresso');
25
+	protected function __construct($timezone = NULL) {
26
+		$this->singular_item = __('WP_User', 'event_espresso');
27
+		$this->plural_item = __('WP_Users', 'event_espresso');
28 28
 		global $wpdb;
29 29
 		$this->_tables = array(
30
-			'WP_User'=> new EE_Primary_Table( $wpdb->users, 'ID', true)
30
+			'WP_User'=> new EE_Primary_Table($wpdb->users, 'ID', true)
31 31
 		);
32 32
 		$this->_fields = array(
33 33
 			'WP_User'=>array(
34
-				'ID'=> new EE_Primary_Key_Int_Field('ID', __('WP_User ID','event_espresso')),
35
-				'user_login'=>new EE_Plain_Text_Field('user_login', __('User Login','event_espresso'), false, '' ),
36
-				'user_pass'=>new EE_Plain_Text_Field('user_pass', __('User Password','event_espresso'), false, '' ),
37
-				'user_nicename'=>new EE_Plain_Text_Field('user_nicename', __(' User Nice Name','event_espresso'), false, ''),
38
-				'user_email' => new EE_Email_Field('user_email', __( 'User Email', 'event_espresso' ), false),
39
-				'user_registered' => new EE_Datetime_Field( 'user_registered', __( 'Date User Registered', 'event_espresso' ), false, EE_Datetime_Field::now, $timezone ),
40
-				'user_activation_key' => new EE_Plain_Text_Field( 'user_activation_key', __( 'User Activation Key', 'event_espresso' ), false, '' ),
41
-				'user_status' => new EE_Integer_Field( 'user_status', __( 'User Status', 'event_espresso' ), false, 0 ),
42
-				'display_name' => new EE_Plain_Text_Field( 'display_name', __( 'Display Name', 'event_espresso' ), false, '' )
34
+				'ID'=> new EE_Primary_Key_Int_Field('ID', __('WP_User ID', 'event_espresso')),
35
+				'user_login'=>new EE_Plain_Text_Field('user_login', __('User Login', 'event_espresso'), false, ''),
36
+				'user_pass'=>new EE_Plain_Text_Field('user_pass', __('User Password', 'event_espresso'), false, ''),
37
+				'user_nicename'=>new EE_Plain_Text_Field('user_nicename', __(' User Nice Name', 'event_espresso'), false, ''),
38
+				'user_email' => new EE_Email_Field('user_email', __('User Email', 'event_espresso'), false),
39
+				'user_registered' => new EE_Datetime_Field('user_registered', __('Date User Registered', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
40
+				'user_activation_key' => new EE_Plain_Text_Field('user_activation_key', __('User Activation Key', 'event_espresso'), false, ''),
41
+				'user_status' => new EE_Integer_Field('user_status', __('User Status', 'event_espresso'), false, 0),
42
+				'display_name' => new EE_Plain_Text_Field('display_name', __('Display Name', 'event_espresso'), false, '')
43 43
 			));
44 44
 		$this->_model_relations = array(
45 45
 			'Attendee' => new EE_Has_Many_Relation(),
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 		);
57 57
 		$this->_wp_core_model = true;
58 58
 		$this->_caps_slug = 'users';
59
-		$this->_cap_contexts_to_cap_action_map[ EEM_Base::caps_read ] = 'list';
60
-		$this->_cap_contexts_to_cap_action_map[ EEM_Base::caps_read_admin ] = 'list';
61
-		foreach( $this->_cap_contexts_to_cap_action_map as $context => $action ) {
62
-			$this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_WP_User();
59
+		$this->_cap_contexts_to_cap_action_map[EEM_Base::caps_read] = 'list';
60
+		$this->_cap_contexts_to_cap_action_map[EEM_Base::caps_read_admin] = 'list';
61
+		foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) {
62
+			$this->_cap_restriction_generators[$context] = new EE_Restriction_Generator_WP_User();
63 63
 		}
64 64
 		//@todo: account for create_users controls whether they can create users at all
65 65
 
66
-		parent::__construct( $timezone );
66
+		parent::__construct($timezone);
67 67
 	}
68 68
 
69 69
 	/**
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Soft_Delete_Where_Conditions.strategy.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91 91
 		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92 92
 			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
93
+		} else{
94 94
 			return parent::finalize_payment_for( $transaction );
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  *
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @author				Mike Nelson
14 14
  * @since		 	   4.6.0
15 15
  */
16
-class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions{
16
+class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions {
17 17
 	/**
18 18
 	 * Strategy for setting default soft delete where conditions. This strategy will find
19 19
 	 * the field of type 'EE_Trashed_Flag_Field', and add a condition that it be FALSE on all queries involving
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 	 * Eg,
23 23
 	 *
24 24
 	 */
25
-	function __construct(){}
25
+	function __construct() {}
26 26
 	/**
27 27
 	 * Gets the where default where conditions for a custom post type model
28 28
 	 * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)
29 29
 	 */
30
-	protected function _get_default_where_conditions(){
30
+	protected function _get_default_where_conditions() {
31 31
 		$trashed_field_name = $this->deleted_field_name();
32 32
 		return array(
33 33
 			$trashed_field_name => false
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	 * @return string
40 40
 	 * @throws EE_Error
41 41
 	 */
42
-	private function deleted_field_name(){
42
+	private function deleted_field_name() {
43 43
 		$field = $this->_model->get_a_field_of_type('EE_Trashed_Flag_Field');
44
-		if($field){
44
+		if ($field) {
45 45
 			return $field->get_name();
46
-		}else{
47
-			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this)));
46
+		} else {
47
+			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this)));
48 48
 		}
49 49
 	}
50 50
 }
51 51
\ No newline at end of file
Please login to merge, or discard this patch.
core/helpers/EEH_Class_Tools.helper.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -35,35 +35,35 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function get_called_class() {
37 37
 		$backtrace = debug_backtrace();
38
-		if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['class'] ) && ! isset( $backtrace[2]['file'] )) {
38
+		if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['class']) && ! isset($backtrace[2]['file'])) {
39 39
 			return $backtrace[2]['class'];
40
-		} else if ( isset( $backtrace[3] ) && is_array( $backtrace[3] ) && isset( $backtrace[3]['class'] ) && ! isset( $backtrace[3]['file'] )) {
40
+		} else if (isset($backtrace[3]) && is_array($backtrace[3]) && isset($backtrace[3]['class']) && ! isset($backtrace[3]['file'])) {
41 41
 			return $backtrace[3]['class'];
42
-		} else if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['file'] ) && isset( $backtrace[2]['line'] )) {
43
-			if ( self::$file_line == $backtrace[2]['file'] . $backtrace[2]['line'] ) {
42
+		} else if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['file']) && isset($backtrace[2]['line'])) {
43
+			if (self::$file_line == $backtrace[2]['file'].$backtrace[2]['line']) {
44 44
 				self::$i++;
45 45
 			} else {
46 46
 				self::$i = 0;
47
-				self::$file_line = $backtrace[2]['file'] . $backtrace[2]['line'];
47
+				self::$file_line = $backtrace[2]['file'].$backtrace[2]['line'];
48 48
 			}
49 49
 			// was  class method called via call_user_func ?
50
-			if ( $backtrace[2]['function'] == 'call_user_func' && isset( $backtrace[2]['args'] ) && is_array( $backtrace[2]['args'] )){
51
-				if ( isset( $backtrace[2]['args'][0] ) && isset( $backtrace[2]['args'][0][0] )) {
50
+			if ($backtrace[2]['function'] == 'call_user_func' && isset($backtrace[2]['args']) && is_array($backtrace[2]['args'])) {
51
+				if (isset($backtrace[2]['args'][0]) && isset($backtrace[2]['args'][0][0])) {
52 52
 					$called_class = $backtrace[2]['args'][0][0];
53 53
 					// is it an EE function ?
54
-					if ( strpos( $called_class, 'EE' ) === 0 ) {
55
-						$prefix_chars = strpos( $called_class, '_' ) + 1;
56
-						$prefix = substr( $called_class, 0, $prefix_chars );
57
-						$classname = substr( $called_class, $prefix_chars, strlen( $called_class ));
58
-						$classname = $prefix . str_replace( ' ', '_', ucwords( strtolower( str_replace( '_', ' ', $classname  ))));
54
+					if (strpos($called_class, 'EE') === 0) {
55
+						$prefix_chars = strpos($called_class, '_') + 1;
56
+						$prefix = substr($called_class, 0, $prefix_chars);
57
+						$classname = substr($called_class, $prefix_chars, strlen($called_class));
58
+						$classname = $prefix.str_replace(' ', '_', ucwords(strtolower(str_replace('_', ' ', $classname))));
59 59
 						return $classname;
60 60
 					}
61 61
 				}
62 62
 			} else {
63
-				$lines = file( $backtrace[2]['file'] );
64
-				preg_match_all( '/([a-zA-Z0-9\_]+)::' . $backtrace[2]['function'] . '/', $lines[$backtrace[2]['line']-1], $matches );
65
-				if ( isset( $matches[1] ) && isset( $matches[1][ self::$i ] )) {
66
-					return $matches[1][ self::$i ];
63
+				$lines = file($backtrace[2]['file']);
64
+				preg_match_all('/([a-zA-Z0-9\_]+)::'.$backtrace[2]['function'].'/', $lines[$backtrace[2]['line'] - 1], $matches);
65
+				if (isset($matches[1]) && isset($matches[1][self::$i])) {
66
+					return $matches[1][self::$i];
67 67
 				}
68 68
 			}
69 69
 		}
@@ -80,22 +80,22 @@  discard block
 block discarded – undo
80 80
 	 * 	@param 	string 	$hook
81 81
 	 * 	@return 	array
82 82
 	 */
83
-	public static function get_class_names_for_all_callbacks_on_hook( $hook = NULL ) {
83
+	public static function get_class_names_for_all_callbacks_on_hook($hook = NULL) {
84 84
 		global $wp_filter;
85 85
 		$class_names = array();
86 86
 		// are any callbacks registered for this hook ?
87
-		if ( isset( $wp_filter[ $hook ] )) {
87
+		if (isset($wp_filter[$hook])) {
88 88
 			// loop thru all of the callbacks attached to the deprecated hookpoint
89
-			foreach( $wp_filter[ $hook ] as $priority ) {
90
-				foreach( $priority as $callback ) {
89
+			foreach ($wp_filter[$hook] as $priority) {
90
+				foreach ($priority as $callback) {
91 91
 					// is the callback a non-static class method ?
92
-					if ( isset( $callback['function'] ) && is_array( $callback['function'] )) {
93
-						if ( isset( $callback['function'][0] ) && is_object( $callback['function'][0] )) {
94
-							$class_names[] = get_class( $callback['function'][0] );
92
+					if (isset($callback['function']) && is_array($callback['function'])) {
93
+						if (isset($callback['function'][0]) && is_object($callback['function'][0])) {
94
+							$class_names[] = get_class($callback['function'][0]);
95 95
 						}
96 96
 					// test for static method
97
-					} else if ( strpos( $callback['function'], '::' ) !== FALSE ) {
98
-						$class = explode( '::', $callback['function'] );
97
+					} else if (strpos($callback['function'], '::') !== FALSE) {
98
+						$class = explode('::', $callback['function']);
99 99
 						$class_names[] = $class[0];
100 100
 					} else {
101 101
 						// just a function
@@ -116,24 +116,24 @@  discard block
 block discarded – undo
116 116
 	 * 	@param		string 	$property
117 117
 	 * 	@return 		boolean
118 118
 	 */
119
-	public static function has_property( $class = NULL, $property = NULL ) {
119
+	public static function has_property($class = NULL, $property = NULL) {
120 120
 		// if $class or $property don't exist, then get out, cuz that would be like... fatal dude
121
-		if ( empty( $class ) || empty( $property )) {
121
+		if (empty($class) || empty($property)) {
122 122
 			return FALSE;
123 123
 		}
124 124
 		// if your hosting company doesn't cut the mustard
125
-		if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) {
125
+		if (version_compare(PHP_VERSION, '5.3.0') < 0) {
126 126
 			// just in case $class is an actual instantiated object
127
-			if ( is_object( $class )) {
128
-				return isset( $class->{$property} ) ? TRUE : FALSE;
127
+			if (is_object($class)) {
128
+				return isset($class->{$property} ) ? TRUE : FALSE;
129 129
 			} else {
130 130
 				// use reflection for < PHP 5.3 to get details using just the class name
131
-				$reflector = new ReflectionClass( $class );
132
-				return $reflector->hasProperty( $property );
131
+				$reflector = new ReflectionClass($class);
132
+				return $reflector->hasProperty($property);
133 133
 			}
134 134
 		} else {
135 135
 			// or try regular property exists method which works as expected in PHP 5.3+
136
-			return property_exists( $class, $property );
136
+			return property_exists($class, $property);
137 137
 		}
138 138
 	}
139 139
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 
145 145
 // if PHP version < 5.3
146
-if ( ! function_exists( 'get_called_class' )) {
146
+if ( ! function_exists('get_called_class')) {
147 147
 	/**
148 148
 	 * @return bool|string
149 149
 	 */
Please login to merge, or discard this patch.
core/helpers/EEH_Event_View.helper.php 4 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -89,7 +91,7 @@  discard block
 block discarded – undo
89 91
 			$payment_method_slug = EE_Registry::instance()->REQ->get( 'ee_payment_method', NULL );
90 92
 			if( $payment_method_slug ) {
91 93
 				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug( $payment_method_slug );
92
-			}else{
94
+			} else{
93 95
 				$payment_method = null;
94 96
 			}
95 97
 			/** @type EE_Payment_Processor $payment_processor */
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @access    public
40 40
 	 * @param    int $EVT_ID
41
-	 * @return    object
41
+	 * @return    null|boolean
42 42
 	 */
43 43
 	public static function get_event( $EVT_ID = 0 ) {
44 44
 		$EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint( $EVT_ID );
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 *  @access 	public
118 118
 	 * @param    int $EVT_ID
119
-	 *  @return 	string
119
+	 *  @return 	boolean
120 120
 	 */
121 121
 	public static function event_has_content_or_excerpt( $EVT_ID = 0 ) {
122 122
 		$event = EEH_Event_View::get_event( $EVT_ID );
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 *    event_active_status
137 137
 	 *
138 138
 	 * @access    public
139
-	 * @param null $num_words
139
+	 * @param integer $num_words
140 140
 	 * @param null $more
141 141
 	 * @return    string
142 142
 	 */
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 *
429 429
 	 * @access    public
430 430
 	 * @param int $EVT_ID
431
-	 * @param null $include_expired
431
+	 * @param false|null $include_expired
432 432
 	 * @param bool $include_deleted
433 433
 	 * @param null $limit
434 434
 	 * @return EE_Datetime[]
Please login to merge, or discard this patch.
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 			// admin has chosen "full description" for the "Event Espresso - Events > Templates > Display Description" option
149 149
 			the_content();
150 150
 		} else if (( is_archive() && has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() ) ) {
151
-            // admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option
151
+			// admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option
152 152
 			// AND an excerpt actually exists
153 153
 			the_excerpt();
154 154
 		} else if (( is_archive() && ! has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() )) {
155
-            // admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option
155
+			// admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option
156 156
 			// but NO excerpt actually exists, so we need to create one
157 157
 			if ( ! empty( $num_words )) {
158 158
 				if ( empty( $more )) {
@@ -161,32 +161,32 @@  discard block
 block discarded – undo
161 161
 					$more .= ' class="more-link"';
162 162
 					$more .= \EED_Events_Archive::link_target();
163 163
 					$more .= '>' . $more_link_text . '</a>';
164
-                    $more = apply_filters( 'the_content_more_link', $more, $more_link_text );
164
+					$more = apply_filters( 'the_content_more_link', $more, $more_link_text );
165 165
 				}
166 166
 				$content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' ));
167 167
 
168 168
 				$content =  wp_trim_words( $content, $num_words, ' ' ) . $more;
169
-            } else {
170
-                $content =  get_the_content();
169
+			} else {
170
+				$content =  get_the_content();
171 171
 			}
172 172
 			global $allowedtags;
173 173
 			// make sure links are allowed
174
-            $allowedtags['a'] = isset($allowedtags['a'])
175
-                ? $allowedtags['a']
176
-                : array();
177
-            // as well as target attribute
178
-            $allowedtags['a']['target'] = isset($allowedtags['a']['target'])
179
-                ? $allowedtags['a']['target']
180
-                : false;
181
-            // but get previous value so we can reset it
182
-            $prev_value = $allowedtags['a']['target'];
183
-            $allowedtags['a']['target'] = true;
174
+			$allowedtags['a'] = isset($allowedtags['a'])
175
+				? $allowedtags['a']
176
+				: array();
177
+			// as well as target attribute
178
+			$allowedtags['a']['target'] = isset($allowedtags['a']['target'])
179
+				? $allowedtags['a']['target']
180
+				: false;
181
+			// but get previous value so we can reset it
182
+			$prev_value = $allowedtags['a']['target'];
183
+			$allowedtags['a']['target'] = true;
184 184
 			$content = wp_kses( $content, $allowedtags );
185 185
 			$content = strip_shortcodes( $content );
186 186
 			echo apply_filters( 'the_content', $content );
187 187
 			$allowedtags['a']['target'] = $prev_value;
188
-        } else {
189
-            // admin has chosen "none" for the "Event Espresso - Events > Templates > Display Description" option
188
+		} else {
189
+			// admin has chosen "none" for the "Event Espresso - Events > Templates > Display Description" option
190 190
 			echo apply_filters( 'the_content', '' );
191 191
 		}
192 192
 		return ob_get_clean();
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 					$url = get_term_link( $term, 'espresso_venue_categories' );
235 235
 					if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) {
236 236
 						$category_links[] = '<a href="' . esc_url( $url )
237
-                                            . '" rel="tag"'
238
-                                            . \EED_Events_Archive::link_target()
239
-                                            .'>'
240
-                                            . $term->name
241
-                                            . '</a>';
237
+											. '" rel="tag"'
238
+											. \EED_Events_Archive::link_target()
239
+											.'>'
240
+											. $term->name
241
+											. '</a>';
242 242
 					}
243 243
 				}
244 244
 			}
Please login to merge, or discard this patch.
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -40,27 +40,27 @@  discard block
 block discarded – undo
40 40
 	 * @param    int $EVT_ID
41 41
 	 * @return    object
42 42
 	 */
43
-	public static function get_event( $EVT_ID = 0 ) {
44
-		$EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint( $EVT_ID );
43
+	public static function get_event($EVT_ID = 0) {
44
+		$EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint($EVT_ID);
45 45
 		// do we already have the Event  you are looking for?
46
-		if ( EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID ) {
46
+		if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) {
47 47
 			return EEH_Event_View::$_event;
48 48
 		}
49 49
 		EEH_Event_View::$_event = NULL;
50 50
 		// international newspaper?
51 51
 		global $post;
52 52
 		// if this is being called from an EE_Event post, then we can just grab the attached EE_Event object
53
-		 if ( isset( $post->post_type ) && $post->post_type == 'espresso_events' || $EVT_ID ) {
53
+		 if (isset($post->post_type) && $post->post_type == 'espresso_events' || $EVT_ID) {
54 54
 //			d( $post );
55 55
 			// grab the event we're looking for
56
-			if ( isset( $post->EE_Event ) && ( $EVT_ID == 0 || ( $EVT_ID == $post->ID ))) {
56
+			if (isset($post->EE_Event) && ($EVT_ID == 0 || ($EVT_ID == $post->ID))) {
57 57
 				EEH_Event_View::$_event = $post->EE_Event;
58 58
 //				d( EEH_Event_View::$_event );
59 59
 			}
60 60
 			// now if we STILL do NOT have an EE_Event model object, BUT we have an Event ID...
61
-			if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID ) {
61
+			if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
62 62
 				// sigh... pull it from the db
63
-				EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
63
+				EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
64 64
 //				d( EEH_Event_View::$_event );
65 65
 			}
66 66
 		}
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 * @param    int $EVT_ID
77 77
 	 * @return    boolean
78 78
 	 */
79
-	public static function display_ticket_selector( $EVT_ID = 0 ) {
80
-		$event = EEH_Event_View::get_event( $EVT_ID );
79
+	public static function display_ticket_selector($EVT_ID = 0) {
80
+		$event = EEH_Event_View::get_event($EVT_ID);
81 81
 		return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE;
82 82
 	}
83 83
 
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	 * @param    int $EVT_ID
91 91
 	 * @return    string
92 92
 	 */
93
-	public static function event_status( $EVT_ID = 0 ) {
94
-		$event = EEH_Event_View::get_event( $EVT_ID );
95
-		return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : '';
93
+	public static function event_status($EVT_ID = 0) {
94
+		$event = EEH_Event_View::get_event($EVT_ID);
95
+		return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : '';
96 96
 	}
97 97
 
98 98
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @param    int $EVT_ID
105 105
 	 *  @return 	string
106 106
 	 */
107
-	public static function event_active_status( $EVT_ID = 0 ) {
108
-		$event = EEH_Event_View::get_event( $EVT_ID );
107
+	public static function event_active_status($EVT_ID = 0) {
108
+		$event = EEH_Event_View::get_event($EVT_ID);
109 109
 		return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive';
110 110
 	}
111 111
 
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 	 * @param    int $EVT_ID
119 119
 	 *  @return 	string
120 120
 	 */
121
-	public static function event_has_content_or_excerpt( $EVT_ID = 0 ) {
122
-		$event = EEH_Event_View::get_event( $EVT_ID );
121
+	public static function event_has_content_or_excerpt($EVT_ID = 0) {
122
+		$event = EEH_Event_View::get_event($EVT_ID);
123 123
 		$has_content_or_excerpt = FALSE;
124
-		if ( $event instanceof EE_Event ) {
125
-			$has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE;
124
+		if ($event instanceof EE_Event) {
125
+			$has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE;
126 126
 		}
127
-		if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) {
127
+		if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) {
128 128
 			$has_content_or_excerpt = FALSE;
129 129
 		}
130 130
 		return $has_content_or_excerpt;
@@ -140,34 +140,34 @@  discard block
 block discarded – undo
140 140
 	 * @param null $more
141 141
 	 * @return    string
142 142
 	 */
143
-	public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) {
143
+	public static function event_content_or_excerpt($num_words = NULL, $more = NULL) {
144 144
 		global $post;
145 145
 
146 146
 		ob_start();
147
-		if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) {
147
+		if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) {
148 148
 			// admin has chosen "full description" for the "Event Espresso - Events > Templates > Display Description" option
149 149
 			the_content();
150
-		} else if (( is_archive() && has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() ) ) {
150
+		} else if ((is_archive() && has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) {
151 151
             // admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option
152 152
 			// AND an excerpt actually exists
153 153
 			the_excerpt();
154
-		} else if (( is_archive() && ! has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() )) {
154
+		} else if ((is_archive() && ! has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) {
155 155
             // admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option
156 156
 			// but NO excerpt actually exists, so we need to create one
157
-			if ( ! empty( $num_words )) {
158
-				if ( empty( $more )) {
159
-					$more_link_text = __( '(more&hellip;)' );
160
-					$more = ' <a href="' . get_permalink() . '"';
157
+			if ( ! empty($num_words)) {
158
+				if (empty($more)) {
159
+					$more_link_text = __('(more&hellip;)');
160
+					$more = ' <a href="'.get_permalink().'"';
161 161
 					$more .= ' class="more-link"';
162 162
 					$more .= \EED_Events_Archive::link_target();
163
-					$more .= '>' . $more_link_text . '</a>';
164
-                    $more = apply_filters( 'the_content_more_link', $more, $more_link_text );
163
+					$more .= '>'.$more_link_text.'</a>';
164
+                    $more = apply_filters('the_content_more_link', $more, $more_link_text);
165 165
 				}
166
-				$content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' ));
166
+				$content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK'));
167 167
 
168
-				$content =  wp_trim_words( $content, $num_words, ' ' ) . $more;
168
+				$content = wp_trim_words($content, $num_words, ' ').$more;
169 169
             } else {
170
-                $content =  get_the_content();
170
+                $content = get_the_content();
171 171
 			}
172 172
 			global $allowedtags;
173 173
 			// make sure links are allowed
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
             // but get previous value so we can reset it
182 182
             $prev_value = $allowedtags['a']['target'];
183 183
             $allowedtags['a']['target'] = true;
184
-			$content = wp_kses( $content, $allowedtags );
185
-			$content = strip_shortcodes( $content );
186
-			echo apply_filters( 'the_content', $content );
184
+			$content = wp_kses($content, $allowedtags);
185
+			$content = strip_shortcodes($content);
186
+			echo apply_filters('the_content', $content);
187 187
 			$allowedtags['a']['target'] = $prev_value;
188 188
         } else {
189 189
             // admin has chosen "none" for the "Event Espresso - Events > Templates > Display Description" option
190
-			echo apply_filters( 'the_content', '' );
190
+			echo apply_filters('the_content', '');
191 191
 		}
192 192
 		return ob_get_clean();
193 193
 	}
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 	 * @param    int $EVT_ID
202 202
 	 *  @return 	EE_Ticket[]
203 203
 	 */
204
-	public static function event_tickets_available( $EVT_ID = 0 ) {
205
-		$event = EEH_Event_View::get_event( $EVT_ID );
204
+	public static function event_tickets_available($EVT_ID = 0) {
205
+		$event = EEH_Event_View::get_event($EVT_ID);
206 206
 		$tickets_available_for_purchase = array();
207
-		if( $event instanceof EE_Event ) {
208
-			$datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE );
209
-			foreach( $datetimes as $datetime ) {
210
-				$tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() );
207
+		if ($event instanceof EE_Event) {
208
+			$datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE);
209
+			foreach ($datetimes as $datetime) {
210
+				$tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase());
211 211
 			}
212 212
 		}
213 213
 		return $tickets_available_for_purchase;
@@ -223,17 +223,17 @@  discard block
 block discarded – undo
223 223
 	 * @param 	  bool   $hide_uncategorized
224 224
 	 * @return    string
225 225
 	 */
226
-	public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) {
226
+	public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) {
227 227
 		$category_links = array();
228
-		$event = EEH_Event_View::get_event( $EVT_ID );
229
-		if ( $event instanceof EE_Event ) {
230
-			$event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' );
231
-			if ( $event_categories ) {
228
+		$event = EEH_Event_View::get_event($EVT_ID);
229
+		if ($event instanceof EE_Event) {
230
+			$event_categories = get_the_terms($event->ID(), 'espresso_event_categories');
231
+			if ($event_categories) {
232 232
 				// loop thru terms and create links
233
-				foreach ( $event_categories as $term ) {
234
-					$url = get_term_link( $term, 'espresso_venue_categories' );
235
-					if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) {
236
-						$category_links[] = '<a href="' . esc_url( $url )
233
+				foreach ($event_categories as $term) {
234
+					$url = get_term_link($term, 'espresso_venue_categories');
235
+					if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) {
236
+						$category_links[] = '<a href="'.esc_url($url)
237 237
                                             . '" rel="tag"'
238 238
                                             . \EED_Events_Archive::link_target()
239 239
                                             .'>'
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 				}
244 244
 			}
245 245
 		}
246
-		return implode( ', ', $category_links );
246
+		return implode(', ', $category_links);
247 247
 	}
248 248
 
249 249
 
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 * @param int    $EVT_ID
258 258
 	 * @return    string
259 259
 	 */
260
-	public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
261
-		$datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID );
262
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
263
-		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) :  '';
260
+	public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
261
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
262
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
263
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
264 264
 	}
265 265
 
266 266
 
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
 	 * @param int    $EVT_ID
275 275
 	 * @return    string
276 276
 	 */
277
-	public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
278
-		$datetime = EEH_Event_View::get_last_date_obj( $EVT_ID );
279
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
280
-		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : '';
277
+	public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
278
+		$datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
279
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
280
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
281 281
 	}
282 282
 
283 283
 
@@ -291,10 +291,10 @@  discard block
 block discarded – undo
291 291
 	 * @param int    $EVT_ID
292 292
 	 * @return    string
293 293
 	 */
294
-	public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
295
-		$datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID );
296
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
297
-		return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : '';
294
+	public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
295
+		$datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID);
296
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
297
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
298 298
 	}
299 299
 
300 300
 
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 	 * @param int    $EVT_ID
309 309
 	 * @return    string
310 310
 	 */
311
-	public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
312
-		$datetime = EEH_Event_View::get_last_date_obj( $EVT_ID );
313
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
314
-		return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : '';
311
+	public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
312
+		$datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
313
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
314
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
315 315
 	}
316 316
 
317 317
 
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 	 * @param int $EVT_ID
324 324
 	 * @return    string
325 325
 	 */
326
-	public static function event_date_as_calendar_page( $EVT_ID = 0 ) {
327
-		$datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID );
328
-		if ( $datetime instanceof EE_Datetime ) {
326
+	public static function event_date_as_calendar_page($EVT_ID = 0) {
327
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
328
+		if ($datetime instanceof EE_Datetime) {
329 329
 	?>
330 330
 		<div class="event-date-calendar-page-dv">
331
-			<div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime( 'DTT_EVT_start', 'M' );?></div>
332
-			<div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div>
331
+			<div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M'); ?></div>
332
+			<div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div>
333 333
 		</div>
334 334
 	<?php
335 335
 		}
@@ -344,17 +344,17 @@  discard block
 block discarded – undo
344 344
 	 * @param int $EVT_ID
345 345
 	 * @return    string
346 346
 	 */
347
-	public static function get_primary_date_obj( $EVT_ID = 0 ) {
348
-		$event = EEH_Event_View::get_event( $EVT_ID );
349
-		if ( $event instanceof EE_Event ) {
347
+	public static function get_primary_date_obj($EVT_ID = 0) {
348
+		$event = EEH_Event_View::get_event($EVT_ID);
349
+		if ($event instanceof EE_Event) {
350 350
 			$datetimes = $event->get_many_related(
351 351
 				'Datetime',
352 352
 				array(
353 353
 					'limit' => 1,
354
-					'order_by' => array( 'DTT_order' => 'ASC' )
354
+					'order_by' => array('DTT_order' => 'ASC')
355 355
 				)
356 356
 			);
357
-			return reset( $datetimes );
357
+			return reset($datetimes);
358 358
 		} else {
359 359
 			 return FALSE;
360 360
 		}
@@ -369,17 +369,17 @@  discard block
 block discarded – undo
369 369
 	 * @param int $EVT_ID
370 370
 	 * @return    string
371 371
 	 */
372
-	public static function get_last_date_obj( $EVT_ID = 0 ) {
373
-		$event = EEH_Event_View::get_event( $EVT_ID );
374
-		if ( $event instanceof EE_Event ) {
372
+	public static function get_last_date_obj($EVT_ID = 0) {
373
+		$event = EEH_Event_View::get_event($EVT_ID);
374
+		if ($event instanceof EE_Event) {
375 375
 			$datetimes = $event->get_many_related(
376 376
 				'Datetime',
377 377
 				array(
378 378
 					'limit' => 1,
379
-					'order_by' => array( 'DTT_order' => 'DESC' )
379
+					'order_by' => array('DTT_order' => 'DESC')
380 380
 				)
381 381
 			);
382
-			return end( $datetimes );
382
+			return end($datetimes);
383 383
 		} else {
384 384
 			return FALSE;
385 385
 		}
@@ -394,17 +394,17 @@  discard block
 block discarded – undo
394 394
 	 * @param int $EVT_ID
395 395
 	 * @return    string
396 396
 	 */
397
-	public static function get_earliest_date_obj( $EVT_ID = 0 ) {
398
-		$event = EEH_Event_View::get_event( $EVT_ID );
399
-		if ( $event instanceof EE_Event ) {
397
+	public static function get_earliest_date_obj($EVT_ID = 0) {
398
+		$event = EEH_Event_View::get_event($EVT_ID);
399
+		if ($event instanceof EE_Event) {
400 400
 			$datetimes = $event->get_many_related(
401 401
 				'Datetime',
402 402
 				array(
403 403
 					'limit' => 1,
404
-					'order_by' => array( 'DTT_EVT_start' => 'ASC' )
404
+					'order_by' => array('DTT_EVT_start' => 'ASC')
405 405
 				)
406 406
 			);
407
-			return reset( $datetimes );
407
+			return reset($datetimes);
408 408
 		} else {
409 409
 			 return FALSE;
410 410
 		}
@@ -419,17 +419,17 @@  discard block
 block discarded – undo
419 419
 	 * @param int $EVT_ID
420 420
 	 * @return    string
421 421
 	 */
422
-	public static function get_latest_date_obj( $EVT_ID = 0 ) {
423
-		$event = EEH_Event_View::get_event( $EVT_ID );
424
-		if ( $event instanceof EE_Event ) {
422
+	public static function get_latest_date_obj($EVT_ID = 0) {
423
+		$event = EEH_Event_View::get_event($EVT_ID);
424
+		if ($event instanceof EE_Event) {
425 425
 			$datetimes = $event->get_many_related(
426 426
 				'Datetime',
427 427
 				array(
428 428
 					'limit' => 1,
429
-					'order_by' => array( 'DTT_EVT_start' => 'DESC' )
429
+					'order_by' => array('DTT_EVT_start' => 'DESC')
430 430
 				)
431 431
 			);
432
-			return end( $datetimes );
432
+			return end($datetimes);
433 433
 		} else {
434 434
 			return FALSE;
435 435
 		}
@@ -447,17 +447,17 @@  discard block
 block discarded – undo
447 447
 	 * @param null $limit
448 448
 	 * @return EE_Datetime[]
449 449
 	 */
450
-	public static function get_all_date_obj( $EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL ) {
451
-		$event = EEH_Event_View::get_event( $EVT_ID );
452
-		if($include_expired === null){
453
-			if($event instanceof EE_Event && $event->is_expired()){
450
+	public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL) {
451
+		$event = EEH_Event_View::get_event($EVT_ID);
452
+		if ($include_expired === null) {
453
+			if ($event instanceof EE_Event && $event->is_expired()) {
454 454
 				$include_expired = true;
455
-			}else{
455
+			} else {
456 456
 				$include_expired = false;
457 457
 			}
458 458
 		}
459 459
 
460
-		if ( $event instanceof EE_Event ) {
460
+		if ($event instanceof EE_Event) {
461 461
 			return $event->datetimes_ordered($include_expired, $include_deleted, $limit);
462 462
 		} else {
463 463
 			 return array();
@@ -473,11 +473,11 @@  discard block
 block discarded – undo
473 473
 	 * @param int $EVT_ID
474 474
 	 * @return    string
475 475
 	 */
476
-	public static function event_link_url( $EVT_ID = 0 ) {
477
-		$event = EEH_Event_View::get_event( $EVT_ID );
478
-		if ( $event instanceof EE_Event ) {
479
-			$url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() );
480
-			return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url;
476
+	public static function event_link_url($EVT_ID = 0) {
477
+		$event = EEH_Event_View::get_event($EVT_ID);
478
+		if ($event instanceof EE_Event) {
479
+			$url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID());
480
+			return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url;
481 481
 		}
482 482
 		return NULL;
483 483
 	}
@@ -491,10 +491,10 @@  discard block
 block discarded – undo
491 491
 	 * @param int $EVT_ID
492 492
 	 * @return    string
493 493
 	 */
494
-	public static function event_phone( $EVT_ID = 0 ) {
495
-		$event = EEH_Event_View::get_event( $EVT_ID );
496
-		if ( $event instanceof EE_Event ) {
497
-			return EEH_Schema::telephone( $event->phone() );
494
+	public static function event_phone($EVT_ID = 0) {
495
+		$event = EEH_Event_View::get_event($EVT_ID);
496
+		if ($event instanceof EE_Event) {
497
+			return EEH_Schema::telephone($event->phone());
498 498
 		}
499 499
 		return NULL;
500 500
 	}
@@ -511,26 +511,26 @@  discard block
 block discarded – undo
511 511
 	 * @param string $after
512 512
 	 * @return    string
513 513
 	 */
514
-	public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) {
515
-		$event = EEH_Event_View::get_event( $EVT_ID );
516
-		if ( $event instanceof EE_Event ) {
514
+	public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') {
515
+		$event = EEH_Event_View::get_event($EVT_ID);
516
+		if ($event instanceof EE_Event) {
517 517
 			// can the user edit this post ?
518
-			if ( current_user_can( 'edit_post', $event->ID() )) {
518
+			if (current_user_can('edit_post', $event->ID())) {
519 519
 				// set link text
520
-				$link_text = ! empty( $link ) ? $link : __('edit this event');
520
+				$link_text = ! empty($link) ? $link : __('edit this event');
521 521
 				// generate nonce
522
-				$nonce = wp_create_nonce( 'edit_nonce' );
522
+				$nonce = wp_create_nonce('edit_nonce');
523 523
 				// generate url to event editor for this event
524
-				$url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() );
524
+				$url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url());
525 525
 				// get edit CPT text
526
-				$post_type_obj = get_post_type_object( 'espresso_events' );
526
+				$post_type_obj = get_post_type_object('espresso_events');
527 527
 				// build final link html
528
-				$link = '<a class="post-edit-link" href="' . $url . '" ';
529
-				$link .= ' title="' . esc_attr( $post_type_obj->labels->edit_item ) . '"';
528
+				$link = '<a class="post-edit-link" href="'.$url.'" ';
529
+				$link .= ' title="'.esc_attr($post_type_obj->labels->edit_item).'"';
530 530
 				$link .= \EED_Events_Archive::link_target();
531
-				$link .='>' . $link_text . '</a>';
531
+				$link .= '>'.$link_text.'</a>';
532 532
 				// put it all together
533
-				return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after;
533
+				return $before.apply_filters('edit_post_link', $link, $event->ID()).$after;
534 534
 			}
535 535
 		}
536 536
 		return '';
Please login to merge, or discard this patch.
core/helpers/EEH_File.helper.php 4 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -595,8 +595,6 @@
 block discarded – undo
595 595
 	 * converts it into a "remote" filepath (the filepath the currently-in-use 
596 596
 	 * $wp_filesystem needs to use access the folder or file).
597 597
 	 * See http://wordpress.stackexchange.com/questions/124900/using-wp-filesystem-in-plugins
598
-	 * @param WP_Filesystem_Base $wp_filesystem we aren't initially sure which one
599
-	 * is in use, so you need to provide it
600 598
 	 * @param string $local_filepath the filepath to the folder/file locally
601 599
 	 * @return string the remote filepath (eg the filepath the filesystem method, eg 
602 600
 	 * ftp or ssh, will use to access the folder
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -325,8 +325,8 @@
 block discarded – undo
325 325
 		//eg if given "/var/something/somewhere/", we want to get "somewhere"'s
326 326
 		//parent folder, "/var/something/"
327 327
 		$ds = strlen($file_or_folder_path) > 1
328
-            ? strrpos($file_or_folder_path, DS, -2)
329
-            : strlen($file_or_folder_path);
328
+			? strrpos($file_or_folder_path, DS, -2)
329
+			: strlen($file_or_folder_path);
330 330
 		return substr($file_or_folder_path, 0, $ds + 1);
331 331
 	}
332 332
 
Please login to merge, or discard this patch.
Spacing   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
  * @ version		 	4.0
13 13
  *
14 14
  */
15
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
16
-require_once( EE_INTERFACES . 'EEI_Interfaces.php' );
15
+require_once(EE_HELPERS.'EEH_Base.helper.php');
16
+require_once(EE_INTERFACES.'EEI_Interfaces.php');
17 17
 /**
18 18
  *
19 19
  * Class EEH_File
@@ -52,30 +52,30 @@  discard block
 block discarded – undo
52 52
 	 * @throws EE_Error if filesystem credentials are required
53 53
 	 * @return WP_Filesystem_Base
54 54
 	 */
55
-	private static function _get_wp_filesystem( $filepath = null) {
56
-		if( apply_filters(
55
+	private static function _get_wp_filesystem($filepath = null) {
56
+		if (apply_filters(
57 57
 				'FHEE__EEH_File___get_wp_filesystem__allow_using_filesystem_direct',
58
-				$filepath && EEH_File::is_in_uploads_folder( $filepath ),
59
-				$filepath ) ) {
60
-			if( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct ) {
61
-				require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
58
+				$filepath && EEH_File::is_in_uploads_folder($filepath),
59
+				$filepath )) {
60
+			if ( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct) {
61
+				require_once(ABSPATH.'wp-admin/includes/class-wp-filesystem-base.php');
62 62
 				$method = 'direct';
63
-				$wp_filesystem_direct_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );
63
+				$wp_filesystem_direct_file = apply_filters('filesystem_method_file', ABSPATH.'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method);
64 64
 				//check constants defined, just like in wp-admin/includes/file.php's WP_Filesystem()
65
-				if ( ! defined('FS_CHMOD_DIR') ) {
66
-					define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) );
65
+				if ( ! defined('FS_CHMOD_DIR')) {
66
+					define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0777 | 0755));
67 67
 				}
68
-				if ( ! defined('FS_CHMOD_FILE') ) {
69
-					define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
68
+				if ( ! defined('FS_CHMOD_FILE')) {
69
+					define('FS_CHMOD_FILE', (fileperms(ABSPATH.'index.php') & 0777 | 0644));
70 70
 				}
71
-				require_once( $wp_filesystem_direct_file );
72
-				EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct( array() );
71
+				require_once($wp_filesystem_direct_file);
72
+				EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct(array());
73 73
 			}
74 74
 			return EEH_File::$_wp_filesystem_direct;
75 75
 		}
76 76
 		global $wp_filesystem;
77 77
 		// no filesystem setup ???
78
-		if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
78
+		if ( ! $wp_filesystem instanceof WP_Filesystem_Base) {
79 79
 			// if some eager beaver's just trying to get in there too early...
80 80
 			// let them do it, because we are one of those eager beavers! :P
81 81
 			/**
@@ -88,34 +88,34 @@  discard block
 block discarded – undo
88 88
 			 * and there may be troubles if the WP files are owned by a different user
89 89
 			 * than the server user. But both of these issues should exist in 4.4 and earlier too
90 90
 			 */
91
-			if ( FALSE && ! did_action( 'wp_loaded' )) {
91
+			if (FALSE && ! did_action('wp_loaded')) {
92 92
 				$msg = __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso');
93
-				if ( WP_DEBUG ) {
94
-					$msg .= '<br />' .  __('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso');
93
+				if (WP_DEBUG) {
94
+					$msg .= '<br />'.__('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso');
95 95
 				}
96
-				throw new EE_Error( $msg );
96
+				throw new EE_Error($msg);
97 97
 			} else {
98 98
 				// should be loaded if we are past the wp_loaded hook...
99
-				if ( ! function_exists( 'WP_Filesystem' )) {
100
-					require_once( ABSPATH . 'wp-admin/includes/file.php' );
101
-					require_once( ABSPATH . 'wp-admin/includes/template.php' );
99
+				if ( ! function_exists('WP_Filesystem')) {
100
+					require_once(ABSPATH.'wp-admin/includes/file.php');
101
+					require_once(ABSPATH.'wp-admin/includes/template.php');
102 102
 				}
103 103
 				// turn on output buffering so that we can capture the credentials form
104 104
 				ob_start();
105
-				$credentials = request_filesystem_credentials( '' );
105
+				$credentials = request_filesystem_credentials('');
106 106
 				// store credentials form for the time being
107 107
 				EEH_File::$_credentials_form = ob_get_clean();
108 108
 				// basically check for direct or previously configured access
109
-				if ( ! WP_Filesystem( $credentials ) ) {
109
+				if ( ! WP_Filesystem($credentials)) {
110 110
 					// if credentials do NOT exist
111
-					if ( $credentials === FALSE ) {
112
-						add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 );
113
-						throw new EE_Error( __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'));
114
-					} elseif( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
115
-						add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 );
111
+					if ($credentials === FALSE) {
112
+						add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999);
113
+						throw new EE_Error(__('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'));
114
+					} elseif (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
115
+						add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999);
116 116
 						throw new EE_Error(
117 117
 								sprintf(
118
-										__( 'WP Filesystem Error: $1%s', 'event_espresso' ),
118
+										__('WP Filesystem Error: $1%s', 'event_espresso'),
119 119
 										$wp_filesystem->errors->get_error_message() ) );
120 120
 					}
121 121
 				}
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 * display_request_filesystem_credentials_form
129 129
 	 */
130 130
 	public static function display_request_filesystem_credentials_form() {
131
-		if ( ! empty( EEH_File::$_credentials_form )) {
132
-			echo '<div class="updated espresso-notices-attention"><p>' . EEH_File::$_credentials_form . '</p></div>';
131
+		if ( ! empty(EEH_File::$_credentials_form)) {
132
+			echo '<div class="updated espresso-notices-attention"><p>'.EEH_File::$_credentials_form.'</p></div>';
133 133
 		}
134 134
 	}
135 135
 
@@ -147,29 +147,29 @@  discard block
 block discarded – undo
147 147
 	 * @throws EE_Error if filesystem credentials are required
148 148
 	 * @return bool
149 149
 	 */
150
-	public static function verify_filepath_and_permissions( $full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '' ) {
150
+	public static function verify_filepath_and_permissions($full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '') {
151 151
 		// load WP_Filesystem and set file permissions
152
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
153
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
154
-		if ( ! $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) )) {
155
-			$file_name = ! empty( $type_of_file ) ? $file_name . ' ' . $type_of_file : $file_name;
156
-			$file_name .= ! empty( $file_ext ) ? ' file' : ' folder';
152
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
153
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
154
+		if ( ! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
155
+			$file_name = ! empty($type_of_file) ? $file_name.' '.$type_of_file : $file_name;
156
+			$file_name .= ! empty($file_ext) ? ' file' : ' folder';
157 157
 			$msg = sprintf(
158
-				__( 'The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso' ),
158
+				__('The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso'),
159 159
 				$file_name,
160 160
 				'<br />'
161 161
 			);
162
-			if ( EEH_File::exists( $full_file_path )) {
163
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, $type_of_file );
162
+			if (EEH_File::exists($full_file_path)) {
163
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, $type_of_file);
164 164
 			} else {
165 165
 				// no file permissions means the file was not found
166 166
 				$msg .= sprintf(
167
-					__( 'Please ensure the following path is correct: "%s".', 'event_espresso' ),
167
+					__('Please ensure the following path is correct: "%s".', 'event_espresso'),
168 168
 					$full_file_path
169 169
 				);
170 170
 			}
171
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
172
-				throw new EE_Error( $msg . '||' . $msg );
171
+			if (defined('WP_DEBUG') && WP_DEBUG) {
172
+				throw new EE_Error($msg.'||'.$msg);
173 173
 			}
174 174
 			return FALSE;
175 175
 		}
@@ -187,24 +187,24 @@  discard block
 block discarded – undo
187 187
 	 * @throws EE_Error if filesystem credentials are required
188 188
 	 * @return string
189 189
 	 */
190
-	private static function _permissions_error_for_unreadable_filepath( $full_file_path = '', $type_of_file = '' ){
190
+	private static function _permissions_error_for_unreadable_filepath($full_file_path = '', $type_of_file = '') {
191 191
 		// load WP_Filesystem and set file permissions
192
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
192
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
193 193
 		// check file permissions
194
-		$perms = $wp_filesystem->getchmod( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) );
195
-		if ( $perms ) {
194
+		$perms = $wp_filesystem->getchmod(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path));
195
+		if ($perms) {
196 196
 			// file permissions exist, but way be set incorrectly
197
-			$type_of_file = ! empty( $type_of_file ) ? $type_of_file . ' ' : '';
198
-			$type_of_file .= ! empty( $type_of_file ) ? 'file' : 'folder';
197
+			$type_of_file = ! empty($type_of_file) ? $type_of_file.' ' : '';
198
+			$type_of_file .= ! empty($type_of_file) ? 'file' : 'folder';
199 199
 			return sprintf(
200
-				__( 'File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso' ),
200
+				__('File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso'),
201 201
 				$type_of_file,
202 202
 				$perms
203 203
 			);
204 204
 		} else {
205 205
 			// file exists but file permissions could not be read ?!?!
206 206
 			return sprintf(
207
-				__( 'Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso' ),
207
+				__('Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso'),
208 208
 				$full_file_path
209 209
 			);
210 210
 		}
@@ -222,35 +222,35 @@  discard block
 block discarded – undo
222 222
 	 * can't write to it
223 223
 	 * @return bool false if folder isn't writable; true if it exists and is writeable,
224 224
 	 */
225
-	public static function ensure_folder_exists_and_is_writable( $folder = '' ){
226
-		if ( empty( $folder )) {
225
+	public static function ensure_folder_exists_and_is_writable($folder = '') {
226
+		if (empty($folder)) {
227 227
 			return false;
228 228
 		}
229 229
 		// remove ending DS
230
-		$folder = EEH_File::standardise_directory_separators( rtrim( $folder, '/\\' ));
231
-		$parent_folder = EEH_File::get_parent_folder( $folder );
230
+		$folder = EEH_File::standardise_directory_separators(rtrim($folder, '/\\'));
231
+		$parent_folder = EEH_File::get_parent_folder($folder);
232 232
 		// add DS to folder
233
-		$folder = EEH_File::end_with_directory_separator( $folder );
234
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $folder );
235
-		if ( ! $wp_filesystem->is_dir( EEH_File::convert_local_filepath_to_remote_filepath( $folder ) ) ) {
233
+		$folder = EEH_File::end_with_directory_separator($folder);
234
+		$wp_filesystem = EEH_File::_get_wp_filesystem($folder);
235
+		if ( ! $wp_filesystem->is_dir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) {
236 236
 			//ok so it doesn't exist. Does its parent? Can we write to it?
237
-			if(	! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
237
+			if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) {
238 238
 				return false;
239 239
 			}
240
-			if ( ! EEH_File::verify_is_writable( $parent_folder, 'folder' )) {
240
+			if ( ! EEH_File::verify_is_writable($parent_folder, 'folder')) {
241 241
 				return false;
242 242
 			} else {
243
-				if ( ! $wp_filesystem->mkdir( EEH_File::convert_local_filepath_to_remote_filepath(  $folder ) ) ) {
244
-					if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
245
-						$msg = sprintf( __( '"%s" could not be created.', 'event_espresso' ), $folder );
246
-						$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $folder );
247
-						throw new EE_Error( $msg );
243
+				if ( ! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) {
244
+					if (defined('WP_DEBUG') && WP_DEBUG) {
245
+						$msg = sprintf(__('"%s" could not be created.', 'event_espresso'), $folder);
246
+						$msg .= EEH_File::_permissions_error_for_unreadable_filepath($folder);
247
+						throw new EE_Error($msg);
248 248
 					}
249 249
 					return false;
250 250
 				}
251
-				EEH_File::add_index_file( $folder );
251
+				EEH_File::add_index_file($folder);
252 252
 			}
253
-		} elseif ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
253
+		} elseif ( ! EEH_File::verify_is_writable($folder, 'folder')) {
254 254
 			return false;
255 255
 		}
256 256
 		return true;
@@ -265,15 +265,15 @@  discard block
 block discarded – undo
265 265
 	 * @throws EE_Error if filesystem credentials are required
266 266
 	 * @return bool
267 267
 	 */
268
-	public static function verify_is_writable( $full_path = '', $file_or_folder = 'folder' ){
268
+	public static function verify_is_writable($full_path = '', $file_or_folder = 'folder') {
269 269
 		// load WP_Filesystem and set file permissions
270
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_path );
271
-		$full_path = EEH_File::standardise_directory_separators( $full_path );
272
-		if ( ! $wp_filesystem->is_writable( EEH_File::convert_local_filepath_to_remote_filepath( $full_path ) ) ) {
273
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
274
-				$msg = sprintf( __( 'The "%1$s" %2$s is not writable.', 'event_espresso' ), $full_path, $file_or_folder );
275
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_path );
276
-				throw new EE_Error( $msg );
270
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_path);
271
+		$full_path = EEH_File::standardise_directory_separators($full_path);
272
+		if ( ! $wp_filesystem->is_writable(EEH_File::convert_local_filepath_to_remote_filepath($full_path))) {
273
+			if (defined('WP_DEBUG') && WP_DEBUG) {
274
+				$msg = sprintf(__('The "%1$s" %2$s is not writable.', 'event_espresso'), $full_path, $file_or_folder);
275
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_path);
276
+				throw new EE_Error($msg);
277 277
 			}
278 278
 			return FALSE;
279 279
 		}
@@ -290,25 +290,25 @@  discard block
 block discarded – undo
290 290
 	 * @throws EE_Error if filesystem credentials are required
291 291
 	 * @return bool
292 292
 	 */
293
-	public static function ensure_file_exists_and_is_writable( $full_file_path = '' ) {
293
+	public static function ensure_file_exists_and_is_writable($full_file_path = '') {
294 294
 		// load WP_Filesystem and set file permissions
295
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
296
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
297
-		$parent_folder = EEH_File::get_parent_folder( $full_file_path );
298
-		if ( ! EEH_File::exists( $full_file_path )) {
299
-			if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
295
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
296
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
297
+		$parent_folder = EEH_File::get_parent_folder($full_file_path);
298
+		if ( ! EEH_File::exists($full_file_path)) {
299
+			if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) {
300 300
 				return false;
301 301
 			}
302
-			if ( ! $wp_filesystem->touch( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) {
303
-				if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
304
-					$msg = sprintf( __( 'The "%s" file could not be created.', 'event_espresso' ), $full_file_path );
305
-					$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path );
306
-					throw new EE_Error( $msg );
302
+			if ( ! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
303
+				if (defined('WP_DEBUG') && WP_DEBUG) {
304
+					$msg = sprintf(__('The "%s" file could not be created.', 'event_espresso'), $full_file_path);
305
+					$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path);
306
+					throw new EE_Error($msg);
307 307
 				}
308 308
 				return false;
309 309
 			}
310 310
 		}
311
-		if ( ! EEH_File::verify_is_writable( $full_file_path, 'file' )) {
311
+		if ( ! EEH_File::verify_is_writable($full_file_path, 'file')) {
312 312
 			return false;
313 313
 		}
314 314
 		return true;
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 * @param string $file_or_folder_path
321 321
 	 * @return string parent folder, ENDING with a directory separator
322 322
 	 */
323
-	public static function get_parent_folder( $file_or_folder_path ) {
323
+	public static function get_parent_folder($file_or_folder_path) {
324 324
 		//find the last DS, ignoring a DS on the very end
325 325
 		//eg if given "/var/something/somewhere/", we want to get "somewhere"'s
326 326
 		//parent folder, "/var/something/"
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
 	 * @throws EE_Error if filesystem credentials are required
343 343
 	 * @return string
344 344
 	 */
345
-	public static function get_file_contents( $full_file_path = '' ){
346
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
347
-		if ( EEH_File::verify_filepath_and_permissions( $full_file_path, EEH_File::get_filename_from_filepath( $full_file_path ) , EEH_File::get_file_extension( $full_file_path ))) {
345
+	public static function get_file_contents($full_file_path = '') {
346
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
347
+		if (EEH_File::verify_filepath_and_permissions($full_file_path, EEH_File::get_filename_from_filepath($full_file_path), EEH_File::get_file_extension($full_file_path))) {
348 348
 			// load WP_Filesystem and set file permissions
349
-			$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
350
-			return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) );
349
+			$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
350
+			return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path));
351 351
 		}
352 352
 		return '';
353 353
 	}
@@ -362,26 +362,26 @@  discard block
 block discarded – undo
362 362
 	 * @throws EE_Error if filesystem credentials are required
363 363
 	 * @return bool
364 364
 	 */
365
-	public static function write_to_file( $full_file_path = '', $file_contents = '', $file_type = '' ){
366
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
367
-		$file_type = ! empty( $file_type ) ? rtrim( $file_type, ' ' ) . ' ' : '';
368
-		$folder = EEH_File::remove_filename_from_filepath( $full_file_path );
369
-		if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
370
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
371
-				$msg = sprintf( __( 'The %1$sfile located at "%2$s" is not writable.', 'event_espresso' ), $file_type, $full_file_path );
372
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path );
373
-				throw new EE_Error( $msg );
365
+	public static function write_to_file($full_file_path = '', $file_contents = '', $file_type = '') {
366
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
367
+		$file_type = ! empty($file_type) ? rtrim($file_type, ' ').' ' : '';
368
+		$folder = EEH_File::remove_filename_from_filepath($full_file_path);
369
+		if ( ! EEH_File::verify_is_writable($folder, 'folder')) {
370
+			if (defined('WP_DEBUG') && WP_DEBUG) {
371
+				$msg = sprintf(__('The %1$sfile located at "%2$s" is not writable.', 'event_espresso'), $file_type, $full_file_path);
372
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path);
373
+				throw new EE_Error($msg);
374 374
 			}
375 375
 			return FALSE;
376 376
 		}
377 377
 		// load WP_Filesystem and set file permissions
378
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
378
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
379 379
 		// write the file
380
-		if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ), $file_contents )) {
381
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
382
-				$msg = sprintf( __( 'The %1$sfile located at "%2$s" could not be written to.', 'event_espresso' ), $file_type, $full_file_path );
383
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, 'f' );
384
-				throw new EE_Error( $msg );
380
+		if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path), $file_contents)) {
381
+			if (defined('WP_DEBUG') && WP_DEBUG) {
382
+				$msg = sprintf(__('The %1$sfile located at "%2$s" could not be written to.', 'event_espresso'), $file_type, $full_file_path);
383
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, 'f');
384
+				throw new EE_Error($msg);
385 385
 			}
386 386
 			return FALSE;
387 387
 		}
@@ -397,9 +397,9 @@  discard block
 block discarded – undo
397 397
 	 * @throws EE_Error if filesystem credentials are required
398 398
 	 * @return boolean
399 399
 	 */
400
-	public static function delete( $filepath, $recursive = false, $type = false ) {
400
+	public static function delete($filepath, $recursive = false, $type = false) {
401 401
 		$wp_filesystem = EEH_File::_get_wp_filesystem();
402
-		return $wp_filesystem->delete( $filepath, $recursive, $type ) ? TRUE : FALSE;
402
+		return $wp_filesystem->delete($filepath, $recursive, $type) ? TRUE : FALSE;
403 403
 	}
404 404
 
405 405
 
@@ -411,9 +411,9 @@  discard block
 block discarded – undo
411 411
 	 * @throws EE_Error if filesystem credentials are required
412 412
 	 * @return bool
413 413
 	 */
414
-	public static function exists( $full_file_path = '' ) {
415
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
416
-		return $wp_filesystem->exists( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ? TRUE : FALSE;
414
+	public static function exists($full_file_path = '') {
415
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
416
+		return $wp_filesystem->exists(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)) ? TRUE : FALSE;
417 417
 	}
418 418
 
419 419
 
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 	 * @throws EE_Error if filesystem credentials are required
427 427
 	 * @return bool
428 428
 	 */
429
-	public static function is_readable( $full_file_path = '' ) {
430
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
431
-		if( $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath(  $full_file_path ) ) ) {
429
+	public static function is_readable($full_file_path = '') {
430
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
431
+		if ($wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
432 432
 			return true;
433 433
 		} else {
434 434
 			return false;
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 	 * @param string $full_file_path
445 445
 	 * @return string
446 446
 	 */
447
-	public static function remove_filename_from_filepath( $full_file_path = '' ) {
448
-		return pathinfo( $full_file_path, PATHINFO_DIRNAME );
447
+	public static function remove_filename_from_filepath($full_file_path = '') {
448
+		return pathinfo($full_file_path, PATHINFO_DIRNAME);
449 449
 	}
450 450
 
451 451
 
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
 	 * @param string $full_file_path
456 456
 	 * @return string
457 457
 	 */
458
-	public static function get_filename_from_filepath( $full_file_path = '' ) {
459
-		return pathinfo( $full_file_path, PATHINFO_BASENAME );
458
+	public static function get_filename_from_filepath($full_file_path = '') {
459
+		return pathinfo($full_file_path, PATHINFO_BASENAME);
460 460
 	}
461 461
 
462 462
 
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 	 * @param string $full_file_path
467 467
 	 * @return string
468 468
 	 */
469
-	public static function get_file_extension( $full_file_path = '' ) {
470
-		return pathinfo( $full_file_path, PATHINFO_EXTENSION );
469
+	public static function get_file_extension($full_file_path = '') {
470
+		return pathinfo($full_file_path, PATHINFO_EXTENSION);
471 471
 	}
472 472
 
473 473
 
@@ -478,10 +478,10 @@  discard block
 block discarded – undo
478 478
 	 * @throws EE_Error if filesystem credentials are required
479 479
 	 * @return bool
480 480
 	 */
481
-	public static function add_htaccess_deny_from_all( $folder = '' ) {
482
-		$folder = EEH_File::standardise_and_end_with_directory_separator( $folder );
483
-		if ( ! EEH_File::exists( $folder . '.htaccess' ) ) {
484
-			if ( ! EEH_File::write_to_file( $folder . '.htaccess', 'deny from all', '.htaccess' )) {
481
+	public static function add_htaccess_deny_from_all($folder = '') {
482
+		$folder = EEH_File::standardise_and_end_with_directory_separator($folder);
483
+		if ( ! EEH_File::exists($folder.'.htaccess')) {
484
+			if ( ! EEH_File::write_to_file($folder.'.htaccess', 'deny from all', '.htaccess')) {
485 485
 				return FALSE;
486 486
 			}
487 487
 		}
@@ -495,10 +495,10 @@  discard block
 block discarded – undo
495 495
 	 * @throws EE_Error if filesystem credentials are required
496 496
 	 * @return boolean
497 497
 	 */
498
-	public static function add_index_file( $folder ) {
499
-		$folder = EEH_File::standardise_and_end_with_directory_separator( $folder );
500
-		if ( ! EEH_File::exists( $folder . 'index.php' ) ) {
501
-			if ( ! EEH_File::write_to_file( $folder . 'index.php', 'You are not permitted to read from this folder', '.php' )) {
498
+	public static function add_index_file($folder) {
499
+		$folder = EEH_File::standardise_and_end_with_directory_separator($folder);
500
+		if ( ! EEH_File::exists($folder.'index.php')) {
501
+			if ( ! EEH_File::write_to_file($folder.'index.php', 'You are not permitted to read from this folder', '.php')) {
502 502
 				return false;
503 503
 			}
504 504
 		}
@@ -513,11 +513,11 @@  discard block
 block discarded – undo
513 513
 	 * @param string $file_path
514 514
 	 * @return string
515 515
 	 */
516
-	public static function get_classname_from_filepath_with_standard_filename( $file_path ){
516
+	public static function get_classname_from_filepath_with_standard_filename($file_path) {
517 517
 		//extract file from path
518
-		$filename = basename( $file_path );
518
+		$filename = basename($file_path);
519 519
 		//now remove the first period and everything after
520
-		$pos_of_first_period = strpos( $filename,'.' );
520
+		$pos_of_first_period = strpos($filename, '.');
521 521
 		return substr($filename, 0, $pos_of_first_period);
522 522
 	}
523 523
 
@@ -529,8 +529,8 @@  discard block
 block discarded – undo
529 529
 	 * @param string $file_path
530 530
 	 * @return string
531 531
 	 */
532
-	public static function standardise_directory_separators( $file_path ){
533
-		return str_replace( array( '\\', '/' ), DS, $file_path );
532
+	public static function standardise_directory_separators($file_path) {
533
+		return str_replace(array('\\', '/'), DS, $file_path);
534 534
 	}
535 535
 
536 536
 
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
 	 * @param string $file_path
542 542
 	 * @return string
543 543
 	 */
544
-	public static function end_with_directory_separator( $file_path ){
545
-		return rtrim( $file_path, '/\\' ) . DS;
544
+	public static function end_with_directory_separator($file_path) {
545
+		return rtrim($file_path, '/\\').DS;
546 546
 	}
547 547
 
548 548
 
@@ -552,8 +552,8 @@  discard block
 block discarded – undo
552 552
 	 * @param $file_path
553 553
 	 * @return string
554 554
 	 */
555
-	public static function standardise_and_end_with_directory_separator( $file_path ){
556
-		return self::end_with_directory_separator( self::standardise_directory_separators( $file_path ));
555
+	public static function standardise_and_end_with_directory_separator($file_path) {
556
+		return self::end_with_directory_separator(self::standardise_directory_separators($file_path));
557 557
 	}
558 558
 
559 559
 
@@ -570,21 +570,21 @@  discard block
 block discarded – undo
570 570
 	 *		if $index_numerically == FALSE (Default) keys are what the class names SHOULD be;
571 571
 	 *		 and values are their filepaths
572 572
 	 */
573
-	public static function get_contents_of_folders( $folder_paths = array(), $index_numerically = FALSE ){
573
+	public static function get_contents_of_folders($folder_paths = array(), $index_numerically = FALSE) {
574 574
 		$class_to_folder_path = array();
575
-		foreach( $folder_paths as $folder_path ){
576
-			$folder_path = self::standardise_and_end_with_directory_separator( $folder_path );
575
+		foreach ($folder_paths as $folder_path) {
576
+			$folder_path = self::standardise_and_end_with_directory_separator($folder_path);
577 577
 			// load WP_Filesystem and set file permissions
578
-			$files_in_folder = glob( $folder_path . '*' );
578
+			$files_in_folder = glob($folder_path.'*');
579 579
 			$class_to_folder_path = array();
580
-			if ( $files_in_folder ) {
581
-				foreach( $files_in_folder as $file_path ){
580
+			if ($files_in_folder) {
581
+				foreach ($files_in_folder as $file_path) {
582 582
 					//only add files, not folders
583
-					if ( ! is_dir( $file_path )) {
584
-						if ( $index_numerically ) {
583
+					if ( ! is_dir($file_path)) {
584
+						if ($index_numerically) {
585 585
 							$class_to_folder_path[] = $file_path;
586 586
 						} else {
587
-							$classname = self::get_classname_from_filepath_with_standard_filename( $file_path );
587
+							$classname = self::get_classname_from_filepath_with_standard_filename($file_path);
588 588
 							$class_to_folder_path[$classname] = $file_path;
589 589
 						}
590 590
 					}
@@ -604,39 +604,39 @@  discard block
 block discarded – undo
604 604
 	 * @throws EE_Error if filesystem credentials are required
605 605
 	 * @return boolean success
606 606
 	 */
607
-	public static function copy( $source_file, $destination_file, $overwrite = FALSE ){
608
-		$full_source_path = EEH_File::standardise_directory_separators( $source_file );
609
-		if( ! EEH_File::exists( $full_source_path ) ){
610
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
611
-				$msg = sprintf( __( 'The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso' ), $full_source_path );
612
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path );
613
-				throw new EE_Error( $msg );
607
+	public static function copy($source_file, $destination_file, $overwrite = FALSE) {
608
+		$full_source_path = EEH_File::standardise_directory_separators($source_file);
609
+		if ( ! EEH_File::exists($full_source_path)) {
610
+			if (defined('WP_DEBUG') && WP_DEBUG) {
611
+				$msg = sprintf(__('The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso'), $full_source_path);
612
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path);
613
+				throw new EE_Error($msg);
614 614
 			}
615 615
 			return FALSE;
616 616
 		}
617 617
 
618
-		$full_dest_path = EEH_File::standardise_directory_separators( $destination_file );
619
-		$folder = EEH_File::remove_filename_from_filepath( $full_dest_path );
620
-		if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
621
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
622
-				$msg = sprintf( __( 'The file located at "%2$s" is not writable.', 'event_espresso' ), $full_dest_path );
623
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_dest_path );
624
-				throw new EE_Error( $msg );
618
+		$full_dest_path = EEH_File::standardise_directory_separators($destination_file);
619
+		$folder = EEH_File::remove_filename_from_filepath($full_dest_path);
620
+		if ( ! EEH_File::verify_is_writable($folder, 'folder')) {
621
+			if (defined('WP_DEBUG') && WP_DEBUG) {
622
+				$msg = sprintf(__('The file located at "%2$s" is not writable.', 'event_espresso'), $full_dest_path);
623
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_dest_path);
624
+				throw new EE_Error($msg);
625 625
 			}
626 626
 			return FALSE;
627 627
 		}
628 628
 
629 629
 		// load WP_Filesystem and set file permissions
630
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $destination_file );
630
+		$wp_filesystem = EEH_File::_get_wp_filesystem($destination_file);
631 631
 		// write the file
632 632
 		if ( ! $wp_filesystem->copy(
633
-						EEH_File::convert_local_filepath_to_remote_filepath( $full_source_path ),
634
-						EEH_File::convert_local_filepath_to_remote_filepath( $full_dest_path ),
633
+						EEH_File::convert_local_filepath_to_remote_filepath($full_source_path),
634
+						EEH_File::convert_local_filepath_to_remote_filepath($full_dest_path),
635 635
 						$overwrite )) {
636
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
637
-				$msg = sprintf( __( 'Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso' ), $full_source_path );
638
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path, 'f' );
639
-				throw new EE_Error( $msg );
636
+			if (defined('WP_DEBUG') && WP_DEBUG) {
637
+				$msg = sprintf(__('Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso'), $full_source_path);
638
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path, 'f');
639
+				throw new EE_Error($msg);
640 640
 			}
641 641
 			return FALSE;
642 642
 		}
@@ -648,9 +648,9 @@  discard block
 block discarded – undo
648 648
 	 * @param string $filepath
649 649
 	 * @return boolean
650 650
 	 */
651
-	public static function is_in_uploads_folder( $filepath ) {
651
+	public static function is_in_uploads_folder($filepath) {
652 652
 		$uploads = wp_upload_dir();
653
-		return strpos( $filepath, $uploads[ 'basedir' ] ) === 0 ? true : false;
653
+		return strpos($filepath, $uploads['basedir']) === 0 ? true : false;
654 654
 	}
655 655
 
656 656
 	/**
@@ -665,9 +665,9 @@  discard block
 block discarded – undo
665 665
 	 * @return string the remote filepath (eg the filepath the filesystem method, eg
666 666
 	 * ftp or ssh, will use to access the folder
667 667
 	 */
668
-	public static function convert_local_filepath_to_remote_filepath( $local_filepath ) {
669
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $local_filepath );
670
-		return str_replace( WP_CONTENT_DIR . DS, $wp_filesystem->wp_content_dir(), $local_filepath );
668
+	public static function convert_local_filepath_to_remote_filepath($local_filepath) {
669
+		$wp_filesystem = EEH_File::_get_wp_filesystem($local_filepath);
670
+		return str_replace(WP_CONTENT_DIR.DS, $wp_filesystem->wp_content_dir(), $local_filepath);
671 671
 	}
672 672
 }
673 673
 // End of file EEH_File.helper.php
Please login to merge, or discard this patch.
core/helpers/EEH_Line_Item.helper.php 4 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91 91
 		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92 92
 			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
93
+		} else{
94 94
 			return parent::finalize_payment_for( $transaction );
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 	 * Deletes ALL children of the passed line item
611 611
 	 *
612 612
 	 * @param EE_Line_Item $parent_line_item
613
-	 * @return bool
613
+	 * @return integer
614 614
 	 */
615 615
 	public static function delete_all_child_items( EE_Line_Item $parent_line_item ) {
616 616
 		$deleted = 0;
@@ -848,6 +848,7 @@  discard block
 block discarded – undo
848 848
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
849 849
 	 * @param string $line_item_type one of the EEM_Line_Item constants
850 850
 	 * @param string | NULL $obj_type object model class name (minus prefix) or NULL to ignore object type when searching
851
+	 * @param string $obj_type
851 852
 	 * @return EE_Line_Item[]
852 853
 	 */
853 854
 	protected static function _get_descendants_by_type_and_object_type( EE_Line_Item $parent_line_item, $line_item_type, $obj_type = NULL ) {
@@ -873,7 +874,7 @@  discard block
 block discarded – undo
873 874
 	 * @uses  EEH_Line_Item::_get_descendants_by_type_and_object_type()
874 875
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
875 876
 	 * @param string $OBJ_type object type (like Event)
876
-	 * @param array $OBJ_IDs array of OBJ_IDs
877
+	 * @param string[] $OBJ_IDs array of OBJ_IDs
877 878
 	 * @return EE_Line_Item[]
878 879
 	 */
879 880
 	public static function get_line_items_by_object_type_and_IDs( EE_Line_Item $parent_line_item, $OBJ_type = '', $OBJ_IDs = array() ) {
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -551,15 +551,15 @@  discard block
 block discarded – undo
551 551
 	}
552 552
 
553 553
 	/**
554
-	  * Given the grand total line item and a ticket, finds the event sub-total
555
-	  * line item the ticket's purchase should be added onto
556
-	  *
557
-	  * @access public
558
-	  * @param EE_Line_Item $grand_total the grand total line item
559
-	  * @param EE_Ticket $ticket
560
-	  * @throws \EE_Error
561
-	  * @return EE_Line_Item
562
-	  */
554
+	 * Given the grand total line item and a ticket, finds the event sub-total
555
+	 * line item the ticket's purchase should be added onto
556
+	 *
557
+	 * @access public
558
+	 * @param EE_Line_Item $grand_total the grand total line item
559
+	 * @param EE_Ticket $ticket
560
+	 * @throws \EE_Error
561
+	 * @return EE_Line_Item
562
+	 */
563 563
 	public static function get_event_line_item_for_ticket( EE_Line_Item $grand_total, EE_Ticket $ticket ) {
564 564
 		$first_datetime = $ticket->first_datetime();
565 565
 		if ( ! $first_datetime instanceof EE_Datetime ) {
@@ -807,22 +807,22 @@  discard block
 block discarded – undo
807 807
 		$add_to_existing_line_item = false
808 808
 	) {
809 809
 		$tax_subtotal = self::get_taxes_subtotal( $total_line_item );
810
-            $taxable_total = $total_line_item->taxable_total();
811
-
812
-            if( $add_to_existing_line_item ) {
813
-                $new_tax = $tax_subtotal->get_child_line_item( $code );
814
-	            EEM_Line_Item::instance()->delete(
815
-		            array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) )
816
-	            );
817
-            } else {
818
-                $new_tax = null;
819
-                $tax_subtotal->delete_children_line_items();
820
-            }
821
-            if( $new_tax ) {
822
-                $new_tax->set_total( $new_tax->total() + $amount );
823
-                $new_tax->set_percent( $taxable_total ? $new_tax->total() / $taxable_total * 100 : 0 );
824
-            } else {
825
-                //no existing tax item. Create it
810
+			$taxable_total = $total_line_item->taxable_total();
811
+
812
+			if( $add_to_existing_line_item ) {
813
+				$new_tax = $tax_subtotal->get_child_line_item( $code );
814
+				EEM_Line_Item::instance()->delete(
815
+					array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) )
816
+				);
817
+			} else {
818
+				$new_tax = null;
819
+				$tax_subtotal->delete_children_line_items();
820
+			}
821
+			if( $new_tax ) {
822
+				$new_tax->set_total( $new_tax->total() + $amount );
823
+				$new_tax->set_percent( $taxable_total ? $new_tax->total() / $taxable_total * 100 : 0 );
824
+			} else {
825
+				//no existing tax item. Create it
826 826
 				$new_tax = EE_Line_Item::new_instance( array(
827 827
 					'TXN_ID'      => $total_line_item->TXN_ID(),
828 828
 					'LIN_name'    => $name ? $name : __( 'Tax', 'event_espresso' ),
@@ -835,16 +835,16 @@  discard block
 block discarded – undo
835 835
 				) );
836 836
 			}
837 837
 
838
-            $new_tax = apply_filters(
838
+			$new_tax = apply_filters(
839 839
 				'FHEE__EEH_Line_Item__set_total_tax_to__new_tax_subtotal',
840 840
 				$new_tax,
841 841
 				$total_line_item
842
-            );
843
-            $new_tax->save();
844
-            $tax_subtotal->set_total( $new_tax->total() );
845
-            $tax_subtotal->save();
846
-            $total_line_item->recalculate_total_including_taxes();
847
-            return $new_tax;
842
+			);
843
+			$new_tax->save();
844
+			$tax_subtotal->set_total( $new_tax->total() );
845
+			$tax_subtotal->save();
846
+			$total_line_item->recalculate_total_including_taxes();
847
+			return $new_tax;
848 848
 	}
849 849
 
850 850
 
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 			if ( $child_line_item instanceof EE_Line_Item ) {
991 991
 				if (
992 992
 					$child_line_item->type() === $line_item_type
993
-				    && (
993
+					&& (
994 994
 						$child_line_item->OBJ_type() === $obj_type || $obj_type === null
995 995
 					)
996 996
 				) {
Please login to merge, or discard this patch.
Spacing   +346 added lines, -346 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  *
4 4
  * EEH_Line_Item
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @return boolean success
46 46
 	 * @throws \EE_Error
47 47
 	 */
48
-	public static function add_unrelated_item( EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL  ){
49
-		$items_subtotal = self::get_pre_tax_subtotal( $parent_line_item );
48
+	public static function add_unrelated_item(EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL) {
49
+		$items_subtotal = self::get_pre_tax_subtotal($parent_line_item);
50 50
 		$line_item = EE_Line_Item::new_instance(array(
51 51
 			'LIN_name' => $name,
52 52
 			'LIN_desc' => $description,
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			'LIN_quantity' => $quantity,
55 55
 			'LIN_percent' => null,
56 56
 			'LIN_is_taxable' => $taxable,
57
-			'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count( $items_subtotal->children() ) : 0,
57
+			'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count($items_subtotal->children()) : 0,
58 58
 			'LIN_total' => (float) $unit_price * (int) $quantity,
59 59
 			'LIN_type'=>  EEM_Line_Item::type_line_item,
60 60
 			'LIN_code' => $code,
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			$line_item,
65 65
 			$parent_line_item
66 66
 		);
67
-		return self::add_item( $parent_line_item, $line_item );
67
+		return self::add_item($parent_line_item, $line_item);
68 68
 	}
69 69
 
70 70
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @return boolean success
87 87
 	 * @throws \EE_Error
88 88
 	 */
89
-	public static function add_percentage_based_item( EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE ){
89
+	public static function add_percentage_based_item(EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE) {
90 90
 		$line_item = EE_Line_Item::new_instance(array(
91 91
 			'LIN_name' => $name,
92 92
 			'LIN_desc' => $description,
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 			'LIN_percent' => $percentage_amount,
95 95
 			'LIN_quantity' => NULL,
96 96
 			'LIN_is_taxable' => $taxable,
97
-			'LIN_total' => (float) ( $percentage_amount * ( $parent_line_item->total() / 100 ) ),
97
+			'LIN_total' => (float) ($percentage_amount * ($parent_line_item->total() / 100)),
98 98
 			'LIN_type'=>  EEM_Line_Item::type_line_item,
99 99
 			'LIN_parent' => $parent_line_item->ID()
100 100
 		));
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			'FHEE__EEH_Line_Item__add_percentage_based_item__line_item',
103 103
 			$line_item
104 104
 		);
105
-		return self::add_item( $parent_line_item, $line_item );
105
+		return self::add_item($parent_line_item, $line_item);
106 106
 	}
107 107
 
108 108
 
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 	 * @return \EE_Line_Item
124 124
 	 * @throws \EE_Error
125 125
 	 */
126
-	public static function add_ticket_purchase( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ){
127
-		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total() ) {
128
-			throw new EE_Error( sprintf( __( 'A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso' ), $ticket->ID(), $total_line_item->ID() ) );
126
+	public static function add_ticket_purchase(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
127
+		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total()) {
128
+			throw new EE_Error(sprintf(__('A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso'), $ticket->ID(), $total_line_item->ID()));
129 129
 		}
130 130
 		// either increment the qty for an existing ticket
131
-		$line_item = self::increment_ticket_qty_if_already_in_cart( $total_line_item, $ticket, $qty );
131
+		$line_item = self::increment_ticket_qty_if_already_in_cart($total_line_item, $ticket, $qty);
132 132
 		// or add a new one
133
-		if ( ! $line_item instanceof EE_Line_Item ) {
134
-			$line_item = self::create_ticket_line_item( $total_line_item, $ticket, $qty );
133
+		if ( ! $line_item instanceof EE_Line_Item) {
134
+			$line_item = self::create_ticket_line_item($total_line_item, $ticket, $qty);
135 135
 		}
136 136
 		$total_line_item->recalculate_total_including_taxes();
137 137
 		return $line_item;
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 	 * @return \EE_Line_Item
148 148
 	 * @throws \EE_Error
149 149
 	 */
150
-	public static function increment_ticket_qty_if_already_in_cart( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
150
+	public static function increment_ticket_qty_if_already_in_cart(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
151 151
 		$line_item = null;
152
-		if ( $total_line_item instanceof EE_Line_Item && $total_line_item->is_total() ) {
153
-			$ticket_line_items = EEH_Line_Item::get_ticket_line_items( $total_line_item );
154
-			foreach ( (array)$ticket_line_items as $ticket_line_item ) {
152
+		if ($total_line_item instanceof EE_Line_Item && $total_line_item->is_total()) {
153
+			$ticket_line_items = EEH_Line_Item::get_ticket_line_items($total_line_item);
154
+			foreach ((array) $ticket_line_items as $ticket_line_item) {
155 155
 				if (
156 156
 					$ticket_line_item instanceof EE_Line_Item
157 157
 					&& (int) $ticket_line_item->OBJ_ID() === (int) $ticket->ID()
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 				}
162 162
 			}
163 163
 		}
164
-		if ( $line_item instanceof EE_Line_Item ) {
165
-			EEH_Line_Item::increment_quantity( $line_item, $qty );
164
+		if ($line_item instanceof EE_Line_Item) {
165
+			EEH_Line_Item::increment_quantity($line_item, $qty);
166 166
 			return $line_item;
167 167
 		}
168 168
 		return null;
@@ -179,16 +179,16 @@  discard block
 block discarded – undo
179 179
 	 * @return void
180 180
 	 * @throws \EE_Error
181 181
 	 */
182
-	public static function increment_quantity( EE_Line_Item $line_item, $qty = 1 ) {
183
-		if( ! $line_item->is_percent() ) {
182
+	public static function increment_quantity(EE_Line_Item $line_item, $qty = 1) {
183
+		if ( ! $line_item->is_percent()) {
184 184
 			$qty += $line_item->quantity();
185
-			$line_item->set_quantity( $qty );
186
-			$line_item->set_total( $line_item->unit_price() * $qty );
185
+			$line_item->set_quantity($qty);
186
+			$line_item->set_total($line_item->unit_price() * $qty);
187 187
 			$line_item->save();
188 188
 		}
189
-		foreach( $line_item->children() as $child ) {
190
-			if( $child->is_sub_line_item() ) {
191
-				EEH_Line_Item::update_quantity( $child, $qty );
189
+		foreach ($line_item->children() as $child) {
190
+			if ($child->is_sub_line_item()) {
191
+				EEH_Line_Item::update_quantity($child, $qty);
192 192
 			}
193 193
 		}
194 194
 	}
@@ -204,17 +204,17 @@  discard block
 block discarded – undo
204 204
 	 * @return void
205 205
 	 * @throws \EE_Error
206 206
 	 */
207
-	public static function decrement_quantity( EE_Line_Item $line_item, $qty = 1 ) {
208
-		if( ! $line_item->is_percent() ) {
207
+	public static function decrement_quantity(EE_Line_Item $line_item, $qty = 1) {
208
+		if ( ! $line_item->is_percent()) {
209 209
 			$qty = $line_item->quantity() - $qty;
210
-			$qty = max( $qty, 0 );
211
-			$line_item->set_quantity( $qty );
212
-			$line_item->set_total( $line_item->unit_price() * $qty );
210
+			$qty = max($qty, 0);
211
+			$line_item->set_quantity($qty);
212
+			$line_item->set_total($line_item->unit_price() * $qty);
213 213
 			$line_item->save();
214 214
 		}
215
-		foreach( $line_item->children() as $child ) {
216
-			if( $child->is_sub_line_item() ) {
217
-				EEH_Line_Item::update_quantity( $child, $qty );
215
+		foreach ($line_item->children() as $child) {
216
+			if ($child->is_sub_line_item()) {
217
+				EEH_Line_Item::update_quantity($child, $qty);
218 218
 			}
219 219
 		}
220 220
 	}
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
 	 * @param int          $new_quantity
230 230
 	 * @throws \EE_Error
231 231
 	 */
232
-	public static function update_quantity( EE_Line_Item $line_item, $new_quantity ) {
233
-		if( ! $line_item->is_percent() ) {
234
-			$line_item->set_quantity( $new_quantity );
235
-			$line_item->set_total( $line_item->unit_price() * $new_quantity );
232
+	public static function update_quantity(EE_Line_Item $line_item, $new_quantity) {
233
+		if ( ! $line_item->is_percent()) {
234
+			$line_item->set_quantity($new_quantity);
235
+			$line_item->set_total($line_item->unit_price() * $new_quantity);
236 236
 			$line_item->save();
237 237
 		}
238
-		foreach( $line_item->children() as $child ) {
239
-			if( $child->is_sub_line_item() ) {
240
-				EEH_Line_Item::update_quantity( $child, $new_quantity );
238
+		foreach ($line_item->children() as $child) {
239
+			if ($child->is_sub_line_item()) {
240
+				EEH_Line_Item::update_quantity($child, $new_quantity);
241 241
 			}
242 242
 		}
243 243
 	}
@@ -252,43 +252,43 @@  discard block
 block discarded – undo
252 252
 	 * @return \EE_Line_Item
253 253
 	 * @throws \EE_Error
254 254
 	 */
255
-	public static function create_ticket_line_item( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
255
+	public static function create_ticket_line_item(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
256 256
 		$datetimes = $ticket->datetimes();
257
-		$first_datetime = reset( $datetimes );
258
-		if( $first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event ) {
257
+		$first_datetime = reset($datetimes);
258
+		if ($first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event) {
259 259
 			$first_datetime_name = $first_datetime->event()->name();
260 260
 		} else {
261
-			$first_datetime_name = __( 'Event', 'event_espresso' );
261
+			$first_datetime_name = __('Event', 'event_espresso');
262 262
 		}
263
-		$event = sprintf( _x( '(For %1$s)', '(For Event Name)', 'event_espresso' ), $first_datetime_name );
263
+		$event = sprintf(_x('(For %1$s)', '(For Event Name)', 'event_espresso'), $first_datetime_name);
264 264
 		// get event subtotal line
265
-		$events_sub_total = self::get_event_line_item_for_ticket( $total_line_item, $ticket );
265
+		$events_sub_total = self::get_event_line_item_for_ticket($total_line_item, $ticket);
266 266
 		// add $ticket to cart
267
-		$line_item = EE_Line_Item::new_instance( array(
267
+		$line_item = EE_Line_Item::new_instance(array(
268 268
 			'LIN_name'       	=> $ticket->name(),
269
-			'LIN_desc'       		=> $ticket->description() !== '' ? $ticket->description() . ' ' . $event : $event,
269
+			'LIN_desc'       		=> $ticket->description() !== '' ? $ticket->description().' '.$event : $event,
270 270
 			'LIN_unit_price' 	=> $ticket->price(),
271 271
 			'LIN_quantity'   	=> $qty,
272 272
 			'LIN_is_taxable' 	=> $ticket->taxable(),
273
-			'LIN_order'      	=> count( $events_sub_total->children() ),
273
+			'LIN_order'      	=> count($events_sub_total->children()),
274 274
 			'LIN_total'      		=> $ticket->price() * $qty,
275 275
 			'LIN_type'       		=> EEM_Line_Item::type_line_item,
276 276
 			'OBJ_ID'         		=> $ticket->ID(),
277 277
 			'OBJ_type'       	=> 'Ticket'
278
-		) );
278
+		));
279 279
 		$line_item = apply_filters(
280 280
 			'FHEE__EEH_Line_Item__create_ticket_line_item__line_item',
281 281
 			$line_item
282 282
 		);
283
-		$events_sub_total->add_child_line_item( $line_item );
283
+		$events_sub_total->add_child_line_item($line_item);
284 284
 		//now add the sub-line items
285 285
 		$running_total_for_ticket = 0;
286
-		foreach ( $ticket->prices( array( 'order_by' => array( 'PRC_order' => 'ASC' ) ) ) as $price ) {
286
+		foreach ($ticket->prices(array('order_by' => array('PRC_order' => 'ASC'))) as $price) {
287 287
 			$sign = $price->is_discount() ? -1 : 1;
288 288
 			$price_total = $price->is_percent()
289 289
 				? $running_total_for_ticket * $price->amount() / 100
290 290
 				: $price->amount() * $qty;
291
-			$sub_line_item = EE_Line_Item::new_instance( array(
291
+			$sub_line_item = EE_Line_Item::new_instance(array(
292 292
 				'LIN_name'       	=> $price->name(),
293 293
 				'LIN_desc'       		=> $price->desc(),
294 294
 				'LIN_quantity'   	=> $price->is_percent() ? null : $qty,
@@ -298,18 +298,18 @@  discard block
 block discarded – undo
298 298
 				'LIN_type'       		=> EEM_Line_Item::type_sub_line_item,
299 299
 				'OBJ_ID'         		=> $price->ID(),
300 300
 				'OBJ_type'       	=> 'Price'
301
-			) );
301
+			));
302 302
 			$sub_line_item = apply_filters(
303 303
 				'FHEE__EEH_Line_Item__create_ticket_line_item__sub_line_item',
304 304
 				$sub_line_item
305 305
 			);
306
-			if ( $price->is_percent() ) {
307
-				$sub_line_item->set_percent( $sign * $price->amount() );
306
+			if ($price->is_percent()) {
307
+				$sub_line_item->set_percent($sign * $price->amount());
308 308
 			} else {
309
-				$sub_line_item->set_unit_price( $sign * $price->amount() );
309
+				$sub_line_item->set_unit_price($sign * $price->amount());
310 310
 			}
311 311
 			$running_total_for_ticket += $price_total;
312
-			$line_item->add_child_line_item( $sub_line_item );
312
+			$line_item->add_child_line_item($sub_line_item);
313 313
 		}
314 314
 		return $line_item;
315 315
 	}
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	 * @return boolean
330 330
 	 * @throws \EE_Error
331 331
 	 */
332
-	public static function add_item( EE_Line_Item $total_line_item, EE_Line_Item $item ){
333
-		$pre_tax_subtotal = self::get_pre_tax_subtotal( $total_line_item );
334
-		if ( $pre_tax_subtotal instanceof EE_Line_Item ){
332
+	public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item) {
333
+		$pre_tax_subtotal = self::get_pre_tax_subtotal($total_line_item);
334
+		if ($pre_tax_subtotal instanceof EE_Line_Item) {
335 335
 			$success = $pre_tax_subtotal->add_child_line_item($item);
336
-		}else{
336
+		} else {
337 337
 			return FALSE;
338 338
 		}
339 339
 		$total_line_item->recalculate_total_including_taxes();
@@ -352,34 +352,34 @@  discard block
 block discarded – undo
352 352
 	 * @return bool success
353 353
 	 * @throws \EE_Error
354 354
 	 */
355
-	public static function cancel_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
355
+	public static function cancel_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) {
356 356
 		// validate incoming line_item
357
-		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
357
+		if ($ticket_line_item->OBJ_type() !== 'Ticket') {
358 358
 			throw new EE_Error(
359 359
 				sprintf(
360
-					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
360
+					__('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'),
361 361
 					$ticket_line_item->type()
362 362
 				)
363 363
 			);
364 364
 		}
365
-		if ( $ticket_line_item->quantity() < $qty ) {
365
+		if ($ticket_line_item->quantity() < $qty) {
366 366
 			throw new EE_Error(
367 367
 				sprintf(
368
-					__( 'Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso' ),
368
+					__('Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso'),
369 369
 					$qty,
370 370
 					$ticket_line_item->quantity()
371 371
 				)
372 372
 			);
373 373
 		}
374 374
 		// decrement ticket quantity; don't rely on auto-fixing when recalculating totals to do this
375
-		$ticket_line_item->set_quantity( $ticket_line_item->quantity() - $qty );
376
-		foreach( $ticket_line_item->children() as $child_line_item ) {
377
-			if(
375
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() - $qty);
376
+		foreach ($ticket_line_item->children() as $child_line_item) {
377
+			if (
378 378
 				$child_line_item->is_sub_line_item()
379 379
 				&& ! $child_line_item->is_percent()
380 380
 				&& ! $child_line_item->is_cancellation()
381 381
 			) {
382
-				$child_line_item->set_quantity( $child_line_item->quantity() - $qty );
382
+				$child_line_item->set_quantity($child_line_item->quantity() - $qty);
383 383
 			}
384 384
 		}
385 385
 		// get cancellation sub line item
@@ -387,37 +387,37 @@  discard block
 block discarded – undo
387 387
 			$ticket_line_item,
388 388
 			EEM_Line_Item::type_cancellation
389 389
 		);
390
-		$cancellation_line_item = reset( $cancellation_line_item );
390
+		$cancellation_line_item = reset($cancellation_line_item);
391 391
 		// verify that this ticket was indeed previously cancelled
392
-		if ( $cancellation_line_item instanceof EE_Line_Item ) {
392
+		if ($cancellation_line_item instanceof EE_Line_Item) {
393 393
 			// increment cancelled quantity
394
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() + $qty );
394
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() + $qty);
395 395
 		} else {
396 396
 			// create cancellation sub line item
397
-			$cancellation_line_item = EE_Line_Item::new_instance( array(
398
-				'LIN_name'       => __( 'Cancellation', 'event_espresso' ),
397
+			$cancellation_line_item = EE_Line_Item::new_instance(array(
398
+				'LIN_name'       => __('Cancellation', 'event_espresso'),
399 399
 				'LIN_desc'       => sprintf(
400
-					_x( 'Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso' ),
400
+					_x('Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso'),
401 401
 					$ticket_line_item->name(),
402
-					current_time( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) )
402
+					current_time(get_option('date_format').' '.get_option('time_format'))
403 403
 				),
404 404
 				'LIN_unit_price' => 0, // $ticket_line_item->unit_price()
405 405
 				'LIN_quantity'   => $qty,
406 406
 				'LIN_is_taxable' => $ticket_line_item->is_taxable(),
407
-				'LIN_order'      => count( $ticket_line_item->children() ),
407
+				'LIN_order'      => count($ticket_line_item->children()),
408 408
 				'LIN_total'      => 0, // $ticket_line_item->unit_price()
409 409
 				'LIN_type'       => EEM_Line_Item::type_cancellation,
410
-			) );
411
-			$ticket_line_item->add_child_line_item( $cancellation_line_item );
410
+			));
411
+			$ticket_line_item->add_child_line_item($cancellation_line_item);
412 412
 		}
413
-		if ( $ticket_line_item->save_this_and_descendants() > 0 ) {
413
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
414 414
 			// decrement parent line item quantity
415 415
 			$event_line_item = $ticket_line_item->parent();
416
-			if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) {
417
-				$event_line_item->set_quantity( $event_line_item->quantity() - $qty );
416
+			if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') {
417
+				$event_line_item->set_quantity($event_line_item->quantity() - $qty);
418 418
 				$event_line_item->save();
419 419
 			}
420
-			EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item );
420
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
421 421
 			return true;
422 422
 		}
423 423
 		return false;
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
 	 * @return bool success
436 436
 	 * @throws \EE_Error
437 437
 	 */
438
-	public static function reinstate_canceled_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
438
+	public static function reinstate_canceled_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) {
439 439
 		// validate incoming line_item
440
-		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
440
+		if ($ticket_line_item->OBJ_type() !== 'Ticket') {
441 441
 			throw new EE_Error(
442 442
 				sprintf(
443
-					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
443
+					__('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'),
444 444
 					$ticket_line_item->type()
445 445
 				)
446 446
 			);
@@ -450,42 +450,42 @@  discard block
 block discarded – undo
450 450
 			$ticket_line_item,
451 451
 			EEM_Line_Item::type_cancellation
452 452
 		);
453
-		$cancellation_line_item = reset( $cancellation_line_item );
453
+		$cancellation_line_item = reset($cancellation_line_item);
454 454
 		// verify that this ticket was indeed previously cancelled
455
-		if ( ! $cancellation_line_item instanceof EE_Line_Item ) {
455
+		if ( ! $cancellation_line_item instanceof EE_Line_Item) {
456 456
 			return false;
457 457
 		}
458
-		if ( $cancellation_line_item->quantity() > $qty ) {
458
+		if ($cancellation_line_item->quantity() > $qty) {
459 459
 			// decrement cancelled quantity
460
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty );
461
-		} else if ( $cancellation_line_item->quantity() == $qty ) {
460
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
461
+		} else if ($cancellation_line_item->quantity() == $qty) {
462 462
 			// decrement cancelled quantity in case anyone still has the object kicking around
463
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty );
463
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
464 464
 			// delete because quantity will end up as 0
465 465
 			$cancellation_line_item->delete();
466 466
 			// and attempt to destroy the object,
467 467
 			// even though PHP won't actually destroy it until it needs the memory
468
-			unset( $cancellation_line_item );
468
+			unset($cancellation_line_item);
469 469
 		} else {
470 470
 			// what ?!?! negative quantity ?!?!
471 471
 			throw new EE_Error(
472 472
 				sprintf(
473
-					__( 'Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
474
-						'event_espresso' ),
473
+					__('Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
474
+						'event_espresso'),
475 475
 					$qty,
476 476
 					$cancellation_line_item->quantity()
477 477
 				)
478 478
 			);
479 479
 		}
480 480
 		// increment ticket quantity
481
-		$ticket_line_item->set_quantity( $ticket_line_item->quantity() + $qty );
482
-		if ( $ticket_line_item->save_this_and_descendants() > 0 ) {
481
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() + $qty);
482
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
483 483
 			// increment parent line item quantity
484 484
 			$event_line_item = $ticket_line_item->parent();
485
-			if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) {
486
-				$event_line_item->set_quantity( $event_line_item->quantity() + $qty );
485
+			if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') {
486
+				$event_line_item->set_quantity($event_line_item->quantity() + $qty);
487 487
 			}
488
-			EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item );
488
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
489 489
 			return true;
490 490
 		}
491 491
 		return false;
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 	 * @param EE_Line_Item $line_item
501 501
 	 * @return \EE_Line_Item
502 502
 	 */
503
-	public static function get_grand_total_and_recalculate_everything( EE_Line_Item $line_item ){
504
-		$grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item );
503
+	public static function get_grand_total_and_recalculate_everything(EE_Line_Item $line_item) {
504
+		$grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item);
505 505
 		return $grand_total_line_item->recalculate_total_including_taxes();
506 506
 	}
507 507
 
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 	 * @return \EE_Line_Item
515 515
 	 * @throws \EE_Error
516 516
 	 */
517
-	public static function get_pre_tax_subtotal( EE_Line_Item $total_line_item ){
518
-		$pre_tax_subtotal = $total_line_item->get_child_line_item( 'pre-tax-subtotal' );
517
+	public static function get_pre_tax_subtotal(EE_Line_Item $total_line_item) {
518
+		$pre_tax_subtotal = $total_line_item->get_child_line_item('pre-tax-subtotal');
519 519
 		return $pre_tax_subtotal instanceof EE_Line_Item
520 520
 			? $pre_tax_subtotal
521
-			: self::create_pre_tax_subtotal( $total_line_item );
521
+			: self::create_pre_tax_subtotal($total_line_item);
522 522
 	}
523 523
 
524 524
 
@@ -530,9 +530,9 @@  discard block
 block discarded – undo
530 530
 	 * @return \EE_Line_Item
531 531
 	 * @throws \EE_Error
532 532
 	 */
533
-	public static function get_taxes_subtotal( EE_Line_Item $total_line_item ){
534
-		$taxes = $total_line_item->get_child_line_item( 'taxes' );
535
-		return $taxes ? $taxes : self::create_taxes_subtotal( $total_line_item );
533
+	public static function get_taxes_subtotal(EE_Line_Item $total_line_item) {
534
+		$taxes = $total_line_item->get_child_line_item('taxes');
535
+		return $taxes ? $taxes : self::create_taxes_subtotal($total_line_item);
536 536
 	}
537 537
 
538 538
 
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
 	 * @return void
546 546
 	 * @throws \EE_Error
547 547
 	 */
548
-	public static function set_TXN_ID( EE_Line_Item $line_item, $transaction = NULL ){
549
-		if( $transaction ){
548
+	public static function set_TXN_ID(EE_Line_Item $line_item, $transaction = NULL) {
549
+		if ($transaction) {
550 550
 			/** @type EEM_Transaction $EEM_Transaction */
551
-			$EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' );
552
-			$TXN_ID = $EEM_Transaction->ensure_is_ID( $transaction );
553
-			$line_item->set_TXN_ID( $TXN_ID );
551
+			$EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
552
+			$TXN_ID = $EEM_Transaction->ensure_is_ID($transaction);
553
+			$line_item->set_TXN_ID($TXN_ID);
554 554
 		}
555 555
 	}
556 556
 
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 	 * @return \EE_Line_Item of type total
566 566
 	 * @throws \EE_Error
567 567
 	 */
568
-	public static function create_total_line_item( $transaction = NULL ){
569
-		$total_line_item = EE_Line_Item::new_instance( array(
568
+	public static function create_total_line_item($transaction = NULL) {
569
+		$total_line_item = EE_Line_Item::new_instance(array(
570 570
 			'LIN_code'	=> 'total',
571 571
 			'LIN_name'	=> __('Grand Total', 'event_espresso'),
572 572
 			'LIN_type'	=> EEM_Line_Item::type_total,
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 			'FHEE__EEH_Line_Item__create_total_line_item__total_line_item',
577 577
 			$total_line_item
578 578
 		);
579
-		self::set_TXN_ID( $total_line_item, $transaction );
580
-		self::create_pre_tax_subtotal( $total_line_item, $transaction );
581
-		self::create_taxes_subtotal( $total_line_item, $transaction );
579
+		self::set_TXN_ID($total_line_item, $transaction);
580
+		self::create_pre_tax_subtotal($total_line_item, $transaction);
581
+		self::create_taxes_subtotal($total_line_item, $transaction);
582 582
 		return $total_line_item;
583 583
 	}
584 584
 
@@ -592,19 +592,19 @@  discard block
 block discarded – undo
592 592
 	 * @return EE_Line_Item
593 593
 	 * @throws \EE_Error
594 594
 	 */
595
-	protected static function create_pre_tax_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
596
-		$pre_tax_line_item = EE_Line_Item::new_instance( array(
595
+	protected static function create_pre_tax_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
596
+		$pre_tax_line_item = EE_Line_Item::new_instance(array(
597 597
 			'LIN_code' 	=> 'pre-tax-subtotal',
598
-			'LIN_name' 	=> __( 'Pre-Tax Subtotal', 'event_espresso' ),
598
+			'LIN_name' 	=> __('Pre-Tax Subtotal', 'event_espresso'),
599 599
 			'LIN_type' 	=> EEM_Line_Item::type_sub_total
600
-		) );
600
+		));
601 601
 		$pre_tax_line_item = apply_filters(
602 602
 			'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item',
603 603
 			$pre_tax_line_item
604 604
 		);
605
-		self::set_TXN_ID( $pre_tax_line_item, $transaction );
606
-		$total_line_item->add_child_line_item( $pre_tax_line_item );
607
-		self::create_event_subtotal( $pre_tax_line_item, $transaction );
605
+		self::set_TXN_ID($pre_tax_line_item, $transaction);
606
+		$total_line_item->add_child_line_item($pre_tax_line_item);
607
+		self::create_event_subtotal($pre_tax_line_item, $transaction);
608 608
 		return $pre_tax_line_item;
609 609
 	}
610 610
 
@@ -619,21 +619,21 @@  discard block
 block discarded – undo
619 619
 	 * @return EE_Line_Item
620 620
 	 * @throws \EE_Error
621 621
 	 */
622
-	protected static function create_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
622
+	protected static function create_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
623 623
 		$tax_line_item = EE_Line_Item::new_instance(array(
624 624
 			'LIN_code'	=> 'taxes',
625 625
 			'LIN_name' 	=> __('Taxes', 'event_espresso'),
626 626
 			'LIN_type'	=> EEM_Line_Item::type_tax_sub_total,
627
-			'LIN_order' => 1000,//this should always come last
627
+			'LIN_order' => 1000, //this should always come last
628 628
 		));
629 629
 		$tax_line_item = apply_filters(
630 630
 			'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item',
631 631
 			$tax_line_item
632 632
 		);
633
-		self::set_TXN_ID( $tax_line_item, $transaction );
634
-		$total_line_item->add_child_line_item( $tax_line_item );
633
+		self::set_TXN_ID($tax_line_item, $transaction);
634
+		$total_line_item->add_child_line_item($tax_line_item);
635 635
 		//and lastly, add the actual taxes
636
-		self::apply_taxes( $total_line_item );
636
+		self::apply_taxes($total_line_item);
637 637
 		return $tax_line_item;
638 638
 	}
639 639
 
@@ -648,11 +648,11 @@  discard block
 block discarded – undo
648 648
 	 * @return EE_Line_Item
649 649
 	 * @throws \EE_Error
650 650
 	 */
651
-	public static function create_event_subtotal( EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL ){
651
+	public static function create_event_subtotal(EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL) {
652 652
 		$event_line_item = EE_Line_Item::new_instance(array(
653
-			'LIN_code'	=> self::get_event_code( $event ),
654
-			'LIN_name' 	=> self::get_event_name( $event ),
655
-			'LIN_desc' 	=> self::get_event_desc( $event ),
653
+			'LIN_code'	=> self::get_event_code($event),
654
+			'LIN_name' 	=> self::get_event_name($event),
655
+			'LIN_desc' 	=> self::get_event_desc($event),
656 656
 			'LIN_type'	=> EEM_Line_Item::type_sub_total,
657 657
 			'OBJ_type' 	=> 'Event',
658 658
 			'OBJ_ID' 		=>  $event instanceof EE_Event ? $event->ID() : 0
@@ -661,8 +661,8 @@  discard block
 block discarded – undo
661 661
 			'FHEE__EEH_Line_Item__create_event_subtotal__event_line_item',
662 662
 			$event_line_item
663 663
 		);
664
-		self::set_TXN_ID( $event_line_item, $transaction );
665
-		$pre_tax_line_item->add_child_line_item( $event_line_item );
664
+		self::set_TXN_ID($event_line_item, $transaction);
665
+		$pre_tax_line_item->add_child_line_item($event_line_item);
666 666
 		return $event_line_item;
667 667
 	}
668 668
 
@@ -675,8 +675,8 @@  discard block
 block discarded – undo
675 675
 	 * @return string
676 676
 	 * @throws \EE_Error
677 677
 	 */
678
-	public static function get_event_code( $event ) {
679
-		return 'event-' . ( $event instanceof EE_Event ? $event->ID() : '0' );
678
+	public static function get_event_code($event) {
679
+		return 'event-'.($event instanceof EE_Event ? $event->ID() : '0');
680 680
 	}
681 681
 
682 682
 	/**
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
 	 * @param EE_Event $event
685 685
 	 * @return string
686 686
 	 */
687
-	public static function get_event_name( $event ) {
688
-		return $event instanceof EE_Event ? $event->name() : __( 'Event', 'event_espresso' );
687
+	public static function get_event_name($event) {
688
+		return $event instanceof EE_Event ? $event->name() : __('Event', 'event_espresso');
689 689
 	}
690 690
 
691 691
 	/**
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 * @param EE_Event $event
694 694
 	 * @return string
695 695
 	 */
696
-	public static function get_event_desc( $event ) {
696
+	public static function get_event_desc($event) {
697 697
 		return $event instanceof EE_Event ? $event->short_description() : '';
698 698
 	}
699 699
 
@@ -707,27 +707,27 @@  discard block
 block discarded – undo
707 707
 	  * @throws \EE_Error
708 708
 	  * @return EE_Line_Item
709 709
 	  */
710
-	public static function get_event_line_item_for_ticket( EE_Line_Item $grand_total, EE_Ticket $ticket ) {
710
+	public static function get_event_line_item_for_ticket(EE_Line_Item $grand_total, EE_Ticket $ticket) {
711 711
 		$first_datetime = $ticket->first_datetime();
712
-		if ( ! $first_datetime instanceof EE_Datetime ) {
712
+		if ( ! $first_datetime instanceof EE_Datetime) {
713 713
 			throw new EE_Error(
714
-				sprintf( __( 'The supplied ticket (ID %d) has no datetimes', 'event_espresso' ), $ticket->ID() )
714
+				sprintf(__('The supplied ticket (ID %d) has no datetimes', 'event_espresso'), $ticket->ID())
715 715
 			);
716 716
 		}
717 717
 		$event = $first_datetime->event();
718
-		if ( ! $event instanceof EE_Event ) {
718
+		if ( ! $event instanceof EE_Event) {
719 719
 			throw new EE_Error(
720 720
 				sprintf(
721
-					__( 'The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso' ),
721
+					__('The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso'),
722 722
 					$ticket->ID()
723 723
 				)
724 724
 			);
725 725
 		}
726
-		$events_sub_total = EEH_Line_Item::get_event_line_item( $grand_total, $event );
727
-		if ( ! $events_sub_total instanceof EE_Line_Item ) {
726
+		$events_sub_total = EEH_Line_Item::get_event_line_item($grand_total, $event);
727
+		if ( ! $events_sub_total instanceof EE_Line_Item) {
728 728
 			throw new EE_Error(
729 729
 				sprintf(
730
-					__( 'There is no events sub-total for ticket %s on total line item %d', 'event_espresso' ),
730
+					__('There is no events sub-total for ticket %s on total line item %d', 'event_espresso'),
731 731
 					$ticket->ID(),
732 732
 					$grand_total->ID()
733 733
 				)
@@ -746,31 +746,31 @@  discard block
 block discarded – undo
746 746
 	 * @return EE_Line_Item for the event subtotal which is a child of $grand_total
747 747
 	 * @throws \EE_Error
748 748
 	 */
749
-	public static function get_event_line_item( EE_Line_Item $grand_total, $event ) {
749
+	public static function get_event_line_item(EE_Line_Item $grand_total, $event) {
750 750
 		/** @type EE_Event $event */
751
-		$event = EEM_Event::instance()->ensure_is_obj( $event, true );
751
+		$event = EEM_Event::instance()->ensure_is_obj($event, true);
752 752
 		$event_line_item = NULL;
753 753
 		$found = false;
754
-		foreach ( EEH_Line_Item::get_event_subtotals( $grand_total ) as $event_line_item ) {
754
+		foreach (EEH_Line_Item::get_event_subtotals($grand_total) as $event_line_item) {
755 755
 			// default event subtotal, we should only ever find this the first time this method is called
756
-			if ( ! $event_line_item->OBJ_ID() ) {
756
+			if ( ! $event_line_item->OBJ_ID()) {
757 757
 				// let's use this! but first... set the event details
758
-				EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
758
+				EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
759 759
 				$found = true;
760 760
 				break;
761
-			} else if ( $event_line_item->OBJ_ID() === $event->ID() ) {
761
+			} else if ($event_line_item->OBJ_ID() === $event->ID()) {
762 762
 				// found existing line item for this event in the cart, so break out of loop and use this one
763 763
 				$found = true;
764 764
 				break;
765 765
 			}
766 766
 		}
767
-		if ( ! $found ) {
767
+		if ( ! $found) {
768 768
 			//there is no event sub-total yet, so add it
769
-			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal( $grand_total );
769
+			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal($grand_total);
770 770
 			// create a new "event" subtotal below that
771
-			$event_line_item = EEH_Line_Item::create_event_subtotal( $pre_tax_subtotal, null, $event );
771
+			$event_line_item = EEH_Line_Item::create_event_subtotal($pre_tax_subtotal, null, $event);
772 772
 			// and set the event details
773
-			EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
773
+			EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
774 774
 		}
775 775
 		return $event_line_item;
776 776
 	}
@@ -791,13 +791,13 @@  discard block
 block discarded – undo
791 791
 		EE_Event $event,
792 792
 		$transaction = null
793 793
 	) {
794
-		if ( $event instanceof EE_Event ) {
795
-			$event_line_item->set_code( self::get_event_code( $event ) );
796
-			$event_line_item->set_name( self::get_event_name( $event ) );
797
-			$event_line_item->set_desc( self::get_event_desc( $event ) );
798
-			$event_line_item->set_OBJ_ID( $event->ID() );
794
+		if ($event instanceof EE_Event) {
795
+			$event_line_item->set_code(self::get_event_code($event));
796
+			$event_line_item->set_name(self::get_event_name($event));
797
+			$event_line_item->set_desc(self::get_event_desc($event));
798
+			$event_line_item->set_OBJ_ID($event->ID());
799 799
 		}
800
-		self::set_TXN_ID( $event_line_item, $transaction );
800
+		self::set_TXN_ID($event_line_item, $transaction);
801 801
 	}
802 802
 
803 803
 
@@ -810,19 +810,19 @@  discard block
 block discarded – undo
810 810
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
811 811
 	 * @throws \EE_Error
812 812
 	 */
813
-	public static function apply_taxes( EE_Line_Item $total_line_item ){
813
+	public static function apply_taxes(EE_Line_Item $total_line_item) {
814 814
 		/** @type EEM_Price $EEM_Price */
815
-		$EEM_Price = EE_Registry::instance()->load_model( 'Price' );
815
+		$EEM_Price = EE_Registry::instance()->load_model('Price');
816 816
 		// get array of taxes via Price Model
817 817
 		$ordered_taxes = $EEM_Price->get_all_prices_that_are_taxes();
818
-		ksort( $ordered_taxes );
819
-		$taxes_line_item = self::get_taxes_subtotal( $total_line_item );
818
+		ksort($ordered_taxes);
819
+		$taxes_line_item = self::get_taxes_subtotal($total_line_item);
820 820
 		//just to be safe, remove its old tax line items
821 821
 		$taxes_line_item->delete_children_line_items();
822 822
 		//loop thru taxes
823
-		foreach ( $ordered_taxes as $order => $taxes ) {
824
-			foreach ( $taxes as $tax ) {
825
-				if ( $tax instanceof EE_Price ) {
823
+		foreach ($ordered_taxes as $order => $taxes) {
824
+			foreach ($taxes as $tax) {
825
+				if ($tax instanceof EE_Price) {
826 826
 					$tax_line_item = EE_Line_Item::new_instance(
827 827
 						array(
828 828
 							'LIN_name'       => $tax->name(),
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 						'FHEE__EEH_Line_Item__apply_taxes__tax_line_item',
841 841
 						$tax_line_item
842 842
 					);
843
-					$taxes_line_item->add_child_line_item( $tax_line_item );
843
+					$taxes_line_item->add_child_line_item($tax_line_item);
844 844
 				}
845 845
 			}
846 846
 		}
@@ -857,10 +857,10 @@  discard block
 block discarded – undo
857 857
 	 * @return float
858 858
 	 * @throws \EE_Error
859 859
 	 */
860
-	public static function ensure_taxes_applied( $total_line_item ){
861
-		$taxes_subtotal = self::get_taxes_subtotal( $total_line_item );
862
-		if( ! $taxes_subtotal->children()){
863
-			self::apply_taxes( $total_line_item );
860
+	public static function ensure_taxes_applied($total_line_item) {
861
+		$taxes_subtotal = self::get_taxes_subtotal($total_line_item);
862
+		if ( ! $taxes_subtotal->children()) {
863
+			self::apply_taxes($total_line_item);
864 864
 		}
865 865
 		return $taxes_subtotal->total();
866 866
 	}
@@ -874,16 +874,16 @@  discard block
 block discarded – undo
874 874
 	 * @return bool
875 875
 	 * @throws \EE_Error
876 876
 	 */
877
-	public static function delete_all_child_items( EE_Line_Item $parent_line_item ) {
877
+	public static function delete_all_child_items(EE_Line_Item $parent_line_item) {
878 878
 		$deleted = 0;
879
-		foreach ( $parent_line_item->children() as $child_line_item ) {
880
-			if ( $child_line_item instanceof EE_Line_Item ) {
881
-				$deleted += EEH_Line_Item::delete_all_child_items( $child_line_item );
882
-				if ( $child_line_item->ID() ) {
879
+		foreach ($parent_line_item->children() as $child_line_item) {
880
+			if ($child_line_item instanceof EE_Line_Item) {
881
+				$deleted += EEH_Line_Item::delete_all_child_items($child_line_item);
882
+				if ($child_line_item->ID()) {
883 883
 					$child_line_item->delete();
884
-					unset( $child_line_item );
884
+					unset($child_line_item);
885 885
 				} else {
886
-					$parent_line_item->delete_child_line_item( $child_line_item->code() );
886
+					$parent_line_item->delete_child_line_item($child_line_item->code());
887 887
 				}
888 888
 				$deleted++;
889 889
 			}
@@ -905,9 +905,9 @@  discard block
 block discarded – undo
905 905
 	 * @param array|bool|string $line_item_codes
906 906
 	 * @return int number of items successfully removed
907 907
 	 */
908
-	public static function delete_items( EE_Line_Item $total_line_item, $line_item_codes = FALSE ) {
908
+	public static function delete_items(EE_Line_Item $total_line_item, $line_item_codes = FALSE) {
909 909
 
910
-		if( $total_line_item->type() !== EEM_Line_Item::type_total ){
910
+		if ($total_line_item->type() !== EEM_Line_Item::type_total) {
911 911
 			EE_Error::doing_it_wrong(
912 912
 				'EEH_Line_Item::delete_items',
913 913
 				__(
@@ -917,20 +917,20 @@  discard block
 block discarded – undo
917 917
 				'4.6.18'
918 918
 			);
919 919
 		}
920
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
920
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
921 921
 
922 922
 		// check if only a single line_item_id was passed
923
-		if ( ! empty( $line_item_codes ) && ! is_array( $line_item_codes )) {
923
+		if ( ! empty($line_item_codes) && ! is_array($line_item_codes)) {
924 924
 			// place single line_item_id in an array to appear as multiple line_item_ids
925
-			$line_item_codes = array ( $line_item_codes );
925
+			$line_item_codes = array($line_item_codes);
926 926
 		}
927 927
 		$removals = 0;
928 928
 		// cycle thru line_item_ids
929
-		foreach ( $line_item_codes as $line_item_id ) {
929
+		foreach ($line_item_codes as $line_item_id) {
930 930
 			$removals += $total_line_item->delete_child_line_item($line_item_id);
931 931
 		}
932 932
 
933
-		if ( $removals > 0 ) {
933
+		if ($removals > 0) {
934 934
 			$total_line_item->recalculate_taxes_and_tax_total();
935 935
 			return $removals;
936 936
 		} else {
@@ -963,33 +963,33 @@  discard block
 block discarded – undo
963 963
 		$code = null,
964 964
 		$add_to_existing_line_item = false
965 965
 	) {
966
-		$tax_subtotal = self::get_taxes_subtotal( $total_line_item );
966
+		$tax_subtotal = self::get_taxes_subtotal($total_line_item);
967 967
             $taxable_total = $total_line_item->taxable_total();
968 968
 
969
-            if( $add_to_existing_line_item ) {
970
-                $new_tax = $tax_subtotal->get_child_line_item( $code );
969
+            if ($add_to_existing_line_item) {
970
+                $new_tax = $tax_subtotal->get_child_line_item($code);
971 971
 	            EEM_Line_Item::instance()->delete(
972
-		            array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) )
972
+		            array(array('LIN_code' => array('!=', $code), 'LIN_parent' => $tax_subtotal->ID()))
973 973
 	            );
974 974
             } else {
975 975
                 $new_tax = null;
976 976
                 $tax_subtotal->delete_children_line_items();
977 977
             }
978
-            if( $new_tax ) {
979
-                $new_tax->set_total( $new_tax->total() + $amount );
980
-                $new_tax->set_percent( $taxable_total ? $new_tax->total() / $taxable_total * 100 : 0 );
978
+            if ($new_tax) {
979
+                $new_tax->set_total($new_tax->total() + $amount);
980
+                $new_tax->set_percent($taxable_total ? $new_tax->total() / $taxable_total * 100 : 0);
981 981
             } else {
982 982
                 //no existing tax item. Create it
983
-				$new_tax = EE_Line_Item::new_instance( array(
983
+				$new_tax = EE_Line_Item::new_instance(array(
984 984
 					'TXN_ID'      => $total_line_item->TXN_ID(),
985
-					'LIN_name'    => $name ? $name : __( 'Tax', 'event_espresso' ),
985
+					'LIN_name'    => $name ? $name : __('Tax', 'event_espresso'),
986 986
 					'LIN_desc'    => $description ? $description : '',
987
-					'LIN_percent' => $taxable_total ? ( $amount / $taxable_total * 100 ) : 0,
987
+					'LIN_percent' => $taxable_total ? ($amount / $taxable_total * 100) : 0,
988 988
 					'LIN_total'   => $amount,
989 989
 					'LIN_parent'  => $tax_subtotal->ID(),
990 990
 					'LIN_type'    => EEM_Line_Item::type_tax,
991 991
 					'LIN_code'    => $code
992
-				) );
992
+				));
993 993
 			}
994 994
 
995 995
             $new_tax = apply_filters(
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 				$total_line_item
999 999
             );
1000 1000
             $new_tax->save();
1001
-            $tax_subtotal->set_total( $new_tax->total() );
1001
+            $tax_subtotal->set_total($new_tax->total());
1002 1002
             $tax_subtotal->save();
1003 1003
             $total_line_item->recalculate_total_including_taxes();
1004 1004
             return $new_tax;
@@ -1020,14 +1020,14 @@  discard block
 block discarded – undo
1020 1020
 		$code_substring_for_whitelist = null
1021 1021
 	) {
1022 1022
 		$whitelisted = false;
1023
-		if( $code_substring_for_whitelist !== null ) {
1024
-			$whitelisted = strpos( $line_item->code(), $code_substring_for_whitelist ) !== false ? true : false;
1023
+		if ($code_substring_for_whitelist !== null) {
1024
+			$whitelisted = strpos($line_item->code(), $code_substring_for_whitelist) !== false ? true : false;
1025 1025
 		}
1026
-		if( ! $whitelisted && $line_item->is_line_item() ) {
1027
-			$line_item->set_is_taxable( $taxable );
1026
+		if ( ! $whitelisted && $line_item->is_line_item()) {
1027
+			$line_item->set_is_taxable($taxable);
1028 1028
 		}
1029
-		foreach( $line_item->children() as $child_line_item ) {
1030
-			EEH_Line_Item::set_line_items_taxable( $child_line_item, $taxable, $code_substring_for_whitelist );
1029
+		foreach ($line_item->children() as $child_line_item) {
1030
+			EEH_Line_Item::set_line_items_taxable($child_line_item, $taxable, $code_substring_for_whitelist);
1031 1031
 		}
1032 1032
 	}
1033 1033
 
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1041 1041
 	 * @return EE_Line_Item[]
1042 1042
 	 */
1043
-	public static function get_event_subtotals( EE_Line_Item $parent_line_item ) {
1044
-		return self::get_subtotals_of_object_type( $parent_line_item, 'Event' );
1043
+	public static function get_event_subtotals(EE_Line_Item $parent_line_item) {
1044
+		return self::get_subtotals_of_object_type($parent_line_item, 'Event');
1045 1045
 	}
1046 1046
 
1047 1047
 
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 	 * @param string $obj_type
1055 1055
 	 * @return EE_Line_Item[]
1056 1056
 	 */
1057
-	public static function get_subtotals_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
1057
+	public static function get_subtotals_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
1058 1058
 		return self::_get_descendants_by_type_and_object_type(
1059 1059
 			$parent_line_item,
1060 1060
 			EEM_Line_Item::type_sub_total,
@@ -1071,8 +1071,8 @@  discard block
 block discarded – undo
1071 1071
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1072 1072
 	 * @return EE_Line_Item[]
1073 1073
 	 */
1074
-	public static function get_ticket_line_items( EE_Line_Item $parent_line_item ) {
1075
-		return self::get_line_items_of_object_type( $parent_line_item, 'Ticket' );
1074
+	public static function get_ticket_line_items(EE_Line_Item $parent_line_item) {
1075
+		return self::get_line_items_of_object_type($parent_line_item, 'Ticket');
1076 1076
 	}
1077 1077
 
1078 1078
 
@@ -1085,8 +1085,8 @@  discard block
 block discarded – undo
1085 1085
 	 * @param string $obj_type
1086 1086
 	 * @return EE_Line_Item[]
1087 1087
 	 */
1088
-	public static function get_line_items_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
1089
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, EEM_Line_Item::type_line_item, $obj_type );
1088
+	public static function get_line_items_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
1089
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, EEM_Line_Item::type_line_item, $obj_type);
1090 1090
 	}
1091 1091
 
1092 1092
 
@@ -1097,8 +1097,8 @@  discard block
 block discarded – undo
1097 1097
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1098 1098
 	 * @return EE_Line_Item[]
1099 1099
 	 */
1100
-	public static function get_tax_descendants( EE_Line_Item $parent_line_item ) {
1101
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_tax );
1100
+	public static function get_tax_descendants(EE_Line_Item $parent_line_item) {
1101
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_tax);
1102 1102
 	}
1103 1103
 
1104 1104
 
@@ -1109,8 +1109,8 @@  discard block
 block discarded – undo
1109 1109
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1110 1110
 	 * @return EE_Line_Item[]
1111 1111
 	 */
1112
-	public static function get_line_item_descendants( EE_Line_Item $parent_line_item ) {
1113
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_line_item );
1112
+	public static function get_line_item_descendants(EE_Line_Item $parent_line_item) {
1113
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_line_item);
1114 1114
 	}
1115 1115
 
1116 1116
 
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
 	 * @param string $line_item_type one of the EEM_Line_Item constants
1124 1124
 	 * @return EE_Line_Item[]
1125 1125
 	 */
1126
-	public static function get_descendants_of_type( EE_Line_Item $parent_line_item, $line_item_type ) {
1127
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, $line_item_type, NULL );
1126
+	public static function get_descendants_of_type(EE_Line_Item $parent_line_item, $line_item_type) {
1127
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, $line_item_type, NULL);
1128 1128
 	}
1129 1129
 
1130 1130
 
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
 		$obj_type = null
1144 1144
 	) {
1145 1145
 		$objects = array();
1146
-		foreach ( $parent_line_item->children() as $child_line_item ) {
1147
-			if ( $child_line_item instanceof EE_Line_Item ) {
1146
+		foreach ($parent_line_item->children() as $child_line_item) {
1147
+			if ($child_line_item instanceof EE_Line_Item) {
1148 1148
 				if (
1149 1149
 					$child_line_item->type() === $line_item_type
1150 1150
 				    && (
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 		$OBJ_type = '',
1185 1185
 		$OBJ_IDs = array()
1186 1186
 	) {
1187
-		return self::_get_descendants_by_object_type_and_object_ID( $parent_line_item, $OBJ_type, $OBJ_IDs );
1187
+		return self::_get_descendants_by_object_type_and_object_ID($parent_line_item, $OBJ_type, $OBJ_IDs);
1188 1188
 	}
1189 1189
 
1190 1190
 
@@ -1203,12 +1203,12 @@  discard block
 block discarded – undo
1203 1203
 		$OBJ_IDs
1204 1204
 	) {
1205 1205
 		$objects = array();
1206
-		foreach ( $parent_line_item->children() as $child_line_item ) {
1207
-			if ( $child_line_item instanceof EE_Line_Item ) {
1206
+		foreach ($parent_line_item->children() as $child_line_item) {
1207
+			if ($child_line_item instanceof EE_Line_Item) {
1208 1208
 				if (
1209 1209
 					$child_line_item->OBJ_type() === $OBJ_type
1210
-					&& is_array( $OBJ_IDs )
1211
-					&& in_array( $child_line_item->OBJ_ID(), $OBJ_IDs )
1210
+					&& is_array($OBJ_IDs)
1211
+					&& in_array($child_line_item->OBJ_ID(), $OBJ_IDs)
1212 1212
 				) {
1213 1213
 					$objects[] = $child_line_item;
1214 1214
 				} else {
@@ -1238,8 +1238,8 @@  discard block
 block discarded – undo
1238 1238
 	 * @param string $type like one of the EEM_Line_Item::type_*
1239 1239
 	 * @return EE_Line_Item
1240 1240
 	 */
1241
-	public static function get_nearest_descendant_of_type( EE_Line_Item $parent_line_item, $type ) {
1242
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_type' , $type );
1241
+	public static function get_nearest_descendant_of_type(EE_Line_Item $parent_line_item, $type) {
1242
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_type', $type);
1243 1243
 	}
1244 1244
 
1245 1245
 
@@ -1253,8 +1253,8 @@  discard block
 block discarded – undo
1253 1253
 	 * @param string $code any value used for LIN_code
1254 1254
 	 * @return EE_Line_Item
1255 1255
 	 */
1256
-	public static function get_nearest_descendant_having_code( EE_Line_Item $parent_line_item, $code ) {
1257
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_code' , $code );
1256
+	public static function get_nearest_descendant_having_code(EE_Line_Item $parent_line_item, $code) {
1257
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_code', $code);
1258 1258
 	}
1259 1259
 
1260 1260
 
@@ -1268,15 +1268,15 @@  discard block
 block discarded – undo
1268 1268
 	 * @param string $value any value stored in $search_field
1269 1269
 	 * @return EE_Line_Item
1270 1270
 	 */
1271
-	protected static function _get_nearest_descendant( EE_Line_Item $parent_line_item, $search_field, $value ) {
1272
-		foreach( $parent_line_item->children() as $child ){
1273
-			if ( $child->get( $search_field ) == $value ){
1271
+	protected static function _get_nearest_descendant(EE_Line_Item $parent_line_item, $search_field, $value) {
1272
+		foreach ($parent_line_item->children() as $child) {
1273
+			if ($child->get($search_field) == $value) {
1274 1274
 				return $child;
1275 1275
 			}
1276 1276
 		}
1277
-		foreach( $parent_line_item->children() as $child ){
1278
-			$descendant_found = self::_get_nearest_descendant( $child, $search_field, $value );
1279
-			if ( $descendant_found ){
1277
+		foreach ($parent_line_item->children() as $child) {
1278
+			$descendant_found = self::_get_nearest_descendant($child, $search_field, $value);
1279
+			if ($descendant_found) {
1280 1280
 				return $descendant_found;
1281 1281
 			}
1282 1282
 		}
@@ -1293,24 +1293,24 @@  discard block
 block discarded – undo
1293 1293
 	 * @return \EE_Line_Item
1294 1294
 	 * @throws \EE_Error
1295 1295
 	 */
1296
-	public static function find_transaction_grand_total_for_line_item( EE_Line_Item $line_item ){
1297
-		if ( $line_item->TXN_ID() ) {
1298
-			$total_line_item = $line_item->transaction()->total_line_item( false );
1299
-			if ( $total_line_item instanceof EE_Line_Item ) {
1296
+	public static function find_transaction_grand_total_for_line_item(EE_Line_Item $line_item) {
1297
+		if ($line_item->TXN_ID()) {
1298
+			$total_line_item = $line_item->transaction()->total_line_item(false);
1299
+			if ($total_line_item instanceof EE_Line_Item) {
1300 1300
 				return $total_line_item;
1301 1301
 			}
1302 1302
 		} else {
1303 1303
 			$line_item_parent = $line_item->parent();
1304
-			if ( $line_item_parent instanceof EE_Line_Item ) {
1305
-				if ( $line_item_parent->is_total() ) {
1304
+			if ($line_item_parent instanceof EE_Line_Item) {
1305
+				if ($line_item_parent->is_total()) {
1306 1306
 					return $line_item_parent;
1307 1307
 				}
1308
-				return EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item_parent );
1308
+				return EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item_parent);
1309 1309
 			}
1310 1310
 		}
1311 1311
 		throw new EE_Error(
1312 1312
 			sprintf(
1313
-				__( 'A valid grand total for line item %1$d was not found.', 'event_espresso' ),
1313
+				__('A valid grand total for line item %1$d was not found.', 'event_espresso'),
1314 1314
 				$line_item->ID()
1315 1315
 			)
1316 1316
 		);
@@ -1327,31 +1327,31 @@  discard block
 block discarded – undo
1327 1327
 	 * @return void
1328 1328
 	 * @throws \EE_Error
1329 1329
 	 */
1330
-	public static function visualize( EE_Line_Item $line_item, $indentation = 0 ){
1330
+	public static function visualize(EE_Line_Item $line_item, $indentation = 0) {
1331 1331
 		echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1332
-		if ( ! $indentation ) {
1333
-			echo defined( 'EE_TESTS_DIR' ) ? "\n" : '<br />';
1332
+		if ( ! $indentation) {
1333
+			echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1334 1334
 		}
1335
-		for( $i = 0; $i < $indentation; $i++ ){
1335
+		for ($i = 0; $i < $indentation; $i++) {
1336 1336
 			echo ". ";
1337 1337
 		}
1338 1338
 		$breakdown = '';
1339
-		if ( $line_item->is_line_item()){
1340
-			if ( $line_item->is_percent() ) {
1339
+		if ($line_item->is_line_item()) {
1340
+			if ($line_item->is_percent()) {
1341 1341
 				$breakdown = "{$line_item->percent()}%";
1342 1342
 			} else {
1343
-				$breakdown = '$' . "{$line_item->unit_price()} x {$line_item->quantity()}";
1343
+				$breakdown = '$'."{$line_item->unit_price()} x {$line_item->quantity()}";
1344 1344
 			}
1345 1345
 		}
1346
-		echo $line_item->name() . " [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : " . '$' . "{$line_item->total()}";
1347
-		if ( $breakdown ) {
1346
+		echo $line_item->name()." [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : ".'$'."{$line_item->total()}";
1347
+		if ($breakdown) {
1348 1348
 			echo " ( {$breakdown} )";
1349 1349
 		}
1350
-		if( $line_item->is_taxable() ){
1350
+		if ($line_item->is_taxable()) {
1351 1351
 			echo "  * taxable";
1352 1352
 		}
1353
-		if( $line_item->children() ){
1354
-			foreach($line_item->children() as $child){
1353
+		if ($line_item->children()) {
1354
+			foreach ($line_item->children() as $child) {
1355 1355
 				self::visualize($child, $indentation + 1);
1356 1356
 			}
1357 1357
 		}
@@ -1392,97 +1392,97 @@  discard block
 block discarded – undo
1392 1392
 	 *                                          is theirs, which can be done with
1393 1393
 	 *                                          `EEM_Line_Item::instance()->get_line_item_for_registration( $registration );`
1394 1394
 	 */
1395
-	public static function calculate_reg_final_prices_per_line_item( EE_Line_Item $line_item, $billable_ticket_quantities = array() ) {
1395
+	public static function calculate_reg_final_prices_per_line_item(EE_Line_Item $line_item, $billable_ticket_quantities = array()) {
1396 1396
 		//init running grand total if not already
1397
-		if ( ! isset( $running_totals[ 'total' ] ) ) {
1398
-			$running_totals[ 'total' ] = 0;
1397
+		if ( ! isset($running_totals['total'])) {
1398
+			$running_totals['total'] = 0;
1399 1399
 		}
1400
-		if( ! isset( $running_totals[ 'taxable' ] ) ) {
1401
-			$running_totals[ 'taxable' ] = array( 'total' => 0 );
1400
+		if ( ! isset($running_totals['taxable'])) {
1401
+			$running_totals['taxable'] = array('total' => 0);
1402 1402
 		}
1403
-		foreach ( $line_item->children() as $child_line_item ) {
1404
-			switch ( $child_line_item->type() ) {
1403
+		foreach ($line_item->children() as $child_line_item) {
1404
+			switch ($child_line_item->type()) {
1405 1405
 
1406 1406
 				case EEM_Line_Item::type_sub_total :
1407
-					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $child_line_item, $billable_ticket_quantities );
1407
+					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item($child_line_item, $billable_ticket_quantities);
1408 1408
 					//combine arrays but preserve numeric keys
1409
-					$running_totals = array_replace_recursive( $running_totals_from_subtotal, $running_totals );
1410
-					$running_totals[ 'total' ] += $running_totals_from_subtotal[ 'total' ];
1411
-					$running_totals[ 'taxable'][ 'total' ] += $running_totals_from_subtotal[ 'taxable' ][ 'total' ];
1409
+					$running_totals = array_replace_recursive($running_totals_from_subtotal, $running_totals);
1410
+					$running_totals['total'] += $running_totals_from_subtotal['total'];
1411
+					$running_totals['taxable']['total'] += $running_totals_from_subtotal['taxable']['total'];
1412 1412
 					break;
1413 1413
 
1414 1414
 				case EEM_Line_Item::type_tax_sub_total :
1415 1415
 
1416 1416
 					//find how much the taxes percentage is
1417
-					if ( $child_line_item->percent() !== 0 ) {
1417
+					if ($child_line_item->percent() !== 0) {
1418 1418
 						$tax_percent_decimal = $child_line_item->percent() / 100;
1419 1419
 					} else {
1420 1420
 						$tax_percent_decimal = EE_Taxes::get_total_taxes_percentage() / 100;
1421 1421
 					}
1422 1422
 					//and apply to all the taxable totals, and add to the pretax totals
1423
-					foreach ( $running_totals as $line_item_id => $this_running_total ) {
1423
+					foreach ($running_totals as $line_item_id => $this_running_total) {
1424 1424
 						//"total" and "taxable" array key is an exception
1425
-						if ( $line_item_id === 'taxable' ) {
1425
+						if ($line_item_id === 'taxable') {
1426 1426
 							continue;
1427 1427
 						}
1428
-						$taxable_total = $running_totals[ 'taxable' ][ $line_item_id ];
1429
-						$running_totals[ $line_item_id ] += ( $taxable_total * $tax_percent_decimal );
1428
+						$taxable_total = $running_totals['taxable'][$line_item_id];
1429
+						$running_totals[$line_item_id] += ($taxable_total * $tax_percent_decimal);
1430 1430
 					}
1431 1431
 					break;
1432 1432
 
1433 1433
 				case EEM_Line_Item::type_line_item :
1434 1434
 
1435 1435
 					// ticket line items or ????
1436
-					if ( $child_line_item->OBJ_type() === 'Ticket' ) {
1436
+					if ($child_line_item->OBJ_type() === 'Ticket') {
1437 1437
 						// kk it's a ticket
1438
-						if ( isset( $running_totals[ $child_line_item->ID() ] ) ) {
1438
+						if (isset($running_totals[$child_line_item->ID()])) {
1439 1439
 							//huh? that shouldn't happen.
1440
-							$running_totals[ 'total' ] += $child_line_item->total();
1440
+							$running_totals['total'] += $child_line_item->total();
1441 1441
 						} else {
1442 1442
 							//its not in our running totals yet. great.
1443
-							if ( $child_line_item->is_taxable() ) {
1443
+							if ($child_line_item->is_taxable()) {
1444 1444
 								$taxable_amount = $child_line_item->unit_price();
1445 1445
 							} else {
1446 1446
 								$taxable_amount = 0;
1447 1447
 							}
1448 1448
 							// are we only calculating totals for some tickets?
1449
-							if ( isset( $billable_ticket_quantities[ $child_line_item->OBJ_ID() ] ) ) {
1450
-								$quantity = $billable_ticket_quantities[ $child_line_item->OBJ_ID() ];
1451
-								$running_totals[ $child_line_item->ID() ] = $quantity
1449
+							if (isset($billable_ticket_quantities[$child_line_item->OBJ_ID()])) {
1450
+								$quantity = $billable_ticket_quantities[$child_line_item->OBJ_ID()];
1451
+								$running_totals[$child_line_item->ID()] = $quantity
1452 1452
 									? $child_line_item->unit_price()
1453 1453
 									: 0;
1454
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $quantity
1454
+								$running_totals['taxable'][$child_line_item->ID()] = $quantity
1455 1455
 									? $taxable_amount
1456 1456
 									: 0;
1457 1457
 							} else {
1458 1458
 								$quantity = $child_line_item->quantity();
1459
-								$running_totals[ $child_line_item->ID() ] = $child_line_item->unit_price();
1460
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $taxable_amount;
1459
+								$running_totals[$child_line_item->ID()] = $child_line_item->unit_price();
1460
+								$running_totals['taxable'][$child_line_item->ID()] = $taxable_amount;
1461 1461
 							}
1462
-							$running_totals[ 'taxable' ][ 'total' ] += $taxable_amount * $quantity;
1463
-							$running_totals[ 'total' ] += $child_line_item->unit_price() * $quantity;
1462
+							$running_totals['taxable']['total'] += $taxable_amount * $quantity;
1463
+							$running_totals['total'] += $child_line_item->unit_price() * $quantity;
1464 1464
 						}
1465 1465
 					} else {
1466 1466
 						// it's some other type of item added to the cart
1467 1467
 						// it should affect the running totals
1468 1468
 						// basically we want to convert it into a PERCENT modifier. Because
1469 1469
 						// more clearly affect all registration's final price equally
1470
-						$line_items_percent_of_running_total = $running_totals[ 'total' ] > 0
1471
-							? ( $child_line_item->total() / $running_totals[ 'total' ] ) + 1
1470
+						$line_items_percent_of_running_total = $running_totals['total'] > 0
1471
+							? ($child_line_item->total() / $running_totals['total']) + 1
1472 1472
 							: 1;
1473
-						foreach ( $running_totals as $line_item_id => $this_running_total ) {
1473
+						foreach ($running_totals as $line_item_id => $this_running_total) {
1474 1474
 							//the "taxable" array key is an exception
1475
-							if ( $line_item_id === 'taxable' ) {
1475
+							if ($line_item_id === 'taxable') {
1476 1476
 								continue;
1477 1477
 							}
1478 1478
 							// update the running totals
1479 1479
 							// yes this actually even works for the running grand total!
1480
-							$running_totals[ $line_item_id ] =
1480
+							$running_totals[$line_item_id] =
1481 1481
 								$line_items_percent_of_running_total * $this_running_total;
1482 1482
 
1483
-							if ( $child_line_item->is_taxable() ) {
1484
-								$running_totals[ 'taxable' ][ $line_item_id ] =
1485
-									$line_items_percent_of_running_total * $running_totals[ 'taxable' ][ $line_item_id ];
1483
+							if ($child_line_item->is_taxable()) {
1484
+								$running_totals['taxable'][$line_item_id] =
1485
+									$line_items_percent_of_running_total * $running_totals['taxable'][$line_item_id];
1486 1486
 							}
1487 1487
 						}
1488 1488
 					}
@@ -1500,16 +1500,16 @@  discard block
 block discarded – undo
1500 1500
 	 * @return float | null
1501 1501
 	 * @throws \OutOfRangeException
1502 1502
 	 */
1503
-	public static function calculate_final_price_for_ticket_line_item( \EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item ) {
1503
+	public static function calculate_final_price_for_ticket_line_item(\EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item) {
1504 1504
 		static $final_prices_per_ticket_line_item = array();
1505
-		if ( empty( $final_prices_per_ticket_line_item ) ) {
1505
+		if (empty($final_prices_per_ticket_line_item)) {
1506 1506
 			$final_prices_per_ticket_line_item = \EEH_Line_Item::calculate_reg_final_prices_per_line_item(
1507 1507
 				$total_line_item
1508 1508
 			);
1509 1509
 		}
1510 1510
 		//ok now find this new registration's final price
1511
-		if ( isset( $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ] ) ) {
1512
-			return $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ];
1511
+		if (isset($final_prices_per_ticket_line_item[$ticket_line_item->ID()])) {
1512
+			return $final_prices_per_ticket_line_item[$ticket_line_item->ID()];
1513 1513
 		}
1514 1514
 		$message = sprintf(
1515 1515
 			__(
@@ -1518,10 +1518,10 @@  discard block
 block discarded – undo
1518 1518
 			),
1519 1519
 			$ticket_line_item->ID()
1520 1520
 		);
1521
-		if ( WP_DEBUG ) {
1522
-			throw new \OutOfRangeException( $message );
1521
+		if (WP_DEBUG) {
1522
+			throw new \OutOfRangeException($message);
1523 1523
 		} else {
1524
-			EE_Log::instance()->log( __CLASS__, __FUNCTION__, $message );
1524
+			EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message);
1525 1525
 		}
1526 1526
 		return null;
1527 1527
 	}
@@ -1537,15 +1537,15 @@  discard block
 block discarded – undo
1537 1537
 	 * @return \EE_Line_Item
1538 1538
 	 * @throws \EE_Error
1539 1539
 	 */
1540
-	public static function billable_line_item_tree( EE_Line_Item $line_item, $registrations ) {
1541
-		$copy_li = EEH_Line_Item::billable_line_item( $line_item, $registrations );
1542
-		foreach ( $line_item->children() as $child_li ) {
1543
-			$copy_li->add_child_line_item( EEH_Line_Item::billable_line_item_tree( $child_li, $registrations ) );
1540
+	public static function billable_line_item_tree(EE_Line_Item $line_item, $registrations) {
1541
+		$copy_li = EEH_Line_Item::billable_line_item($line_item, $registrations);
1542
+		foreach ($line_item->children() as $child_li) {
1543
+			$copy_li->add_child_line_item(EEH_Line_Item::billable_line_item_tree($child_li, $registrations));
1544 1544
 		}
1545 1545
 		//if this is the grand total line item, make sure the totals all add up
1546 1546
 		//(we could have duplicated this logic AS we copied the line items, but
1547 1547
 		//it seems DRYer this way)
1548
-		if ( $copy_li->type() === EEM_Line_Item::type_total ) {
1548
+		if ($copy_li->type() === EEM_Line_Item::type_total) {
1549 1549
 			$copy_li->recalculate_total_including_taxes();
1550 1550
 		}
1551 1551
 		return $copy_li;
@@ -1562,24 +1562,24 @@  discard block
 block discarded – undo
1562 1562
 	 * @throws \EE_Error
1563 1563
 	 * @param EE_Registration[] $registrations
1564 1564
 	 */
1565
-	public static function billable_line_item( EE_Line_Item $line_item, $registrations ) {
1565
+	public static function billable_line_item(EE_Line_Item $line_item, $registrations) {
1566 1566
 		$new_li_fields = $line_item->model_field_array();
1567
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1567
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1568 1568
 			$line_item->OBJ_type() === 'Ticket'
1569 1569
 		) {
1570 1570
 			$count = 0;
1571
-			foreach ( $registrations as $registration ) {
1572
-				if ( $line_item->OBJ_ID() === $registration->ticket_ID() &&
1573
-					in_array( $registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment() )
1571
+			foreach ($registrations as $registration) {
1572
+				if ($line_item->OBJ_ID() === $registration->ticket_ID() &&
1573
+					in_array($registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment())
1574 1574
 				) {
1575 1575
 					$count++;
1576 1576
 				}
1577 1577
 			}
1578
-			$new_li_fields[ 'LIN_quantity' ] = $count;
1578
+			$new_li_fields['LIN_quantity'] = $count;
1579 1579
 		}
1580 1580
 		//don't set the total. We'll leave that up to the code that calculates it
1581
-		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ], $new_li_fields[ 'LIN_total' ] );
1582
-		return EE_Line_Item::new_instance( $new_li_fields );
1581
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent'], $new_li_fields['LIN_total']);
1582
+		return EE_Line_Item::new_instance($new_li_fields);
1583 1583
 	}
1584 1584
 
1585 1585
 
@@ -1592,19 +1592,19 @@  discard block
 block discarded – undo
1592 1592
 	 * @return \EE_Line_Item|null
1593 1593
 	 * @throws \EE_Error
1594 1594
 	 */
1595
-	public static function non_empty_line_items( EE_Line_Item $line_item ) {
1596
-		$copied_li = EEH_Line_Item::non_empty_line_item( $line_item );
1597
-		if ( $copied_li === null ) {
1595
+	public static function non_empty_line_items(EE_Line_Item $line_item) {
1596
+		$copied_li = EEH_Line_Item::non_empty_line_item($line_item);
1597
+		if ($copied_li === null) {
1598 1598
 			return null;
1599 1599
 		}
1600 1600
 		//if this is an event subtotal, we want to only include it if it
1601 1601
 		//has a non-zero total and at least one ticket line item child
1602 1602
 		$ticket_children = 0;
1603
-		foreach ( $line_item->children() as $child_li ) {
1604
-			$child_li_copy = EEH_Line_Item::non_empty_line_items( $child_li );
1605
-			if ( $child_li_copy !== null ) {
1606
-				$copied_li->add_child_line_item( $child_li_copy );
1607
-				if ( $child_li_copy->type() === EEM_Line_Item::type_line_item &&
1603
+		foreach ($line_item->children() as $child_li) {
1604
+			$child_li_copy = EEH_Line_Item::non_empty_line_items($child_li);
1605
+			if ($child_li_copy !== null) {
1606
+				$copied_li->add_child_line_item($child_li_copy);
1607
+				if ($child_li_copy->type() === EEM_Line_Item::type_line_item &&
1608 1608
 					$child_li_copy->OBJ_type() === 'Ticket'
1609 1609
 				) {
1610 1610
 					$ticket_children++;
@@ -1634,8 +1634,8 @@  discard block
 block discarded – undo
1634 1634
 	 * @return EE_Line_Item
1635 1635
 	 * @throws \EE_Error
1636 1636
 	 */
1637
-	public static function non_empty_line_item( EE_Line_Item $line_item ) {
1638
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1637
+	public static function non_empty_line_item(EE_Line_Item $line_item) {
1638
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1639 1639
 			$line_item->OBJ_type() === 'Ticket' &&
1640 1640
 			$line_item->quantity() === 0
1641 1641
 		) {
@@ -1643,8 +1643,8 @@  discard block
 block discarded – undo
1643 1643
 		}
1644 1644
 		$new_li_fields = $line_item->model_field_array();
1645 1645
 		//don't set the total. We'll leave that up to the code that calculates it
1646
-		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ] );
1647
-		return EE_Line_Item::new_instance( $new_li_fields );
1646
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent']);
1647
+		return EE_Line_Item::new_instance($new_li_fields);
1648 1648
 	}
1649 1649
 
1650 1650
 
@@ -1656,9 +1656,9 @@  discard block
 block discarded – undo
1656 1656
 	 * @return \EE_Line_Item
1657 1657
 	 * @throws \EE_Error
1658 1658
 	 */
1659
-	public static function get_items_subtotal( EE_Line_Item $total_line_item ){
1660
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1661
-		return self::get_pre_tax_subtotal( $total_line_item );
1659
+	public static function get_items_subtotal(EE_Line_Item $total_line_item) {
1660
+		EE_Error::doing_it_wrong('EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1661
+		return self::get_pre_tax_subtotal($total_line_item);
1662 1662
 	}
1663 1663
 
1664 1664
 
@@ -1669,9 +1669,9 @@  discard block
 block discarded – undo
1669 1669
 	 * @return \EE_Line_Item
1670 1670
 	 * @throws \EE_Error
1671 1671
 	 */
1672
-	public static function create_default_total_line_item( $transaction = NULL) {
1673
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0' );
1674
-		return self::create_total_line_item( $transaction );
1672
+	public static function create_default_total_line_item($transaction = NULL) {
1673
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0');
1674
+		return self::create_total_line_item($transaction);
1675 1675
 	}
1676 1676
 
1677 1677
 
@@ -1683,9 +1683,9 @@  discard block
 block discarded – undo
1683 1683
 	 * @return \EE_Line_Item
1684 1684
 	 * @throws \EE_Error
1685 1685
 	 */
1686
-	public static function create_default_tickets_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1687
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1688
-		return self::create_pre_tax_subtotal( $total_line_item, $transaction );
1686
+	public static function create_default_tickets_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1687
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1688
+		return self::create_pre_tax_subtotal($total_line_item, $transaction);
1689 1689
 	}
1690 1690
 
1691 1691
 
@@ -1697,9 +1697,9 @@  discard block
 block discarded – undo
1697 1697
 	 * @return \EE_Line_Item
1698 1698
 	 * @throws \EE_Error
1699 1699
 	 */
1700
-	public static function create_default_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1701
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0' );
1702
-		return self::create_taxes_subtotal( $total_line_item, $transaction );
1700
+	public static function create_default_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1701
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0');
1702
+		return self::create_taxes_subtotal($total_line_item, $transaction);
1703 1703
 	}
1704 1704
 
1705 1705
 
@@ -1711,9 +1711,9 @@  discard block
 block discarded – undo
1711 1711
 	 * @return \EE_Line_Item
1712 1712
 	 * @throws \EE_Error
1713 1713
 	 */
1714
-	public static function create_default_event_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1715
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0' );
1716
-		return self::create_event_subtotal( $total_line_item, $transaction );
1714
+	public static function create_default_event_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1715
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0');
1716
+		return self::create_event_subtotal($total_line_item, $transaction);
1717 1717
 	}
1718 1718
 
1719 1719
 
Please login to merge, or discard this patch.