Completed
Branch FET-8162-relation-exists (8f4753)
by
unknown
32:32 queued 23:52
created
core/db_classes/EE_Question_Form_Input.class.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 *        generate_question_form_inputs_for_object
227 227
 	 *
228 228
 	 * @access    protected
229
-	 * @param bool|object $object $object
229
+	 * @param EE_Base_Class|null $object $object
230 230
 	 * @param    array    $input_types
231 231
 	 * @return        array
232 232
 	 */
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 *    add_temp_option
325 325
 	 * @access public
326 326
 	 * @param \EE_Question_Option $QSO EE_Question_Option
327
-	 * @return boolean
327
+	 * @return boolean|null
328 328
 	 */
329 329
 	public function add_temp_option( EE_Question_Option $QSO ) {
330 330
 		$this->_QST->add_temp_option( $QSO );
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * set property values for question form input
337 337
 	 * @access public
338 338
 	 * @param    string $property
339
-	 * @param    mixed  $value
340
-	 * @return mixed
339
+	 * @param    boolean  $value
340
+	 * @return boolean|null
341 341
 	 */
342 342
 	public function set( $property = NULL, $value = NULL ) {
343 343
 		if ( ! empty( $property ) ) {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	/**
377 377
 	 *    get_meta
378 378
 	 * @access public
379
-	 * @param mixed $key
379
+	 * @param string $key
380 380
 	 * @return mixed
381 381
 	 */
382 382
 	public function get_meta( $key = FALSE ) {
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 	 * @access public
83 83
 	 * @return \EE_Question_Form_Input
84 84
 	 */
85
-	public function __construct( EE_Question $QST = NULL, EE_Answer $ANS = NULL, $q_meta = array() ) {
86
-		if ( empty( $QST ) || empty( $ANS ) ) {
87
-			EE_Error::add_error( __( 'An error occurred. A valid EE_Question or EE_Answer object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
85
+	public function __construct(EE_Question $QST = NULL, EE_Answer $ANS = NULL, $q_meta = array()) {
86
+		if (empty($QST) || empty($ANS)) {
87
+			EE_Error::add_error(__('An error occurred. A valid EE_Question or EE_Answer object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
88 88
 			return NULL;
89 89
 		}
90 90
 		$this->_QST = $QST;
91 91
 		$this->_ANS = $ANS;
92
-		$this->set_question_form_input_meta( $q_meta );
92
+		$this->set_question_form_input_meta($q_meta);
93 93
 		$this->set_question_form_input_init();
94 94
 	}
95 95
 
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @param array $q_meta
102 102
 	 * @return void
103 103
 	 */
104
-	public function set_question_form_input_meta( $q_meta = array() ) {
105
-		$default_q_meta = array( 'att_nmbr' => 1, 'ticket_id' => '', 'date' => '', 'time' => '', 'input_name' => '', 'input_id' => '', 'input_class' => '', 'input_prefix' => 'qstn', 'append_qstn_id' => TRUE, 'htmlentities' => TRUE, 'allow_null' => FALSE );
106
-		$this->_QST_meta = array_merge( $default_q_meta, $q_meta );
104
+	public function set_question_form_input_meta($q_meta = array()) {
105
+		$default_q_meta = array('att_nmbr' => 1, 'ticket_id' => '', 'date' => '', 'time' => '', 'input_name' => '', 'input_id' => '', 'input_class' => '', 'input_prefix' => 'qstn', 'append_qstn_id' => TRUE, 'htmlentities' => TRUE, 'allow_null' => FALSE);
106
+		$this->_QST_meta = array_merge($default_q_meta, $q_meta);
107 107
 	}
108 108
 
109 109
 
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function set_question_form_input_init() {
117 117
 		$qstn_id = $this->_QST->system_ID() ? $this->_QST->system_ID() : $this->_QST->ID();
118
-		$this->_set_input_name( $qstn_id );
119
-		$this->_set_input_id( $qstn_id );
120
-		$this->_set_input_class( $qstn_id );
121
-		$this->set_question_form_input_answer( $qstn_id );
118
+		$this->_set_input_name($qstn_id);
119
+		$this->_set_input_id($qstn_id);
120
+		$this->_set_input_class($qstn_id);
121
+		$this->set_question_form_input_answer($qstn_id);
122 122
 	}
123 123
 
124 124
 
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 	 * @param $qstn_id
130 130
 	 * @return void
131 131
 	 */
132
-	private function _set_input_name( $qstn_id ) {
133
-		if ( ! empty( $qstn_id ) ) {
134
-			$ANS_ID = $this->get( 'ANS_ID' );
135
-			$qstn_id = ! empty( $ANS_ID ) ? '[' . $qstn_id . '][' . $ANS_ID . ']' : '[' . $qstn_id . ']';
132
+	private function _set_input_name($qstn_id) {
133
+		if ( ! empty($qstn_id)) {
134
+			$ANS_ID = $this->get('ANS_ID');
135
+			$qstn_id = ! empty($ANS_ID) ? '['.$qstn_id.']['.$ANS_ID.']' : '['.$qstn_id.']';
136 136
 		}
137
-		$this->QST_input_name = $this->_QST_meta[ 'append_qstn_id' ] && ! empty( $qstn_id ) ? $this->_QST_meta[ 'input_prefix' ] . $this->_QST_meta[ 'input_name' ] . $qstn_id : $this->_QST_meta[ 'input_prefix' ] . $this->_QST_meta[ 'input_name' ];
137
+		$this->QST_input_name = $this->_QST_meta['append_qstn_id'] && ! empty($qstn_id) ? $this->_QST_meta['input_prefix'].$this->_QST_meta['input_name'].$qstn_id : $this->_QST_meta['input_prefix'].$this->_QST_meta['input_name'];
138 138
 	}
139 139
 
140 140
 
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 	 * @param    string $property
146 146
 	 * @return mixed
147 147
 	 */
148
-	public function get( $property = NULL ) {
149
-		if ( ! empty( $property ) ) {
150
-			if ( EEM_Question::instance()->has_field( $property ) ) {
151
-				return $this->_QST->get( $property );
152
-			} else if ( EEM_Answer::instance()->has_field( $property ) ) {
153
-				return $this->_ANS->get( $property );
154
-			} else if ( $this->_question_form_input_property_exists( __CLASS__, $property ) ) {
148
+	public function get($property = NULL) {
149
+		if ( ! empty($property)) {
150
+			if (EEM_Question::instance()->has_field($property)) {
151
+				return $this->_QST->get($property);
152
+			} else if (EEM_Answer::instance()->has_field($property)) {
153
+				return $this->_ANS->get($property);
154
+			} else if ($this->_question_form_input_property_exists(__CLASS__, $property)) {
155 155
 				return $this->{$property};
156 156
 			}
157 157
 		}
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
 	 * @param    string $property
168 168
 	 * @return boolean
169 169
 	 */
170
-	private function _question_form_input_property_exists( $classname, $property ) {
170
+	private function _question_form_input_property_exists($classname, $property) {
171 171
 		// first try regular property exists method which works as expected in PHP 5.3+
172
-		$prop = EEH_Class_Tools::has_property( $classname, $property );
173
-		if ( ! $prop ) {
172
+		$prop = EEH_Class_Tools::has_property($classname, $property);
173
+		if ( ! $prop) {
174 174
 			// use reflection for < PHP 5.3 as a double check when property is not found, possible due to access restriction
175
-			$reflector = new ReflectionClass( $classname );
176
-			$prop = $reflector->hasProperty( $property );
175
+			$reflector = new ReflectionClass($classname);
176
+			$prop = $reflector->hasProperty($property);
177 177
 		}
178 178
 		return $prop;
179 179
 	}
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 	 * @param $qstn_id
187 187
 	 * @return void
188 188
 	 */
189
-	private function _set_input_id( $qstn_id ) {
190
-		$input_id = isset( $this->_QST_meta[ 'input_id' ] ) && ! empty( $this->_QST_meta[ 'input_id' ] ) ? $this->_QST_meta[ 'input_id' ] : sanitize_key( strip_tags( $this->_QST->get( 'QST_display_text' ) ) );
191
-		$this->QST_input_id = $this->_QST_meta[ 'append_qstn_id' ] && ! empty( $qstn_id ) ? $input_id . '-' . $qstn_id : $input_id;
189
+	private function _set_input_id($qstn_id) {
190
+		$input_id = isset($this->_QST_meta['input_id']) && ! empty($this->_QST_meta['input_id']) ? $this->_QST_meta['input_id'] : sanitize_key(strip_tags($this->_QST->get('QST_display_text')));
191
+		$this->QST_input_id = $this->_QST_meta['append_qstn_id'] && ! empty($qstn_id) ? $input_id.'-'.$qstn_id : $input_id;
192 192
 	}
193 193
 
194 194
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @return void
200 200
 	 */
201 201
 	private function _set_input_class() {
202
-		$this->QST_input_class = isset( $this->_QST_meta[ 'input_class' ] ) ? $this->_QST_meta[ 'input_class' ] : '';
202
+		$this->QST_input_class = isset($this->_QST_meta['input_class']) ? $this->_QST_meta['input_class'] : '';
203 203
 	}
204 204
 
205 205
 
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
 	 * @param mixed    int | string    $qstn_id
211 211
 	 * @return void
212 212
 	 */
213
-	public function set_question_form_input_answer( $qstn_id ) {
213
+	public function set_question_form_input_answer($qstn_id) {
214 214
 		// check for answer in $_REQUEST in case we are reprocessing a form after an error
215
-		if ( isset( $this->_QST_meta[ 'EVT_ID' ] ) && isset( $this->_QST_meta[ 'att_nmbr' ] ) && isset( $this->_QST_meta[ 'date' ] ) && isset( $this->_QST_meta[ 'time' ] ) && isset( $this->_QST_meta[ 'price_id' ] ) ) {
216
-			if ( isset( $_REQUEST[ 'qstn' ][ $this->_QST_meta[ 'EVT_ID' ] ][ $this->_QST_meta[ 'att_nmbr' ] ][ $this->_QST_meta[ 'date' ] ][ $this->_QST_meta[ 'time' ] ][ $this->_QST_meta[ 'price_id' ] ][ $qstn_id ] ) ) {
217
-				$answer = $_REQUEST[ 'qstn' ][ $this->_QST_meta[ 'EVT_ID' ] ][ $this->_QST_meta[ 'att_nmbr' ] ][ $this->_QST_meta[ 'date' ] ][ $this->_QST_meta[ 'time' ] ][ $this->_QST_meta[ 'price_id' ] ][ $qstn_id ];
218
-				$this->_ANS->set( 'ANS_value', $answer );
215
+		if (isset($this->_QST_meta['EVT_ID']) && isset($this->_QST_meta['att_nmbr']) && isset($this->_QST_meta['date']) && isset($this->_QST_meta['time']) && isset($this->_QST_meta['price_id'])) {
216
+			if (isset($_REQUEST['qstn'][$this->_QST_meta['EVT_ID']][$this->_QST_meta['att_nmbr']][$this->_QST_meta['date']][$this->_QST_meta['time']][$this->_QST_meta['price_id']][$qstn_id])) {
217
+				$answer = $_REQUEST['qstn'][$this->_QST_meta['EVT_ID']][$this->_QST_meta['att_nmbr']][$this->_QST_meta['date']][$this->_QST_meta['time']][$this->_QST_meta['price_id']][$qstn_id];
218
+				$this->_ANS->set('ANS_value', $answer);
219 219
 			}
220 220
 		}
221 221
 	}
@@ -230,40 +230,40 @@  discard block
 block discarded – undo
230 230
 	 * @param    array    $input_types
231 231
 	 * @return        array
232 232
 	 */
233
-	static function generate_question_form_inputs_for_object( $object = FALSE, $input_types = array() ) {
234
-		if ( ! is_object( $object ) ) {
233
+	static function generate_question_form_inputs_for_object($object = FALSE, $input_types = array()) {
234
+		if ( ! is_object($object)) {
235 235
 			return FALSE;
236 236
 		}
237 237
 		$inputs = array();
238
-		$fields = $object->get_model()->field_settings( FALSE );
238
+		$fields = $object->get_model()->field_settings(FALSE);
239 239
 		//		$pk = $object->ID(); <<< NO!
240 240
 		//		EEH_Debug_Tools::printr( $object, get_class( $object ) . '<br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
241 241
 		//		EEH_Debug_Tools::printr( $fields, '$fields  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
242 242
 		//		EEH_Debug_Tools::printr( $input_types, '$input_types  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
243
-		foreach ( $fields as $field_ID => $field ) {
244
-			if ( $field instanceof EE_Model_Field_Base ) {
243
+		foreach ($fields as $field_ID => $field) {
244
+			if ($field instanceof EE_Model_Field_Base) {
245 245
 				//			echo '<h4>$field_ID : ' . $field_ID . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
246 246
 				//			EEH_Debug_Tools::printr( $field, '$field  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
247
-				if ( isset( $input_types[ $field_ID ] ) ) {
247
+				if (isset($input_types[$field_ID])) {
248 248
 					// get saved value for field
249
-					$value = $object->get( $field_ID );
249
+					$value = $object->get($field_ID);
250 250
 					//				echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
251 251
 					// if no saved value, then use default
252 252
 					$value = $value !== NULL ? $value : $field->get_default_value();
253 253
 					//			if ( $field_ID == 'CNT_active' )
254 254
 					//				echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
255 255
 					// determine question type
256
-					$type = isset( $input_types[ $field_ID ] ) ? $input_types[ $field_ID ][ 'type' ] : 'TEXT';
256
+					$type = isset($input_types[$field_ID]) ? $input_types[$field_ID]['type'] : 'TEXT';
257 257
 					// input name
258
-					$input_name = isset( $input_types[ $field_ID ] ) && isset( $input_types[ $field_ID ][ 'input_name' ] ) ? $input_types[ $field_ID ][ 'input_name' ] . '[' . $field_ID . ']' : $field_ID;
258
+					$input_name = isset($input_types[$field_ID]) && isset($input_types[$field_ID]['input_name']) ? $input_types[$field_ID]['input_name'].'['.$field_ID.']' : $field_ID;
259 259
 					// css class for input
260
-					$class = isset( $input_types[ $field_ID ][ 'class' ] ) && ! empty( $input_types[ $field_ID ][ 'class' ] ) ? ' ' . $input_types[ $field_ID ][ 'class' ] : '';
260
+					$class = isset($input_types[$field_ID]['class']) && ! empty($input_types[$field_ID]['class']) ? ' '.$input_types[$field_ID]['class'] : '';
261 261
 					// whether to apply htmlentities to answer
262
-					$htmlentities = isset( $input_types[ $field_ID ][ 'htmlentities' ] ) ? $input_types[ $field_ID ][ 'htmlentities' ] : TRUE;
262
+					$htmlentities = isset($input_types[$field_ID]['htmlentities']) ? $input_types[$field_ID]['htmlentities'] : TRUE;
263 263
 					// whether to apply htmlentities to answer
264
-					$label_b4 = isset( $input_types[ $field_ID ][ 'label_b4' ] ) ? $input_types[ $field_ID ][ 'label_b4' ] : FALSE;
264
+					$label_b4 = isset($input_types[$field_ID]['label_b4']) ? $input_types[$field_ID]['label_b4'] : FALSE;
265 265
 					// whether to apply htmlentities to answer
266
-					$use_desc_4_label = isset( $input_types[ $field_ID ][ 'use_desc_4_label' ] ) ? $input_types[ $field_ID ][ 'use_desc_4_label' ] : FALSE;
266
+					$use_desc_4_label = isset($input_types[$field_ID]['use_desc_4_label']) ? $input_types[$field_ID]['use_desc_4_label'] : FALSE;
267 267
 
268 268
 					// create EE_Question_Form_Input object
269 269
 					$QFI = new EE_Question_Form_Input(
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 							)
284 284
 						),
285 285
 						array(
286
-							'input_id' => $field_ID . '-' . $object->ID(),
286
+							'input_id' => $field_ID.'-'.$object->ID(),
287 287
 							'input_name' => $input_name,
288
-							'input_class' => $field_ID . $class,
288
+							'input_class' => $field_ID.$class,
289 289
 							'input_prefix' => '',
290 290
 							'append_qstn_id' => FALSE,
291 291
 							'htmlentities' => $htmlentities,
@@ -294,21 +294,21 @@  discard block
 block discarded – undo
294 294
 						)
295 295
 					);
296 296
 					// does question type have options ?
297
-					if ( in_array( $type, array( 'DROPDOWN', 'RADIO_BTN', 'CHECKBOX' ) ) && isset ( $input_types[ $field_ID ] ) && isset ( $input_types[ $field_ID ][ 'options' ] ) ) {
298
-						foreach ( $input_types[ $field_ID ][ 'options' ] as $option ) {
299
-							$option = stripslashes_deep( $option );
300
-							$option_id = ! empty( $option[ 'id' ] ) ? $option[ 'id' ] : 0;
301
-							$QSO = EE_Question_Option::new_instance( array( 'QSO_value' => (string)$option_id, 'QSO_desc' => $option[ 'text' ], 'QSO_deleted' => FALSE ) );
297
+					if (in_array($type, array('DROPDOWN', 'RADIO_BTN', 'CHECKBOX')) && isset ($input_types[$field_ID]) && isset ($input_types[$field_ID]['options'])) {
298
+						foreach ($input_types[$field_ID]['options'] as $option) {
299
+							$option = stripslashes_deep($option);
300
+							$option_id = ! empty($option['id']) ? $option['id'] : 0;
301
+							$QSO = EE_Question_Option::new_instance(array('QSO_value' => (string) $option_id, 'QSO_desc' => $option['text'], 'QSO_deleted' => FALSE));
302 302
 							// all QST (and ANS) properties can be accessed indirectly thru QFI
303
-							$QFI->add_temp_option( $QSO );
303
+							$QFI->add_temp_option($QSO);
304 304
 						}
305 305
 					}
306 306
 					// we don't want ppl manually changing primary keys cuz that would just lead to total craziness man
307
-					if ( $field_ID == $object->get_model()->primary_key_name() ) {
308
-						$QFI->set( 'QST_disabled', TRUE );
307
+					if ($field_ID == $object->get_model()->primary_key_name()) {
308
+						$QFI->set('QST_disabled', TRUE);
309 309
 					}
310 310
 					//EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
311
-					$inputs[ $field_ID ] = $QFI;
311
+					$inputs[$field_ID] = $QFI;
312 312
 					//			if ( $field_ID == 'CNT_active' ) {
313 313
 					//				EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
314 314
 					//			}
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 	 * @param \EE_Question_Option $QSO EE_Question_Option
327 327
 	 * @return boolean
328 328
 	 */
329
-	public function add_temp_option( EE_Question_Option $QSO ) {
330
-		$this->_QST->add_temp_option( $QSO );
329
+	public function add_temp_option(EE_Question_Option $QSO) {
330
+		$this->_QST->add_temp_option($QSO);
331 331
 	}
332 332
 
333 333
 
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
 	 * @param    mixed  $value
340 340
 	 * @return mixed
341 341
 	 */
342
-	public function set( $property = NULL, $value = NULL ) {
343
-		if ( ! empty( $property ) ) {
344
-			if ( EEM_Question::instance()->has_field( $property ) ) {
345
-				$this->_QST->set( $property, $value );
346
-			} else if ( EEM_Answer::instance()->has_field( $property ) ) {
347
-				$this->_ANS->set( $property, $value );
348
-			} else if ( $this->_question_form_input_property_exists( __CLASS__, $property ) ) {
342
+	public function set($property = NULL, $value = NULL) {
343
+		if ( ! empty($property)) {
344
+			if (EEM_Question::instance()->has_field($property)) {
345
+				$this->_QST->set($property, $value);
346
+			} else if (EEM_Answer::instance()->has_field($property)) {
347
+				$this->_ANS->set($property, $value);
348
+			} else if ($this->_question_form_input_property_exists(__CLASS__, $property)) {
349 349
 				echo "<hr>$property is a prop of QFI";
350 350
 				$this->{$property} = $value;
351 351
 				return TRUE;
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
 	 *                                                       whether it was trashed or not.
367 367
 	 * @return EE_Question_Option
368 368
 	 */
369
-	public function options( $notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL ) {
369
+	public function options($notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL) {
370 370
 		$temp_options = $this->_QST->temp_options();
371
-		return ! empty( $temp_options ) ? $temp_options : $this->_QST->options( $notDeletedOptionsOnly, $selected_value_to_always_include );
371
+		return ! empty($temp_options) ? $temp_options : $this->_QST->options($notDeletedOptionsOnly, $selected_value_to_always_include);
372 372
 	}
373 373
 
374 374
 
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
 	 * @param mixed $key
380 380
 	 * @return mixed
381 381
 	 */
382
-	public function get_meta( $key = FALSE ) {
383
-		return $key && isset( $this->_QST_meta[ $key ] ) ? $this->_QST_meta[ $key ] : FALSE;
382
+	public function get_meta($key = FALSE) {
383
+		return $key && isset($this->_QST_meta[$key]) ? $this->_QST_meta[$key] : FALSE;
384 384
 	}
385 385
 
386 386
 
Please login to merge, or discard this patch.
core/db_classes/EE_Question_Group.class.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	/**
66 66
 	 * Gets the question group's internal name
67 67
 	 * @access public
68
-	 * @return string
68
+	 * @return boolean
69 69
 	 */
70 70
 	public function identifier() {
71 71
 		return $this->get( 'QSG_identifier' );
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * Gets the question group's order number in a sequence
90 90
 	 * of other question groups
91 91
 	 * @access public
92
-	 * @return int
92
+	 * @return boolean
93 93
 	 */
94 94
 	public function order() {
95 95
 		return $this->get( 'QSG_order' );
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 *
139 139
 	 * @since 4.5.0
140 140
 	 *
141
-	 * @return int
141
+	 * @return boolean
142 142
 	 */
143 143
 	public function wp_user() {
144 144
 		return $this->get('QSG_wp_user');
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	/**
214 214
 	 * Adds the question to this question group
215 215
 	 * @param EE_Question || int $question object or ID
216
-	 * @return boolean if successful
216
+	 * @return EE_Base_Class if successful
217 217
 	 */
218 218
 	public function add_question( $questionObjectOrID ) {
219 219
 		return $this->_add_relation_to( $questionObjectOrID, 'Question' );
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	/**
225 225
 	 * Removes the question from this question group
226 226
 	 * @param EE_Question || int $question object or ID
227
-	 * @return boolean of success
227
+	 * @return EE_Base_Class of success
228 228
 	 */
229 229
 	public function remove_question( $questionObjectOrID ) {
230 230
 		return $this->_remove_relation_to( $questionObjectOrID, 'Question' );
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 * @param array $props_n_values
33 33
 	 * @return EE_Question_Group|mixed
34 34
 	 */
35
-	public static function new_instance( $props_n_values = array() ) {
36
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
37
-		return $has_object ? $has_object : new self( $props_n_values );
35
+	public static function new_instance($props_n_values = array()) {
36
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
37
+		return $has_object ? $has_object : new self($props_n_values);
38 38
 	}
39 39
 
40 40
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @param array $props_n_values
44 44
 	 * @return EE_Question_Group
45 45
 	 */
46
-	public static function new_instance_from_db( $props_n_values = array() ) {
47
-		return new self( $props_n_values, TRUE );
46
+	public static function new_instance_from_db($props_n_values = array()) {
47
+		return new self($props_n_values, TRUE);
48 48
 	}
49 49
 
50 50
 
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 * @param bool $pretty
56 56
 	 * @return string
57 57
 	 */
58
-	public function name( $pretty = FALSE ) {
59
-		return $pretty ? $this->get_pretty( 'QSG_name' ) : $this->get( 'QSG_name' );
58
+	public function name($pretty = FALSE) {
59
+		return $pretty ? $this->get_pretty('QSG_name') : $this->get('QSG_name');
60 60
 	}
61 61
 
62 62
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return string
69 69
 	 */
70 70
 	public function identifier() {
71
-		return $this->get( 'QSG_identifier' );
71
+		return $this->get('QSG_identifier');
72 72
 	}
73 73
 
74 74
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 * @param bool $pretty
80 80
 	 * @return string
81 81
 	 */
82
-	public function desc( $pretty = FALSE ) {
83
-		return $pretty ? $this->get_pretty( 'QSG_desc' ) : $this->get( 'QSG_desc' );
82
+	public function desc($pretty = FALSE) {
83
+		return $pretty ? $this->get_pretty('QSG_desc') : $this->get('QSG_desc');
84 84
 	}
85 85
 
86 86
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 * @return int
93 93
 	 */
94 94
 	public function order() {
95
-		return $this->get( 'QSG_order' );
95
+		return $this->get('QSG_order');
96 96
 	}
97 97
 
98 98
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @return boolean
104 104
 	 */
105 105
 	public function show_group_name() {
106
-		return $this->get( 'QSG_show_group_name' );
106
+		return $this->get('QSG_show_group_name');
107 107
 	}
108 108
 
109 109
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @return boolean
116 116
 	 */
117 117
 	public function show_group_desc() {
118
-		return $this->get( 'QSG_show_group_desc' );
118
+		return $this->get('QSG_show_group_desc');
119 119
 	}
120 120
 
121 121
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return boolean
129 129
 	 */
130 130
 	public function system_group() {
131
-		return $this->get( 'QSG_system' );
131
+		return $this->get('QSG_system');
132 132
 	}
133 133
 
134 134
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @return boolean
154 154
 	 */
155 155
 	public function deleted() {
156
-		return $this->get( 'QST_deleted' );
156
+		return $this->get('QST_deleted');
157 157
 	}
158 158
 
159 159
 
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	public function questions_in_and_not_in_group() {
166 166
 		$questions_in_group = $this->questions();
167
-		$exclude_question_ids = ! empty( $questions_in_group ) ? array_keys( $questions_in_group ) : array();
168
-		$questions_not_in_group = $this->questions_not_in_group( $exclude_question_ids );
167
+		$exclude_question_ids = ! empty($questions_in_group) ? array_keys($questions_in_group) : array();
168
+		$questions_not_in_group = $this->questions_not_in_group($exclude_question_ids);
169 169
 		return $questions_in_group + $questions_not_in_group;
170 170
 	}
171 171
 
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 	 * @param array $query_params
177 177
 	 * @return EE_Question[]
178 178
 	 */
179
-	public function questions( $query_params = array() ) {
180
-		$query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' ) );
181
-		return $this->ID() ? $this->get_many_related( 'Question', $query_params ) : array();
179
+	public function questions($query_params = array()) {
180
+		$query_params = ! empty($query_params) ? $query_params : array('order_by' => array('Question_Group_Question.QGQ_order' => 'ASC'));
181
+		return $this->ID() ? $this->get_many_related('Question', $query_params) : array();
182 182
 	}
183 183
 
184 184
 
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
 	 * @param  mixed $question_IDS_in_group if empty array then all questions returned.  if FALSE then we first get questions in this group and exclude them from questions get all. IF empty array then we just return all questions.
189 189
 	 * @return EE_Question[]
190 190
 	 */
191
-	public function questions_not_in_group( $question_IDS_in_group = FALSE ) {
192
-		if ( $question_IDS_in_group === FALSE ) {
191
+	public function questions_not_in_group($question_IDS_in_group = FALSE) {
192
+		if ($question_IDS_in_group === FALSE) {
193 193
 			$questions = $this->questions();
194
-			$question_IDS_in_group = ! empty( $questions ) ? array_keys( $questions ) : array();
194
+			$question_IDS_in_group = ! empty($questions) ? array_keys($questions) : array();
195 195
 		}
196
-		$_where = ! empty( $question_IDS_in_group ) ? array( 'QST_ID' => array( 'not_in', $question_IDS_in_group ) ) : array();
196
+		$_where = ! empty($question_IDS_in_group) ? array('QST_ID' => array('not_in', $question_IDS_in_group)) : array();
197 197
 
198
-		return EEM_Question::instance()->get_all( array( $_where, 'order_by' => array( 'QST_ID' => 'ASC' ) ) );
198
+		return EEM_Question::instance()->get_all(array($_where, 'order_by' => array('QST_ID' => 'ASC')));
199 199
 	}
200 200
 
201 201
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 * @return EE_Event[]
206 206
 	 */
207 207
 	public function events() {
208
-		return $this->get_many_related( 'Event' );
208
+		return $this->get_many_related('Event');
209 209
 	}
210 210
 
211 211
 
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 	 * @param EE_Question || int $question object or ID
216 216
 	 * @return boolean if successful
217 217
 	 */
218
-	public function add_question( $questionObjectOrID ) {
219
-		return $this->_add_relation_to( $questionObjectOrID, 'Question' );
218
+	public function add_question($questionObjectOrID) {
219
+		return $this->_add_relation_to($questionObjectOrID, 'Question');
220 220
 	}
221 221
 
222 222
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 * @param EE_Question || int $question object or ID
227 227
 	 * @return boolean of success
228 228
 	 */
229
-	public function remove_question( $questionObjectOrID ) {
230
-		return $this->_remove_relation_to( $questionObjectOrID, 'Question' );
229
+	public function remove_question($questionObjectOrID) {
230
+		return $this->_remove_relation_to($questionObjectOrID, 'Question');
231 231
 	}
232 232
 
233 233
 
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
 	 * @param $qst_order
238 238
 	 * @return int
239 239
 	 */
240
-	public function update_question_order( $questionObjectOrID, $qst_order ) {
241
-		$qst_ID = $questionObjectOrID instanceof EE_Question ? $questionObjectOrID->ID() : (int)$questionObjectOrID;
242
-		return EEM_Question_Group_Question::instance()->update( array( 'QGQ_order' => $qst_order ), array( array( 'QST_ID' => $qst_ID, 'QSG_ID' => $this->ID() ) ) );
240
+	public function update_question_order($questionObjectOrID, $qst_order) {
241
+		$qst_ID = $questionObjectOrID instanceof EE_Question ? $questionObjectOrID->ID() : (int) $questionObjectOrID;
242
+		return EEM_Question_Group_Question::instance()->update(array('QGQ_order' => $qst_order), array(array('QST_ID' => $qst_ID, 'QSG_ID' => $this->ID())));
243 243
 	}
244 244
 
245 245
 
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function has_questions_with_answers() {
252 252
 		$has_answers = FALSE;
253
-		$questions = $this->get_many_related( 'Question' );
254
-		foreach ( $questions as $question ) {
255
-			if ( $question->count_related( 'Answer' ) > 0 )
253
+		$questions = $this->get_many_related('Question');
254
+		foreach ($questions as $question) {
255
+			if ($question->count_related('Answer') > 0)
256 256
 				$has_answers = TRUE;
257 257
 		}
258 258
 		return $has_answers;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	public function set_order_to_latest() {
270 270
 		$latest_order = $this->get_model()->get_latest_question_group_order();
271
-		$latest_order ++;
272
-		$this->set( 'QSG_order', $latest_order );
271
+		$latest_order++;
272
+		$this->set('QSG_order', $latest_order);
273 273
 	}
274 274
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -252,8 +252,9 @@
 block discarded – undo
252 252
 		$has_answers = FALSE;
253 253
 		$questions = $this->get_many_related( 'Question' );
254 254
 		foreach ( $questions as $question ) {
255
-			if ( $question->count_related( 'Answer' ) > 0 )
256
-				$has_answers = TRUE;
255
+			if ( $question->count_related( 'Answer' ) > 0 ) {
256
+							$has_answers = TRUE;
257
+			}
257 258
 		}
258 259
 		return $has_answers;
259 260
 	}
Please login to merge, or discard this patch.
core/db_classes/EE_Status.class.php 2 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	/**
67 67
 	 * Sets code
68 68
 	 * @param string $code
69
-	 * @return boolean
69
+	 * @return boolean|null
70 70
 	 */
71 71
 	function set_code( $code ) {
72 72
 		$this->set( 'STS_code', $code );
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 	/**
78 78
 	 * Gets desc
79
-	 * @return string
79
+	 * @return boolean
80 80
 	 */
81 81
 	function desc() {
82 82
 		return $this->get( 'STS_desc' );
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	/**
88 88
 	 * Sets desc
89 89
 	 * @param string $desc
90
-	 * @return boolean
90
+	 * @return boolean|null
91 91
 	 */
92 92
 	function set_desc( $desc ) {
93 93
 		$this->set( 'STS_desc', $desc );
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
 	/**
99 99
 	 * Gets type
100
-	 * @return string
100
+	 * @return boolean
101 101
 	 */
102 102
 	function type() {
103 103
 		return $this->get( 'STS_type' );
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	/**
109 109
 	 * Sets type
110 110
 	 * @param string $type
111
-	 * @return boolean
111
+	 * @return boolean|null
112 112
 	 */
113 113
 	function set_type( $type ) {
114 114
 		$this->set( 'STS_type', $type );
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	/**
130 130
 	 * Sets can_edit
131 131
 	 * @param boolean $can_edit
132
-	 * @return boolean
132
+	 * @return boolean|null
133 133
 	 */
134 134
 	function set_can_edit( $can_edit ) {
135 135
 		$this->set( 'STS_can_edit', $can_edit );
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	/**
151 151
 	 * Sets open
152 152
 	 * @param boolean $open
153
-	 * @return boolean
153
+	 * @return boolean|null
154 154
 	 */
155 155
 	function set_open( $open ) {
156 156
 		$this->set( 'STS_open', $open );
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 * @param array $props_n_values
33 33
 	 * @return EE_Status
34 34
 	 */
35
-	public static function new_instance( $props_n_values = array() ) {
36
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
37
-		return $has_object ? $has_object : new self( $props_n_values );
35
+	public static function new_instance($props_n_values = array()) {
36
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
37
+		return $has_object ? $has_object : new self($props_n_values);
38 38
 	}
39 39
 
40 40
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @param array $props_n_values
44 44
 	 * @return EE_Status
45 45
 	 */
46
-	public static function new_instance_from_db( $props_n_values = array() ) {
47
-		return new self( $props_n_values, TRUE );
46
+	public static function new_instance_from_db($props_n_values = array()) {
47
+		return new self($props_n_values, TRUE);
48 48
 	}
49 49
 
50 50
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 * @param string $schema
56 56
 	 * @return string
57 57
 	 */
58
-	function code( $plural = FALSE, $schema = 'upper' ) {
59
-		$id = $this->get( 'STS_ID' );
60
-		$code = EEM_Status::instance()->localized_status( array( $id => $this->get( 'STS_code' ) ), $plural, $schema );
61
-		return $code[ $id ];
58
+	function code($plural = FALSE, $schema = 'upper') {
59
+		$id = $this->get('STS_ID');
60
+		$code = EEM_Status::instance()->localized_status(array($id => $this->get('STS_code')), $plural, $schema);
61
+		return $code[$id];
62 62
 	}
63 63
 
64 64
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @param string $code
69 69
 	 * @return boolean
70 70
 	 */
71
-	function set_code( $code ) {
72
-		$this->set( 'STS_code', $code );
71
+	function set_code($code) {
72
+		$this->set('STS_code', $code);
73 73
 	}
74 74
 
75 75
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @return string
80 80
 	 */
81 81
 	function desc() {
82
-		return $this->get( 'STS_desc' );
82
+		return $this->get('STS_desc');
83 83
 	}
84 84
 
85 85
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	 * @param string $desc
90 90
 	 * @return boolean
91 91
 	 */
92
-	function set_desc( $desc ) {
93
-		$this->set( 'STS_desc', $desc );
92
+	function set_desc($desc) {
93
+		$this->set('STS_desc', $desc);
94 94
 	}
95 95
 
96 96
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @return string
101 101
 	 */
102 102
 	function type() {
103
-		return $this->get( 'STS_type' );
103
+		return $this->get('STS_type');
104 104
 	}
105 105
 
106 106
 
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	 * @param string $type
111 111
 	 * @return boolean
112 112
 	 */
113
-	function set_type( $type ) {
114
-		$this->set( 'STS_type', $type );
113
+	function set_type($type) {
114
+		$this->set('STS_type', $type);
115 115
 	}
116 116
 
117 117
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @return boolean
122 122
 	 */
123 123
 	function can_edit() {
124
-		return $this->get( 'STS_can_edit' );
124
+		return $this->get('STS_can_edit');
125 125
 	}
126 126
 
127 127
 
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 	 * @param boolean $can_edit
132 132
 	 * @return boolean
133 133
 	 */
134
-	function set_can_edit( $can_edit ) {
135
-		$this->set( 'STS_can_edit', $can_edit );
134
+	function set_can_edit($can_edit) {
135
+		$this->set('STS_can_edit', $can_edit);
136 136
 	}
137 137
 
138 138
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return boolean
143 143
 	 */
144 144
 	function open() {
145
-		return $this->get( 'STS_open' );
145
+		return $this->get('STS_open');
146 146
 	}
147 147
 
148 148
 
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @param boolean $open
153 153
 	 * @return boolean
154 154
 	 */
155
-	function set_open( $open ) {
156
-		$this->set( 'STS_open', $open );
155
+	function set_open($open) {
156
+		$this->set('STS_open', $open);
157 157
 	}
158 158
 }
159 159
 
Please login to merge, or discard this patch.
core/db_classes/EE_Term.class.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 	/**
68 68
 	 * Gets name
69
-	 * @return string
69
+	 * @return boolean
70 70
 	 */
71 71
 	function name() {
72 72
 		return $this->get( 'name' );
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	/**
78 78
 	 * Sets name
79 79
 	 * @param string $name
80
-	 * @return boolean
80
+	 * @return boolean|null
81 81
 	 */
82 82
 	function set_name( $name ) {
83 83
 		$this->set( 'name', $name );
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 	/**
89 89
 	 * Gets slug
90
-	 * @return string
90
+	 * @return boolean
91 91
 	 */
92 92
 	function slug() {
93 93
 		return $this->get( 'slug' );
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	/**
99 99
 	 * Sets slug
100 100
 	 * @param string $slug
101
-	 * @return boolean
101
+	 * @return boolean|null
102 102
 	 */
103 103
 	function set_slug( $slug ) {
104 104
 		$this->set( 'slug', $slug );
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	 * @param bool $bydb
35 35
 	 * @param string $timezone
36 36
 	 */
37
-	protected function __construct( $fieldValues = array(), $bydb = FALSE, $timezone = '' ) {
38
-		if ( ! isset( $fieldValues[ 'slug' ] ) ) {
39
-			$fieldValues[ 'slug' ] = $fieldValues[ 'name' ];
37
+	protected function __construct($fieldValues = array(), $bydb = FALSE, $timezone = '') {
38
+		if ( ! isset($fieldValues['slug'])) {
39
+			$fieldValues['slug'] = $fieldValues['name'];
40 40
 		}
41
-		parent::__construct( $fieldValues, $bydb, $timezone );
41
+		parent::__construct($fieldValues, $bydb, $timezone);
42 42
 	}
43 43
 
44 44
 
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 	 * @param array $props_n_values
48 48
 	 * @return EE_Term|mixed
49 49
 	 */
50
-	public static function new_instance( $props_n_values = array() ) {
51
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
52
-		return $has_object ? $has_object : new self( $props_n_values );
50
+	public static function new_instance($props_n_values = array()) {
51
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
52
+		return $has_object ? $has_object : new self($props_n_values);
53 53
 	}
54 54
 
55 55
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 * @param array $props_n_values
59 59
 	 * @return EE_Term
60 60
 	 */
61
-	public static function new_instance_from_db( $props_n_values = array() ) {
62
-		return new self( $props_n_values, TRUE );
61
+	public static function new_instance_from_db($props_n_values = array()) {
62
+		return new self($props_n_values, TRUE);
63 63
 	}
64 64
 
65 65
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @return string
70 70
 	 */
71 71
 	function name() {
72
-		return $this->get( 'name' );
72
+		return $this->get('name');
73 73
 	}
74 74
 
75 75
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 * @param string $name
80 80
 	 * @return boolean
81 81
 	 */
82
-	function set_name( $name ) {
83
-		$this->set( 'name', $name );
82
+	function set_name($name) {
83
+		$this->set('name', $name);
84 84
 	}
85 85
 
86 86
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @return string
91 91
 	 */
92 92
 	function slug() {
93
-		return $this->get( 'slug' );
93
+		return $this->get('slug');
94 94
 	}
95 95
 
96 96
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	 * @param string $slug
101 101
 	 * @return boolean
102 102
 	 */
103
-	function set_slug( $slug ) {
104
-		$this->set( 'slug', $slug );
103
+	function set_slug($slug) {
104
+		$this->set('slug', $slug);
105 105
 	}
106 106
 }
107 107
 
Please login to merge, or discard this patch.
core/db_classes/EE_Term_Taxonomy.class.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 	/**
53 53
 	 * Gets taxonomy
54
-	 * @return string
54
+	 * @return boolean
55 55
 	 */
56 56
 	function taxonomy() {
57 57
 		return $this->get( 'taxonomy' );
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	/**
63 63
 	 * Sets taxonomy
64 64
 	 * @param string $taxonomy
65
-	 * @return boolean
65
+	 * @return boolean|null
66 66
 	 */
67 67
 	function set_taxonomy( $taxonomy ) {
68 68
 		$this->set( 'taxonomy', $taxonomy );
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 	/**
74 74
 	 * Gets term_count
75
-	 * @return int
75
+	 * @return boolean
76 76
 	 */
77 77
 	function count() {
78 78
 		return $this->get( 'term_count' );
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	/**
84 84
 	 * Sets term_count
85 85
 	 * @param int $term_count
86
-	 * @return boolean
86
+	 * @return boolean|null
87 87
 	 */
88 88
 	function set_count( $term_count ) {
89 89
 		$this->set( 'term_count', $term_count );
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 * @param array $props_n_values
33 33
 	 * @return EE_Term_Taxonomy
34 34
 	 */
35
-	public static function new_instance( $props_n_values = array() ) {
36
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
37
-		return $has_object ? $has_object : new self( $props_n_values );
35
+	public static function new_instance($props_n_values = array()) {
36
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
37
+		return $has_object ? $has_object : new self($props_n_values);
38 38
 	}
39 39
 
40 40
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @param array $props_n_values
44 44
 	 * @return EE_Term_Taxonomy
45 45
 	 */
46
-	public static function new_instance_from_db( $props_n_values = array() ) {
47
-		return new self( $props_n_values, TRUE );
46
+	public static function new_instance_from_db($props_n_values = array()) {
47
+		return new self($props_n_values, TRUE);
48 48
 	}
49 49
 
50 50
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @return string
55 55
 	 */
56 56
 	function taxonomy() {
57
-		return $this->get( 'taxonomy' );
57
+		return $this->get('taxonomy');
58 58
 	}
59 59
 
60 60
 
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 	 * @param string $taxonomy
65 65
 	 * @return boolean
66 66
 	 */
67
-	function set_taxonomy( $taxonomy ) {
68
-		$this->set( 'taxonomy', $taxonomy );
67
+	function set_taxonomy($taxonomy) {
68
+		$this->set('taxonomy', $taxonomy);
69 69
 	}
70 70
 
71 71
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @return int
76 76
 	 */
77 77
 	function count() {
78
-		return $this->get( 'term_count' );
78
+		return $this->get('term_count');
79 79
 	}
80 80
 
81 81
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @param int $term_count
86 86
 	 * @return boolean
87 87
 	 */
88
-	function set_count( $term_count ) {
89
-		$this->set( 'term_count', $term_count );
88
+	function set_count($term_count) {
89
+		$this->set('term_count', $term_count);
90 90
 	}
91 91
 
92 92
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @return EE_Term
97 97
 	 */
98 98
 	function term() {
99
-		return $this->get_first_related( 'Term' );
99
+		return $this->get_first_related('Term');
100 100
 	}
101 101
 
102 102
 
Please login to merge, or discard this patch.
core/db_models/EEM_Attendee.model.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
 	*
110 110
 	* 		@access		public
111 111
 	* 		@param		$ATT_ID
112
-	*		@return 		mixed		array on success, FALSE on fail
112
+	*		@return 		EE_Soft_Delete_Base_Class|null		array on success, FALSE on fail
113 113
 	 * 		@deprecated
114 114
 	*/
115 115
 	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 
106 106
 
107 107
 	/**
108
-	*		retrieve  a single attendee from db via their ID
109
-	*
110
-	* 		@access		public
111
-	* 		@param		$ATT_ID
112
-	*		@return 		mixed		array on success, FALSE on fail
108
+	 *		retrieve  a single attendee from db via their ID
109
+	 *
110
+	 * 		@access		public
111
+	 * 		@param		$ATT_ID
112
+	 *		@return 		mixed		array on success, FALSE on fail
113 113
 	 * 		@deprecated
114
-	*/
114
+	 */
115 115
 	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
116 116
 		// retrieve a particular EE_Attendee
117 117
 		return $this->get_one_by_ID( $ATT_ID );
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 
122 122
 
123 123
 	/**
124
-	*		retrieve  a single attendee from db via their ID
125
-	*
126
-	* 		@access		public
127
-	* 		@param		array $where_cols_n_values
128
-	*		@return 		mixed		array on success, FALSE on fail
129
-	*/
124
+	 *		retrieve  a single attendee from db via their ID
125
+	 *
126
+	 * 		@access		public
127
+	 * 		@param		array $where_cols_n_values
128
+	 *		@return 		mixed		array on success, FALSE on fail
129
+	 */
130 130
 	public function get_attendee( $where_cols_n_values = array() ) {
131 131
 
132 132
 		if ( empty( $where_cols_n_values )) {
@@ -174,20 +174,20 @@  discard block
 block discarded – undo
174 174
 
175 175
 
176 176
 	/**
177
-             * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate
178
-             * EE_Attendee objects.
179
-             *
180
-             * @since    4.3.0
181
-             * @param  array $ids array of EE_Registration ids
182
-             * @return  EE_Attendee[]
183
-             */
184
-            public function get_array_of_contacts_from_reg_ids( $ids ) {
185
-                $ids = (array) $ids;
186
-                $_where = array(
187
-                    'Registration.REG_ID' => array( 'in', $ids )
188
-                    );
189
-                return $this->get_all( array( $_where ) );
190
-            }
177
+	 * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate
178
+	 * EE_Attendee objects.
179
+	 *
180
+	 * @since    4.3.0
181
+	 * @param  array $ids array of EE_Registration ids
182
+	 * @return  EE_Attendee[]
183
+	 */
184
+			public function get_array_of_contacts_from_reg_ids( $ids ) {
185
+				$ids = (array) $ids;
186
+				$_where = array(
187
+					'Registration.REG_ID' => array( 'in', $ids )
188
+					);
189
+				return $this->get_all( array( $_where ) );
190
+			}
191 191
 
192 192
 
193 193
 }
Please login to merge, or discard this patch.
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
 require_once ( EE_MODELS . 'EEM_Base.model.php' );
3 5
 
4 6
 /**
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 
4 4
 /**
5 5
  *
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
 	 * QST_ID and QST_systems that relate to attendee attributes.
20 20
 	 * NOTE: this will be deprecated if we remove system questions
21 21
 	 */
22
-	const fname_question_id=1;
23
-	const lname_question_id=2;
24
-	const email_question_id=3;
25
-	const address_question_id=4;
26
-	const address2_question_id=5;
27
-	const city_question_id=6;
28
-	const state_question_id=7;
29
-	const country_question_id=8;
30
-	const zip_question_id=9;
31
-	const phone_question_id=10;
22
+	const fname_question_id = 1;
23
+	const lname_question_id = 2;
24
+	const email_question_id = 3;
25
+	const address_question_id = 4;
26
+	const address2_question_id = 5;
27
+	const city_question_id = 6;
28
+	const state_question_id = 7;
29
+	const country_question_id = 8;
30
+	const zip_question_id = 9;
31
+	const phone_question_id = 10;
32 32
 
33 33
 
34 34
 
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 * @access protected
40 40
 	 * @param null $timezone
41 41
 	 */
42
-	protected function __construct( $timezone = NULL ) {
43
-		$this->singular_item = __('Attendee','event_espresso');
44
-		$this->plural_item = __('Attendees','event_espresso');
42
+	protected function __construct($timezone = NULL) {
43
+		$this->singular_item = __('Attendee', 'event_espresso');
44
+		$this->plural_item = __('Attendees', 'event_espresso');
45 45
 		$this->_tables = array(
46 46
 			'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'),
47 47
 			'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID')
@@ -55,35 +55,35 @@  discard block
 block discarded – undo
55 55
 				'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, current_time('timestamp')),
56 56
 				'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")),
57 57
 				'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, current_time('timestamp')),
58
-				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ),
58
+				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false),
59 59
 				'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0),
60
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'),// EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
60
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'), // EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
61 61
 				'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish')
62 62
 			),
63 63
 			'Attendee_Meta'=>array(
64
-				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false),
64
+				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false),
65 65
 				'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false),
66
-				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''),
67
-				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''),
68
-				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''),
69
-				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''),
70
-				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''),
71
-				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'),
72
-				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'),
73
-				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''),
74
-				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''),
75
-				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '')
66
+				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''),
67
+				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''),
68
+				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''),
69
+				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''),
70
+				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''),
71
+				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'),
72
+				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'),
73
+				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''),
74
+				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''),
75
+				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '')
76 76
 			));
77 77
 		$this->_model_relations = array(
78 78
 			'Registration'=>new EE_Has_Many_Relation(),
79 79
 			'State'=>new EE_Belongs_To_Relation(),
80 80
 			'Country'=>new EE_Belongs_To_Relation(),
81
-			'Event'=>new EE_HABTM_Relation('Registration', FALSE ),
81
+			'Event'=>new EE_HABTM_Relation('Registration', FALSE),
82 82
 			'WP_User' => new EE_Belongs_To_Relation(),
83 83
 		);
84 84
 		require_once('strategies/EE_CPT_Where_Conditions.strategy.php');
85 85
 		$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_attendees', 'ATTM_ID');
86
-		parent::__construct( $timezone );
86
+		parent::__construct($timezone);
87 87
 
88 88
 	}
89 89
 
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 	 * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID
96 96
 	 * @return EE_Attendee[]
97 97
 	 */
98
-	public function get_attendees_for_transaction( $transaction_id_or_obj ){
99
-		return $this->get_all( array( array(
98
+	public function get_attendees_for_transaction($transaction_id_or_obj) {
99
+		return $this->get_all(array(array(
100 100
 			  'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj
101 101
 		  )));
102 102
 	}
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	*		@return 		mixed		array on success, FALSE on fail
112 112
 	 * 		@deprecated
113 113
 	*/
114
-	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
114
+	public function get_attendee_by_ID($ATT_ID = FALSE) {
115 115
 		// retrieve a particular EE_Attendee
116
-		return $this->get_one_by_ID( $ATT_ID );
116
+		return $this->get_one_by_ID($ATT_ID);
117 117
 	}
118 118
 
119 119
 
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
 	* 		@param		array $where_cols_n_values
127 127
 	*		@return 		mixed		array on success, FALSE on fail
128 128
 	*/
129
-	public function get_attendee( $where_cols_n_values = array() ) {
129
+	public function get_attendee($where_cols_n_values = array()) {
130 130
 
131
-		if ( empty( $where_cols_n_values )) {
131
+		if (empty($where_cols_n_values)) {
132 132
 			return FALSE;
133 133
 		}
134
-		$attendee = $this->get_all( array($where_cols_n_values ));
135
-		if ( ! empty( $attendee )) {
136
-			return array_shift( $attendee );
134
+		$attendee = $this->get_all(array($where_cols_n_values));
135
+		if ( ! empty($attendee)) {
136
+			return array_shift($attendee);
137 137
 		} else {
138 138
 			return FALSE;
139 139
 		}
@@ -149,20 +149,20 @@  discard block
 block discarded – undo
149 149
 	 * @param array $where_cols_n_values
150 150
 	 * @return bool|mixed
151 151
 	 */
152
-	public function find_existing_attendee( $where_cols_n_values = NULL ) {
152
+	public function find_existing_attendee($where_cols_n_values = NULL) {
153 153
 		// search by combo of first and last names plus the email address
154
-		$attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email );
154
+		$attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email);
155 155
 		// no search params means attendee object already exists.
156
-		$where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys;
156
+		$where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys;
157 157
 		$valid_data = TRUE;
158 158
 		// check for required values
159
-		$valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE;
160
-		$valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE;
161
-		$valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE;
159
+		$valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE;
160
+		$valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE;
161
+		$valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE;
162 162
 
163
-		if ( $valid_data ) {
164
-			$attendee = $this->get_attendee( $where_cols_n_values );
165
-			if ( $attendee instanceof EE_Attendee ) {
163
+		if ($valid_data) {
164
+			$attendee = $this->get_attendee($where_cols_n_values);
165
+			if ($attendee instanceof EE_Attendee) {
166 166
 				return $attendee;
167 167
 			}
168 168
 		}
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
              * @param  array $ids array of EE_Registration ids
181 181
              * @return  EE_Attendee[]
182 182
              */
183
-            public function get_array_of_contacts_from_reg_ids( $ids ) {
183
+            public function get_array_of_contacts_from_reg_ids($ids) {
184 184
                 $ids = (array) $ids;
185 185
                 $_where = array(
186
-                    'Registration.REG_ID' => array( 'in', $ids )
186
+                    'Registration.REG_ID' => array('in', $ids)
187 187
                     );
188
-                return $this->get_all( array( $_where ) );
188
+                return $this->get_all(array($_where));
189 189
             }
190 190
 
191 191
 
Please login to merge, or discard this patch.
core/db_models/EEM_Message_Template_Group.model.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * get_all_message_templates_by_messenger
85 85
 	 *
86 86
 	 * @access public
87
-	 * @return array all (including trashed or inactive) message template group objects for the given messenger
87
+	 * @return EE_Base_Class[] all (including trashed or inactive) message template group objects for the given messenger
88 88
 	 */
89 89
 	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC' ) {
90 90
 		return $this->get_all_deleted_and_undeleted( array( array('MTP_messenger' => $messenger), 'order_by' => array($orderby => $order) ) );
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * This sends things to the validator for the given messenger and message type.
272 272
 	 *
273 273
 	 *
274
-	 * @param  array $fields the incoming fields to check.  Note this array is in the formatted fields from the form fields setup.  So we need to reformat this into an array of expected field refs by the validator.  Note also that this is not only the fields for the Message Template Group but ALSO for Message Template.
274
+	 * @param  string $fields the incoming fields to check.  Note this array is in the formatted fields from the form fields setup.  So we need to reformat this into an array of expected field refs by the validator.  Note also that this is not only the fields for the Message Template Group but ALSO for Message Template.
275 275
 	 * @param string $context The context the fields were obtained from.
276 276
 	 * @param string $messenger The messenger we are validating
277 277
 	 * @param string $message_type The message type we are validating.
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION') )
2 2
 	exit('NO direct script access allowed');
3 3
 /**
4
- * Event Espresso
5
- *
6
- * Event Registration and Management Plugin for Wordpress
7
- *
8
- * @package		Event Espresso
9
- * @author		Seth Shoultes
10
- * @copyright	(c)2009-2012 Event Espresso All Rights Reserved.
11
- * @license		@link http://eventespresso.com/support/terms-conditions/  ** see Plugin Licensing * *
12
- * @link		http://www.eventespresso.com
13
- * @version		4.1
14
- *
15
- * ------------------------------------------------------------------------
16
- *
17
- * EEM_Message_Template_Group
18
- *
19
- *
20
- *
21
- * @package		Event Espresso
22
- * @subpackage	includes/models/EEM_Message_Template_Group.model.php
23
- * @author		Darren Ethier
24
- *
25
- *
26
- */
4
+	 * Event Espresso
5
+	 *
6
+	 * Event Registration and Management Plugin for Wordpress
7
+	 *
8
+	 * @package		Event Espresso
9
+	 * @author		Seth Shoultes
10
+	 * @copyright	(c)2009-2012 Event Espresso All Rights Reserved.
11
+	 * @license		@link http://eventespresso.com/support/terms-conditions/  ** see Plugin Licensing * *
12
+	 * @link		http://www.eventespresso.com
13
+	 * @version		4.1
14
+	 *
15
+	 * ------------------------------------------------------------------------
16
+	 *
17
+	 * EEM_Message_Template_Group
18
+	 *
19
+	 *
20
+	 *
21
+	 * @package		Event Espresso
22
+	 * @subpackage	includes/models/EEM_Message_Template_Group.model.php
23
+	 * @author		Darren Ethier
24
+	 *
25
+	 *
26
+	 */
27 27
 require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
28 28
 class EEM_Message_Template_Group extends EEM_Soft_Delete_Base {
29 29
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION') ) {
2 2
 	exit('NO direct script access allowed');
3
+}
3 4
 /**
4 5
  * Event Espresso
5 6
  *
@@ -288,7 +289,9 @@  discard block
 block discarded – undo
288 289
 				$assembled_fields[$value['name']] = $value['content']['main'];
289 290
 				//loop through the content and get the other fields.
290 291
 				foreach ( $value['content'] as $name => $val ) {
291
-					if ( $name == 'main' ) continue;
292
+					if ( $name == 'main' ) {
293
+						continue;
294
+					}
292 295
 					$assembled_fields[$name] = $val;
293 296
 				}
294 297
 				continue;
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('NO direct script access allowed');
3 3
 /**
4 4
  * Event Espresso
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *
25 25
  *
26 26
  */
27
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
27
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
28 28
 class EEM_Message_Template_Group extends EEM_Soft_Delete_Base {
29 29
 
30 30
 	// private instance of the EEM_Message_Template_Group object
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
 
35
-	protected function __construct( $timezone = NULL ) {
35
+	protected function __construct($timezone = NULL) {
36 36
 		$this->singular_item = __('Message Template Group', 'event_espresso');
37 37
 		$this->plural_item = __('Message Template Groups', 'event_espresso');
38 38
 		$this->_tables = array(
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 		$this->_fields = array(
42 42
 			'Message_Template_Group' => array(
43 43
 				'GRP_ID' => new EE_Primary_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso')),
44
-				'MTP_name' => new EE_Plain_Text_Field( 'MTP_name', __('The name of the temlpate group', 'event_espresso'), FALSE, '' ),
45
-				'MTP_description' => new EE_Simple_HTML_Field( 'MTP_description', __('A brief description about this template.', 'event_espresso' ), FALSE, '' ),
46
-				'MTP_user_id'=> new EE_WP_User_Field('MTP_user_id', __('Template Creator ID', 'event_espresso'), FALSE, get_current_user_id() ),
47
-				'MTP_messenger'=>new EE_Plain_Text_Field('MTP_messenger', __('Messenger Used for Template', 'event_espresso'), FALSE, 'email' ),
48
-				'MTP_message_type'=>new EE_Plain_Text_Field('MTP_message_type', __('Message Type', 'event_espresso'),false,'registration'),
44
+				'MTP_name' => new EE_Plain_Text_Field('MTP_name', __('The name of the temlpate group', 'event_espresso'), FALSE, ''),
45
+				'MTP_description' => new EE_Simple_HTML_Field('MTP_description', __('A brief description about this template.', 'event_espresso'), FALSE, ''),
46
+				'MTP_user_id'=> new EE_WP_User_Field('MTP_user_id', __('Template Creator ID', 'event_espresso'), FALSE, get_current_user_id()),
47
+				'MTP_messenger'=>new EE_Plain_Text_Field('MTP_messenger', __('Messenger Used for Template', 'event_espresso'), FALSE, 'email'),
48
+				'MTP_message_type'=>new EE_Plain_Text_Field('MTP_message_type', __('Message Type', 'event_espresso'), false, 'registration'),
49 49
 				'MTP_is_global'=>new EE_Boolean_Field('MTP_is_global', __('Flag indicating if Template Group is Global', 'event_espresso'), false, true),
50 50
 				'MTP_is_override'=>new EE_Boolean_Field('MTP_is_override', __('Flag indicating if Template Group overrides any other Templates for the messenger/messagetype combination', 'event_espresso'), false, false),
51 51
 				'MTP_deleted'=>new EE_Trashed_Flag_Field('MTP_deleted', __('Flag indicating whether this has been trashed', 'event_espresso'), false, false),
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 			'WP_User' => new EE_Belongs_To_Relation(),
59 59
 			);
60 60
 
61
-		parent::__construct( $timezone );
61
+		parent::__construct($timezone);
62 62
 	}
63 63
 
64 64
 
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 * @return array   message template objects that are attached to a specific event.
71 71
 	 */
72 72
 	public function get_all_trashed_message_templates_by_event($EVT_ID, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE) {
73
-		$query_params = array( array('Event.EVT_ID' => $EVT_ID), 'order_by' => array($orderby => $order), 'limit' => $limit );
74
-		return $count ? $this->count_deleted( $query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted( $query_params );
73
+		$query_params = array(array('Event.EVT_ID' => $EVT_ID), 'order_by' => array($orderby => $order), 'limit' => $limit);
74
+		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted($query_params);
75 75
 	}
76 76
 
77 77
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * @access public
83 83
 	 * @return array all (including trashed or inactive) message template group objects for the given messenger
84 84
 	 */
85
-	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC' ) {
86
-		return $this->get_all_deleted_and_undeleted( array( array('MTP_messenger' => $messenger), 'order_by' => array($orderby => $order) ) );
85
+	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC') {
86
+		return $this->get_all_deleted_and_undeleted(array(array('MTP_messenger' => $messenger), 'order_by' => array($orderby => $order)));
87 87
 	}
88 88
 
89 89
 
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 	 * @param  array  $_where any existing where conditions to append these to.
94 94
 	 * @return array          original where conditions or original with additional filters.
95 95
 	 */
96
-	protected function _maybe_mtp_filters( $_where = array() ) {
96
+	protected function _maybe_mtp_filters($_where = array()) {
97 97
 		//account for messenger or message type filters
98
-		if ( isset($_REQUEST['ee_messenger_filter_by'] ) && $_REQUEST['ee_messenger_filter_by'] != 'none_selected' && $_REQUEST['ee_messenger_filter_by'] != 'all'  ) {
99
-			$_where['MTP_messenger'] =  $_REQUEST['ee_messenger_filter_by'] ;
98
+		if (isset($_REQUEST['ee_messenger_filter_by']) && $_REQUEST['ee_messenger_filter_by'] != 'none_selected' && $_REQUEST['ee_messenger_filter_by'] != 'all') {
99
+			$_where['MTP_messenger'] = $_REQUEST['ee_messenger_filter_by'];
100 100
 		}
101 101
 
102
-		if ( isset( $_REQUEST['ee_message_type_filter_by']) && $_REQUEST['ee_message_type_filter_by'] != 'none_selected' ) {
102
+		if (isset($_REQUEST['ee_message_type_filter_by']) && $_REQUEST['ee_message_type_filter_by'] != 'none_selected') {
103 103
 			$_where['MTP_message_type'] = $_REQUEST['ee_message_type_filter_by'];
104 104
 		}
105 105
 
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 	 * @access public
114 114
 	 * @return array  all active (non_trashed, active) message template objects
115 115
 	 */
116
-	public function get_all_active_message_templates($orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $global = TRUE, $user_check = FALSE ) {
117
-		$_where = $global ? array('MTP_is_global' => TRUE ) : array('MTP_is_global' => FALSE );
116
+	public function get_all_active_message_templates($orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $global = TRUE, $user_check = FALSE) {
117
+		$_where = $global ? array('MTP_is_global' => TRUE) : array('MTP_is_global' => FALSE);
118 118
 		$_where['MTP_is_active'] = TRUE;
119 119
 		$_where = $this->_maybe_mtp_filters($_where);
120 120
 
121
-		if  ( $user_check && ! $global && ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_messages', 'get_all_active_message_templates' )  ) {
121
+		if ($user_check && ! $global && ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_messages', 'get_all_active_message_templates')) {
122 122
 			$_where['MTP_user_id'] = get_current_user_id();
123 123
 		}
124 124
 
125
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
125
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
126 126
 
127
-		return $count ? $this->count($query_params, 'GRP_ID', TRUE ) : $this->get_all($query_params);
127
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
128 128
 	}
129 129
 
130 130
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 
141 141
 		$_where = $this->_maybe_mtp_filters();
142 142
 
143
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
143
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
144 144
 
145
-		$r_templates = $count ? $this->count_deleted_and_undeleted($query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted_and_undeleted( $query_params );
145
+		$r_templates = $count ? $this->count_deleted_and_undeleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted_and_undeleted($query_params);
146 146
 
147 147
 		return $r_templates;
148 148
 	}
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 	 * @param  array  $query_params same as EEM_Base::get_all()
157 157
 	 * @return  EE_Message_Template_Group[]
158 158
 	 */
159
-	public function get_all_custom_templates_by_event( $EVT_ID, $query_params = array() ) {
160
-		$_where = array( 'Event.EVT_ID' => $EVT_ID );
161
-		return $this->get_all( array( $_where ) );
159
+	public function get_all_custom_templates_by_event($EVT_ID, $query_params = array()) {
160
+		$_where = array('Event.EVT_ID' => $EVT_ID);
161
+		return $this->get_all(array($_where));
162 162
 	}
163 163
 
164 164
 
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
 	 * @return EE_Message_Template_Group[] message template groups.
173 173
 	 */
174 174
 	public function get_all_trashed_grouped_message_templates($orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $global = TRUE) {
175
-		$_where = $global ? array('MTP_is_global' => TRUE ) : array('MTP_is_global' => FALSE );
175
+		$_where = $global ? array('MTP_is_global' => TRUE) : array('MTP_is_global' => FALSE);
176 176
 		$_where['MTP_is_active'] = TRUE;
177 177
 		$_where = $this->_maybe_mtp_filters($_where);
178 178
 
179
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
179
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
180 180
 
181
-		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted( $query_params );
181
+		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted($query_params);
182 182
 	}
183 183
 
184 184
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param  bool   $active  		ignore "active" or not. (default only return active)
196 196
 	 * @return mixed (int|EE_Message_Template_Group[])                depending on $count.
197 197
 	 */
198
-	public function get_event_message_templates_by_m_and_mt_and_evt( $messenger, $message_type, $evt_id, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $active = TRUE ) {
198
+	public function get_event_message_templates_by_m_and_mt_and_evt($messenger, $message_type, $evt_id, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $active = TRUE) {
199 199
 
200 200
 		$_where = array(
201 201
 			'MTP_messenger' => $messenger,
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
 			'MTP_is_active' => $active
206 206
 			);
207 207
 
208
-		$query_params = array( $_where, 'order_by' => array($orderby=>$order), 'limit' => $limit );
208
+		$query_params = array($_where, 'order_by' => array($orderby=>$order), 'limit' => $limit);
209 209
 
210
-		return $count ? $this->count($query_params, 'GRP_ID', TRUE ) : $this->get_all( $query_params );
210
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
211 211
 	}
212 212
 
213 213
 
@@ -224,20 +224,20 @@  discard block
 block discarded – undo
224 224
 	 * @param  bool   $active  		ignore "active" or not. (default only return active) - 'all' means return both inactive AND inactive.
225 225
 	 * @return ARRAY               message template objects that are global (i.e. non-event)
226 226
 	 */
227
-	public function get_global_message_template_by_m_and_mt($messenger, $message_type, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $active = TRUE ) {
227
+	public function get_global_message_template_by_m_and_mt($messenger, $message_type, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $active = TRUE) {
228 228
 		$_where = array(
229 229
 			'MTP_messenger' => $messenger,
230 230
 			'MTP_message_type' => $message_type,
231 231
 			'MTP_is_global' => TRUE,
232 232
 			);
233 233
 
234
-		if ( $active != 'all' ) {
234
+		if ($active != 'all') {
235 235
 			$_where['MTP_is_active'] = $active;
236 236
 		}
237 237
 
238
-		$query_params = array( $_where, 'order_by' => array( $orderby => $order ), 'limit' => $limit );
238
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
239 239
 
240
-		return $count ? $this->count( $query_params, 'GRP_ID', TRUE ) : $this->get_all( $query_params );
240
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
241 241
 	}
242 242
 
243 243
 
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 	 * @param  array  $query_params same as EEM_Base->get_all()
251 251
 	 * @return EE_Message_Template_Group[]
252 252
 	 */
253
-	public function get_custom_message_template_by_m_and_mt( $messenger, $message_type, $query_params = array() ) {
253
+	public function get_custom_message_template_by_m_and_mt($messenger, $message_type, $query_params = array()) {
254 254
 		$_where = array(
255 255
 			'MTP_is_global' => FALSE,
256 256
 			'MTP_messenger' => $messenger,
257 257
 			'MTP_message_type' => $message_type
258 258
 			);
259 259
 
260
-		return $this->get_all( array( $_where ) );
260
+		return $this->get_all(array($_where));
261 261
 	}
262 262
 
263 263
 
@@ -278,13 +278,13 @@  discard block
 block discarded – undo
278 278
 		$assembled_fields = array();
279 279
 
280 280
 		//let's loop through all the fields and set them up in the right format
281
-		foreach ( $fields as $index => $value ) {
281
+		foreach ($fields as $index => $value) {
282 282
 			//first let's figure out if the value['content'] in the current index is an array.  If it is then this is special fields that are used in parsing special shortcodes (i.e. 'attendee_list').
283
-			if ( is_array($value['content']) ) {
283
+			if (is_array($value['content'])) {
284 284
 				$assembled_fields[$value['name']] = $value['content']['main'];
285 285
 				//loop through the content and get the other fields.
286
-				foreach ( $value['content'] as $name => $val ) {
287
-					if ( $name == 'main' ) continue;
286
+				foreach ($value['content'] as $name => $val) {
287
+					if ($name == 'main') continue;
288 288
 					$assembled_fields[$name] = $val;
289 289
 				}
290 290
 				continue;
@@ -295,21 +295,21 @@  discard block
 block discarded – undo
295 295
 		}
296 296
 
297 297
 		//now we've got the assembled_fields.  We need to setup the string for the appropriate validator class and call that.
298
-		$m_ref = ucwords( str_replace('_',' ', $messenger ) );
299
-		$m_ref = str_replace( ' ', '_', $m_ref );
300
-		$mt_ref = ucwords( str_replace('_', ' ', $message_type ) );
301
-		$mt_ref = str_replace( ' ', '_', $mt_ref );
298
+		$m_ref = ucwords(str_replace('_', ' ', $messenger));
299
+		$m_ref = str_replace(' ', '_', $m_ref);
300
+		$mt_ref = ucwords(str_replace('_', ' ', $message_type));
301
+		$mt_ref = str_replace(' ', '_', $mt_ref);
302 302
 
303
-		$classname = 'EE_Messages_' . $m_ref . '_' . $mt_ref . '_Validator';
303
+		$classname = 'EE_Messages_'.$m_ref.'_'.$mt_ref.'_Validator';
304 304
 
305
-		if ( !class_exists( $classname ) ) {
306
-			$msg[] = __( 'The Validator class was unable to load', 'event_espresso');
307
-			$msg[] = sprintf( __('The class name compiled was %s. Please check and make sure the spelling and case is correct for the class name and that there is an autoloader in place for this class', 'event_espresso'), $classname );
308
-			throw new EE_Error( implode( '||', $msg ) );
305
+		if ( ! class_exists($classname)) {
306
+			$msg[] = __('The Validator class was unable to load', 'event_espresso');
307
+			$msg[] = sprintf(__('The class name compiled was %s. Please check and make sure the spelling and case is correct for the class name and that there is an autoloader in place for this class', 'event_espresso'), $classname);
308
+			throw new EE_Error(implode('||', $msg));
309 309
 		}
310 310
 
311
-		$a = new ReflectionClass( $classname );
312
-		$_VLD = $a->newInstance( $assembled_fields, $context );
311
+		$a = new ReflectionClass($classname);
312
+		$_VLD = $a->newInstance($assembled_fields, $context);
313 313
 		$result = $_VLD->validate();
314 314
 		return $result;
315 315
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Payment_Method.model.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	/**
202 202
 	 * Overrides parent ot also check by the slug
203 203
 	 * @see EEM_Base::ensure_is_obj()
204
-	 * @param string|int|EE_Payment_Method $base_class_obj_or_id
204
+	 * @param EE_Payment_Method $base_class_obj_or_id
205 205
 	 * @param boolean                      $ensure_is_in_db
206 206
 	 * @return EE_Payment_Method
207 207
 	 * @throws EE_Error
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	/**
230 230
 	 * Gets the ID of this object, or if its a string finds the object's id
231 231
 	 * associated with that slug
232
-	 * @param mixed $base_obj_or_id_or_slug
232
+	 * @param EE_Payment_Method $base_obj_or_id_or_slug
233 233
 	 * @return int
234 234
 	 */
235 235
 	function ensure_is_ID( $base_obj_or_id_or_slug ) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -217,8 +217,7 @@  discard block
 block discarded – undo
217 217
 		//ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID)
218 218
 		try {
219 219
 			return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db );
220
-		}
221
-		catch ( EE_Error $e ) {
220
+		} catch ( EE_Error $e ) {
222 221
 			//handle it outside the catch
223 222
 		}
224 223
 		throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) );
@@ -283,8 +282,7 @@  discard block
 block discarded – undo
283 282
 						break;
284 283
 					}
285 284
 				}
286
-			}
287
-			catch ( EE_Error $e ) {
285
+			} catch ( EE_Error $e ) {
288 286
 				$payment_method->set_active( FALSE );
289 287
 			}
290 288
 		}
@@ -307,8 +305,7 @@  discard block
 block discarded – undo
307 305
 			try {
308 306
 				$payment_method->type_obj();
309 307
 				$usable_payment_methods[ $key ] = $payment_method;
310
-			}
311
-			catch ( EE_Error $e ) {
308
+			} catch ( EE_Error $e ) {
312 309
 				//if it threw an exception, its because the payment type object
313 310
 				//isn't defined (probably because somehow the DB got borked,
314 311
 				//or an addon which defined it got deactivated
Please login to merge, or discard this patch.
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  *
@@ -37,33 +37,33 @@  discard block
 block discarded – undo
37 37
 	 * @access   protected
38 38
 	 * @return EEM_Payment_Method
39 39
 	 */
40
-	protected function __construct( $timezone = NULL ) {
41
-		$this->singlular_item = __( 'Payment Method', 'event_espresso' );
42
-		$this->plural_item = __( 'Payment Methods', 'event_espresso' );
43
-		$this->_tables = array( 'Payment_Method' => new EE_Primary_Table( 'esp_payment_method', 'PMD_ID' ) );
40
+	protected function __construct($timezone = NULL) {
41
+		$this->singlular_item = __('Payment Method', 'event_espresso');
42
+		$this->plural_item = __('Payment Methods', 'event_espresso');
43
+		$this->_tables = array('Payment_Method' => new EE_Primary_Table('esp_payment_method', 'PMD_ID'));
44 44
 		$this->_fields = array(
45 45
 			'Payment_Method' => array(
46
-				'PMD_ID' => new EE_Primary_Key_Int_Field( 'PMD_ID', __( "ID", 'event_espresso' ) ),
47
-				'PMD_type' => new EE_Plain_Text_Field( 'PMD_type', __( "Payment Method Type", 'event_espresso' ), FALSE, 'Admin_Only' ),
48
-				'PMD_name' => new EE_Plain_Text_Field( 'PMD_name', __( "Name", 'event_espresso' ), FALSE ),
49
-				'PMD_desc' => new EE_Post_Content_Field( 'PMD_desc', __( "Description", 'event_espresso' ), FALSE, '' ),
50
-				'PMD_admin_name' => new EE_Plain_Text_Field( 'PMD_admin_name', __( "Admin-Only Name", 'event_espresso' ), TRUE ),
51
-				'PMD_admin_desc' => new EE_Post_Content_Field( 'PMD_admin_desc', __( "Admin-Only Description", 'event_espresso' ), TRUE ),
52
-				'PMD_slug' => new EE_Slug_Field( 'PMD_slug', __( "Slug", 'event_espresso' ), FALSE ),
53
-				'PMD_order' => new EE_Integer_Field( 'PMD_order', __( "Order", 'event_espresso' ), FALSE, 0 ),
54
-				'PMD_debug_mode' => new EE_Boolean_Field( 'PMD_debug_mode', __( "Debug Mode On?", 'event_espresso' ), FALSE, FALSE ),
55
-				'PMD_wp_user' => new EE_WP_User_Field( 'PMD_wp_user', __( "Payment Method Creator ID", 'event_espresso' ), FALSE ),
56
-				'PMD_open_by_default' => new EE_Boolean_Field( 'PMD_open_by_default', __( "Open by Default?", 'event_espresso' ), FALSE, FALSE ), 'PMD_button_url' => new EE_Plain_Text_Field( 'PMD_button_url', __( "Button URL", 'event_espresso' ), TRUE, '' ),
57
-				'PMD_scope' => new EE_Serialized_Text_Field( 'PMD_scope', __( "Usable From?", 'event_espresso' ), FALSE, array() ), //possible values currently are 'CART','ADMIN','API'
46
+				'PMD_ID' => new EE_Primary_Key_Int_Field('PMD_ID', __("ID", 'event_espresso')),
47
+				'PMD_type' => new EE_Plain_Text_Field('PMD_type', __("Payment Method Type", 'event_espresso'), FALSE, 'Admin_Only'),
48
+				'PMD_name' => new EE_Plain_Text_Field('PMD_name', __("Name", 'event_espresso'), FALSE),
49
+				'PMD_desc' => new EE_Post_Content_Field('PMD_desc', __("Description", 'event_espresso'), FALSE, ''),
50
+				'PMD_admin_name' => new EE_Plain_Text_Field('PMD_admin_name', __("Admin-Only Name", 'event_espresso'), TRUE),
51
+				'PMD_admin_desc' => new EE_Post_Content_Field('PMD_admin_desc', __("Admin-Only Description", 'event_espresso'), TRUE),
52
+				'PMD_slug' => new EE_Slug_Field('PMD_slug', __("Slug", 'event_espresso'), FALSE),
53
+				'PMD_order' => new EE_Integer_Field('PMD_order', __("Order", 'event_espresso'), FALSE, 0),
54
+				'PMD_debug_mode' => new EE_Boolean_Field('PMD_debug_mode', __("Debug Mode On?", 'event_espresso'), FALSE, FALSE),
55
+				'PMD_wp_user' => new EE_WP_User_Field('PMD_wp_user', __("Payment Method Creator ID", 'event_espresso'), FALSE),
56
+				'PMD_open_by_default' => new EE_Boolean_Field('PMD_open_by_default', __("Open by Default?", 'event_espresso'), FALSE, FALSE), 'PMD_button_url' => new EE_Plain_Text_Field('PMD_button_url', __("Button URL", 'event_espresso'), TRUE, ''),
57
+				'PMD_scope' => new EE_Serialized_Text_Field('PMD_scope', __("Usable From?", 'event_espresso'), FALSE, array()), //possible values currently are 'CART','ADMIN','API'
58 58
 		) );
59 59
 		$this->_model_relations = array(
60 60
  //			'Event'=>new EE_HABTM_Relation('Event_Payment_Method'),
61 61
 			'Payment' => new EE_Has_Many_Relation(),
62
-			'Currency' => new EE_HABTM_Relation( 'Currency_Payment_Method' ),
62
+			'Currency' => new EE_HABTM_Relation('Currency_Payment_Method'),
63 63
 			'Transaction' => new EE_Has_Many_Relation(),
64 64
 			'WP_User' => new EE_Belongs_To_Relation(),
65 65
 		);
66
-		parent::__construct( $timezone );
66
+		parent::__construct($timezone);
67 67
 	}
68 68
 
69 69
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 * @param string $slug
74 74
 	 * @return EE_Payment_Method
75 75
 	 */
76
-	public function get_one_by_slug( $slug ) {
77
-		return $this->get_one( array( array( 'PMD_slug' => $slug ) ) );
76
+	public function get_one_by_slug($slug) {
77
+		return $this->get_one(array(array('PMD_slug' => $slug)));
78 78
 	}
79 79
 
80 80
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 		return apply_filters(
89 89
 			'FHEE__EEM_Payment_Method__scopes',
90 90
 			array(
91
-				self::scope_cart 		=> __( "Front-end Registration Page", 'event_espresso' ),
92
-				self::scope_admin 	=> __( "Admin Registration Page (no online processing)", 'event_espresso' )
91
+				self::scope_cart 		=> __("Front-end Registration Page", 'event_espresso'),
92
+				self::scope_admin 	=> __("Admin Registration Page (no online processing)", 'event_espresso')
93 93
 			)
94 94
 		);
95 95
 	}
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @param string $scope like one of EEM_Payment_Method::instance()->scopes()
102 102
 	 * @return boolean
103 103
 	 */
104
-	public function is_valid_scope( $scope ) {
104
+	public function is_valid_scope($scope) {
105 105
 		$scopes = $this->scopes();
106
-		if ( isset( $scopes[ $scope ] ) ) {
106
+		if (isset($scopes[$scope])) {
107 107
 			return TRUE;
108 108
 		} else {
109 109
 			return FALSE;
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @throws EE_Error
120 120
 	 * @return EE_Payment_Method[]
121 121
 	 */
122
-	public function get_all_active( $scope = NULL, $query_params = array() ) {
123
-		if( ! isset( $query_params[ 'order_by' ] ) && ! isset( $query_params[ 'order' ] ) ) {
124
-			$query_params = array( 'order_by' => array( 'PMD_order' => 'ASC', 'PMD_ID' => 'ASC' ) );
122
+	public function get_all_active($scope = NULL, $query_params = array()) {
123
+		if ( ! isset($query_params['order_by']) && ! isset($query_params['order'])) {
124
+			$query_params = array('order_by' => array('PMD_order' => 'ASC', 'PMD_ID' => 'ASC'));
125 125
 		}
126
-		return $this->get_all( $this->_get_query_params_for_all_active( $scope, $query_params ) );
126
+		return $this->get_all($this->_get_query_params_for_all_active($scope, $query_params));
127 127
 	}
128 128
 
129 129
 	/**
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param array $query_params
133 133
 	 * @return int
134 134
 	 */
135
-	public function count_active( $scope = NULL, $query_params = array() ){
136
-		return $this->count( $this->_get_query_params_for_all_active( $scope, $query_params ) );
135
+	public function count_active($scope = NULL, $query_params = array()) {
136
+		return $this->count($this->_get_query_params_for_all_active($scope, $query_params));
137 137
 	}
138 138
 
139 139
 	/**
@@ -144,21 +144,21 @@  discard block
 block discarded – undo
144 144
 	 * @return array like param of EEM_Base::get_all()
145 145
 	 * @throws EE_Error
146 146
 	 */
147
-	protected function _get_query_params_for_all_active( $scope = NULL, $query_params = array() ){
148
-		if ( $scope ) {
149
-			if ( $this->is_valid_scope( $scope ) ) {
150
-				return array_replace_recursive( array( array( 'PMD_scope' => array( 'LIKE', "%$scope%" ) ) ), $query_params );
147
+	protected function _get_query_params_for_all_active($scope = NULL, $query_params = array()) {
148
+		if ($scope) {
149
+			if ($this->is_valid_scope($scope)) {
150
+				return array_replace_recursive(array(array('PMD_scope' => array('LIKE', "%$scope%"))), $query_params);
151 151
 			} else {
152
-				throw new EE_Error( sprintf( __( "'%s' is not a valid scope for a payment method", "event_espresso" ), $scope ) );
152
+				throw new EE_Error(sprintf(__("'%s' is not a valid scope for a payment method", "event_espresso"), $scope));
153 153
 			}
154 154
 		} else {
155 155
 			$acceptable_scopes = array();
156 156
 			$count = 0;
157
-			foreach ( $this->scopes() as $scope_name => $desc ) {
157
+			foreach ($this->scopes() as $scope_name => $desc) {
158 158
 				$count++;
159
-				$acceptable_scopes[ 'PMD_scope*' . $count ] = array( 'LIKE', '%' . $scope_name . '%' );
159
+				$acceptable_scopes['PMD_scope*'.$count] = array('LIKE', '%'.$scope_name.'%');
160 160
 			}
161
-			return array_replace_recursive( array( array( 'OR*active_scope' => $acceptable_scopes ) ), $query_params );
161
+			return array_replace_recursive(array(array('OR*active_scope' => $acceptable_scopes)), $query_params);
162 162
 		}
163 163
 	}
164 164
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @param array  $query_params
171 171
 	 * @return EE_Payment_Method
172 172
 	 */
173
-	public function get_one_active( $scope = NULL, $query_params = array() ) {
174
-		return $this->get_one( $this->_get_query_params_for_all_active( $scope, $query_params ) );
173
+	public function get_one_active($scope = NULL, $query_params = array()) {
174
+		return $this->get_one($this->_get_query_params_for_all_active($scope, $query_params));
175 175
 	}
176 176
 
177 177
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @param string $type
182 182
 	 * @return EE_Payment_Method
183 183
 	 */
184
-	public function get_one_of_type( $type ) {
185
-		return $this->get_one( array( array( 'PMD_type' => $type ) ) );
184
+	public function get_one_of_type($type) {
185
+		return $this->get_one(array(array('PMD_type' => $type)));
186 186
 	}
187 187
 
188 188
 
@@ -195,22 +195,22 @@  discard block
 block discarded – undo
195 195
 	 * @return EE_Payment_Method
196 196
 	 * @throws EE_Error
197 197
 	 */
198
-	public function ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db = FALSE ) {
198
+	public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = FALSE) {
199 199
 		//first: check if it's a slug
200
-		if( is_string( $base_class_obj_or_id ) ) {
201
-			$obj = $this->get_one_by_slug( $base_class_obj_or_id );
202
-			if( $obj ) {
200
+		if (is_string($base_class_obj_or_id)) {
201
+			$obj = $this->get_one_by_slug($base_class_obj_or_id);
202
+			if ($obj) {
203 203
 				return $obj;
204 204
 			}
205 205
 		}
206 206
 		//ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID)
207 207
 		try {
208
-			return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db );
208
+			return parent::ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db);
209 209
 		}
210
-		catch ( EE_Error $e ) {
210
+		catch (EE_Error $e) {
211 211
 			//handle it outside the catch
212 212
 		}
213
-		throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) );
213
+		throw new EE_Error(sprintf(__("'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso"), $base_class_obj_or_id));
214 214
 	}
215 215
 
216 216
 
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
 	 * @param mixed $base_obj_or_id_or_slug
222 222
 	 * @return int
223 223
 	 */
224
-	function ensure_is_ID( $base_obj_or_id_or_slug ) {
225
-		if ( is_string( $base_obj_or_id_or_slug ) ) {
224
+	function ensure_is_ID($base_obj_or_id_or_slug) {
225
+		if (is_string($base_obj_or_id_or_slug)) {
226 226
 			//assume it's a slug
227
-			$base_obj_or_id_or_slug = $this->get_one_by_slug( $base_obj_or_id_or_slug );
227
+			$base_obj_or_id_or_slug = $this->get_one_by_slug($base_obj_or_id_or_slug);
228 228
 		}
229
-		return parent::ensure_is_ID( $base_obj_or_id_or_slug );
229
+		return parent::ensure_is_ID($base_obj_or_id_or_slug);
230 230
 	}
231 231
 
232 232
 
@@ -235,24 +235,24 @@  discard block
 block discarded – undo
235 235
 	 * Verifies the button urls on all the passed payment methods have a valid button url. If not, resets them to their default.
236 236
 	 * @param EE_Payment_Method[] $payment_methods. If NULL is provided defaults to all payment methods active in the cart
237 237
 	 */
238
-	function verify_button_urls( $payment_methods = NULL ) {
239
-		EE_Registry::instance()->load_helper( 'URL' );
240
-		$payment_methods = is_array( $payment_methods ) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
241
-		foreach ( $payment_methods as $payment_method ) {
238
+	function verify_button_urls($payment_methods = NULL) {
239
+		EE_Registry::instance()->load_helper('URL');
240
+		$payment_methods = is_array($payment_methods) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
241
+		foreach ($payment_methods as $payment_method) {
242 242
 			try {
243 243
 				$current_button_url = $payment_method->button_url();
244
-				$buttons_urls_to_try = apply_filters( 'FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
245
-					'current_ssl' => str_replace( "http://", "https://", $current_button_url ),
246
-					'current' => str_replace( "https://", "http://", $current_button_url ),
247
-					'default_ssl' => str_replace( "http://", "https://", $payment_method->type_obj()->default_button_url() ),
248
-					'default' => str_replace( "https://", "http://", $payment_method->type_obj()->default_button_url() ),
249
-				) );
250
-				foreach( $buttons_urls_to_try as $button_url_to_try ) {
251
-					if( $button_url_to_try &&
252
-						EEH_URL::remote_file_exists( $button_url_to_try )	) {
253
-						if( $current_button_url != $button_url_to_try ){
254
-							$payment_method->save( array( 'PMD_button_url' => $button_url_to_try ) );
255
-							EE_Error::add_attention( sprintf( __( "Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso" ), $payment_method->name(), $button_url_to_try ) );
244
+				$buttons_urls_to_try = apply_filters('FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
245
+					'current_ssl' => str_replace("http://", "https://", $current_button_url),
246
+					'current' => str_replace("https://", "http://", $current_button_url),
247
+					'default_ssl' => str_replace("http://", "https://", $payment_method->type_obj()->default_button_url()),
248
+					'default' => str_replace("https://", "http://", $payment_method->type_obj()->default_button_url()),
249
+				));
250
+				foreach ($buttons_urls_to_try as $button_url_to_try) {
251
+					if ($button_url_to_try &&
252
+						EEH_URL::remote_file_exists($button_url_to_try)) {
253
+						if ($current_button_url != $button_url_to_try) {
254
+							$payment_method->save(array('PMD_button_url' => $button_url_to_try));
255
+							EE_Error::add_attention(sprintf(__("Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso"), $payment_method->name(), $button_url_to_try));
256 256
 						}
257 257
 						//this image exists. So if wasn't set before, now it is;
258 258
 						//or if it was already set, we have nothing to do
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 					}
261 261
 				}
262 262
 			}
263
-			catch ( EE_Error $e ) {
264
-				$payment_method->set_active( FALSE );
263
+			catch (EE_Error $e) {
264
+				$payment_method->set_active(FALSE);
265 265
 			}
266 266
 		}
267 267
 	}
@@ -275,23 +275,23 @@  discard block
 block discarded – undo
275 275
 	 * @param array $rows
276 276
 	 * @return EE_Payment_Method[]
277 277
 	 */
278
-	protected function _create_objects( $rows = array() ) {
279
-		$payment_methods = parent::_create_objects( $rows );
278
+	protected function _create_objects($rows = array()) {
279
+		$payment_methods = parent::_create_objects($rows);
280 280
 		/* @var $payment_methods EE_Payment_Method[] */
281 281
 		$usable_payment_methods = array();
282
-		foreach ( $payment_methods as $key => $payment_method ) {
282
+		foreach ($payment_methods as $key => $payment_method) {
283 283
 			try {
284 284
 				$payment_method->type_obj();
285
-				$usable_payment_methods[ $key ] = $payment_method;
285
+				$usable_payment_methods[$key] = $payment_method;
286 286
 			}
287
-			catch ( EE_Error $e ) {
287
+			catch (EE_Error $e) {
288 288
 				//if it threw an exception, its because the payment type object
289 289
 				//isn't defined (probably because somehow the DB got borked,
290 290
 				//or an addon which defined it got deactivated
291 291
 				//so deactivate it and move on
292 292
 				$payment_method->deactivate();
293 293
 				$payment_method->save();
294
-				EE_Error::add_attention( sprintf( __( "There is no payment method type '%s', so the payment method '%s' was deactivated", "event_espresso" ), $payment_method->type(), $payment_method->name() ), __FILE__, __FUNCTION__, __LINE__ );
294
+				EE_Error::add_attention(sprintf(__("There is no payment method type '%s', so the payment method '%s' was deactivated", "event_espresso"), $payment_method->type(), $payment_method->name()), __FILE__, __FUNCTION__, __LINE__);
295 295
 			}
296 296
 		}
297 297
 		return $usable_payment_methods;
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 	 * @param string 	$scope @see EEM_Payment_Method::get_all_for_events
308 308
 	 * @return EE_Payment_Method[]
309 309
 	 */
310
-	public function get_all_for_transaction( $transaction, $scope ) {
310
+	public function get_all_for_transaction($transaction, $scope) {
311 311
 		//@todo take relations between events and payment methods into account, once that relation exists
312
-		if ( $transaction instanceof EE_Transaction ) {
312
+		if ($transaction instanceof EE_Transaction) {
313 313
 			//@todo take the relation between transaction and currencies into account
314 314
 		}
315
-		$currencies_for_events = array( EE_Config::instance()->currency->code );
316
-		return $this->get_all_active( $scope, array( array( 'Currency.CUR_code' => array( 'IN', $currencies_for_events ) ) ) );
315
+		$currencies_for_events = array(EE_Config::instance()->currency->code);
316
+		return $this->get_all_active($scope, array(array('Currency.CUR_code' => array('IN', $currencies_for_events))));
317 317
 	}
318 318
 
319 319
 
Please login to merge, or discard this patch.
core/db_models/EEM_Price_Type.model.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	/**
44 44
 	 * return an array of Base types. Keys are INTs which are used in the database,
45 45
 	 * values are text-representations of the base type.
46
-	 * @return array
46
+	 * @return integer
47 47
 	 */
48 48
 	public function get_base_types(){
49 49
 		return $this->base_types;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * 		instantiate a new price type object with blank/empty properties
122 122
 	 *
123 123
 	 * 		@access		public
124
-	 * 		@return		mixed		array on success, FALSE on fail
124
+	 * 		@return		EE_Price_Type		array on success, FALSE on fail
125 125
 	 */
126 126
 	public function get_new_price_type() {
127 127
 		return EE_Price_Type::new_instance();
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 	public $type = NULL;
34 34
 
35 35
 	/**
36
-	*	Price Base types
37
-	*
38
-	*	@access	private
39
-	*	@var int
40
-	*/
36
+	 *	Price Base types
37
+	 *
38
+	 *	@access	private
39
+	 *	@var int
40
+	 */
41 41
 	public $base_types = null;
42 42
 
43 43
 	/**
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
  *
145 145
  * @param type $query_params
146 146
  * @param boolean $allow_blocking if TRUE, matched objects will only be deleted if there is no related model info
147
-	 * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects
148
-	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
147
+ * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects
148
+ * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
149 149
  * @return boolean
150 150
  */
151 151
 	public function delete_permanently($query_params = array(), $allow_blocking = true) {
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 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_Price_Type.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Price_Type.class.php');
26 26
 
27 27
 
28 28
 class EEM_Price_Type extends EEM_Soft_Delete_Base {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * values are text-representations of the base type.
46 46
 	 * @return array
47 47
 	 */
48
-	public function get_base_types(){
48
+	public function get_base_types() {
49 49
 		return $this->base_types;
50 50
 	}
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param type $base_type_int
55 55
 	 * @return type
56 56
 	 */
57
-	public function get_base_type_name($base_type_int){
57
+	public function get_base_type_name($base_type_int) {
58 58
 		return $this->base_types[$base_type_int];
59 59
 	}
60 60
 
@@ -79,27 +79,27 @@  discard block
 block discarded – undo
79 79
 	 * 		@access protected
80 80
 	 * 		@return void
81 81
 	 */
82
-	protected function __construct( $timezone = NULL ) {
82
+	protected function __construct($timezone = NULL) {
83 83
 		$this->base_types = array(
84
-			EEM_Price_Type::base_type_base_price => __('Price','event_espresso'),
85
-			EEM_Price_Type::base_type_discount => __('Discount','event_espresso'),
86
-			EEM_Price_Type::base_type_surcharge => __('Surcharge','event_espresso'),
87
-			EEM_Price_Type::base_type_tax => __('Tax','event_espresso') );
88
-		$this->singular_item = __('Price Type','event_espresso');
89
-		$this->plural_item = __('Price Types','event_espresso');
84
+			EEM_Price_Type::base_type_base_price => __('Price', 'event_espresso'),
85
+			EEM_Price_Type::base_type_discount => __('Discount', 'event_espresso'),
86
+			EEM_Price_Type::base_type_surcharge => __('Surcharge', 'event_espresso'),
87
+			EEM_Price_Type::base_type_tax => __('Tax', 'event_espresso') );
88
+		$this->singular_item = __('Price Type', 'event_espresso');
89
+		$this->plural_item = __('Price Types', 'event_espresso');
90 90
 
91 91
 		$this->_tables = array(
92
-			'Price_Type'=>new EE_Primary_Table('esp_price_type','PRT_ID')
92
+			'Price_Type'=>new EE_Primary_Table('esp_price_type', 'PRT_ID')
93 93
 		);
94 94
 		$this->_fields = array(
95 95
 			'Price_Type'=>array(
96
-				'PRT_ID'=>new EE_Primary_Key_Int_Field('PRT_ID', __('Price Type ID','event_espresso')),
97
-				'PRT_name'=>new EE_Plain_Text_Field('PRT_name', __('Price Type Name','event_espresso'), false, ''),
98
-				'PBT_ID'=>new EE_Enum_Integer_Field('PBT_ID', __('Price Base type ID, 1 = Price , 2 = Discount , 3 = Surcharge , 4 = Tax','event_espresso'), false, EEM_Price_Type::base_type_base_price, $this->base_types),
99
-				'PRT_is_percent'=>new EE_Boolean_Field('PRT_is_percent', __('Flag indicating price is a percentage','event_espresso'), false, false),
100
-				'PRT_order'=>new EE_Integer_Field('PRT_order', __('Order in which price should be applied. ','event_espresso'), false, 0),
101
-				'PRT_deleted'=>new EE_Trashed_Flag_Field('PRT_deleted', __('Flag indicating price type has been trashed','event_espresso'), false, false),
102
-				'PRT_wp_user' => new EE_WP_User_Field('PRT_wp_user', __('Price Type Creator ID', 'event_espresso'), FALSE ),
96
+				'PRT_ID'=>new EE_Primary_Key_Int_Field('PRT_ID', __('Price Type ID', 'event_espresso')),
97
+				'PRT_name'=>new EE_Plain_Text_Field('PRT_name', __('Price Type Name', 'event_espresso'), false, ''),
98
+				'PBT_ID'=>new EE_Enum_Integer_Field('PBT_ID', __('Price Base type ID, 1 = Price , 2 = Discount , 3 = Surcharge , 4 = Tax', 'event_espresso'), false, EEM_Price_Type::base_type_base_price, $this->base_types),
99
+				'PRT_is_percent'=>new EE_Boolean_Field('PRT_is_percent', __('Flag indicating price is a percentage', 'event_espresso'), false, false),
100
+				'PRT_order'=>new EE_Integer_Field('PRT_order', __('Order in which price should be applied. ', 'event_espresso'), false, 0),
101
+				'PRT_deleted'=>new EE_Trashed_Flag_Field('PRT_deleted', __('Flag indicating price type has been trashed', 'event_espresso'), false, false),
102
+				'PRT_wp_user' => new EE_WP_User_Field('PRT_wp_user', __('Price Type Creator ID', 'event_espresso'), FALSE),
103 103
 			)
104 104
 		);
105 105
 		$this->_model_relations = array(
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			'WP_User' => new EE_Belongs_To_Relation(),
108 108
 		);
109 109
 
110
-		parent::__construct( $timezone );
110
+		parent::__construct($timezone);
111 111
 
112 112
 	}
113 113
 
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
 		$ID = $query_params[0][$this->get_primary_key_field()->get_name()];
154 154
 
155 155
 		//check if any prices use this price type
156
-		$prc_query_params = array(array('PRT_ID'=>array('IN',$would_be_deleted_price_type_ids)));
157
-		if ( $prices = $this->get_all_related($ID,'Price',$prc_query_params)) {
156
+		$prc_query_params = array(array('PRT_ID'=>array('IN', $would_be_deleted_price_type_ids)));
157
+		if ($prices = $this->get_all_related($ID, 'Price', $prc_query_params)) {
158 158
 			$prices_names_and_ids = array();
159
-			foreach($prices as $price){
159
+			foreach ($prices as $price) {
160 160
 				/* @var $price EE_Price */
161 161
 				$prices_names_and_ids[] = $price->name()."(".$price->ID().")";
162 162
 			}
163
-			$msg = sprintf(__('The Price Type(s) could not be deleted because there are existing Prices that currently use this Price Type.  If you still wish to delete this Price Type, then either delete those Prices or change them to use other Price Types.The prices are: %s', 'event_espresso'),implode(",",$prices_names_and_ids));
164
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
163
+			$msg = sprintf(__('The Price Type(s) could not be deleted because there are existing Prices that currently use this Price Type.  If you still wish to delete this Price Type, then either delete those Prices or change them to use other Price Types.The prices are: %s', 'event_espresso'), implode(",", $prices_names_and_ids));
164
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
165 165
 			return FALSE;
166 166
 		}
167 167
 
Please login to merge, or discard this patch.
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.