@@ -156,7 +156,7 @@ |
||
156 | 156 | * |
157 | 157 | * @since 4.5.0 |
158 | 158 | * |
159 | - * @return int |
|
159 | + * @return boolean |
|
160 | 160 | */ |
161 | 161 | public function wp_user() { |
162 | 162 | return $this->get('PRT_wp_user'); |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
32 | 32 | * @param array $props_n_values |
33 | 33 | * @return EE_Price_Type |
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 |
||
43 | 43 | * @param array $props_n_values |
44 | 44 | * @return EE_Price_Type |
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 |
||
55 | 55 | * @access public |
56 | 56 | * @param string $PRT_name |
57 | 57 | */ |
58 | - public function set_name( $PRT_name = '' ) { |
|
59 | - $this->set( 'PRT_name', $PRT_name ); |
|
58 | + public function set_name($PRT_name = '') { |
|
59 | + $this->set('PRT_name', $PRT_name); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | * @access public |
68 | 68 | * @param bool $PRT_is_percent |
69 | 69 | */ |
70 | - public function set_is_percent( $PRT_is_percent = FALSE ) { |
|
71 | - $this->set( 'PRT_is_percent', $PRT_is_percent ); |
|
70 | + public function set_is_percent($PRT_is_percent = FALSE) { |
|
71 | + $this->set('PRT_is_percent', $PRT_is_percent); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * @access public |
80 | 80 | * @param int $PRT_order |
81 | 81 | */ |
82 | - public function set_order( $PRT_order = 0 ) { |
|
83 | - $this->set( 'PRT_order', $PRT_order ); |
|
82 | + public function set_order($PRT_order = 0) { |
|
83 | + $this->set('PRT_order', $PRT_order); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * |
90 | 90 | */ |
91 | 91 | public function move_to_trash() { |
92 | - $this->set( 'PRT_deleted', TRUE ); |
|
92 | + $this->set('PRT_deleted', TRUE); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * |
99 | 99 | */ |
100 | 100 | public function restore_from_trash() { |
101 | - $this->set( 'PRT_deleted', FALSE ); |
|
101 | + $this->set('PRT_deleted', FALSE); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @access public |
109 | 109 | */ |
110 | 110 | public function name() { |
111 | - return $this->get( 'PRT_name' ); |
|
111 | + return $this->get('PRT_name'); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @access public |
119 | 119 | */ |
120 | 120 | public function base_type() { |
121 | - return $this->get( 'PBT_ID' ); |
|
121 | + return $this->get('PBT_ID'); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return mixed |
128 | 128 | */ |
129 | 129 | public function base_type_name() { |
130 | - return $this->get_pretty( 'PBT_ID' ); |
|
130 | + return $this->get_pretty('PBT_ID'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @access public |
138 | 138 | */ |
139 | 139 | public function is_percent() { |
140 | - return $this->get( 'PRT_is_percent' ); |
|
140 | + return $this->get('PRT_is_percent'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return bool |
147 | 147 | */ |
148 | 148 | public function is_discount() { |
149 | - return $this->get( 'PBT_ID' ) == 2 ? TRUE : FALSE; |
|
149 | + return $this->get('PBT_ID') == 2 ? TRUE : FALSE; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @access public |
170 | 170 | */ |
171 | 171 | public function order() { |
172 | - return $this->get( 'PRT_order' ); |
|
172 | + return $this->get('PRT_order'); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @access public |
180 | 180 | */ |
181 | 181 | public function deleted() { |
182 | - return $this->get( 'PRT_deleted' ); |
|
182 | + return $this->get('PRT_deleted'); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 |
@@ -226,7 +226,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 ) { |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -65,7 +65,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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' ); |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -252,8 +252,9 @@ |
||
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 | } |
@@ -40,7 +40,7 @@ discard block |
||
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 |
||
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 |
||
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' ); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | * @param string $timezone |
20 | 20 | * @return EE_Registration_Payment |
21 | 21 | */ |
22 | - public static function new_instance( $props_n_values = array(), $timezone = '', $date_formats = array() ) { |
|
23 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
24 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
22 | + public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) { |
|
23 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
24 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -31,8 +31,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return \EE_Registration |
88 | 88 | */ |
89 | 89 | public function registration() { |
90 | - return $this->get_first_related( 'Registration' ); |
|
90 | + return $this->get_first_related('Registration'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @return \EE_Payment |
99 | 99 | */ |
100 | 100 | public function payment() { |
101 | - return $this->get_first_related( 'Payment' ); |
|
101 | + return $this->get_first_related('Payment'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 |
@@ -50,7 +50,7 @@ discard block |
||
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 |
||
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 |
||
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' ); |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -66,7 +66,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 ); |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -66,7 +66,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 ); |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -51,7 +51,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 ); |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param array $props_n_values incoming values from the database |
50 | 50 | * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
51 | 51 | * the website will be used. |
52 | - * @return EE_Attendee |
|
52 | + * @return EE_Transaction |
|
53 | 53 | */ |
54 | 54 | public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
55 | 55 | return new self( $props_n_values, TRUE, $timezone ); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | /** |
213 | 213 | * get Transaction Total |
214 | 214 | * @access public |
215 | - * @return float |
|
215 | + * @return boolean |
|
216 | 216 | */ |
217 | 217 | public function total() { |
218 | 218 | return $this->get( 'TXN_total' ); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | /** |
224 | 224 | * get Total Amount Paid to Date |
225 | 225 | * @access public |
226 | - * @return float |
|
226 | + * @return boolean |
|
227 | 227 | */ |
228 | 228 | public function paid() { |
229 | 229 | return $this->get( 'TXN_paid' ); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | /** |
327 | 327 | * Gets all the attendees for this transaction (handy for use with EE_Attendee's get_registrations_for_event function |
328 | 328 | * for getting attendees and how many registrations they each have for an event) |
329 | - * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT' |
|
329 | + * @return EE_Base_Class[] EE_Attendee[] by default, int if $output is set to 'COUNT' |
|
330 | 330 | */ |
331 | 331 | public function attendees() { |
332 | 332 | return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) ); |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | /** |
572 | 572 | * Gets all the extra meta info on this payment |
573 | 573 | * @param array $query_params like EEM_Base::get_all |
574 | - * @return EE_Extra_Meta |
|
574 | + * @return EE_Base_Class[] |
|
575 | 575 | */ |
576 | 576 | public function extra_meta( $query_params = array() ) { |
577 | 577 | return $this->get_many_related( 'Extra_Meta', $query_params ); |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | |
714 | 714 | /** |
715 | 715 | * Gets PMD_ID |
716 | - * @return int |
|
716 | + * @return boolean |
|
717 | 717 | */ |
718 | 718 | function payment_method_ID() { |
719 | 719 | return $this->get('PMD_ID'); |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | /** |
725 | 725 | * Sets PMD_ID |
726 | 726 | * @param int $PMD_ID |
727 | - * @return boolean |
|
727 | + * @return boolean|null |
|
728 | 728 | */ |
729 | 729 | function set_payment_method_ID($PMD_ID) { |
730 | 730 | $this->set('PMD_ID', $PMD_ID); |
@@ -742,11 +742,11 @@ |
||
742 | 742 | $pm = $this->get_first_related('Payment_Method'); |
743 | 743 | if( $pm instanceof EE_Payment_Method ){ |
744 | 744 | return $pm; |
745 | - }else{ |
|
745 | + } else{ |
|
746 | 746 | $last_payment = $this->last_payment(); |
747 | 747 | if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
748 | 748 | return $last_payment->payment_method(); |
749 | - }else{ |
|
749 | + } else{ |
|
750 | 750 | return NULL; |
751 | 751 | } |
752 | 752 | } |
@@ -1,5 +1,5 @@ discard block |
||
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 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @subpackage includes/classes/EE_Transaction.class.php |
27 | 27 | * @author Brent Christensen |
28 | 28 | */ |
29 | -class EE_Transaction extends EE_Base_Class implements EEI_Transaction{ |
|
29 | +class EE_Transaction extends EE_Base_Class implements EEI_Transaction { |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | * date_format and the second value is the time format |
39 | 39 | * @return EE_Transaction |
40 | 40 | */ |
41 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
42 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
43 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
41 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
42 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
43 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * the website will be used. |
52 | 52 | * @return EE_Attendee |
53 | 53 | */ |
54 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
55 | - return new self( $props_n_values, TRUE, $timezone ); |
|
54 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
55 | + return new self($props_n_values, TRUE, $timezone); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | public function lock() { |
70 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
71 | - $locked_transactions[ $this->ID() ] = true; |
|
72 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
70 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
71 | + $locked_transactions[$this->ID()] = true; |
|
72 | + update_option('ee_locked_transactions', $locked_transactions); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | * @return void |
84 | 84 | */ |
85 | 85 | public function unlock() { |
86 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
87 | - unset( $locked_transactions[ $this->ID() ] ); |
|
88 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
86 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
87 | + unset($locked_transactions[$this->ID()]); |
|
88 | + update_option('ee_locked_transactions', $locked_transactions); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * @return boolean |
103 | 103 | */ |
104 | 104 | public function is_locked() { |
105 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
106 | - return isset( $locked_transactions[ $this->ID() ] ) ? true : false; |
|
105 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
106 | + return isset($locked_transactions[$this->ID()]) ? true : false; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | * @access public |
115 | 115 | * @param float $total total value of transaction |
116 | 116 | */ |
117 | - public function set_total( $total = 0.00 ) { |
|
118 | - $this->set( 'TXN_total', $total ); |
|
117 | + public function set_total($total = 0.00) { |
|
118 | + $this->set('TXN_total', $total); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @access public |
127 | 127 | * @param float $total_paid total amount paid to date (sum of all payments) |
128 | 128 | */ |
129 | - public function set_paid( $total_paid = 0.00 ) { |
|
130 | - $this->set( 'TXN_paid', $total_paid ); |
|
129 | + public function set_paid($total_paid = 0.00) { |
|
130 | + $this->set('TXN_paid', $total_paid); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @access public |
139 | 139 | * @param string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set |
140 | 140 | */ |
141 | - public function set_status( $status = '' ) { |
|
142 | - $this->set( 'STS_ID', $status ); |
|
141 | + public function set_status($status = '') { |
|
142 | + $this->set('STS_ID', $status); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | * @access public |
151 | 151 | * @param string $hash_salt required for some payment gateways |
152 | 152 | */ |
153 | - public function set_hash_salt( $hash_salt = '' ) { |
|
154 | - $this->set( 'TXN_hash_salt', $hash_salt ); |
|
153 | + public function set_hash_salt($hash_salt = '') { |
|
154 | + $this->set('TXN_hash_salt', $hash_salt); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | * Sets TXN_reg_steps array |
161 | 161 | * @param array $txn_reg_steps |
162 | 162 | */ |
163 | - function set_reg_steps( $txn_reg_steps ) { |
|
164 | - $this->set( 'TXN_reg_steps', $txn_reg_steps ); |
|
163 | + function set_reg_steps($txn_reg_steps) { |
|
164 | + $this->set('TXN_reg_steps', $txn_reg_steps); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | * @return array |
172 | 172 | */ |
173 | 173 | function reg_steps() { |
174 | - $TXN_reg_steps = $this->get( 'TXN_reg_steps' ); |
|
175 | - return is_array( $TXN_reg_steps ) ? $TXN_reg_steps : array(); |
|
174 | + $TXN_reg_steps = $this->get('TXN_reg_steps'); |
|
175 | + return is_array($TXN_reg_steps) ? $TXN_reg_steps : array(); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @return string of transaction's total cost, with currency symbol and decimal |
183 | 183 | */ |
184 | 184 | public function pretty_total() { |
185 | - return $this->get_pretty( 'TXN_total' ); |
|
185 | + return $this->get_pretty('TXN_total'); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @return string |
193 | 193 | */ |
194 | 194 | public function pretty_paid() { |
195 | - return $this->get_pretty( 'TXN_paid' ); |
|
195 | + return $this->get_pretty('TXN_paid'); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return float amount remaining |
205 | 205 | */ |
206 | 206 | public function remaining() { |
207 | - return (float)( $this->total() - $this->paid() ); |
|
207 | + return (float) ($this->total() - $this->paid()); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @return float |
216 | 216 | */ |
217 | 217 | public function total() { |
218 | - return $this->get( 'TXN_total' ); |
|
218 | + return $this->get('TXN_total'); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @return float |
227 | 227 | */ |
228 | 228 | public function paid() { |
229 | - return $this->get( 'TXN_paid' ); |
|
229 | + return $this->get('TXN_paid'); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * @access public |
237 | 237 | */ |
238 | 238 | public function get_cart_session() { |
239 | - $session_data = $this->get( 'TXN_session_data' ); |
|
240 | - return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart ? $session_data[ 'cart' ] : NULL; |
|
239 | + $session_data = $this->get('TXN_session_data'); |
|
240 | + return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart ? $session_data['cart'] : NULL; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | * @access public |
248 | 248 | */ |
249 | 249 | public function session_data() { |
250 | - $session_data = $this->get( 'TXN_session_data' ); |
|
251 | - if ( empty( $session_data ) ) { |
|
252 | - $session_data = array( 'id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array() ); |
|
250 | + $session_data = $this->get('TXN_session_data'); |
|
251 | + if (empty($session_data)) { |
|
252 | + $session_data = array('id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array()); |
|
253 | 253 | } |
254 | 254 | return $session_data; |
255 | 255 | } |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | * @access public |
263 | 263 | * @param EE_Session|array $session_data |
264 | 264 | */ |
265 | - public function set_txn_session_data( $session_data ) { |
|
266 | - if ( $session_data instanceof EE_Session ) { |
|
267 | - $this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE )); |
|
265 | + public function set_txn_session_data($session_data) { |
|
266 | + if ($session_data instanceof EE_Session) { |
|
267 | + $this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE)); |
|
268 | 268 | } else { |
269 | - $this->set( 'TXN_session_data', $session_data ); |
|
269 | + $this->set('TXN_session_data', $session_data); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @access public |
278 | 278 | */ |
279 | 279 | public function hash_salt_() { |
280 | - return $this->get( 'TXN_hash_salt' ); |
|
280 | + return $this->get('TXN_hash_salt'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -297,13 +297,13 @@ discard block |
||
297 | 297 | * @param boolean $gmt - whether to return a unix timestamp with UTC offset applied (default) or no UTC offset applied |
298 | 298 | * @return string | int |
299 | 299 | */ |
300 | - public function datetime( $format = FALSE, $gmt = FALSE ) { |
|
301 | - if ( $format ) { |
|
302 | - return $this->get_pretty( 'TXN_timestamp' ); |
|
303 | - } else if ( $gmt ) { |
|
304 | - return $this->get_raw( 'TXN_timestamp' ); |
|
300 | + public function datetime($format = FALSE, $gmt = FALSE) { |
|
301 | + if ($format) { |
|
302 | + return $this->get_pretty('TXN_timestamp'); |
|
303 | + } else if ($gmt) { |
|
304 | + return $this->get_raw('TXN_timestamp'); |
|
305 | 305 | } else { |
306 | - return $this->get( 'TXN_timestamp' ); |
|
306 | + return $this->get('TXN_timestamp'); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | * @param boolean $get_cached TRUE to retrieve cached registrations or FALSE to pull from the db |
316 | 316 | * @return EE_Registration[] |
317 | 317 | */ |
318 | - public function registrations( $query_params = array(), $get_cached = FALSE ) { |
|
319 | - $query_params = ( empty( $query_params ) || ! is_array( $query_params ) ) ? array( 'order_by' => array( 'Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC' ) ) : $query_params; |
|
318 | + public function registrations($query_params = array(), $get_cached = FALSE) { |
|
319 | + $query_params = (empty($query_params) || ! is_array($query_params)) ? array('order_by' => array('Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC')) : $query_params; |
|
320 | 320 | $query_params = $get_cached ? array() : $query_params; |
321 | - return $this->get_many_related( 'Registration', $query_params ); |
|
321 | + return $this->get_many_related('Registration', $query_params); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT' |
330 | 330 | */ |
331 | 331 | public function attendees() { |
332 | - return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) ); |
|
332 | + return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID()))); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param array $query_params like EEM_Base::get_all |
340 | 340 | * @return EE_Payment[] |
341 | 341 | */ |
342 | - public function payments( $query_params = array() ) { |
|
343 | - return $this->get_many_related( 'Payment', $query_params ); |
|
342 | + public function payments($query_params = array()) { |
|
343 | + return $this->get_many_related('Payment', $query_params); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | * @return EE_Payment[] |
351 | 351 | */ |
352 | 352 | public function approved_payments() { |
353 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
354 | - return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) ); |
|
353 | + EE_Registry::instance()->load_model('Payment'); |
|
354 | + return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC'))); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | * @param bool $show_icons |
362 | 362 | * @return string |
363 | 363 | */ |
364 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
365 | - echo $this->pretty_status( $show_icons ); |
|
364 | + public function e_pretty_status($show_icons = FALSE) { |
|
365 | + echo $this->pretty_status($show_icons); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | * @param bool $show_icons |
373 | 373 | * @return string |
374 | 374 | */ |
375 | - public function pretty_status( $show_icons = FALSE ) { |
|
376 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
375 | + public function pretty_status($show_icons = FALSE) { |
|
376 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
377 | 377 | $icon = ''; |
378 | - switch ( $this->status_ID() ) { |
|
378 | + switch ($this->status_ID()) { |
|
379 | 379 | case EEM_Transaction::complete_status_code: |
380 | 380 | $icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : ''; |
381 | 381 | break; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : ''; |
393 | 393 | break; |
394 | 394 | } |
395 | - return $icon . $status[ $this->status_ID() ]; |
|
395 | + return $icon.$status[$this->status_ID()]; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @access public |
403 | 403 | */ |
404 | 404 | public function status_ID() { |
405 | - return $this->get( 'STS_ID' ); |
|
405 | + return $this->get('STS_ID'); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return boolean |
413 | 413 | */ |
414 | 414 | public function is_free() { |
415 | - return (float)$this->get( 'TXN_total' ) == 0 ? TRUE : FALSE; |
|
415 | + return (float) $this->get('TXN_total') == 0 ? TRUE : FALSE; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -480,12 +480,12 @@ discard block |
||
480 | 480 | * @access public |
481 | 481 | * @return string |
482 | 482 | */ |
483 | - public function invoice_url( $type = 'html' ) { |
|
483 | + public function invoice_url($type = 'html') { |
|
484 | 484 | $REG = $this->primary_registration(); |
485 | - if ( ! $REG instanceof EE_Registration ) { |
|
485 | + if ( ! $REG instanceof EE_Registration) { |
|
486 | 486 | return ''; |
487 | 487 | } |
488 | - return $REG->invoice_url( $type ); |
|
488 | + return $REG->invoice_url($type); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * @return EE_Registration |
496 | 496 | */ |
497 | 497 | public function primary_registration() { |
498 | - return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) ); |
|
498 | + return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -505,12 +505,12 @@ discard block |
||
505 | 505 | * @param string $type 'pdf' or 'html' (default is 'html') |
506 | 506 | * @return string |
507 | 507 | */ |
508 | - public function receipt_url( $type = 'html' ) { |
|
508 | + public function receipt_url($type = 'html') { |
|
509 | 509 | $REG = $this->primary_registration(); |
510 | - if ( ! $REG instanceof EE_Registration ) { |
|
510 | + if ( ! $REG instanceof EE_Registration) { |
|
511 | 511 | return ''; |
512 | 512 | } |
513 | - return $REG->receipt_url( $type ); |
|
513 | + return $REG->receipt_url($type); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | |
@@ -535,15 +535,15 @@ discard block |
||
535 | 535 | * @deprecated |
536 | 536 | * @return boolean |
537 | 537 | */ |
538 | - public function update_based_on_payments(){ |
|
538 | + public function update_based_on_payments() { |
|
539 | 539 | EE_Error::doing_it_wrong( |
540 | - __CLASS__ . '::' . __FUNCTION__, |
|
541 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
540 | + __CLASS__.'::'.__FUNCTION__, |
|
541 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
542 | 542 | '4.6.0' |
543 | 543 | ); |
544 | 544 | /** @type EE_Transaction_Processor $transaction_processor */ |
545 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
546 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this ); |
|
545 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
546 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | * @return string |
553 | 553 | */ |
554 | 554 | public function gateway_response_on_transaction() { |
555 | - $payment = $this->get_first_related( 'Payment' ); |
|
555 | + $payment = $this->get_first_related('Payment'); |
|
556 | 556 | return $payment instanceof EE_Payment ? $payment->gateway_response() : ''; |
557 | 557 | } |
558 | 558 | |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | * @return EE_Status |
564 | 564 | */ |
565 | 565 | public function status_obj() { |
566 | - return $this->get_first_related( 'Status' ); |
|
566 | + return $this->get_first_related('Status'); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | |
@@ -573,8 +573,8 @@ discard block |
||
573 | 573 | * @param array $query_params like EEM_Base::get_all |
574 | 574 | * @return EE_Extra_Meta |
575 | 575 | */ |
576 | - public function extra_meta( $query_params = array() ) { |
|
577 | - return $this->get_many_related( 'Extra_Meta', $query_params ); |
|
576 | + public function extra_meta($query_params = array()) { |
|
577 | + return $this->get_many_related('Extra_Meta', $query_params); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | * @param EE_Registration $registration |
585 | 585 | * @return EE_Base_Class the relation was added to |
586 | 586 | */ |
587 | - public function add_registration( EE_Registration $registration ) { |
|
588 | - return $this->_add_relation_to( $registration, 'Registration' ); |
|
587 | + public function add_registration(EE_Registration $registration) { |
|
588 | + return $this->_add_relation_to($registration, 'Registration'); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | |
@@ -596,8 +596,8 @@ discard block |
||
596 | 596 | * @param int $registration_or_id |
597 | 597 | * @return EE_Base_Class that was removed from being related |
598 | 598 | */ |
599 | - public function remove_registration_with_id( $registration_or_id ) { |
|
600 | - return $this->_remove_relation_to( $registration_or_id, 'Registration' ); |
|
599 | + public function remove_registration_with_id($registration_or_id) { |
|
600 | + return $this->_remove_relation_to($registration_or_id, 'Registration'); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | * @return EE_Line_Item[] |
608 | 608 | */ |
609 | 609 | public function items_purchased() { |
610 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) ); |
|
610 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item))); |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | |
@@ -617,8 +617,8 @@ discard block |
||
617 | 617 | * @param EE_Line_Item $line_item |
618 | 618 | * @return EE_Base_Class the relation was added to |
619 | 619 | */ |
620 | - public function add_line_item( EE_Line_Item $line_item ) { |
|
621 | - return $this->_add_relation_to( $line_item, 'Line_Item' ); |
|
620 | + public function add_line_item(EE_Line_Item $line_item) { |
|
621 | + return $this->_add_relation_to($line_item, 'Line_Item'); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -628,8 +628,8 @@ discard block |
||
628 | 628 | * @param array $query_params |
629 | 629 | * @return EE_Line_Item[] |
630 | 630 | */ |
631 | - public function line_items( $query_params = array() ) { |
|
632 | - return $this->get_many_related( 'Line_Item', $query_params ); |
|
631 | + public function line_items($query_params = array()) { |
|
632 | + return $this->get_many_related('Line_Item', $query_params); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | * @return EE_Line_Item[] |
640 | 640 | */ |
641 | 641 | public function tax_items() { |
642 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) ); |
|
642 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
643 | 643 | } |
644 | 644 | |
645 | 645 | |
@@ -650,10 +650,10 @@ discard block |
||
650 | 650 | * @return EE_Line_Item |
651 | 651 | */ |
652 | 652 | public function total_line_item() { |
653 | - $item = $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) ); |
|
654 | - if( ! $item ){ |
|
655 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
656 | - $item = EEH_Line_Item::create_total_line_item( $this ); |
|
653 | + $item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total))); |
|
654 | + if ( ! $item) { |
|
655 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
656 | + $item = EEH_Line_Item::create_total_line_item($this); |
|
657 | 657 | } |
658 | 658 | return $item; |
659 | 659 | } |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | */ |
668 | 668 | public function tax_total() { |
669 | 669 | $tax_line_item = $this->tax_total_line_item(); |
670 | - if ( $tax_line_item ) { |
|
670 | + if ($tax_line_item) { |
|
671 | 671 | return $tax_line_item->total(); |
672 | 672 | } else { |
673 | 673 | return 0; |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @return EE_Line_Item |
682 | 682 | */ |
683 | 683 | public function tax_total_line_item() { |
684 | - return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() ); |
|
684 | + return EEH_Line_Item::get_taxes_subtotal($this->total_line_item()); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -690,20 +690,20 @@ discard block |
||
690 | 690 | * Gets the array of billing info for the gateway and for this transaction's primary registration's attendee. |
691 | 691 | * @return EE_Form_Section_Proper |
692 | 692 | */ |
693 | - public function billing_info(){ |
|
693 | + public function billing_info() { |
|
694 | 694 | $payment_method = $this->payment_method(); |
695 | - if ( !$payment_method){ |
|
695 | + if ( ! $payment_method) { |
|
696 | 696 | EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
697 | 697 | return false; |
698 | 698 | } |
699 | 699 | $primary_reg = $this->primary_registration(); |
700 | - if ( ! $primary_reg ) { |
|
701 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
700 | + if ( ! $primary_reg) { |
|
701 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
702 | 702 | return FALSE; |
703 | 703 | } |
704 | 704 | $attendee = $primary_reg->attendee(); |
705 | - if ( ! $attendee ) { |
|
706 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
705 | + if ( ! $attendee) { |
|
706 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
707 | 707 | return FALSE; |
708 | 708 | } |
709 | 709 | return $attendee->billing_info_for_payment_method($payment_method); |
@@ -738,15 +738,15 @@ discard block |
||
738 | 738 | * offline ones, dont' create payments) |
739 | 739 | * @return EE_Payment_Method |
740 | 740 | */ |
741 | - function payment_method(){ |
|
741 | + function payment_method() { |
|
742 | 742 | $pm = $this->get_first_related('Payment_Method'); |
743 | - if( $pm instanceof EE_Payment_Method ){ |
|
743 | + if ($pm instanceof EE_Payment_Method) { |
|
744 | 744 | return $pm; |
745 | - }else{ |
|
745 | + } else { |
|
746 | 746 | $last_payment = $this->last_payment(); |
747 | - if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
|
747 | + if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) { |
|
748 | 748 | return $last_payment->payment_method(); |
749 | - }else{ |
|
749 | + } else { |
|
750 | 750 | return NULL; |
751 | 751 | } |
752 | 752 | } |
@@ -757,15 +757,15 @@ discard block |
||
757 | 757 | * @return EE_Payment |
758 | 758 | */ |
759 | 759 | public function last_payment() { |
760 | - return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) ); |
|
760 | + return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc'))); |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | /** |
764 | 764 | * Gets all the line items which are unrelated to tickets on this transaction |
765 | 765 | * @return EE_Line_Item[] |
766 | 766 | */ |
767 | - public function non_ticket_line_items(){ |
|
768 | - return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() ); |
|
767 | + public function non_ticket_line_items() { |
|
768 | + return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID()); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 |