Completed
Branch DECAF-4.7 (a62460)
by
unknown
113:29 queued 104: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_Registration_Payment.class.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	/**
41 41
 	 * registration_ID
42 42
 	 * @access 	public
43
-	 * @return 	int
43
+	 * @return 	boolean
44 44
 	 */
45 45
 	public function registration_ID() {
46 46
 		return $this->get( 'REG_ID' );
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	/**
52 52
 	 * payment_ID
53 53
 	 * @access 	public
54
-	 * @return    int
54
+	 * @return    boolean
55 55
 	 */
56 56
 	public function payment_ID() {
57 57
 		return $this->get( 'PAY_ID' );
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	/**
63 63
 	 * amount
64 64
 	 * @access 	public
65
-	 * @return 	float
65
+	 * @return 	boolean
66 66
 	 */
67 67
 	public function amount() {
68 68
 		return $this->get( 'RPY_amount' );
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 	 * @param string $timezone
20 20
 	 * @return EE_Registration_Payment
21 21
 	 */
22
-	public static function new_instance( $props_n_values = array(), $timezone = '' ) {
23
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
24
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone );
22
+	public static function new_instance($props_n_values = array(), $timezone = '') {
23
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
24
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone);
25 25
 	}
26 26
 
27 27
 
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 * @param string $timezone
32 32
 	 * @return EE_Registration_Payment
33 33
 	 */
34
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) {
35
-		return new self( $props_n_values, true, $timezone );
34
+	public static function new_instance_from_db($props_n_values = array(), $timezone = '') {
35
+		return new self($props_n_values, true, $timezone);
36 36
 	}
37 37
 
38 38
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return 	int
44 44
 	 */
45 45
 	public function registration_ID() {
46
-		return $this->get( 'REG_ID' );
46
+		return $this->get('REG_ID');
47 47
 	}
48 48
 
49 49
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @return    int
55 55
 	 */
56 56
 	public function payment_ID() {
57
-		return $this->get( 'PAY_ID' );
57
+		return $this->get('PAY_ID');
58 58
 	}
59 59
 
60 60
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @return 	float
66 66
 	 */
67 67
 	public function amount() {
68
-		return $this->get( 'RPY_amount' );
68
+		return $this->get('RPY_amount');
69 69
 	}
70 70
 
71 71
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 * @access    public
76 76
 	 * @param float $amount
77 77
 	 */
78
-	public function set_amount( $amount = 0.000 ) {
79
-		$this->set( 'RPY_amount', $amount );
78
+	public function set_amount($amount = 0.000) {
79
+		$this->set('RPY_amount', $amount);
80 80
 	}
81 81
 
82 82
 
Please login to merge, or discard this patch.
core/db_classes/EE_State.class.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
 	/**
53
-	 * @return string
53
+	 * @return boolean
54 54
 	 */
55 55
 	public function country_iso() {
56 56
 		return $this->get( 'CNT_ISO' );
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 
61 61
 	/**
62
-	 * @return string
62
+	 * @return boolean
63 63
 	 */
64 64
 	public function abbrev() {
65 65
 		return $this->get( 'STA_abbrev' );
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 
79 79
 	/**
80
-	 * @return string
80
+	 * @return boolean
81 81
 	 */
82 82
 	public function name() {
83 83
 		return $this->get( 'STA_name' );
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 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_State|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_State
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
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return string
54 54
 	 */
55 55
 	public function country_iso() {
56
-		return $this->get( 'CNT_ISO' );
56
+		return $this->get('CNT_ISO');
57 57
 	}
58 58
 
59 59
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @return string
63 63
 	 */
64 64
 	public function abbrev() {
65
-		return $this->get( 'STA_abbrev' );
65
+		return $this->get('STA_abbrev');
66 66
 	}
67 67
 
68 68
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @return bool
72 72
 	 */
73 73
 	public function active() {
74
-		return $this->get( 'STA_active' );
74
+		return $this->get('STA_active');
75 75
 	}
76 76
 
77 77
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @return string
81 81
 	 */
82 82
 	public function name() {
83
-		return $this->get( 'STA_name' );
83
+		return $this->get('STA_name');
84 84
 	}
85 85
 
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return EE_Country
90 90
 	 */
91 91
 	public function country() {
92
-		return $this->get_first_related( 'Country' );
92
+		return $this->get_first_related('Country');
93 93
 	}
94 94
 
95 95
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	/**
98 98
 	 * @param $iso
99 99
 	 */
100
-	public function set_country_iso( $iso ) {
101
-		$this->set( 'CNT_ISO', $iso );
100
+	public function set_country_iso($iso) {
101
+		$this->set('CNT_ISO', $iso);
102 102
 	}
103 103
 
104 104
 
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	/**
107 107
 	 * @param $abbrev
108 108
 	 */
109
-	public function set_abbrev( $abbrev ) {
110
-		$this->set( 'STA_abbrev', $abbrev );
109
+	public function set_abbrev($abbrev) {
110
+		$this->set('STA_abbrev', $abbrev);
111 111
 	}
112 112
 
113 113
 
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	/**
116 116
 	 * @param $active
117 117
 	 */
118
-	public function set_active( $active ) {
119
-		$this->set( 'STA_active', $active );
118
+	public function set_active($active) {
119
+		$this->set('STA_active', $active);
120 120
 	}
121 121
 
122 122
 
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	/**
125 125
 	 * @param $name
126 126
 	 */
127
-	public function set_name( $name ) {
128
-		$this->set( 'STA_name', $name );
127
+	public function set_name($name) {
128
+		$this->set('STA_name', $name);
129 129
 	}
130 130
 }
131 131
 
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_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.
Spacing   +56 added lines, -56 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),
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 			'Event' => new EE_HABTM_Relation('Event_Message_Template'),
58 58
 			'WP_User' => new EE_Belongs_To_Relation(),
59 59
 			);
60
-		foreach( $this->_cap_contexts_to_cap_action_map as $context => $action ){
61
-			$this->_cap_restriction_generators[ $context ] = new EE_Restriction_Generator_Global( 'MTP_is_global');
60
+		foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) {
61
+			$this->_cap_restriction_generators[$context] = new EE_Restriction_Generator_Global('MTP_is_global');
62 62
 		}
63 63
 		$this->_caps_slug = 'messages';
64 64
 
65
-		parent::__construct( $timezone );
65
+		parent::__construct($timezone);
66 66
 	}
67 67
 
68 68
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 * @return array   message template objects that are attached to a specific event.
75 75
 	 */
76 76
 	public function get_all_trashed_message_templates_by_event($EVT_ID, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE) {
77
-		$query_params = array( array('Event.EVT_ID' => $EVT_ID), 'order_by' => array($orderby => $order), 'limit' => $limit );
78
-		return $count ? $this->count_deleted( $query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted( $query_params );
77
+		$query_params = array(array('Event.EVT_ID' => $EVT_ID), 'order_by' => array($orderby => $order), 'limit' => $limit);
78
+		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted($query_params);
79 79
 	}
80 80
 
81 81
 
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	 * @access public
87 87
 	 * @return array all (including trashed or inactive) message template group objects for the given messenger
88 88
 	 */
89
-	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC' ) {
90
-		return $this->get_all_deleted_and_undeleted( array( array('MTP_messenger' => $messenger), 'order_by' => array($orderby => $order) ) );
89
+	public function get_all_message_templates_by_messenger($messenger, $orderby = 'GRP_ID', $order = 'ASC') {
90
+		return $this->get_all_deleted_and_undeleted(array(array('MTP_messenger' => $messenger), 'order_by' => array($orderby => $order)));
91 91
 	}
92 92
 
93 93
 
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 	 * @param  array  $_where any existing where conditions to append these to.
98 98
 	 * @return array          original where conditions or original with additional filters.
99 99
 	 */
100
-	protected function _maybe_mtp_filters( $_where = array() ) {
100
+	protected function _maybe_mtp_filters($_where = array()) {
101 101
 		//account for messenger or message type filters
102
-		if ( isset($_REQUEST['ee_messenger_filter_by'] ) && $_REQUEST['ee_messenger_filter_by'] != 'none_selected' && $_REQUEST['ee_messenger_filter_by'] != 'all'  ) {
103
-			$_where['MTP_messenger'] =  $_REQUEST['ee_messenger_filter_by'] ;
102
+		if (isset($_REQUEST['ee_messenger_filter_by']) && $_REQUEST['ee_messenger_filter_by'] != 'none_selected' && $_REQUEST['ee_messenger_filter_by'] != 'all') {
103
+			$_where['MTP_messenger'] = $_REQUEST['ee_messenger_filter_by'];
104 104
 		}
105 105
 
106
-		if ( isset( $_REQUEST['ee_message_type_filter_by']) && $_REQUEST['ee_message_type_filter_by'] != 'none_selected' ) {
106
+		if (isset($_REQUEST['ee_message_type_filter_by']) && $_REQUEST['ee_message_type_filter_by'] != 'none_selected') {
107 107
 			$_where['MTP_message_type'] = $_REQUEST['ee_message_type_filter_by'];
108 108
 		}
109 109
 
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
 	 * @access public
118 118
 	 * @return array  all active (non_trashed, active) message template objects
119 119
 	 */
120
-	public function get_all_active_message_templates($orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $global = TRUE, $user_check = FALSE ) {
121
-		$_where = $global ? array('MTP_is_global' => TRUE ) : array('MTP_is_global' => FALSE );
120
+	public function get_all_active_message_templates($orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $global = TRUE, $user_check = FALSE) {
121
+		$_where = $global ? array('MTP_is_global' => TRUE) : array('MTP_is_global' => FALSE);
122 122
 		$_where['MTP_is_active'] = TRUE;
123 123
 		$_where = $this->_maybe_mtp_filters($_where);
124 124
 
125
-		if  ( $user_check && ! $global && ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_messages', 'get_all_active_message_templates' )  ) {
125
+		if ($user_check && ! $global && ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_messages', 'get_all_active_message_templates')) {
126 126
 			$_where['MTP_user_id'] = get_current_user_id();
127 127
 		}
128 128
 
129
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
129
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
130 130
 
131
-		return $count ? $this->count($query_params, 'GRP_ID', TRUE ) : $this->get_all($query_params);
131
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
132 132
 	}
133 133
 
134 134
 
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 
145 145
 		$_where = $this->_maybe_mtp_filters();
146 146
 
147
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
147
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
148 148
 
149
-		$r_templates = $count ? $this->count_deleted_and_undeleted($query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted_and_undeleted( $query_params );
149
+		$r_templates = $count ? $this->count_deleted_and_undeleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted_and_undeleted($query_params);
150 150
 
151 151
 		return $r_templates;
152 152
 	}
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
 	 * @param  array  $query_params same as EEM_Base::get_all()
161 161
 	 * @return  EE_Message_Template_Group[]
162 162
 	 */
163
-	public function get_all_custom_templates_by_event( $EVT_ID, $query_params = array() ) {
164
-		$_where = array( 'Event.EVT_ID' => $EVT_ID );
165
-		return $this->get_all( array( $_where ) );
163
+	public function get_all_custom_templates_by_event($EVT_ID, $query_params = array()) {
164
+		$_where = array('Event.EVT_ID' => $EVT_ID);
165
+		return $this->get_all(array($_where));
166 166
 	}
167 167
 
168 168
 
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
 	 * @return EE_Message_Template_Group[] message template groups.
177 177
 	 */
178 178
 	public function get_all_trashed_grouped_message_templates($orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $global = TRUE) {
179
-		$_where = $global ? array('MTP_is_global' => TRUE ) : array('MTP_is_global' => FALSE );
179
+		$_where = $global ? array('MTP_is_global' => TRUE) : array('MTP_is_global' => FALSE);
180 180
 		$_where['MTP_is_active'] = TRUE;
181 181
 		$_where = $this->_maybe_mtp_filters($_where);
182 182
 
183
-		$query_params = array( $_where, 'order_by' => array($orderby => $order), 'limit' => $limit );
183
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
184 184
 
185
-		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE ) : $this->get_all_deleted( $query_params );
185
+		return $count ? $this->count_deleted($query_params, 'GRP_ID', TRUE) : $this->get_all_deleted($query_params);
186 186
 	}
187 187
 
188 188
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @param  bool   $active  		ignore "active" or not. (default only return active)
200 200
 	 * @return mixed (int|EE_Message_Template_Group[])                depending on $count.
201 201
 	 */
202
-	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 ) {
202
+	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) {
203 203
 
204 204
 		$_where = array(
205 205
 			'MTP_messenger' => $messenger,
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 			'MTP_is_active' => $active
210 210
 			);
211 211
 
212
-		$query_params = array( $_where, 'order_by' => array($orderby=>$order), 'limit' => $limit );
212
+		$query_params = array($_where, 'order_by' => array($orderby=>$order), 'limit' => $limit);
213 213
 
214
-		return $count ? $this->count($query_params, 'GRP_ID', TRUE ) : $this->get_all( $query_params );
214
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
215 215
 	}
216 216
 
217 217
 
@@ -228,20 +228,20 @@  discard block
 block discarded – undo
228 228
 	 * @param  bool   $active  		ignore "active" or not. (default only return active) - 'all' means return both inactive AND inactive.
229 229
 	 * @return ARRAY               message template objects that are global (i.e. non-event)
230 230
 	 */
231
-	public function get_global_message_template_by_m_and_mt($messenger, $message_type, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $active = TRUE ) {
231
+	public function get_global_message_template_by_m_and_mt($messenger, $message_type, $orderby = 'GRP_ID', $order = 'ASC', $limit = NULL, $count = FALSE, $active = TRUE) {
232 232
 		$_where = array(
233 233
 			'MTP_messenger' => $messenger,
234 234
 			'MTP_message_type' => $message_type,
235 235
 			'MTP_is_global' => TRUE,
236 236
 			);
237 237
 
238
-		if ( $active != 'all' ) {
238
+		if ($active != 'all') {
239 239
 			$_where['MTP_is_active'] = $active;
240 240
 		}
241 241
 
242
-		$query_params = array( $_where, 'order_by' => array( $orderby => $order ), 'limit' => $limit );
242
+		$query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit);
243 243
 
244
-		return $count ? $this->count( $query_params, 'GRP_ID', TRUE ) : $this->get_all( $query_params );
244
+		return $count ? $this->count($query_params, 'GRP_ID', TRUE) : $this->get_all($query_params);
245 245
 	}
246 246
 
247 247
 
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
 	 * @param  array  $query_params same as EEM_Base->get_all()
255 255
 	 * @return EE_Message_Template_Group[]
256 256
 	 */
257
-	public function get_custom_message_template_by_m_and_mt( $messenger, $message_type, $query_params = array() ) {
257
+	public function get_custom_message_template_by_m_and_mt($messenger, $message_type, $query_params = array()) {
258 258
 		$_where = array(
259 259
 			'MTP_is_global' => FALSE,
260 260
 			'MTP_messenger' => $messenger,
261 261
 			'MTP_message_type' => $message_type
262 262
 			);
263 263
 
264
-		return $this->get_all( array( $_where ) );
264
+		return $this->get_all(array($_where));
265 265
 	}
266 266
 
267 267
 
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
 		$assembled_fields = array();
283 283
 
284 284
 		//let's loop through all the fields and set them up in the right format
285
-		foreach ( $fields as $index => $value ) {
285
+		foreach ($fields as $index => $value) {
286 286
 			//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').
287
-			if ( is_array($value['content']) ) {
287
+			if (is_array($value['content'])) {
288 288
 				$assembled_fields[$value['name']] = $value['content']['main'];
289 289
 				//loop through the content and get the other fields.
290
-				foreach ( $value['content'] as $name => $val ) {
291
-					if ( $name == 'main' ) continue;
290
+				foreach ($value['content'] as $name => $val) {
291
+					if ($name == 'main') continue;
292 292
 					$assembled_fields[$name] = $val;
293 293
 				}
294 294
 				continue;
@@ -299,21 +299,21 @@  discard block
 block discarded – undo
299 299
 		}
300 300
 
301 301
 		//now we've got the assembled_fields.  We need to setup the string for the appropriate validator class and call that.
302
-		$m_ref = ucwords( str_replace('_',' ', $messenger ) );
303
-		$m_ref = str_replace( ' ', '_', $m_ref );
304
-		$mt_ref = ucwords( str_replace('_', ' ', $message_type ) );
305
-		$mt_ref = str_replace( ' ', '_', $mt_ref );
302
+		$m_ref = ucwords(str_replace('_', ' ', $messenger));
303
+		$m_ref = str_replace(' ', '_', $m_ref);
304
+		$mt_ref = ucwords(str_replace('_', ' ', $message_type));
305
+		$mt_ref = str_replace(' ', '_', $mt_ref);
306 306
 
307
-		$classname = 'EE_Messages_' . $m_ref . '_' . $mt_ref . '_Validator';
307
+		$classname = 'EE_Messages_'.$m_ref.'_'.$mt_ref.'_Validator';
308 308
 
309
-		if ( !class_exists( $classname ) ) {
310
-			$msg[] = __( 'The Validator class was unable to load', 'event_espresso');
311
-			$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 );
312
-			throw new EE_Error( implode( '||', $msg ) );
309
+		if ( ! class_exists($classname)) {
310
+			$msg[] = __('The Validator class was unable to load', 'event_espresso');
311
+			$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);
312
+			throw new EE_Error(implode('||', $msg));
313 313
 		}
314 314
 
315
-		$a = new ReflectionClass( $classname );
316
-		$_VLD = $a->newInstance( $assembled_fields, $context );
315
+		$a = new ReflectionClass($classname);
316
+		$_VLD = $a->newInstance($assembled_fields, $context);
317 317
 		$result = $_VLD->validate();
318 318
 		return $result;
319 319
 	}
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.
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   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  *
@@ -37,33 +37,33 @@  discard block
 block discarded – undo
37 37
 	 * @access   protected
38 38
 	 * @return EEM_Payment_Method
39 39
 	 */
40
-	protected function __construct( $timezone = NULL ) {
41
-		$this->singlular_item = __( 'Payment Method', 'event_espresso' );
42
-		$this->plural_item = __( 'Payment Methods', 'event_espresso' );
43
-		$this->_tables = array( 'Payment_Method' => new EE_Primary_Table( 'esp_payment_method', 'PMD_ID' ) );
40
+	protected function __construct($timezone = NULL) {
41
+		$this->singlular_item = __('Payment Method', 'event_espresso');
42
+		$this->plural_item = __('Payment Methods', 'event_espresso');
43
+		$this->_tables = array('Payment_Method' => new EE_Primary_Table('esp_payment_method', 'PMD_ID'));
44 44
 		$this->_fields = array(
45 45
 			'Payment_Method' => array(
46
-				'PMD_ID' => new EE_Primary_Key_Int_Field( 'PMD_ID', __( "ID", 'event_espresso' ) ),
47
-				'PMD_type' => new EE_Plain_Text_Field( 'PMD_type', __( "Payment Method Type", 'event_espresso' ), FALSE, 'Admin_Only' ),
48
-				'PMD_name' => new EE_Plain_Text_Field( 'PMD_name', __( "Name", 'event_espresso' ), FALSE ),
49
-				'PMD_desc' => new EE_Post_Content_Field( 'PMD_desc', __( "Description", 'event_espresso' ), FALSE, '' ),
50
-				'PMD_admin_name' => new EE_Plain_Text_Field( 'PMD_admin_name', __( "Admin-Only Name", 'event_espresso' ), TRUE ),
51
-				'PMD_admin_desc' => new EE_Post_Content_Field( 'PMD_admin_desc', __( "Admin-Only Description", 'event_espresso' ), TRUE ),
52
-				'PMD_slug' => new EE_Slug_Field( 'PMD_slug', __( "Slug", 'event_espresso' ), FALSE ),
53
-				'PMD_order' => new EE_Integer_Field( 'PMD_order', __( "Order", 'event_espresso' ), FALSE, 0 ),
54
-				'PMD_debug_mode' => new EE_Boolean_Field( 'PMD_debug_mode', __( "Debug Mode On?", 'event_espresso' ), FALSE, FALSE ),
55
-				'PMD_wp_user' => new EE_WP_User_Field( 'PMD_wp_user', __( "Payment Method Creator ID", 'event_espresso' ), FALSE ),
56
-				'PMD_open_by_default' => new EE_Boolean_Field( 'PMD_open_by_default', __( "Open by Default?", 'event_espresso' ), FALSE, FALSE ), 'PMD_button_url' => new EE_Plain_Text_Field( 'PMD_button_url', __( "Button URL", 'event_espresso' ), TRUE, '' ),
57
-				'PMD_scope' => new EE_Serialized_Text_Field( 'PMD_scope', __( "Usable From?", 'event_espresso' ), FALSE, array() ), //possible values currently are 'CART','ADMIN','API'
46
+				'PMD_ID' => new EE_Primary_Key_Int_Field('PMD_ID', __("ID", 'event_espresso')),
47
+				'PMD_type' => new EE_Plain_Text_Field('PMD_type', __("Payment Method Type", 'event_espresso'), FALSE, 'Admin_Only'),
48
+				'PMD_name' => new EE_Plain_Text_Field('PMD_name', __("Name", 'event_espresso'), FALSE),
49
+				'PMD_desc' => new EE_Post_Content_Field('PMD_desc', __("Description", 'event_espresso'), FALSE, ''),
50
+				'PMD_admin_name' => new EE_Plain_Text_Field('PMD_admin_name', __("Admin-Only Name", 'event_espresso'), TRUE),
51
+				'PMD_admin_desc' => new EE_Post_Content_Field('PMD_admin_desc', __("Admin-Only Description", 'event_espresso'), TRUE),
52
+				'PMD_slug' => new EE_Slug_Field('PMD_slug', __("Slug", 'event_espresso'), FALSE),
53
+				'PMD_order' => new EE_Integer_Field('PMD_order', __("Order", 'event_espresso'), FALSE, 0),
54
+				'PMD_debug_mode' => new EE_Boolean_Field('PMD_debug_mode', __("Debug Mode On?", 'event_espresso'), FALSE, FALSE),
55
+				'PMD_wp_user' => new EE_WP_User_Field('PMD_wp_user', __("Payment Method Creator ID", 'event_espresso'), FALSE),
56
+				'PMD_open_by_default' => new EE_Boolean_Field('PMD_open_by_default', __("Open by Default?", 'event_espresso'), FALSE, FALSE), 'PMD_button_url' => new EE_Plain_Text_Field('PMD_button_url', __("Button URL", 'event_espresso'), TRUE, ''),
57
+				'PMD_scope' => new EE_Serialized_Text_Field('PMD_scope', __("Usable From?", 'event_espresso'), FALSE, array()), //possible values currently are 'CART','ADMIN','API'
58 58
 		) );
59 59
 		$this->_model_relations = array(
60 60
  //			'Event'=>new EE_HABTM_Relation('Event_Payment_Method'),
61 61
 			'Payment' => new EE_Has_Many_Relation(),
62
-			'Currency' => new EE_HABTM_Relation( 'Currency_Payment_Method' ),
62
+			'Currency' => new EE_HABTM_Relation('Currency_Payment_Method'),
63 63
 			'Transaction' => new EE_Has_Many_Relation(),
64 64
 			'WP_User' => new EE_Belongs_To_Relation(),
65 65
 		);
66
-		parent::__construct( $timezone );
66
+		parent::__construct($timezone);
67 67
 	}
68 68
 
69 69
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 * @param string $slug
74 74
 	 * @return EE_Payment_Method
75 75
 	 */
76
-	public function get_one_by_slug( $slug ) {
77
-		return $this->get_one( array( array( 'PMD_slug' => $slug ) ) );
76
+	public function get_one_by_slug($slug) {
77
+		return $this->get_one(array(array('PMD_slug' => $slug)));
78 78
 	}
79 79
 
80 80
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 		return apply_filters(
89 89
 			'FHEE__EEM_Payment_Method__scopes',
90 90
 			array(
91
-				self::scope_cart 		=> __( "Front-end Registration Page", 'event_espresso' ),
92
-				self::scope_admin 	=> __( "Admin Registration Page (no online processing)", 'event_espresso' )
91
+				self::scope_cart 		=> __("Front-end Registration Page", 'event_espresso'),
92
+				self::scope_admin 	=> __("Admin Registration Page (no online processing)", 'event_espresso')
93 93
 			)
94 94
 		);
95 95
 	}
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @param string $scope like one of EEM_Payment_Method::instance()->scopes()
102 102
 	 * @return boolean
103 103
 	 */
104
-	public function is_valid_scope( $scope ) {
104
+	public function is_valid_scope($scope) {
105 105
 		$scopes = $this->scopes();
106
-		if ( isset( $scopes[ $scope ] ) ) {
106
+		if (isset($scopes[$scope])) {
107 107
 			return TRUE;
108 108
 		} else {
109 109
 			return FALSE;
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @throws EE_Error
120 120
 	 * @return EE_Payment_Method[]
121 121
 	 */
122
-	public function get_all_active( $scope = NULL, $query_params = array() ) {
123
-		if( ! isset( $query_params[ 'order_by' ] ) && ! isset( $query_params[ 'order' ] ) ) {
124
-			$query_params = array( 'order_by' => array( 'PMD_order' => 'ASC', 'PMD_ID' => 'ASC' ) );
122
+	public function get_all_active($scope = NULL, $query_params = array()) {
123
+		if ( ! isset($query_params['order_by']) && ! isset($query_params['order'])) {
124
+			$query_params = array('order_by' => array('PMD_order' => 'ASC', 'PMD_ID' => 'ASC'));
125 125
 		}
126
-		return $this->get_all( $this->_get_query_params_for_all_active( $scope, $query_params ) );
126
+		return $this->get_all($this->_get_query_params_for_all_active($scope, $query_params));
127 127
 	}
128 128
 
129 129
 	/**
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param array $query_params
133 133
 	 * @return int
134 134
 	 */
135
-	public function count_active( $scope = NULL, $query_params = array() ){
136
-		return $this->count( $this->_get_query_params_for_all_active( $scope, $query_params ) );
135
+	public function count_active($scope = NULL, $query_params = array()) {
136
+		return $this->count($this->_get_query_params_for_all_active($scope, $query_params));
137 137
 	}
138 138
 
139 139
 	/**
@@ -144,21 +144,21 @@  discard block
 block discarded – undo
144 144
 	 * @return array like param of EEM_Base::get_all()
145 145
 	 * @throws EE_Error
146 146
 	 */
147
-	protected function _get_query_params_for_all_active( $scope = NULL, $query_params = array() ){
148
-		if ( $scope ) {
149
-			if ( $this->is_valid_scope( $scope ) ) {
150
-				return array_replace_recursive( array( array( 'PMD_scope' => array( 'LIKE', "%$scope%" ) ) ), $query_params );
147
+	protected function _get_query_params_for_all_active($scope = NULL, $query_params = array()) {
148
+		if ($scope) {
149
+			if ($this->is_valid_scope($scope)) {
150
+				return array_replace_recursive(array(array('PMD_scope' => array('LIKE', "%$scope%"))), $query_params);
151 151
 			} else {
152
-				throw new EE_Error( sprintf( __( "'%s' is not a valid scope for a payment method", "event_espresso" ), $scope ) );
152
+				throw new EE_Error(sprintf(__("'%s' is not a valid scope for a payment method", "event_espresso"), $scope));
153 153
 			}
154 154
 		} else {
155 155
 			$acceptable_scopes = array();
156 156
 			$count = 0;
157
-			foreach ( $this->scopes() as $scope_name => $desc ) {
157
+			foreach ($this->scopes() as $scope_name => $desc) {
158 158
 				$count++;
159
-				$acceptable_scopes[ 'PMD_scope*' . $count ] = array( 'LIKE', '%' . $scope_name . '%' );
159
+				$acceptable_scopes['PMD_scope*'.$count] = array('LIKE', '%'.$scope_name.'%');
160 160
 			}
161
-			return array_replace_recursive( array( array( 'OR*active_scope' => $acceptable_scopes ) ), $query_params );
161
+			return array_replace_recursive(array(array('OR*active_scope' => $acceptable_scopes)), $query_params);
162 162
 		}
163 163
 	}
164 164
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @return array like param of EEM_Base::get_all()
171 171
 	 * @throws EE_Error
172 172
 	 */
173
-	public function get_query_params_for_all_active( $scope = NULL, $query_params = array() ) {
174
-		return $this->_get_query_params_for_all_active( $scope, $query_params );
173
+	public function get_query_params_for_all_active($scope = NULL, $query_params = array()) {
174
+		return $this->_get_query_params_for_all_active($scope, $query_params);
175 175
 	}
176 176
 
177 177
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @param array  $query_params
182 182
 	 * @return EE_Payment_Method
183 183
 	 */
184
-	public function get_one_active( $scope = NULL, $query_params = array() ) {
185
-		return $this->get_one( $this->_get_query_params_for_all_active( $scope, $query_params ) );
184
+	public function get_one_active($scope = NULL, $query_params = array()) {
185
+		return $this->get_one($this->_get_query_params_for_all_active($scope, $query_params));
186 186
 	}
187 187
 
188 188
 
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * @param string $type
193 193
 	 * @return EE_Payment_Method
194 194
 	 */
195
-	public function get_one_of_type( $type ) {
196
-		return $this->get_one( array( array( 'PMD_type' => $type ) ) );
195
+	public function get_one_of_type($type) {
196
+		return $this->get_one(array(array('PMD_type' => $type)));
197 197
 	}
198 198
 
199 199
 
@@ -206,22 +206,22 @@  discard block
 block discarded – undo
206 206
 	 * @return EE_Payment_Method
207 207
 	 * @throws EE_Error
208 208
 	 */
209
-	public function ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db = FALSE ) {
209
+	public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = FALSE) {
210 210
 		//first: check if it's a slug
211
-		if( is_string( $base_class_obj_or_id ) ) {
212
-			$obj = $this->get_one_by_slug( $base_class_obj_or_id );
213
-			if( $obj ) {
211
+		if (is_string($base_class_obj_or_id)) {
212
+			$obj = $this->get_one_by_slug($base_class_obj_or_id);
213
+			if ($obj) {
214 214
 				return $obj;
215 215
 			}
216 216
 		}
217 217
 		//ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID)
218 218
 		try {
219
-			return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db );
219
+			return parent::ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db);
220 220
 		}
221
-		catch ( EE_Error $e ) {
221
+		catch (EE_Error $e) {
222 222
 			//handle it outside the catch
223 223
 		}
224
-		throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) );
224
+		throw new EE_Error(sprintf(__("'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso"), $base_class_obj_or_id));
225 225
 	}
226 226
 
227 227
 
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
 	 * @param mixed $base_obj_or_id_or_slug
233 233
 	 * @return int
234 234
 	 */
235
-	function ensure_is_ID( $base_obj_or_id_or_slug ) {
236
-		if ( is_string( $base_obj_or_id_or_slug ) ) {
235
+	function ensure_is_ID($base_obj_or_id_or_slug) {
236
+		if (is_string($base_obj_or_id_or_slug)) {
237 237
 			//assume it's a slug
238
-			$base_obj_or_id_or_slug = $this->get_one_by_slug( $base_obj_or_id_or_slug );
238
+			$base_obj_or_id_or_slug = $this->get_one_by_slug($base_obj_or_id_or_slug);
239 239
 		}
240
-		return parent::ensure_is_ID( $base_obj_or_id_or_slug );
240
+		return parent::ensure_is_ID($base_obj_or_id_or_slug);
241 241
 	}
242 242
 
243 243
 
@@ -246,37 +246,37 @@  discard block
 block discarded – undo
246 246
 	 * Verifies the button urls on all the passed payment methods have a valid button url. If not, resets them to their default.
247 247
 	 * @param EE_Payment_Method[] $payment_methods. If NULL is provided defaults to all payment methods active in the cart
248 248
 	 */
249
-	function verify_button_urls( $payment_methods = NULL ) {
250
-		EE_Registry::instance()->load_helper( 'URL' );
251
-		$payment_methods = is_array( $payment_methods ) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
252
-		foreach ( $payment_methods as $payment_method ) {
249
+	function verify_button_urls($payment_methods = NULL) {
250
+		EE_Registry::instance()->load_helper('URL');
251
+		$payment_methods = is_array($payment_methods) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
252
+		foreach ($payment_methods as $payment_method) {
253 253
 			try {
254 254
 				$current_button_url = $payment_method->button_url();
255
-				$buttons_urls_to_try = apply_filters( 'FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
256
-					'current_ssl' => str_replace( "http://", "https://", $current_button_url ),
257
-					'current' => str_replace( "https://", "http://", $current_button_url ),
258
-					'default_ssl' => str_replace( "http://", "https://", $payment_method->type_obj()->default_button_url() ),
259
-					'default' => str_replace( "https://", "http://", $payment_method->type_obj()->default_button_url() ),
260
-				) );
261
-				foreach( $buttons_urls_to_try as $button_url_to_try ) {
262
-					if(
255
+				$buttons_urls_to_try = apply_filters('FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
256
+					'current_ssl' => str_replace("http://", "https://", $current_button_url),
257
+					'current' => str_replace("https://", "http://", $current_button_url),
258
+					'default_ssl' => str_replace("http://", "https://", $payment_method->type_obj()->default_button_url()),
259
+					'default' => str_replace("https://", "http://", $payment_method->type_obj()->default_button_url()),
260
+				));
261
+				foreach ($buttons_urls_to_try as $button_url_to_try) {
262
+					if (
263 263
 							(//this is the current url and it exists, regardless of SSL issues
264 264
 								$button_url_to_try == $current_button_url &&
265 265
 								EEH_URL::remote_file_exists(
266 266
 										$button_url_to_try,
267 267
 										array(
268 268
 											'sslverify' => false,
269
-											'limit_response_size' => 4095,//we don't really care for a full response, but we do want headers at least. Lets just ask for a one block
269
+											'limit_response_size' => 4095, //we don't really care for a full response, but we do want headers at least. Lets just ask for a one block
270 270
 											) )
271 271
 							)
272 272
 							||
273 273
 							(//this is NOT the current url and it exists with a working SSL cert
274 274
 								$button_url_to_try != $current_button_url &&
275
-								EEH_URL::remote_file_exists( $button_url_to_try )
275
+								EEH_URL::remote_file_exists($button_url_to_try)
276 276
 							) ) {
277
-						if( $current_button_url != $button_url_to_try ){
278
-							$payment_method->save( array( 'PMD_button_url' => $button_url_to_try ) );
279
-							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 ) );
277
+						if ($current_button_url != $button_url_to_try) {
278
+							$payment_method->save(array('PMD_button_url' => $button_url_to_try));
279
+							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));
280 280
 						}
281 281
 						//this image exists. So if wasn't set before, now it is;
282 282
 						//or if it was already set, we have nothing to do
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 					}
285 285
 				}
286 286
 			}
287
-			catch ( EE_Error $e ) {
288
-				$payment_method->set_active( FALSE );
287
+			catch (EE_Error $e) {
288
+				$payment_method->set_active(FALSE);
289 289
 			}
290 290
 		}
291 291
 	}
@@ -299,23 +299,23 @@  discard block
 block discarded – undo
299 299
 	 * @param array $rows
300 300
 	 * @return EE_Payment_Method[]
301 301
 	 */
302
-	protected function _create_objects( $rows = array() ) {
303
-		$payment_methods = parent::_create_objects( $rows );
302
+	protected function _create_objects($rows = array()) {
303
+		$payment_methods = parent::_create_objects($rows);
304 304
 		/* @var $payment_methods EE_Payment_Method[] */
305 305
 		$usable_payment_methods = array();
306
-		foreach ( $payment_methods as $key => $payment_method ) {
306
+		foreach ($payment_methods as $key => $payment_method) {
307 307
 			try {
308 308
 				$payment_method->type_obj();
309
-				$usable_payment_methods[ $key ] = $payment_method;
309
+				$usable_payment_methods[$key] = $payment_method;
310 310
 			}
311
-			catch ( EE_Error $e ) {
311
+			catch (EE_Error $e) {
312 312
 				//if it threw an exception, its because the payment type object
313 313
 				//isn't defined (probably because somehow the DB got borked,
314 314
 				//or an addon which defined it got deactivated
315 315
 				//so deactivate it and move on
316 316
 				$payment_method->deactivate();
317 317
 				$payment_method->save();
318
-				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__ );
318
+				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__);
319 319
 			}
320 320
 		}
321 321
 		return $usable_payment_methods;
@@ -331,16 +331,16 @@  discard block
 block discarded – undo
331 331
 	 * @param string 	$scope @see EEM_Payment_Method::get_all_for_events
332 332
 	 * @return EE_Payment_Method[]
333 333
 	 */
334
-	public function get_all_for_transaction( $transaction, $scope ) {
334
+	public function get_all_for_transaction($transaction, $scope) {
335 335
 		//@todo take relations between events and payment methods into account, once that relation exists
336
-		if ( $transaction instanceof EE_Transaction ) {
336
+		if ($transaction instanceof EE_Transaction) {
337 337
 			//@todo take the relation between transaction and currencies into account
338 338
 		}
339
-		$currencies_for_events = array( EE_Config::instance()->currency->code );
339
+		$currencies_for_events = array(EE_Config::instance()->currency->code);
340 340
 		//give addons a chance to override what payment methods are chosen based on the transaction
341 341
 		return apply_filters(
342 342
 			'FHEE__EEM_Payment_Method__get_all_for_transaction__payment_methods',
343
-			$this->get_all_active( $scope, array( array( 'Currency.CUR_code' => array( 'IN', $currencies_for_events ) ) ) ),
343
+			$this->get_all_active($scope, array(array('Currency.CUR_code' => array('IN', $currencies_for_events)))),
344 344
 			$transaction,
345 345
 			$scope
346 346
 		);
Please login to merge, or discard this patch.