@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @access protected |
513 | 513 | * @param string $fieldname the property item the corresponding value is for. |
514 | 514 | * @param mixed $value The value we are caching. |
515 | - * @param null $cache_type |
|
515 | + * @param string $cache_type |
|
516 | 516 | * @return void |
517 | 517 | */ |
518 | 518 | protected function _set_cached_property( $fieldname, $value, $cache_type = NULL ) { |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | * |
826 | 826 | * @param null $field_to_order_by What field is being used as the reference point. |
827 | 827 | * @param array $query_params Any additional conditions on the query. |
828 | - * @param null $columns_to_select If left null, then an array of EE_Base_Class objects is returned, otherwise |
|
828 | + * @param string $columns_to_select If left null, then an array of EE_Base_Class objects is returned, otherwise |
|
829 | 829 | * you can indicate just the columns you want returned |
830 | 830 | * |
831 | 831 | * @return array|EE_Base_Class |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | * |
851 | 851 | * @param null $field_to_order_by What field is being used as the reference point. |
852 | 852 | * @param array $query_params Any additional conditions on the query. |
853 | - * @param null $columns_to_select If left null, then an EE_Base_Class object is returned, otherwise |
|
853 | + * @param string $columns_to_select If left null, then an EE_Base_Class object is returned, otherwise |
|
854 | 854 | * you can indicate just the column you want returned |
855 | 855 | * |
856 | 856 | * @return array|EE_Base_Class |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | /** |
914 | 914 | * This method simply returns the RAW unprocessed value for the given property in this class |
915 | 915 | * @param string $field_name A valid fieldname |
916 | - * @return mixed Whatever the raw value stored on the property is. |
|
916 | + * @return integer|null Whatever the raw value stored on the property is. |
|
917 | 917 | * @throws EE_Error if fieldSettings is misconfigured or the field doesn't exist. |
918 | 918 | */ |
919 | 919 | public function get_raw($field_name) { |
@@ -987,11 +987,11 @@ discard block |
||
987 | 987 | * |
988 | 988 | * @access protected |
989 | 989 | * @param string $field_name Field on the instantiated EE_Base_Class child object |
990 | - * @param null $dt_frmt valid datetime format used for date (if '' then we just use the default on the field, if NULL we use the last-used format) |
|
991 | - * @param null $tm_frmt Same as above except this is for time format |
|
990 | + * @param string|null $dt_frmt valid datetime format used for date (if '' then we just use the default on the field, if NULL we use the last-used format) |
|
991 | + * @param null|string $tm_frmt Same as above except this is for time format |
|
992 | 992 | * @param string $date_or_time if NULL then both are returned, otherwise "D" = only date and "T" = only time. |
993 | 993 | * @param boolean $echo Whether the dtt is echoing using pretty echoing or just returned using vanilla get |
994 | - * @return void | string | bool | EE_Error string on success, FALSE on fail, or EE_Error Exception is thrown if field is not a valid dtt field, or void if echoing |
|
994 | + * @return string|boolean | string | bool | EE_Error string on success, FALSE on fail, or EE_Error Exception is thrown if field is not a valid dtt field, or void if echoing |
|
995 | 995 | */ |
996 | 996 | protected function _get_datetime( $field_name, $dt_frmt = NULL, $tm_frmt = NULL, $date_or_time = NULL, $echo = FALSE ) { |
997 | 997 | |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | * sets the time on a datetime property |
1165 | 1165 | * |
1166 | 1166 | * @access protected |
1167 | - * @param string|Datetime $time a valid time string for php datetime functions (or DateTime object) |
|
1167 | + * @param string $time a valid time string for php datetime functions (or DateTime object) |
|
1168 | 1168 | * @param string $fieldname the name of the field the time is being set on (must match a EE_Datetime_Field) |
1169 | 1169 | */ |
1170 | 1170 | protected function _set_time_for( $time, $fieldname ) { |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | * sets the date on a datetime property |
1180 | 1180 | * |
1181 | 1181 | * @access protected |
1182 | - * @param string|DateTime $date a valid date string for php datetime functions ( or DateTime object) |
|
1182 | + * @param string $date a valid date string for php datetime functions ( or DateTime object) |
|
1183 | 1183 | * @param string $fieldname the name of the field the date is being set on (must match a EE_Datetime_Field) |
1184 | 1184 | */ |
1185 | 1185 | protected function _set_date_for( $date, $fieldname ) { |
@@ -1233,6 +1233,7 @@ discard block |
||
1233 | 1233 | * @param mixed (array|string) $args This is the arguments that will be passed to the callback. |
1234 | 1234 | * @param string $prepend You can include something to prepend on the timestamp |
1235 | 1235 | * @param string $append You can include something to append on the timestamp |
1236 | + * @param string $args |
|
1236 | 1237 | * @throws EE_Error |
1237 | 1238 | * @return string timestamp |
1238 | 1239 | */ |
@@ -1266,7 +1267,7 @@ discard block |
||
1266 | 1267 | * This calls the `EE_Base_Class::_delete` method. Child classes wishing to change default behaviour should override |
1267 | 1268 | * `EE_Base_Class::_delete` NOT this class. |
1268 | 1269 | * |
1269 | - * @return boolean | int |
|
1270 | + * @return integer | int |
|
1270 | 1271 | */ |
1271 | 1272 | public function delete(){ |
1272 | 1273 | /** |
@@ -1297,7 +1298,7 @@ discard block |
||
1297 | 1298 | * This method is called by the public `EE_Base_Class::delete` method. Any child classes desiring to override default |
1298 | 1299 | * functionality for "delete" (which is to call `permanently_delete`) should override this method NOT `EE_Base_Class::delete` |
1299 | 1300 | * |
1300 | - * @return bool|int |
|
1301 | + * @return boolean |
|
1301 | 1302 | */ |
1302 | 1303 | protected function _delete() { |
1303 | 1304 | $result = $this->delete_permanently(); |
@@ -1537,7 +1538,7 @@ discard block |
||
1537 | 1538 | |
1538 | 1539 | /** |
1539 | 1540 | * for getting a model while instantiated. |
1540 | - * @return \EEM_Base | \EEM_CPT_Base |
|
1541 | + * @return boolean | \EEM_CPT_Base |
|
1541 | 1542 | */ |
1542 | 1543 | public function get_model() { |
1543 | 1544 | $modelName = self::_get_model_classname( get_class($this) ); |
@@ -1568,7 +1569,7 @@ discard block |
||
1568 | 1569 | * If there is a key in the incoming array that matches the primary key for the model AND it is not null, then we check the db. If there's a an object we return it. If not we return false. |
1569 | 1570 | * @param array $props_n_values incoming array of properties and their values |
1570 | 1571 | * @param string $classname the classname of the child class |
1571 | - * @param null $timezone |
|
1572 | + * @param string|null $timezone |
|
1572 | 1573 | * @param array $date_formats incoming date_formats in an array where the first value is the |
1573 | 1574 | * date_format and the second value is the time format |
1574 | 1575 | * @return mixed (EE_Base_Class|bool) |
@@ -1617,7 +1618,7 @@ discard block |
||
1617 | 1618 | * @param $classname |
1618 | 1619 | * @param null $timezone |
1619 | 1620 | * @throws EE_Error |
1620 | - * @return EEM_Base |
|
1621 | + * @return boolean |
|
1621 | 1622 | */ |
1622 | 1623 | protected static function _get_model( $classname, $timezone = NULL ){ |
1623 | 1624 | //find model for this class |
@@ -1633,8 +1634,8 @@ discard block |
||
1633 | 1634 | /** |
1634 | 1635 | * Gets the model instance (eg instance of EEM_Attendee) given its classname (eg EE_Attendee) |
1635 | 1636 | * @param string $model_classname |
1636 | - * @param null $timezone |
|
1637 | - * @return EEM_Base |
|
1637 | + * @param string|null $timezone |
|
1638 | + * @return boolean |
|
1638 | 1639 | */ |
1639 | 1640 | protected static function _get_model_instance_with_name($model_classname, $timezone = NULL){ |
1640 | 1641 | $model_classname = str_replace( 'EEM_', '', $model_classname ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | -do_action( 'AHEE_log', __FILE__, ' FILE LOADED', '' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | +do_action('AHEE_log', __FILE__, ' FILE LOADED', ''); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * Event Espresso |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * ------------------------------------------------------------------------ |
25 | 25 | */ |
26 | 26 | |
27 | -abstract class EE_Base_Class{ |
|
27 | +abstract class EE_Base_Class { |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * This is an array of the original properties and values provided during construction |
@@ -117,60 +117,60 @@ discard block |
||
117 | 117 | * @throws EE_Error |
118 | 118 | * @return \EE_Base_Class |
119 | 119 | */ |
120 | - protected function __construct( $fieldValues = array(), $bydb = FALSE, $timezone = '', $date_formats = array() ){ |
|
120 | + protected function __construct($fieldValues = array(), $bydb = FALSE, $timezone = '', $date_formats = array()) { |
|
121 | 121 | |
122 | - $className=get_class($this); |
|
122 | + $className = get_class($this); |
|
123 | 123 | |
124 | - do_action("AHEE__{$className}__construct",$this,$fieldValues); |
|
125 | - $model=$this->get_model(); |
|
126 | - $model_fields = $model->field_settings( FALSE ); |
|
124 | + do_action("AHEE__{$className}__construct", $this, $fieldValues); |
|
125 | + $model = $this->get_model(); |
|
126 | + $model_fields = $model->field_settings(FALSE); |
|
127 | 127 | // ensure $fieldValues is an array |
128 | - $fieldValues = is_array( $fieldValues ) ? $fieldValues : array( $fieldValues ); |
|
128 | + $fieldValues = is_array($fieldValues) ? $fieldValues : array($fieldValues); |
|
129 | 129 | // EEH_Debug_Tools::printr( $fieldValues, '$fieldValues <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
130 | 130 | // verify client code has not passed any invalid field names |
131 | - foreach($fieldValues as $field_name=> $field_value){ |
|
132 | - if( ! isset( $model_fields[ $field_name] ) ){ |
|
133 | - throw new EE_Error(sprintf(__("Invalid field (%s) passed to constructor of %s. Allowed fields are :%s", "event_espresso"),$field_name,get_class($this),implode(", ",array_keys($model_fields)))); |
|
131 | + foreach ($fieldValues as $field_name=> $field_value) { |
|
132 | + if ( ! isset($model_fields[$field_name])) { |
|
133 | + throw new EE_Error(sprintf(__("Invalid field (%s) passed to constructor of %s. Allowed fields are :%s", "event_espresso"), $field_name, get_class($this), implode(", ", array_keys($model_fields)))); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | // EEH_Debug_Tools::printr( $model_fields, '$model_fields <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
137 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
138 | - $this->_timezone = EEH_DTT_Helper::get_valid_timezone_string( $timezone ); |
|
137 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
138 | + $this->_timezone = EEH_DTT_Helper::get_valid_timezone_string($timezone); |
|
139 | 139 | |
140 | - if ( ! empty( $date_formats ) && is_array( $date_formats ) ) { |
|
140 | + if ( ! empty($date_formats) && is_array($date_formats)) { |
|
141 | 141 | $this->_dt_frmt = $date_formats[0]; |
142 | 142 | $this->_tm_frmt = $date_formats[1]; |
143 | 143 | } else { |
144 | 144 | //set default formats for date and time |
145 | - $this->_dt_frmt = get_option( 'date_format' ); |
|
146 | - $this->_tm_frmt = get_option( 'time_format' ); |
|
145 | + $this->_dt_frmt = get_option('date_format'); |
|
146 | + $this->_tm_frmt = get_option('time_format'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | //if db model is instantiating |
150 | - if ( $bydb ){ |
|
150 | + if ($bydb) { |
|
151 | 151 | //client code has indicated these field values are from the database |
152 | - foreach( $model_fields as $fieldName => $field ){ |
|
153 | - $this->set_from_db( $fieldName, isset( $fieldValues[ $fieldName] ) ? $fieldValues[ $fieldName ] : null ); |
|
152 | + foreach ($model_fields as $fieldName => $field) { |
|
153 | + $this->set_from_db($fieldName, isset($fieldValues[$fieldName]) ? $fieldValues[$fieldName] : null); |
|
154 | 154 | } |
155 | 155 | } else { |
156 | 156 | //we're constructing a brand |
157 | 157 | //new instance of the model object. Generally, this means we'll need to do more field validation |
158 | - foreach( $model_fields as $fieldName => $field ){ |
|
159 | - $this->set( $fieldName, isset( $fieldValues[ $fieldName ] ) ? $fieldValues[ $fieldName ] : null, true ); |
|
158 | + foreach ($model_fields as $fieldName => $field) { |
|
159 | + $this->set($fieldName, isset($fieldValues[$fieldName]) ? $fieldValues[$fieldName] : null, true); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | 163 | //remember what values were passed to this constructor |
164 | 164 | $this->_props_n_values_provided_in_constructor = $fieldValues; |
165 | 165 | //remember in entity mapper |
166 | - if($model->has_primary_key_field() && $this->ID() && ! $bydb ){ |
|
166 | + if ($model->has_primary_key_field() && $this->ID() && ! $bydb) { |
|
167 | 167 | $model->add_to_entity_map($this); |
168 | 168 | } |
169 | 169 | //setup all the relations |
170 | - foreach($this->get_model()->relation_settings() as $relation_name=>$relation_obj){ |
|
171 | - if($relation_obj instanceof EE_Belongs_To_Relation){ |
|
170 | + foreach ($this->get_model()->relation_settings() as $relation_name=>$relation_obj) { |
|
171 | + if ($relation_obj instanceof EE_Belongs_To_Relation) { |
|
172 | 172 | $this->_model_relations[$relation_name] = NULL; |
173 | - }else{ |
|
173 | + } else { |
|
174 | 174 | $this->_model_relations[$relation_name] = array(); |
175 | 175 | } |
176 | 176 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * Action done at the end of each model object construction |
179 | 179 | * @param EE_Base_Class $this the model object just created |
180 | 180 | */ |
181 | - do_action( 'AHEE__EE_Base_Class__construct__finished', $this ); |
|
181 | + do_action('AHEE__EE_Base_Class__construct__finished', $this); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param boolean $allow_persist |
199 | 199 | * @return boolean |
200 | 200 | */ |
201 | - function set_allow_persist( $allow_persist ) { |
|
201 | + function set_allow_persist($allow_persist) { |
|
202 | 202 | return $this->_allow_persist = $allow_persist; |
203 | 203 | } |
204 | 204 | |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | * @param string $field_name |
212 | 212 | * @return mixed|null |
213 | 213 | */ |
214 | - public function get_original( $field_name ){ |
|
215 | - if( isset( $this->_props_n_values_provided_in_constructor[ $field_name ] ) && |
|
216 | - $field_settings = $this->get_Model()->field_settings_for( $field_name )){ |
|
217 | - return $field_settings->prepare_for_get( $this->_props_n_values_provided_in_constructor[ $field_name ] ); |
|
218 | - }else{ |
|
214 | + public function get_original($field_name) { |
|
215 | + if (isset($this->_props_n_values_provided_in_constructor[$field_name]) && |
|
216 | + $field_settings = $this->get_Model()->field_settings_for($field_name)) { |
|
217 | + return $field_settings->prepare_for_get($this->_props_n_values_provided_in_constructor[$field_name]); |
|
218 | + } else { |
|
219 | 219 | return NULL; |
220 | 220 | } |
221 | 221 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param EE_Base_Class $obj |
226 | 226 | * @return string |
227 | 227 | */ |
228 | - public function get_class($obj){ |
|
228 | + public function get_class($obj) { |
|
229 | 229 | return get_class($obj); |
230 | 230 | } |
231 | 231 | |
@@ -238,19 +238,19 @@ discard block |
||
238 | 238 | * @param mixed $field_value |
239 | 239 | * @param bool $use_default |
240 | 240 | */ |
241 | - public function set( $field_name, $field_value, $use_default = FALSE ){ |
|
242 | - $field_obj = $this->get_model()->field_settings_for( $field_name ); |
|
243 | - if ( $field_obj instanceof EE_Model_Field_Base ) { |
|
241 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
242 | + $field_obj = $this->get_model()->field_settings_for($field_name); |
|
243 | + if ($field_obj instanceof EE_Model_Field_Base) { |
|
244 | 244 | // if ( method_exists( $field_obj, 'set_timezone' )) { |
245 | - if ( $field_obj instanceof EE_Datetime_Field ) { |
|
246 | - $field_obj->set_timezone( $this->_timezone ); |
|
247 | - $field_obj->set_date_format( $this->_dt_frmt ); |
|
248 | - $field_obj->set_time_format( $this->_tm_frmt ); |
|
245 | + if ($field_obj instanceof EE_Datetime_Field) { |
|
246 | + $field_obj->set_timezone($this->_timezone); |
|
247 | + $field_obj->set_date_format($this->_dt_frmt); |
|
248 | + $field_obj->set_time_format($this->_tm_frmt); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | $holder_of_value = $field_obj->prepare_for_set($field_value); |
252 | 252 | //should the value be null? |
253 | - if( ($field_value === NULL || $holder_of_value === NULL || $holder_of_value ==='') && $use_default){ |
|
253 | + if (($field_value === NULL || $holder_of_value === NULL || $holder_of_value === '') && $use_default) { |
|
254 | 254 | $this->_fields[$field_name] = $field_obj->get_default_value(); |
255 | 255 | |
256 | 256 | /** |
@@ -260,19 +260,19 @@ discard block |
||
260 | 260 | * object. |
261 | 261 | * @since 4.6.10+ |
262 | 262 | */ |
263 | - if ( $field_obj instanceof EE_Datetime_Field && ! is_null( $this->_fields[$field_name] ) && ! $this->_fields[$field_name] instanceof DateTime ) { |
|
264 | - empty( $this->_fields[$field_name] ) ? $this->set( $field_name, time() ) : $this->set( $field_name, $this->_fields[$field_name] ); |
|
263 | + if ($field_obj instanceof EE_Datetime_Field && ! is_null($this->_fields[$field_name]) && ! $this->_fields[$field_name] instanceof DateTime) { |
|
264 | + empty($this->_fields[$field_name]) ? $this->set($field_name, time()) : $this->set($field_name, $this->_fields[$field_name]); |
|
265 | 265 | } |
266 | 266 | |
267 | - }else{ |
|
267 | + } else { |
|
268 | 268 | $this->_fields[$field_name] = $holder_of_value; |
269 | 269 | } |
270 | 270 | |
271 | 271 | //if we're not in the constructor... |
272 | 272 | //now check if what we set was a primary key |
273 | - if($this->_props_n_values_provided_in_constructor && //note: props_n_values_provided_in_constructor is only set at the END of the constructor |
|
273 | + if ($this->_props_n_values_provided_in_constructor && //note: props_n_values_provided_in_constructor is only set at the END of the constructor |
|
274 | 274 | $field_name == $this->_get_primary_key_name(get_class($this)) && |
275 | - $field_value){ |
|
275 | + $field_value) { |
|
276 | 276 | //if so, we want all this object's fields to be filled either with |
277 | 277 | //what we've explicitly set on this model |
278 | 278 | //or what we have in the db |
@@ -280,20 +280,20 @@ discard block |
||
280 | 280 | $fields_on_model = $this->_get_model(get_class($this))->field_settings(); |
281 | 281 | |
282 | 282 | $obj_in_db = $this->_get_model(get_class($this))->get_one_by_ID($field_value); |
283 | - foreach($fields_on_model as $field_obj){ |
|
284 | - if( ! array_key_exists($field_obj->get_name(), $this->_props_n_values_provided_in_constructor) |
|
285 | - && $field_obj->get_name() != $field_name ){ |
|
283 | + foreach ($fields_on_model as $field_obj) { |
|
284 | + if ( ! array_key_exists($field_obj->get_name(), $this->_props_n_values_provided_in_constructor) |
|
285 | + && $field_obj->get_name() != $field_name) { |
|
286 | 286 | |
287 | - $this->set($field_obj->get_name(),$obj_in_db->get($field_obj->get_name())); |
|
287 | + $this->set($field_obj->get_name(), $obj_in_db->get($field_obj->get_name())); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | //oh this model object has an ID? well make sure its in the entity mapper |
291 | 291 | $this->get_model()->add_to_entity_map($this); |
292 | 292 | } |
293 | 293 | //let's unset any cache for this field_name from the $_cached_properties property. |
294 | - $this->_clear_cached_property( $field_name ); |
|
295 | - }else{ |
|
296 | - throw new EE_Error( sprintf( __( "A valid EE_Model_Field_Base could not be found for the given field name: %s", "event_espresso" ), $field_name ) ); |
|
294 | + $this->_clear_cached_property($field_name); |
|
295 | + } else { |
|
296 | + throw new EE_Error(sprintf(__("A valid EE_Model_Field_Base could not be found for the given field name: %s", "event_espresso"), $field_name)); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | } |
@@ -312,14 +312,14 @@ discard block |
||
312 | 312 | * @param mixed $field_value The value to set. |
313 | 313 | * @return int|bool @see EE_Base_Class::update_extra_meta() for return docs. |
314 | 314 | */ |
315 | - public function set_field_or_extra_meta( $field_name, $field_value ) { |
|
316 | - if ( $this->get_model()->has_field( $field_name ) ) { |
|
317 | - $this->set( $field_name, $field_value ); |
|
315 | + public function set_field_or_extra_meta($field_name, $field_value) { |
|
316 | + if ($this->get_model()->has_field($field_name)) { |
|
317 | + $this->set($field_name, $field_value); |
|
318 | 318 | return true; |
319 | 319 | } else { |
320 | 320 | //ensure this object is saved first so that extra meta can be properly related. |
321 | 321 | $this->save(); |
322 | - return $this->update_extra_meta( $field_name, $field_value ); |
|
322 | + return $this->update_extra_meta($field_name, $field_value); |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
@@ -343,12 +343,12 @@ discard block |
||
343 | 343 | * @param string $field_name expecting the fully qualified field name. |
344 | 344 | * @return mixed|null value for the field if found. null if not found. |
345 | 345 | */ |
346 | - public function get_field_or_extra_meta( $field_name ) { |
|
347 | - if ( $this->get_model()->has_field( $field_name ) ) { |
|
348 | - $column_value = $this->get( $field_name ); |
|
346 | + public function get_field_or_extra_meta($field_name) { |
|
347 | + if ($this->get_model()->has_field($field_name)) { |
|
348 | + $column_value = $this->get($field_name); |
|
349 | 349 | } else { |
350 | 350 | //This isn't a column in the main table, let's see if it is in the extra meta. |
351 | - $column_value = $this->get_extra_meta( $field_name, true, null ); |
|
351 | + $column_value = $this->get_extra_meta($field_name, true, null); |
|
352 | 352 | } |
353 | 353 | return $column_value; |
354 | 354 | } |
@@ -367,19 +367,19 @@ discard block |
||
367 | 367 | * @param string $timezone A valid timezone string as described by @link http://www.php.net/manual/en/timezones.php |
368 | 368 | * @return void |
369 | 369 | */ |
370 | - public function set_timezone( $timezone = '' ) { |
|
370 | + public function set_timezone($timezone = '') { |
|
371 | 371 | EE_Registry::instance()->load_helper('DTT_Helper'); |
372 | - $this->_timezone = EEH_DTT_Helper::get_valid_timezone_string( $timezone ); |
|
372 | + $this->_timezone = EEH_DTT_Helper::get_valid_timezone_string($timezone); |
|
373 | 373 | //make sure we clear all cached properties because they won't be relevant now |
374 | 374 | $this->_clear_cached_properties(); |
375 | 375 | |
376 | 376 | //make sure we update field settings and the date for all EE_Datetime_Fields |
377 | - $model_fields = $this->get_model()->field_settings( false ); |
|
378 | - foreach ( $model_fields as $field_name => $field_obj ) { |
|
379 | - if ( $field_obj instanceof EE_Datetime_Field ) { |
|
380 | - $field_obj->set_timezone( $this->_timezone ); |
|
381 | - if ( isset( $this->_fields[$field_name] ) && $this->_fields[$field_name] instanceof DateTime ) { |
|
382 | - $this->_fields[$field_name]->setTimezone( new DateTimeZone( $this->_timezone ) ); |
|
377 | + $model_fields = $this->get_model()->field_settings(false); |
|
378 | + foreach ($model_fields as $field_name => $field_obj) { |
|
379 | + if ($field_obj instanceof EE_Datetime_Field) { |
|
380 | + $field_obj->set_timezone($this->_timezone); |
|
381 | + if (isset($this->_fields[$field_name]) && $this->_fields[$field_name] instanceof DateTime) { |
|
382 | + $this->_fields[$field_name]->setTimezone(new DateTimeZone($this->_timezone)); |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * |
409 | 409 | * @param string $format should be a format recognizable by PHP date() functions. |
410 | 410 | */ |
411 | - public function set_date_format( $format ) { |
|
411 | + public function set_date_format($format) { |
|
412 | 412 | $this->_dt_frmt = $format; |
413 | 413 | //clear cached_properties because they won't be relevant now. |
414 | 414 | $this->_clear_cached_properties(); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @since 4.6 |
425 | 425 | * @param string $format should be a format recognizable by PHP date() functions. |
426 | 426 | */ |
427 | - public function set_time_format( $format ) { |
|
427 | + public function set_time_format($format) { |
|
428 | 428 | $this->_tm_frmt = $format; |
429 | 429 | //clear cached_properties because they won't be relevant now. |
430 | 430 | $this->_clear_cached_properties(); |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @return mixed string|array |
443 | 443 | */ |
444 | - public function get_format( $full = true ) { |
|
445 | - return $full ? $this->_dt_frmt . ' ' . $this->_tm_frmt : array( $this->_dt_frmt, $this->_tm_frmt ); |
|
444 | + public function get_format($full = true) { |
|
445 | + return $full ? $this->_dt_frmt.' '.$this->_tm_frmt : array($this->_dt_frmt, $this->_tm_frmt); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | |
@@ -460,17 +460,17 @@ discard block |
||
460 | 460 | * @throws EE_Error |
461 | 461 | * @return mixed index into cache, or just TRUE if the relation is of type Belongs_To (because there's only one related thing, no array) |
462 | 462 | */ |
463 | - public function cache( $relationName = '', $object_to_cache = NULL, $cache_id = NULL ){ |
|
463 | + public function cache($relationName = '', $object_to_cache = NULL, $cache_id = NULL) { |
|
464 | 464 | // its entirely possible that there IS no related object yet in which case there is nothing to cache. |
465 | - if ( ! $object_to_cache instanceof EE_Base_Class ) { |
|
465 | + if ( ! $object_to_cache instanceof EE_Base_Class) { |
|
466 | 466 | return FALSE; |
467 | 467 | } |
468 | 468 | // also get "how" the object is related, or throw an error |
469 | - if( ! $relationship_to_model = $this->get_model()->related_settings_for( $relationName )) { |
|
470 | - throw new EE_Error( sprintf( __( 'There is no relationship to %s on a %s. Cannot cache it', 'event_espresso' ), $relationName, get_class( $this ))); |
|
469 | + if ( ! $relationship_to_model = $this->get_model()->related_settings_for($relationName)) { |
|
470 | + throw new EE_Error(sprintf(__('There is no relationship to %s on a %s. Cannot cache it', 'event_espresso'), $relationName, get_class($this))); |
|
471 | 471 | } |
472 | 472 | // how many things are related ? |
473 | - if( $relationship_to_model instanceof EE_Belongs_To_Relation ){ |
|
473 | + if ($relationship_to_model instanceof EE_Belongs_To_Relation) { |
|
474 | 474 | // if it's a "belongs to" relationship, then there's only one related model object eg, if this is a registration, there's only 1 attendee for it |
475 | 475 | // so for these model objects just set it to be cached |
476 | 476 | $this->_model_relations[$relationName] = $object_to_cache; |
@@ -478,26 +478,26 @@ discard block |
||
478 | 478 | } else { |
479 | 479 | // otherwise, this is the "many" side of a one to many relationship, so we'll add the object to the array of related objects for that type. |
480 | 480 | // eg: if this is an event, there are many registrations for that event, so we cache the registrations in an array |
481 | - if( ! is_array( $this->_model_relations[$relationName] )) { |
|
481 | + if ( ! is_array($this->_model_relations[$relationName])) { |
|
482 | 482 | // if for some reason, the cached item is a model object, then stick that in the array, otherwise start with an empty array |
483 | - $this->_model_relations[$relationName] = $this->_model_relations[$relationName] instanceof EE_Base_Class ? array( $this->_model_relations[$relationName] ) : array(); |
|
483 | + $this->_model_relations[$relationName] = $this->_model_relations[$relationName] instanceof EE_Base_Class ? array($this->_model_relations[$relationName]) : array(); |
|
484 | 484 | } |
485 | 485 | // first check for a cache_id which is normally empty |
486 | - if ( ! empty( $cache_id )) { |
|
486 | + if ( ! empty($cache_id)) { |
|
487 | 487 | // if the cache_id exists, then it means we are purposely trying to cache this with a known key that can then be used to retrieve the object later on |
488 | - $this->_model_relations[$relationName][ $cache_id ] = $object_to_cache; |
|
488 | + $this->_model_relations[$relationName][$cache_id] = $object_to_cache; |
|
489 | 489 | $return = $cache_id; |
490 | - } elseif ( $object_to_cache->ID() ) { |
|
490 | + } elseif ($object_to_cache->ID()) { |
|
491 | 491 | // OR the cached object originally came from the db, so let's just use it's PK for an ID |
492 | - $this->_model_relations[$relationName][ $object_to_cache->ID() ] = $object_to_cache; |
|
492 | + $this->_model_relations[$relationName][$object_to_cache->ID()] = $object_to_cache; |
|
493 | 493 | $return = $object_to_cache->ID(); |
494 | 494 | } else { |
495 | 495 | // OR it's a new object with no ID, so just throw it in the array with an auto-incremented ID |
496 | 496 | $this->_model_relations[$relationName][] = $object_to_cache; |
497 | 497 | // move the internal pointer to the end of the array |
498 | - end( $this->_model_relations[$relationName] ); |
|
498 | + end($this->_model_relations[$relationName]); |
|
499 | 499 | // and grab the key so that we can return it |
500 | - $return = key( $this->_model_relations[$relationName] ); |
|
500 | + $return = key($this->_model_relations[$relationName]); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | } |
@@ -515,11 +515,11 @@ discard block |
||
515 | 515 | * @param null $cache_type |
516 | 516 | * @return void |
517 | 517 | */ |
518 | - protected function _set_cached_property( $fieldname, $value, $cache_type = NULL ) { |
|
518 | + protected function _set_cached_property($fieldname, $value, $cache_type = NULL) { |
|
519 | 519 | //first make sure this property exists |
520 | 520 | $this->get_model()->field_settings_for($fieldname); |
521 | 521 | |
522 | - $cache_type = empty( $cache_type ) ? 'standard' : $cache_type; |
|
522 | + $cache_type = empty($cache_type) ? 'standard' : $cache_type; |
|
523 | 523 | $this->_cached_properties[$fieldname][$cache_type] = $value; |
524 | 524 | } |
525 | 525 | |
@@ -534,34 +534,34 @@ discard block |
||
534 | 534 | * It can also accept certain pre-defined "schema" strings to define how to output the property. see the field's prepare_for_pretty_echoing for what strings can be used |
535 | 535 | * @return mixed whatever the value for the property is we're retrieving |
536 | 536 | */ |
537 | - protected function _get_cached_property( $fieldname, $pretty = FALSE, $extra_cache_ref = NULL ) { |
|
537 | + protected function _get_cached_property($fieldname, $pretty = FALSE, $extra_cache_ref = NULL) { |
|
538 | 538 | //verify the field exists |
539 | 539 | $this->get_model()->field_settings_for($fieldname); |
540 | 540 | |
541 | 541 | $cache_type = $pretty ? 'pretty' : 'standard'; |
542 | - $cache_type .= !empty( $extra_cache_ref ) ? '_' . $extra_cache_ref : ''; |
|
542 | + $cache_type .= ! empty($extra_cache_ref) ? '_'.$extra_cache_ref : ''; |
|
543 | 543 | |
544 | - if ( isset( $this->_cached_properties[$fieldname][$cache_type] ) ) { |
|
544 | + if (isset($this->_cached_properties[$fieldname][$cache_type])) { |
|
545 | 545 | return $this->_cached_properties[$fieldname][$cache_type]; |
546 | 546 | } |
547 | 547 | |
548 | 548 | $field_obj = $this->get_model()->field_settings_for($fieldname); |
549 | - if ( $field_obj instanceof EE_Model_Field_Base ) { |
|
549 | + if ($field_obj instanceof EE_Model_Field_Base) { |
|
550 | 550 | /** |
551 | 551 | * maybe this is EE_Datetime_Field. If so we need to make sure timezone and |
552 | 552 | * formats are correct. |
553 | 553 | */ |
554 | - if ( $field_obj instanceof EE_Datetime_Field ) { |
|
555 | - $field_obj->set_timezone( $this->_timezone ); |
|
556 | - $field_obj->set_date_format( $this->_dt_frmt, $pretty ); |
|
557 | - $field_obj->set_time_format( $this->_tm_frmt, $pretty ); |
|
554 | + if ($field_obj instanceof EE_Datetime_Field) { |
|
555 | + $field_obj->set_timezone($this->_timezone); |
|
556 | + $field_obj->set_date_format($this->_dt_frmt, $pretty); |
|
557 | + $field_obj->set_time_format($this->_tm_frmt, $pretty); |
|
558 | 558 | } |
559 | 559 | |
560 | - if( ! isset($this->_fields[$fieldname])){ |
|
560 | + if ( ! isset($this->_fields[$fieldname])) { |
|
561 | 561 | $this->_fields[$fieldname] = NULL; |
562 | 562 | } |
563 | - $value = $pretty ? $field_obj->prepare_for_pretty_echoing($this->_fields[$fieldname], $extra_cache_ref) : $field_obj->prepare_for_get($this->_fields[$fieldname] ); |
|
564 | - $this->_set_cached_property( $fieldname, $value, $cache_type ); |
|
563 | + $value = $pretty ? $field_obj->prepare_for_pretty_echoing($this->_fields[$fieldname], $extra_cache_ref) : $field_obj->prepare_for_get($this->_fields[$fieldname]); |
|
564 | + $this->_set_cached_property($fieldname, $value, $cache_type); |
|
565 | 565 | return $value; |
566 | 566 | } |
567 | 567 | return FALSE; |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | * @param string $property_name the property to remove if it exists (from the _cached_properties array) |
588 | 588 | * @return void |
589 | 589 | */ |
590 | - protected function _clear_cached_property( $property_name ) { |
|
591 | - if ( isset( $this->_cached_properties[ $property_name ] ) ) |
|
592 | - unset( $this->_cached_properties[ $property_name ] ); |
|
590 | + protected function _clear_cached_property($property_name) { |
|
591 | + if (isset($this->_cached_properties[$property_name])) |
|
592 | + unset($this->_cached_properties[$property_name]); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | * @param string $model_name name of the related thing, eg 'Attendee', |
601 | 601 | * @return EE_Base_Class |
602 | 602 | */ |
603 | - protected function ensure_related_thing_is_model_obj($object_or_id,$model_name){ |
|
603 | + protected function ensure_related_thing_is_model_obj($object_or_id, $model_name) { |
|
604 | 604 | $other_model_instance = self::_get_model_instance_with_name(self::_get_model_classname($model_name), $this->_timezone); |
605 | 605 | $model_obj = $other_model_instance->ensure_is_obj($object_or_id); |
606 | 606 | return $model_obj; |
@@ -620,55 +620,55 @@ discard block |
||
620 | 620 | * @throws EE_Error |
621 | 621 | * @return EE_Base_Class | boolean from which was cleared from the cache, or true if we requested to remove a relation from all |
622 | 622 | */ |
623 | - public function clear_cache($relationName, $object_to_remove_or_index_into_array = NULL, $clear_all = FALSE){ |
|
623 | + public function clear_cache($relationName, $object_to_remove_or_index_into_array = NULL, $clear_all = FALSE) { |
|
624 | 624 | $relationship_to_model = $this->get_model()->related_settings_for($relationName); |
625 | 625 | $index_in_cache = ''; |
626 | - if( ! $relationship_to_model){ |
|
627 | - throw new EE_Error(sprintf(__("There is no relationship to %s on a %s. Cannot clear that cache",'event_espresso'),$relationName,get_class($this))); |
|
626 | + if ( ! $relationship_to_model) { |
|
627 | + throw new EE_Error(sprintf(__("There is no relationship to %s on a %s. Cannot clear that cache", 'event_espresso'), $relationName, get_class($this))); |
|
628 | 628 | } |
629 | - if($clear_all){ |
|
629 | + if ($clear_all) { |
|
630 | 630 | $obj_removed = true; |
631 | 631 | $this->_model_relations[$relationName] = null; |
632 | - }elseif($relationship_to_model instanceof EE_Belongs_To_Relation){ |
|
632 | + }elseif ($relationship_to_model instanceof EE_Belongs_To_Relation) { |
|
633 | 633 | $obj_removed = $this->_model_relations[$relationName]; |
634 | 634 | $this->_model_relations[$relationName] = null; |
635 | - }else{ |
|
636 | - if($object_to_remove_or_index_into_array instanceof EE_Base_Class && $object_to_remove_or_index_into_array->ID()){ |
|
635 | + } else { |
|
636 | + if ($object_to_remove_or_index_into_array instanceof EE_Base_Class && $object_to_remove_or_index_into_array->ID()) { |
|
637 | 637 | $index_in_cache = $object_to_remove_or_index_into_array->ID(); |
638 | - if( is_array($this->_model_relations[$relationName]) && ! isset($this->_model_relations[$relationName][$index_in_cache])){ |
|
638 | + if (is_array($this->_model_relations[$relationName]) && ! isset($this->_model_relations[$relationName][$index_in_cache])) { |
|
639 | 639 | $index_found_at = NULL; |
640 | 640 | //find this object in the array even though it has a different key |
641 | - foreach($this->_model_relations[$relationName] as $index=>$obj){ |
|
642 | - if( $obj instanceof EE_Base_Class && ( $obj == $object_to_remove_or_index_into_array || $obj->ID() == $object_to_remove_or_index_into_array->ID() )) { |
|
641 | + foreach ($this->_model_relations[$relationName] as $index=>$obj) { |
|
642 | + if ($obj instanceof EE_Base_Class && ($obj == $object_to_remove_or_index_into_array || $obj->ID() == $object_to_remove_or_index_into_array->ID())) { |
|
643 | 643 | $index_found_at = $index; |
644 | 644 | break; |
645 | 645 | } |
646 | 646 | } |
647 | - if($index_found_at){ |
|
647 | + if ($index_found_at) { |
|
648 | 648 | $index_in_cache = $index_found_at; |
649 | - }else{ |
|
649 | + } else { |
|
650 | 650 | //it wasn't found. huh. well obviously it doesn't need to be removed from teh cache |
651 | 651 | //if it wasn't in it to begin with. So we're done |
652 | 652 | return $object_to_remove_or_index_into_array; |
653 | 653 | } |
654 | 654 | } |
655 | - }elseif($object_to_remove_or_index_into_array instanceof EE_Base_Class){ |
|
655 | + }elseif ($object_to_remove_or_index_into_array instanceof EE_Base_Class) { |
|
656 | 656 | //so they provided a model object, but it's not yet saved to the DB... so let's go hunting for it! |
657 | - foreach($this->get_all_from_cache($relationName) as $index => $potentially_obj_we_want){ |
|
658 | - if($potentially_obj_we_want == $object_to_remove_or_index_into_array){ |
|
657 | + foreach ($this->get_all_from_cache($relationName) as $index => $potentially_obj_we_want) { |
|
658 | + if ($potentially_obj_we_want == $object_to_remove_or_index_into_array) { |
|
659 | 659 | $index_in_cache = $index; |
660 | 660 | } |
661 | 661 | } |
662 | - }else{ |
|
662 | + } else { |
|
663 | 663 | $index_in_cache = $object_to_remove_or_index_into_array; |
664 | 664 | } |
665 | 665 | //supposedly we've found it. But it could just be that the client code |
666 | 666 | //provided a bad index/object |
667 | - if(isset( $this->_model_relations[$relationName]) && |
|
668 | - isset( $this->_model_relations[$relationName][$index_in_cache])){ |
|
667 | + if (isset($this->_model_relations[$relationName]) && |
|
668 | + isset($this->_model_relations[$relationName][$index_in_cache])) { |
|
669 | 669 | $obj_removed = $this->_model_relations[$relationName][$index_in_cache]; |
670 | 670 | unset($this->_model_relations[$relationName][$index_in_cache]); |
671 | - }else{ |
|
671 | + } else { |
|
672 | 672 | //that thing was never cached anyways. |
673 | 673 | $obj_removed = NULL; |
674 | 674 | } |
@@ -687,24 +687,24 @@ discard block |
||
687 | 687 | * @param string $current_cache_id - the ID that was used when originally caching the object |
688 | 688 | * @return boolean TRUE on success, FALSE on fail |
689 | 689 | */ |
690 | - public function update_cache_after_object_save( $relationName, EE_Base_Class $newly_saved_object, $current_cache_id = '') { |
|
690 | + public function update_cache_after_object_save($relationName, EE_Base_Class $newly_saved_object, $current_cache_id = '') { |
|
691 | 691 | // verify that incoming object is of the correct type |
692 | - $obj_class = 'EE_' . $relationName; |
|
693 | - if ( $newly_saved_object instanceof $obj_class ) { |
|
692 | + $obj_class = 'EE_'.$relationName; |
|
693 | + if ($newly_saved_object instanceof $obj_class) { |
|
694 | 694 | /* @type EE_Base_Class $newly_saved_object*/ |
695 | 695 | // now get the type of relation |
696 | - $relationship_to_model = $this->get_model()->related_settings_for( $relationName ); |
|
696 | + $relationship_to_model = $this->get_model()->related_settings_for($relationName); |
|
697 | 697 | // if this is a 1:1 relationship |
698 | - if( $relationship_to_model instanceof EE_Belongs_To_Relation ) { |
|
698 | + if ($relationship_to_model instanceof EE_Belongs_To_Relation) { |
|
699 | 699 | // then just replace the cached object with the newly saved object |
700 | 700 | $this->_model_relations[$relationName] = $newly_saved_object; |
701 | 701 | return TRUE; |
702 | 702 | // or if it's some kind of sordid feral polyamorous relationship... |
703 | - } elseif ( is_array( $this->_model_relations[$relationName] ) && isset( $this->_model_relations[$relationName][ $current_cache_id ] )) { |
|
703 | + } elseif (is_array($this->_model_relations[$relationName]) && isset($this->_model_relations[$relationName][$current_cache_id])) { |
|
704 | 704 | // then remove the current cached item |
705 | - unset( $this->_model_relations[$relationName][ $current_cache_id ] ); |
|
705 | + unset($this->_model_relations[$relationName][$current_cache_id]); |
|
706 | 706 | // and cache the newly saved object using it's new ID |
707 | - $this->_model_relations[$relationName][ $newly_saved_object->ID() ] = $newly_saved_object; |
|
707 | + $this->_model_relations[$relationName][$newly_saved_object->ID()] = $newly_saved_object; |
|
708 | 708 | return TRUE; |
709 | 709 | } |
710 | 710 | } |
@@ -720,11 +720,11 @@ discard block |
||
720 | 720 | * @param string $relationName |
721 | 721 | * @return EE_Base_Class |
722 | 722 | */ |
723 | - public function get_one_from_cache($relationName){ |
|
724 | - $cached_array_or_object = isset( $this->_model_relations[$relationName] ) ? $this->_model_relations[$relationName] : null; |
|
725 | - if(is_array($cached_array_or_object)){ |
|
723 | + public function get_one_from_cache($relationName) { |
|
724 | + $cached_array_or_object = isset($this->_model_relations[$relationName]) ? $this->_model_relations[$relationName] : null; |
|
725 | + if (is_array($cached_array_or_object)) { |
|
726 | 726 | return array_shift($cached_array_or_object); |
727 | - }else{ |
|
727 | + } else { |
|
728 | 728 | return $cached_array_or_object; |
729 | 729 | } |
730 | 730 | } |
@@ -739,14 +739,14 @@ discard block |
||
739 | 739 | * @throws \EE_Error |
740 | 740 | * @return EE_Base_Class[] NOT necessarily indexed by primary keys |
741 | 741 | */ |
742 | - public function get_all_from_cache($relationName){ |
|
743 | - $cached_array_or_object = isset( $this->_model_relations[$relationName] ) ? $this->_model_relations[$relationName] : array(); |
|
744 | - if(is_array($cached_array_or_object)){ |
|
742 | + public function get_all_from_cache($relationName) { |
|
743 | + $cached_array_or_object = isset($this->_model_relations[$relationName]) ? $this->_model_relations[$relationName] : array(); |
|
744 | + if (is_array($cached_array_or_object)) { |
|
745 | 745 | $objects = $cached_array_or_object; |
746 | - }elseif($cached_array_or_object){ |
|
746 | + }elseif ($cached_array_or_object) { |
|
747 | 747 | //if the result is not an array, but exists, make it an array |
748 | 748 | $objects = array($cached_array_or_object); |
749 | - }else{ |
|
749 | + } else { |
|
750 | 750 | //if nothing was found, return an empty array |
751 | 751 | $objects = array(); |
752 | 752 | } |
@@ -754,15 +754,15 @@ discard block |
||
754 | 754 | //basically, if this model object was stored in the session, and these cached model objects |
755 | 755 | //already have IDs, let's make sure they're in their model's entity mapper |
756 | 756 | //otherwise we will have duplicates next time we call EE_Registry::instance()->load_model( $relationName )->get_one_by_ID( $result->ID() ); |
757 | - foreach( $objects as $model_object ){ |
|
758 | - $model = EE_Registry::instance()->load_model( $relationName ); |
|
759 | - if( $model instanceof EEM_Base && $model_object instanceof EE_Base_Class ){ |
|
757 | + foreach ($objects as $model_object) { |
|
758 | + $model = EE_Registry::instance()->load_model($relationName); |
|
759 | + if ($model instanceof EEM_Base && $model_object instanceof EE_Base_Class) { |
|
760 | 760 | //ensure its in the map if it has an ID; otherwise it will be added to the map when its saved |
761 | - if( $model_object->ID() ){ |
|
762 | - $model->add_to_entity_map( $model_object ); |
|
761 | + if ($model_object->ID()) { |
|
762 | + $model->add_to_entity_map($model_object); |
|
763 | 763 | } |
764 | - }else{ |
|
765 | - throw new EE_Error( sprintf( __( 'Error retrieving related model objects. Either $1%s is not a model or $2%s is not a model object', 'event_espresso' ), $relationName, gettype( $model_object ))); |
|
764 | + } else { |
|
765 | + throw new EE_Error(sprintf(__('Error retrieving related model objects. Either $1%s is not a model or $2%s is not a model object', 'event_espresso'), $relationName, gettype($model_object))); |
|
766 | 766 | } |
767 | 767 | } |
768 | 768 | return $objects; |
@@ -781,13 +781,13 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @return array|EE_Base_Class[] |
783 | 783 | */ |
784 | - public function next_x( $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null ) { |
|
785 | - $field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
786 | - $current_value = ! empty( $field ) ? $this->get( $field ) : null; |
|
787 | - if ( empty( $field ) || empty( $current_value ) ) { |
|
784 | + public function next_x($field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null) { |
|
785 | + $field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
786 | + $current_value = ! empty($field) ? $this->get($field) : null; |
|
787 | + if (empty($field) || empty($current_value)) { |
|
788 | 788 | return array(); |
789 | 789 | } |
790 | - return $this->get_model()->next_x( $current_value, $field, $limit, $query_params, $columns_to_select ); |
|
790 | + return $this->get_model()->next_x($current_value, $field, $limit, $query_params, $columns_to_select); |
|
791 | 791 | } |
792 | 792 | |
793 | 793 | |
@@ -806,13 +806,13 @@ discard block |
||
806 | 806 | * |
807 | 807 | * @return array|EE_Base_Class[] |
808 | 808 | */ |
809 | - public function previous_x( $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null ) { |
|
810 | - $field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
811 | - $current_value = ! empty( $field ) ? $this->get( $field ) : null; |
|
812 | - if ( empty( $field ) || empty( $current_value ) ) { |
|
809 | + public function previous_x($field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null) { |
|
810 | + $field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
811 | + $current_value = ! empty($field) ? $this->get($field) : null; |
|
812 | + if (empty($field) || empty($current_value)) { |
|
813 | 813 | return array(); |
814 | 814 | } |
815 | - return $this->get_model()->previous_x( $current_value, $field, $limit, $query_params, $columns_to_select ); |
|
815 | + return $this->get_model()->previous_x($current_value, $field, $limit, $query_params, $columns_to_select); |
|
816 | 816 | } |
817 | 817 | |
818 | 818 | |
@@ -830,13 +830,13 @@ discard block |
||
830 | 830 | * |
831 | 831 | * @return array|EE_Base_Class |
832 | 832 | */ |
833 | - public function next( $field_to_order_by = null, $query_params = array(), $columns_to_select = null ) { |
|
834 | - $field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
835 | - $current_value = ! empty( $field ) ? $this->get( $field ) : null; |
|
836 | - if ( empty( $field ) || empty( $current_value ) ) { |
|
833 | + public function next($field_to_order_by = null, $query_params = array(), $columns_to_select = null) { |
|
834 | + $field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
835 | + $current_value = ! empty($field) ? $this->get($field) : null; |
|
836 | + if (empty($field) || empty($current_value)) { |
|
837 | 837 | return array(); |
838 | 838 | } |
839 | - return $this->get_model()->next( $current_value, $field, $query_params, $columns_to_select ); |
|
839 | + return $this->get_model()->next($current_value, $field, $query_params, $columns_to_select); |
|
840 | 840 | } |
841 | 841 | |
842 | 842 | |
@@ -855,13 +855,13 @@ discard block |
||
855 | 855 | * |
856 | 856 | * @return array|EE_Base_Class |
857 | 857 | */ |
858 | - public function previous( $field_to_order_by = null, $query_params = array(), $columns_to_select = null ) { |
|
859 | - $field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
860 | - $current_value = ! empty( $field ) ? $this->get( $field ) : null; |
|
861 | - if ( empty( $field ) || empty( $current_value ) ) { |
|
858 | + public function previous($field_to_order_by = null, $query_params = array(), $columns_to_select = null) { |
|
859 | + $field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field() ? $this->get_model()->get_primary_key_field()->get_name() : $field_to_order_by; |
|
860 | + $current_value = ! empty($field) ? $this->get($field) : null; |
|
861 | + if (empty($field) || empty($current_value)) { |
|
862 | 862 | return array(); |
863 | 863 | } |
864 | - return $this->get_model()->previous( $current_value, $field, $query_params, $columns_to_select ); |
|
864 | + return $this->get_model()->previous($current_value, $field, $query_params, $columns_to_select); |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | |
@@ -875,25 +875,25 @@ discard block |
||
875 | 875 | * @param string $field_name |
876 | 876 | * @param mixed $field_value_from_db |
877 | 877 | */ |
878 | - public function set_from_db($field_name,$field_value_from_db){ |
|
878 | + public function set_from_db($field_name, $field_value_from_db) { |
|
879 | 879 | $field_obj = $this->get_model()->field_settings_for($field_name); |
880 | - if ( $field_obj instanceof EE_Model_Field_Base ) { |
|
880 | + if ($field_obj instanceof EE_Model_Field_Base) { |
|
881 | 881 | //you would think the DB has no NULLs for non-null label fields right? wrong! |
882 | 882 | //eg, a CPT model object could have an entry in the posts table, but no |
883 | 883 | //entry in the meta table. Meaning that all its columns in the meta table |
884 | 884 | //are null! yikes! so when we find one like that, use defaults for its meta columns |
885 | - if($field_value_from_db === NULL ){ |
|
886 | - if( $field_obj->is_nullable()){ |
|
885 | + if ($field_value_from_db === NULL) { |
|
886 | + if ($field_obj->is_nullable()) { |
|
887 | 887 | //if the field allows nulls, then let it be null |
888 | 888 | $field_value = NULL; |
889 | - }else{ |
|
889 | + } else { |
|
890 | 890 | $field_value = $field_obj->get_default_value(); |
891 | 891 | } |
892 | - }else{ |
|
893 | - $field_value = $field_obj->prepare_for_set_from_db( $field_value_from_db ); |
|
892 | + } else { |
|
893 | + $field_value = $field_obj->prepare_for_set_from_db($field_value_from_db); |
|
894 | 894 | } |
895 | 895 | $this->_fields[$field_name] = $field_value; |
896 | - $this->_clear_cached_property( $field_name ); |
|
896 | + $this->_clear_cached_property($field_name); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
@@ -905,8 +905,8 @@ discard block |
||
905 | 905 | * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property (in cases where the same property may be used for different outputs - i.e. datetime, money etc.) |
906 | 906 | * @return boolean |
907 | 907 | */ |
908 | - public function get($field_name, $extra_cache_ref = NULL ){ |
|
909 | - return $this->_get_cached_property( $field_name, FALSE, $extra_cache_ref ); |
|
908 | + public function get($field_name, $extra_cache_ref = NULL) { |
|
909 | + return $this->_get_cached_property($field_name, FALSE, $extra_cache_ref); |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | |
@@ -936,11 +936,11 @@ discard block |
||
936 | 936 | * just null is returned (because that indicates that likely |
937 | 937 | * this field is nullable). |
938 | 938 | */ |
939 | - public function get_DateTime_object( $field_name ) { |
|
940 | - $field_settings = $this->get_model()->field_settings_for( $field_name ); |
|
939 | + public function get_DateTime_object($field_name) { |
|
940 | + $field_settings = $this->get_model()->field_settings_for($field_name); |
|
941 | 941 | |
942 | - if ( ! $field_settings instanceof EE_Datetime_Field ) { |
|
943 | - EE_Error::add_error( sprintf( __('The field %s is not an EE_Datetime_Field field. There is no DateTime object stored on this field type.', 'event_espresso' ), $field_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
942 | + if ( ! $field_settings instanceof EE_Datetime_Field) { |
|
943 | + EE_Error::add_error(sprintf(__('The field %s is not an EE_Datetime_Field field. There is no DateTime object stored on this field type.', 'event_espresso'), $field_name), __FILE__, __FUNCTION__, __LINE__); |
|
944 | 944 | return false; |
945 | 945 | } |
946 | 946 | |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property (in cases where the same property may be used for different outputs - i.e. datetime, money etc.) |
957 | 957 | * @return void |
958 | 958 | */ |
959 | - public function e($field_name, $extra_cache_ref = NULL){ |
|
959 | + public function e($field_name, $extra_cache_ref = NULL) { |
|
960 | 960 | echo $this->get_pretty($field_name, $extra_cache_ref); |
961 | 961 | } |
962 | 962 | /** |
@@ -965,8 +965,8 @@ discard block |
||
965 | 965 | * @param string $field_name |
966 | 966 | * @return void |
967 | 967 | */ |
968 | - public function f($field_name){ |
|
969 | - $this->e($field_name,'form_input'); |
|
968 | + public function f($field_name) { |
|
969 | + $this->e($field_name, 'form_input'); |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | /** |
@@ -975,8 +975,8 @@ discard block |
||
975 | 975 | * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property (in cases where the same property may be used for different outputs - i.e. datetime, money etc.) |
976 | 976 | * @return mixed |
977 | 977 | */ |
978 | - public function get_pretty($field_name, $extra_cache_ref = NULL){ |
|
979 | - return $this->_get_cached_property( $field_name, TRUE, $extra_cache_ref ); |
|
978 | + public function get_pretty($field_name, $extra_cache_ref = NULL) { |
|
979 | + return $this->_get_cached_property($field_name, TRUE, $extra_cache_ref); |
|
980 | 980 | } |
981 | 981 | |
982 | 982 | |
@@ -993,37 +993,37 @@ discard block |
||
993 | 993 | * @param boolean $echo Whether the dtt is echoing using pretty echoing or just returned using vanilla get |
994 | 994 | * @return void | string | bool | EE_Error string on success, FALSE on fail, or EE_Error Exception is thrown if field is not a valid dtt field, or void if echoing |
995 | 995 | */ |
996 | - protected function _get_datetime( $field_name, $dt_frmt = NULL, $tm_frmt = NULL, $date_or_time = NULL, $echo = FALSE ) { |
|
996 | + protected function _get_datetime($field_name, $dt_frmt = NULL, $tm_frmt = NULL, $date_or_time = NULL, $echo = FALSE) { |
|
997 | 997 | |
998 | - $in_dt_frmt = empty($dt_frmt) ? $this->_dt_frmt : $dt_frmt; |
|
998 | + $in_dt_frmt = empty($dt_frmt) ? $this->_dt_frmt : $dt_frmt; |
|
999 | 999 | $in_tm_frmt = empty($tm_frmt) ? $this->_tm_frmt : $tm_frmt; |
1000 | 1000 | |
1001 | 1001 | //validate field for datetime and returns field settings if valid. |
1002 | - $field = $this->_get_dtt_field_settings( $field_name ); |
|
1002 | + $field = $this->_get_dtt_field_settings($field_name); |
|
1003 | 1003 | |
1004 | 1004 | //clear cached property if either formats are not null. |
1005 | - if( $dt_frmt !== null || $tm_frmt !== null ) { |
|
1006 | - $this->_clear_cached_property( $field_name ); |
|
1005 | + if ($dt_frmt !== null || $tm_frmt !== null) { |
|
1006 | + $this->_clear_cached_property($field_name); |
|
1007 | 1007 | //reset format properties because they are used in get() |
1008 | 1008 | $this->_dt_frmt = $in_dt_frmt; |
1009 | 1009 | $this->_tm_frmt = $in_tm_frmt; |
1010 | 1010 | } |
1011 | 1011 | |
1012 | - if ( $echo ) |
|
1013 | - $field->set_pretty_date_format( $in_dt_frmt ); |
|
1012 | + if ($echo) |
|
1013 | + $field->set_pretty_date_format($in_dt_frmt); |
|
1014 | 1014 | else |
1015 | - $field->set_date_format( $in_dt_frmt ); |
|
1015 | + $field->set_date_format($in_dt_frmt); |
|
1016 | 1016 | |
1017 | - if ( $echo ) |
|
1018 | - $field->set_pretty_time_format( $in_tm_frmt ); |
|
1017 | + if ($echo) |
|
1018 | + $field->set_pretty_time_format($in_tm_frmt); |
|
1019 | 1019 | else |
1020 | - $field->set_time_format( $in_tm_frmt ); |
|
1020 | + $field->set_time_format($in_tm_frmt); |
|
1021 | 1021 | |
1022 | 1022 | //set timezone in field object |
1023 | - $field->set_timezone( $this->_timezone ); |
|
1023 | + $field->set_timezone($this->_timezone); |
|
1024 | 1024 | |
1025 | 1025 | //set the output returned |
1026 | - switch ( $date_or_time ) { |
|
1026 | + switch ($date_or_time) { |
|
1027 | 1027 | |
1028 | 1028 | case 'D' : |
1029 | 1029 | $field->set_date_time_output('date'); |
@@ -1038,11 +1038,11 @@ discard block |
||
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | |
1041 | - if ( $echo ) { |
|
1042 | - $this->e( $field_name, $date_or_time ); |
|
1041 | + if ($echo) { |
|
1042 | + $this->e($field_name, $date_or_time); |
|
1043 | 1043 | return ''; |
1044 | 1044 | } |
1045 | - return $this->get( $field_name, $date_or_time ); |
|
1045 | + return $this->get($field_name, $date_or_time); |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | |
@@ -1052,8 +1052,8 @@ discard block |
||
1052 | 1052 | * @param string $format format for the date returned (if NULL we use default in dt_frmt property) |
1053 | 1053 | * @return string datetime value formatted |
1054 | 1054 | */ |
1055 | - public function get_date( $field_name, $format = NULL ) { |
|
1056 | - return $this->_get_datetime( $field_name, $format, NULL, 'D' ); |
|
1055 | + public function get_date($field_name, $format = NULL) { |
|
1056 | + return $this->_get_datetime($field_name, $format, NULL, 'D'); |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | |
@@ -1062,8 +1062,8 @@ discard block |
||
1062 | 1062 | * @param $field_name |
1063 | 1063 | * @param null $format |
1064 | 1064 | */ |
1065 | - public function e_date( $field_name, $format = NULL ) { |
|
1066 | - $this->_get_datetime( $field_name, $format, NULL, 'D', TRUE ); |
|
1065 | + public function e_date($field_name, $format = NULL) { |
|
1066 | + $this->_get_datetime($field_name, $format, NULL, 'D', TRUE); |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | |
@@ -1073,8 +1073,8 @@ discard block |
||
1073 | 1073 | * @param string $format format for the time returned ( if NULL we use default in tm_frmt property) |
1074 | 1074 | * @return string datetime value formatted |
1075 | 1075 | */ |
1076 | - public function get_time( $field_name, $format = NULL ) { |
|
1077 | - return $this->_get_datetime( $field_name, NULL, $format, 'T' ); |
|
1076 | + public function get_time($field_name, $format = NULL) { |
|
1077 | + return $this->_get_datetime($field_name, NULL, $format, 'T'); |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | |
@@ -1083,8 +1083,8 @@ discard block |
||
1083 | 1083 | * @param $field_name |
1084 | 1084 | * @param null $format |
1085 | 1085 | */ |
1086 | - public function e_time( $field_name, $format = NULL ) { |
|
1087 | - $this->_get_datetime( $field_name, NULL, $format, 'T', TRUE ); |
|
1086 | + public function e_time($field_name, $format = NULL) { |
|
1087 | + $this->_get_datetime($field_name, NULL, $format, 'T', TRUE); |
|
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | |
@@ -1097,8 +1097,8 @@ discard block |
||
1097 | 1097 | * @param string $tm_frmt format for the time returned (if NULL we use default in tm_frmt property) |
1098 | 1098 | * @return string datetime value formatted |
1099 | 1099 | */ |
1100 | - public function get_datetime( $field_name, $dt_frmt = NULL, $tm_frmt = NULL ) { |
|
1101 | - return $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt ); |
|
1100 | + public function get_datetime($field_name, $dt_frmt = NULL, $tm_frmt = NULL) { |
|
1101 | + return $this->_get_datetime($field_name, $dt_frmt, $tm_frmt); |
|
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | |
@@ -1108,8 +1108,8 @@ discard block |
||
1108 | 1108 | * @param null $dt_frmt |
1109 | 1109 | * @param null $tm_frmt |
1110 | 1110 | */ |
1111 | - public function e_datetime( $field_name, $dt_frmt = NULL, $tm_frmt = NULL ) { |
|
1112 | - $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, NULL, TRUE); |
|
1111 | + public function e_datetime($field_name, $dt_frmt = NULL, $tm_frmt = NULL) { |
|
1112 | + $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, NULL, TRUE); |
|
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | |
@@ -1124,10 +1124,10 @@ discard block |
||
1124 | 1124 | * @return string Date and time string in set locale or false if no field exists for the given |
1125 | 1125 | * field name. |
1126 | 1126 | */ |
1127 | - public function get_i18n_datetime( $field_name, $format = NULL ) { |
|
1128 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
1129 | - $format = empty( $format ) ? $this->_dt_frmt . ' ' . $this->_tm_frmt : $format; |
|
1130 | - return date_i18n( $format, EEH_DTT_Helper::get_timestamp_with_offset( $this->get_raw( $field_name ), $this->_timezone ) ); |
|
1127 | + public function get_i18n_datetime($field_name, $format = NULL) { |
|
1128 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
1129 | + $format = empty($format) ? $this->_dt_frmt.' '.$this->_tm_frmt : $format; |
|
1130 | + return date_i18n($format, EEH_DTT_Helper::get_timestamp_with_offset($this->get_raw($field_name), $this->_timezone)); |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | |
@@ -1139,14 +1139,14 @@ discard block |
||
1139 | 1139 | * @throws EE_Error |
1140 | 1140 | * @return EE_Datetime_Field |
1141 | 1141 | */ |
1142 | - protected function _get_dtt_field_settings( $field_name ) { |
|
1142 | + protected function _get_dtt_field_settings($field_name) { |
|
1143 | 1143 | $field = $this->get_model()->field_settings_for($field_name); |
1144 | 1144 | |
1145 | 1145 | //check if field is dtt |
1146 | - if ( $field instanceof EE_Datetime_Field ) { |
|
1146 | + if ($field instanceof EE_Datetime_Field) { |
|
1147 | 1147 | return $field; |
1148 | 1148 | } else { |
1149 | - throw new EE_Error( sprintf( __('The field name "%s" has been requested for the EE_Base_Class datetime functions and it is not a valid EE_Datetime_Field. Please check the spelling of the field and make sure it has been setup as a EE_Datetime_Field in the %s model constructor', 'event_espresso'), $field_name, self::_get_model_classname( get_class($this) ) ) ); |
|
1149 | + throw new EE_Error(sprintf(__('The field name "%s" has been requested for the EE_Base_Class datetime functions and it is not a valid EE_Datetime_Field. Please check the spelling of the field and make sure it has been setup as a EE_Datetime_Field in the %s model constructor', 'event_espresso'), $field_name, self::_get_model_classname(get_class($this)))); |
|
1150 | 1150 | } |
1151 | 1151 | } |
1152 | 1152 | |
@@ -1167,8 +1167,8 @@ discard block |
||
1167 | 1167 | * @param string|Datetime $time a valid time string for php datetime functions (or DateTime object) |
1168 | 1168 | * @param string $fieldname the name of the field the time is being set on (must match a EE_Datetime_Field) |
1169 | 1169 | */ |
1170 | - protected function _set_time_for( $time, $fieldname ) { |
|
1171 | - $this->_set_date_time( 'T', $time, $fieldname ); |
|
1170 | + protected function _set_time_for($time, $fieldname) { |
|
1171 | + $this->_set_date_time('T', $time, $fieldname); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | |
@@ -1182,8 +1182,8 @@ discard block |
||
1182 | 1182 | * @param string|DateTime $date a valid date string for php datetime functions ( or DateTime object) |
1183 | 1183 | * @param string $fieldname the name of the field the date is being set on (must match a EE_Datetime_Field) |
1184 | 1184 | */ |
1185 | - protected function _set_date_for( $date, $fieldname ) { |
|
1186 | - $this->_set_date_time( 'D', $date, $fieldname ); |
|
1185 | + protected function _set_date_for($date, $fieldname) { |
|
1186 | + $this->_set_date_time('D', $date, $fieldname); |
|
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | |
@@ -1199,21 +1199,21 @@ discard block |
||
1199 | 1199 | * @param string|DateTime $datetime_value A valid Date or Time string (or DateTime object) |
1200 | 1200 | * @param string $fieldname the name of the field the date OR time is being set on (must match a EE_Datetime_Field property) |
1201 | 1201 | */ |
1202 | - protected function _set_date_time( $what = 'T', $datetime_value, $fieldname ) { |
|
1203 | - $field = $this->_get_dtt_field_settings( $fieldname ); |
|
1204 | - $field->set_timezone( $this->_timezone ); |
|
1205 | - $field->set_date_format( $this->_dt_frmt ); |
|
1206 | - $field->set_time_format( $this->_tm_frmt ); |
|
1202 | + protected function _set_date_time($what = 'T', $datetime_value, $fieldname) { |
|
1203 | + $field = $this->_get_dtt_field_settings($fieldname); |
|
1204 | + $field->set_timezone($this->_timezone); |
|
1205 | + $field->set_date_format($this->_dt_frmt); |
|
1206 | + $field->set_time_format($this->_tm_frmt); |
|
1207 | 1207 | |
1208 | - switch ( $what ) { |
|
1208 | + switch ($what) { |
|
1209 | 1209 | case 'T' : |
1210 | - $this->_fields[$fieldname] = $field->prepare_for_set_with_new_time( $datetime_value, $this->_fields[$fieldname] ); |
|
1210 | + $this->_fields[$fieldname] = $field->prepare_for_set_with_new_time($datetime_value, $this->_fields[$fieldname]); |
|
1211 | 1211 | break; |
1212 | 1212 | case 'D' : |
1213 | - $this->_fields[$fieldname] = $field->prepare_for_set_with_new_date( $datetime_value, $this->_fields[$fieldname] ); |
|
1213 | + $this->_fields[$fieldname] = $field->prepare_for_set_with_new_date($datetime_value, $this->_fields[$fieldname]); |
|
1214 | 1214 | break; |
1215 | 1215 | case 'B' : |
1216 | - $this->_fields[$fieldname] = $field->prepare_for_set( $datetime_value ); |
|
1216 | + $this->_fields[$fieldname] = $field->prepare_for_set($datetime_value); |
|
1217 | 1217 | break; |
1218 | 1218 | } |
1219 | 1219 | |
@@ -1236,25 +1236,25 @@ discard block |
||
1236 | 1236 | * @throws EE_Error |
1237 | 1237 | * @return string timestamp |
1238 | 1238 | */ |
1239 | - public function display_in_my_timezone( $field_name, $callback = 'get_datetime', $args = NULL, $prepend = '', $append = '' ) { |
|
1239 | + public function display_in_my_timezone($field_name, $callback = 'get_datetime', $args = NULL, $prepend = '', $append = '') { |
|
1240 | 1240 | EE_Registry::instance()->load_helper('DTT_Helper'); |
1241 | 1241 | $timezone = EEH_DTT_Helper::get_timezone(); |
1242 | 1242 | |
1243 | - if ( $timezone == $this->_timezone ) |
|
1243 | + if ($timezone == $this->_timezone) |
|
1244 | 1244 | return ''; |
1245 | 1245 | |
1246 | 1246 | $original_timezone = $this->_timezone; |
1247 | - $this->set_timezone( $timezone ); |
|
1247 | + $this->set_timezone($timezone); |
|
1248 | 1248 | |
1249 | 1249 | $fn = (array) $field_name; |
1250 | - $args = array_merge( $fn, (array) $args ); |
|
1250 | + $args = array_merge($fn, (array) $args); |
|
1251 | 1251 | |
1252 | - if ( !method_exists( $this, $callback ) ) |
|
1253 | - throw new EE_Error(sprintf( __('The method named "%s" given as the callback param in "display_in_my_timezone" does not exist. Please check your spelling', 'event_espresso'), $callback ) ); |
|
1252 | + if ( ! method_exists($this, $callback)) |
|
1253 | + throw new EE_Error(sprintf(__('The method named "%s" given as the callback param in "display_in_my_timezone" does not exist. Please check your spelling', 'event_espresso'), $callback)); |
|
1254 | 1254 | $args = (array) $args; |
1255 | - $return = $prepend . call_user_func_array( array( $this, $callback ), $args ) . $append; |
|
1255 | + $return = $prepend.call_user_func_array(array($this, $callback), $args).$append; |
|
1256 | 1256 | |
1257 | - $this->set_timezone( $original_timezone ); |
|
1257 | + $this->set_timezone($original_timezone); |
|
1258 | 1258 | return $return; |
1259 | 1259 | } |
1260 | 1260 | |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | * |
1269 | 1269 | * @return boolean | int |
1270 | 1270 | */ |
1271 | - public function delete(){ |
|
1271 | + public function delete() { |
|
1272 | 1272 | /** |
1273 | 1273 | * Called just before the `EE_Base_Class::_delete` method call. |
1274 | 1274 | * Note: `EE_Base_Class::_delete` might be overridden by child classes so any client code hooking into these actions |
@@ -1277,7 +1277,7 @@ discard block |
||
1277 | 1277 | * |
1278 | 1278 | * @param EE_Base_Class $model_object about to be 'deleted' |
1279 | 1279 | */ |
1280 | - do_action( 'AHEE__EE_Base_Class__delete__before', $this ); |
|
1280 | + do_action('AHEE__EE_Base_Class__delete__before', $this); |
|
1281 | 1281 | $result = $this->_delete(); |
1282 | 1282 | /** |
1283 | 1283 | * Called just after the `EE_Base_Class::_delete` method call. |
@@ -1287,7 +1287,7 @@ discard block |
||
1287 | 1287 | * @param EE_Base_Class $model_object that was just 'deleted' |
1288 | 1288 | * @param boolean $result |
1289 | 1289 | */ |
1290 | - do_action( 'AHEE__EE_Base_Class__delete__end', $this, $result ); |
|
1290 | + do_action('AHEE__EE_Base_Class__delete__end', $this, $result); |
|
1291 | 1291 | return $result; |
1292 | 1292 | } |
1293 | 1293 | |
@@ -1310,22 +1310,22 @@ discard block |
||
1310 | 1310 | * Deletes this model object permanently from db (but keep in mind related models my block the delete and return an error) |
1311 | 1311 | * @return bool | int |
1312 | 1312 | */ |
1313 | - public function delete_permanently(){ |
|
1313 | + public function delete_permanently() { |
|
1314 | 1314 | /** |
1315 | 1315 | * Called just before HARD deleting a model object |
1316 | 1316 | * |
1317 | 1317 | * @param EE_Base_Class $model_object about to be 'deleted' |
1318 | 1318 | */ |
1319 | - do_action( 'AHEE__EE_Base_Class__delete_permanently__before', $this ); |
|
1320 | - $model=$this->get_model(); |
|
1321 | - $result=$model->delete_permanently_by_ID($this->ID()); |
|
1319 | + do_action('AHEE__EE_Base_Class__delete_permanently__before', $this); |
|
1320 | + $model = $this->get_model(); |
|
1321 | + $result = $model->delete_permanently_by_ID($this->ID()); |
|
1322 | 1322 | $this->refresh_cache_of_related_objects(); |
1323 | 1323 | /** |
1324 | 1324 | * Called just after HARD deleting a model object |
1325 | 1325 | * @param EE_Base_Class $model_object that was just 'deleted' |
1326 | 1326 | * @param boolean $result |
1327 | 1327 | */ |
1328 | - do_action( 'AHEE__EE_Base_Class__delete_permanently__end', $this, $result ); |
|
1328 | + do_action('AHEE__EE_Base_Class__delete_permanently__end', $this, $result); |
|
1329 | 1329 | return $result; |
1330 | 1330 | } |
1331 | 1331 | |
@@ -1334,18 +1334,18 @@ discard block |
||
1334 | 1334 | * related model objects |
1335 | 1335 | */ |
1336 | 1336 | public function refresh_cache_of_related_objects() { |
1337 | - foreach( $this->get_model()->relation_settings() as $relation_name => $relation_obj ) { |
|
1338 | - if( ! empty( $this->_model_relations[ $relation_name ] ) ) { |
|
1339 | - $related_objects = $this->_model_relations[ $relation_name ]; |
|
1340 | - if( $relation_obj instanceof EE_Belongs_To_Relation ) { |
|
1337 | + foreach ($this->get_model()->relation_settings() as $relation_name => $relation_obj) { |
|
1338 | + if ( ! empty($this->_model_relations[$relation_name])) { |
|
1339 | + $related_objects = $this->_model_relations[$relation_name]; |
|
1340 | + if ($relation_obj instanceof EE_Belongs_To_Relation) { |
|
1341 | 1341 | //this relation only stores a single model object, not an array |
1342 | 1342 | //but let's make it consistent |
1343 | - $related_objects = array( $related_objects ); |
|
1343 | + $related_objects = array($related_objects); |
|
1344 | 1344 | } |
1345 | - foreach( $related_objects as $related_object ) { |
|
1345 | + foreach ($related_objects as $related_object) { |
|
1346 | 1346 | //only refresh their cache if they're in memory |
1347 | - if( $related_object instanceof EE_Base_Class ) { |
|
1348 | - $related_object->clear_cache( $this->get_model()->get_this_model_name(), $this ); |
|
1347 | + if ($related_object instanceof EE_Base_Class) { |
|
1348 | + $related_object->clear_cache($this->get_model()->get_this_model_name(), $this); |
|
1349 | 1349 | } |
1350 | 1350 | } |
1351 | 1351 | } |
@@ -1365,17 +1365,17 @@ discard block |
||
1365 | 1365 | * @return int , 1 on a successful update, the ID of the new entry on insert; 0 on failure or if the model object |
1366 | 1366 | * isn't allowed to persist (as determined by EE_Base_Class::allow_persist()) |
1367 | 1367 | */ |
1368 | - public function save($set_cols_n_values=array()) { |
|
1368 | + public function save($set_cols_n_values = array()) { |
|
1369 | 1369 | /** |
1370 | 1370 | * Filters the fields we're about to save on the model object |
1371 | 1371 | * |
1372 | 1372 | * @param array $set_cols_n_values |
1373 | 1373 | * @param EE_Base_Class $model_object |
1374 | 1374 | */ |
1375 | - $set_cols_n_values = apply_filters( 'FHEE__EE_Base_Class__save__set_cols_n_values', $set_cols_n_values, $this ); |
|
1375 | + $set_cols_n_values = apply_filters('FHEE__EE_Base_Class__save__set_cols_n_values', $set_cols_n_values, $this); |
|
1376 | 1376 | //set attributes as provided in $set_cols_n_values |
1377 | - foreach($set_cols_n_values as $column=>$value){ |
|
1378 | - $this->set($column,$value); |
|
1377 | + foreach ($set_cols_n_values as $column=>$value) { |
|
1378 | + $this->set($column, $value); |
|
1379 | 1379 | } |
1380 | 1380 | /** |
1381 | 1381 | * Saving a model object. |
@@ -1383,8 +1383,8 @@ discard block |
||
1383 | 1383 | * Before we perform a save, this action is fired. |
1384 | 1384 | * @param EE_Base_Class $model_object the model object about to be saved. |
1385 | 1385 | */ |
1386 | - do_action( 'AHEE__EE_Base_Class__save__begin', $this ); |
|
1387 | - if( ! $this->allow_persist() ) { |
|
1386 | + do_action('AHEE__EE_Base_Class__save__begin', $this); |
|
1387 | + if ( ! $this->allow_persist()) { |
|
1388 | 1388 | return 0; |
1389 | 1389 | } |
1390 | 1390 | //now get current attribute values |
@@ -1394,61 +1394,61 @@ discard block |
||
1394 | 1394 | $old_assumption_concerning_value_preparation = $this->get_model()->get_assumption_concerning_values_already_prepared_by_model_object(); |
1395 | 1395 | $this->get_model()->assume_values_already_prepared_by_model_object(true); |
1396 | 1396 | //does this model have an autoincrement PK? |
1397 | - if($this->get_model()->has_primary_key_field()){ |
|
1398 | - if($this->get_model()->get_primary_key_field()->is_auto_increment()){ |
|
1397 | + if ($this->get_model()->has_primary_key_field()) { |
|
1398 | + if ($this->get_model()->get_primary_key_field()->is_auto_increment()) { |
|
1399 | 1399 | //ok check if it's set, if so: update; if not, insert |
1400 | - if ( ! empty( $save_cols_n_values[self::_get_primary_key_name( get_class($this) )] ) ){ |
|
1401 | - $results = $this->get_model()->update_by_ID ( $save_cols_n_values, $this->ID() ); |
|
1400 | + if ( ! empty($save_cols_n_values[self::_get_primary_key_name(get_class($this))])) { |
|
1401 | + $results = $this->get_model()->update_by_ID($save_cols_n_values, $this->ID()); |
|
1402 | 1402 | } else { |
1403 | - unset($save_cols_n_values[self::_get_primary_key_name( get_class( $this) )]); |
|
1404 | - $results = $this->get_model()->insert( $save_cols_n_values, true); |
|
1405 | - if($results){ |
|
1403 | + unset($save_cols_n_values[self::_get_primary_key_name(get_class($this))]); |
|
1404 | + $results = $this->get_model()->insert($save_cols_n_values, true); |
|
1405 | + if ($results) { |
|
1406 | 1406 | //if successful, set the primary key |
1407 | 1407 | //but don't use the normal SET method, because it will check if |
1408 | 1408 | //an item with the same ID exists in the mapper & db, then |
1409 | 1409 | //will find it in the db (because we just added it) and THAT object |
1410 | 1410 | //will get added to the mapper before we can add this one! |
1411 | 1411 | //but if we just avoid using the SET method, all that headache can be avoided |
1412 | - $pk_field_name =self::_get_primary_key_name( get_class($this)); |
|
1412 | + $pk_field_name = self::_get_primary_key_name(get_class($this)); |
|
1413 | 1413 | $this->_fields[$pk_field_name] = $results; |
1414 | 1414 | $this->_clear_cached_property($pk_field_name); |
1415 | - $this->get_model()->add_to_entity_map( $this ); |
|
1415 | + $this->get_model()->add_to_entity_map($this); |
|
1416 | 1416 | $this->_update_cached_related_model_objs_fks(); |
1417 | 1417 | } |
1418 | 1418 | } |
1419 | - }else{//PK is NOT auto-increment |
|
1419 | + } else {//PK is NOT auto-increment |
|
1420 | 1420 | //so check if one like it already exists in the db |
1421 | - if( $this->get_model()->exists_by_ID( $this->ID() ) ){ |
|
1422 | - if( ! $this->in_entity_map() && WP_DEBUG ){ |
|
1421 | + if ($this->get_model()->exists_by_ID($this->ID())) { |
|
1422 | + if ( ! $this->in_entity_map() && WP_DEBUG) { |
|
1423 | 1423 | throw new EE_Error( |
1424 | 1424 | sprintf( |
1425 | - __( 'Using a model object %1$s that is NOT in the entity map, can lead to unexpected errors. You should either: %4$s 1. Put it in the entity mapper by calling %2$s %4$s 2. Discard this model object and use what is in the entity mapper %4$s 3. Fetch from the database using %3$s', 'event_espresso' ), |
|
1425 | + __('Using a model object %1$s that is NOT in the entity map, can lead to unexpected errors. You should either: %4$s 1. Put it in the entity mapper by calling %2$s %4$s 2. Discard this model object and use what is in the entity mapper %4$s 3. Fetch from the database using %3$s', 'event_espresso'), |
|
1426 | 1426 | get_class($this), |
1427 | - get_class( $this->get_model() ) . '::instance()->add_to_entity_map()', |
|
1428 | - get_class( $this->get_model() ) . '::instance()->get_one_by_ID()', |
|
1427 | + get_class($this->get_model()).'::instance()->add_to_entity_map()', |
|
1428 | + get_class($this->get_model()).'::instance()->get_one_by_ID()', |
|
1429 | 1429 | '<br />' |
1430 | 1430 | ) |
1431 | 1431 | ); |
1432 | 1432 | } |
1433 | 1433 | $results = $this->get_model()->update_by_ID($save_cols_n_values, $this->ID()); |
1434 | - }else{ |
|
1434 | + } else { |
|
1435 | 1435 | $results = $this->get_model()->insert($save_cols_n_values); |
1436 | 1436 | $this->_update_cached_related_model_objs_fks(); |
1437 | 1437 | } |
1438 | 1438 | } |
1439 | - }else{//there is NO primary key |
|
1439 | + } else {//there is NO primary key |
|
1440 | 1440 | $already_in_db = false; |
1441 | - foreach($this->get_model()->unique_indexes() as $index){ |
|
1441 | + foreach ($this->get_model()->unique_indexes() as $index) { |
|
1442 | 1442 | $uniqueness_where_params = array_intersect_key($save_cols_n_values, $index->fields()); |
1443 | - if($this->get_model()->exists(array($uniqueness_where_params))){ |
|
1443 | + if ($this->get_model()->exists(array($uniqueness_where_params))) { |
|
1444 | 1444 | $already_in_db = true; |
1445 | 1445 | } |
1446 | 1446 | } |
1447 | - if( $already_in_db ){ |
|
1448 | - $combined_pk_fields_n_values = array_intersect_key( $save_cols_n_values, $this->get_model()->get_combined_primary_key_fields() ); |
|
1449 | - $results = $this->get_model()->update( $save_cols_n_values,$combined_pk_fields_n_values ); |
|
1450 | - }else{ |
|
1451 | - $results = $this->get_model()->insert( $save_cols_n_values ); |
|
1447 | + if ($already_in_db) { |
|
1448 | + $combined_pk_fields_n_values = array_intersect_key($save_cols_n_values, $this->get_model()->get_combined_primary_key_fields()); |
|
1449 | + $results = $this->get_model()->update($save_cols_n_values, $combined_pk_fields_n_values); |
|
1450 | + } else { |
|
1451 | + $results = $this->get_model()->insert($save_cols_n_values); |
|
1452 | 1452 | } |
1453 | 1453 | } |
1454 | 1454 | //restore the old assumption about values being prepared by the model object |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | * @param boolean|int $results if it were updated, TRUE or FALSE; if it were newly inserted |
1462 | 1462 | * the new ID (or 0 if an error occurred and it wasn't updated) |
1463 | 1463 | */ |
1464 | - do_action( 'AHEE__EE_Base_Class__save__end', $this, $results ); |
|
1464 | + do_action('AHEE__EE_Base_Class__save__end', $this, $results); |
|
1465 | 1465 | return $results; |
1466 | 1466 | } |
1467 | 1467 | |
@@ -1473,13 +1473,13 @@ discard block |
||
1473 | 1473 | * and we want to let its cached relations with foreign keys to it know about that change. Eg: we've created a transaction but haven't saved it to the db. We also create a registration and don't save it to the DB, but we DO cache it on the transaction. Now, when we save the transaction, the registration's TXN_ID will be automatically updated, whether or not they exist in the DB (if they do, their DB records will be automatically updated) |
1474 | 1474 | * @return void |
1475 | 1475 | */ |
1476 | - protected function _update_cached_related_model_objs_fks(){ |
|
1477 | - foreach( $this->get_model()->relation_settings() as $relation_name => $relation_obj ){ |
|
1478 | - if( $relation_obj instanceof EE_Has_Many_Relation ){ |
|
1479 | - foreach( $this->get_all_from_cache( $relation_name ) as $related_model_obj_in_cache) { |
|
1480 | - $fk_to_this = $related_model_obj_in_cache->get_model()->get_foreign_key_to( $this->get_model()->get_this_model_name() ); |
|
1481 | - $related_model_obj_in_cache->set($fk_to_this->get_name(), $this->ID() ); |
|
1482 | - if( $related_model_obj_in_cache->ID() ){ |
|
1476 | + protected function _update_cached_related_model_objs_fks() { |
|
1477 | + foreach ($this->get_model()->relation_settings() as $relation_name => $relation_obj) { |
|
1478 | + if ($relation_obj instanceof EE_Has_Many_Relation) { |
|
1479 | + foreach ($this->get_all_from_cache($relation_name) as $related_model_obj_in_cache) { |
|
1480 | + $fk_to_this = $related_model_obj_in_cache->get_model()->get_foreign_key_to($this->get_model()->get_this_model_name()); |
|
1481 | + $related_model_obj_in_cache->set($fk_to_this->get_name(), $this->ID()); |
|
1482 | + if ($related_model_obj_in_cache->ID()) { |
|
1483 | 1483 | $related_model_obj_in_cache->save(); |
1484 | 1484 | } |
1485 | 1485 | } |
@@ -1495,21 +1495,21 @@ discard block |
||
1495 | 1495 | * and this object and properly setup |
1496 | 1496 | * @return int ID of new model object on save; 0 on failure+ |
1497 | 1497 | */ |
1498 | - public function save_new_cached_related_model_objs(){ |
|
1498 | + public function save_new_cached_related_model_objs() { |
|
1499 | 1499 | //make sure this has been saved |
1500 | - if( ! $this->ID()){ |
|
1500 | + if ( ! $this->ID()) { |
|
1501 | 1501 | $id = $this->save(); |
1502 | - }else{ |
|
1502 | + } else { |
|
1503 | 1503 | $id = $this->ID(); |
1504 | 1504 | } |
1505 | 1505 | //now save all the NEW cached model objects (ie they don't exist in the DB) |
1506 | - foreach($this->get_model()->relation_settings() as $relationName => $relationObj){ |
|
1506 | + foreach ($this->get_model()->relation_settings() as $relationName => $relationObj) { |
|
1507 | 1507 | |
1508 | 1508 | |
1509 | - if($this->_model_relations[$relationName]){ |
|
1509 | + if ($this->_model_relations[$relationName]) { |
|
1510 | 1510 | //is this a relation where we should expect just ONE related object (ie, EE_Belongs_To_relation) |
1511 | 1511 | //or MANY related objects (ie, EE_HABTM_Relation or EE_Has_Many_Relation)? |
1512 | - if($relationObj instanceof EE_Belongs_To_Relation){ |
|
1512 | + if ($relationObj instanceof EE_Belongs_To_Relation) { |
|
1513 | 1513 | //add a relation to that relation type (which saves the appropriate thing in the process) |
1514 | 1514 | //but ONLY if it DOES NOT exist in the DB |
1515 | 1515 | /* @var $related_model_obj EE_Base_Class */ |
@@ -1518,8 +1518,8 @@ discard block |
||
1518 | 1518 | $this->_add_relation_to($related_model_obj, $relationName); |
1519 | 1519 | $related_model_obj->save_new_cached_related_model_objs(); |
1520 | 1520 | // } |
1521 | - }else{ |
|
1522 | - foreach($this->_model_relations[$relationName] as $related_model_obj){ |
|
1521 | + } else { |
|
1522 | + foreach ($this->_model_relations[$relationName] as $related_model_obj) { |
|
1523 | 1523 | //add a relation to that relation type (which saves the appropriate thing in the process) |
1524 | 1524 | //but ONLY if it DOES NOT exist in the DB |
1525 | 1525 | // if( ! $related_model_obj->ID()){ |
@@ -1540,8 +1540,8 @@ discard block |
||
1540 | 1540 | * @return \EEM_Base | \EEM_CPT_Base |
1541 | 1541 | */ |
1542 | 1542 | public function get_model() { |
1543 | - $modelName = self::_get_model_classname( get_class($this) ); |
|
1544 | - return self::_get_model_instance_with_name($modelName, $this->_timezone ); |
|
1543 | + $modelName = self::_get_model_classname(get_class($this)); |
|
1544 | + return self::_get_model_instance_with_name($modelName, $this->_timezone); |
|
1545 | 1545 | } |
1546 | 1546 | |
1547 | 1547 | |
@@ -1551,10 +1551,10 @@ discard block |
||
1551 | 1551 | * @param $classname |
1552 | 1552 | * @return mixed bool|EE_Base_Class|EEM_CPT_Base |
1553 | 1553 | */ |
1554 | - protected static function _get_object_from_entity_mapper($props_n_values, $classname){ |
|
1554 | + protected static function _get_object_from_entity_mapper($props_n_values, $classname) { |
|
1555 | 1555 | //TODO: will not work for Term_Relationships because they have no PK! |
1556 | - $primary_id_ref = self::_get_primary_key_name( $classname ); |
|
1557 | - if ( array_key_exists( $primary_id_ref, $props_n_values ) && !empty( $props_n_values[$primary_id_ref] ) ) { |
|
1556 | + $primary_id_ref = self::_get_primary_key_name($classname); |
|
1557 | + if (array_key_exists($primary_id_ref, $props_n_values) && ! empty($props_n_values[$primary_id_ref])) { |
|
1558 | 1558 | $id = $props_n_values[$primary_id_ref]; |
1559 | 1559 | return self::_get_model($classname)->get_from_entity_map($id); |
1560 | 1560 | } |
@@ -1573,35 +1573,35 @@ discard block |
||
1573 | 1573 | * date_format and the second value is the time format |
1574 | 1574 | * @return mixed (EE_Base_Class|bool) |
1575 | 1575 | */ |
1576 | - protected static function _check_for_object( $props_n_values, $classname, $timezone = NULL, $date_formats = array() ) { |
|
1577 | - if( self::_get_model( $classname )->has_primary_key_field()){ |
|
1578 | - $primary_id_ref = self::_get_primary_key_name( $classname ); |
|
1576 | + protected static function _check_for_object($props_n_values, $classname, $timezone = NULL, $date_formats = array()) { |
|
1577 | + if (self::_get_model($classname)->has_primary_key_field()) { |
|
1578 | + $primary_id_ref = self::_get_primary_key_name($classname); |
|
1579 | 1579 | |
1580 | - if ( array_key_exists( $primary_id_ref, $props_n_values ) && !empty( $props_n_values[$primary_id_ref] ) ) { |
|
1581 | - $existing = self::_get_model( $classname, $timezone )->get_one_by_ID( $props_n_values[$primary_id_ref] ); |
|
1582 | - }else{ |
|
1580 | + if (array_key_exists($primary_id_ref, $props_n_values) && ! empty($props_n_values[$primary_id_ref])) { |
|
1581 | + $existing = self::_get_model($classname, $timezone)->get_one_by_ID($props_n_values[$primary_id_ref]); |
|
1582 | + } else { |
|
1583 | 1583 | $existing = null; |
1584 | 1584 | } |
1585 | - }elseif( self::_get_model( $classname, $timezone )->has_all_combined_primary_key_fields( $props_n_values ) ){ |
|
1585 | + }elseif (self::_get_model($classname, $timezone)->has_all_combined_primary_key_fields($props_n_values)) { |
|
1586 | 1586 | //no primary key on this model, but there's still a matching item in the DB |
1587 | - $existing = self::_get_model($classname, $timezone)->get_one_by_ID( self::_get_model($classname, $timezone)->get_index_primary_key_string( $props_n_values ) ); |
|
1588 | - }else{ |
|
1587 | + $existing = self::_get_model($classname, $timezone)->get_one_by_ID(self::_get_model($classname, $timezone)->get_index_primary_key_string($props_n_values)); |
|
1588 | + } else { |
|
1589 | 1589 | $existing = null; |
1590 | 1590 | } |
1591 | - if ( $existing ) { |
|
1591 | + if ($existing) { |
|
1592 | 1592 | |
1593 | 1593 | //set date formats if present before setting values |
1594 | - if ( ! empty( $date_formats ) && is_array( $date_formats ) ) { |
|
1595 | - $existing->set_date_format( $date_formats[0] ); |
|
1596 | - $existing->set_time_format( $date_formats[1] ); |
|
1594 | + if ( ! empty($date_formats) && is_array($date_formats)) { |
|
1595 | + $existing->set_date_format($date_formats[0]); |
|
1596 | + $existing->set_time_format($date_formats[1]); |
|
1597 | 1597 | } else { |
1598 | 1598 | //set default formats for date and time |
1599 | - $existing->set_date_format( get_option( 'date_format' ) ); |
|
1600 | - $existing->set_time_format( get_option( 'time_format' ) ); |
|
1599 | + $existing->set_date_format(get_option('date_format')); |
|
1600 | + $existing->set_time_format(get_option('time_format')); |
|
1601 | 1601 | } |
1602 | 1602 | |
1603 | - foreach ( $props_n_values as $property => $field_value ) { |
|
1604 | - $existing->set( $property, $field_value ); |
|
1603 | + foreach ($props_n_values as $property => $field_value) { |
|
1604 | + $existing->set($property, $field_value); |
|
1605 | 1605 | } |
1606 | 1606 | return $existing; |
1607 | 1607 | } else { |
@@ -1619,13 +1619,13 @@ discard block |
||
1619 | 1619 | * @throws EE_Error |
1620 | 1620 | * @return EEM_Base |
1621 | 1621 | */ |
1622 | - protected static function _get_model( $classname, $timezone = NULL ){ |
|
1622 | + protected static function _get_model($classname, $timezone = NULL) { |
|
1623 | 1623 | //find model for this class |
1624 | - if( ! $classname ){ |
|
1625 | - throw new EE_Error(sprintf(__("What were you thinking calling _get_model(%s)?? You need to specify the class name", "event_espresso"),$classname)); |
|
1624 | + if ( ! $classname) { |
|
1625 | + throw new EE_Error(sprintf(__("What were you thinking calling _get_model(%s)?? You need to specify the class name", "event_espresso"), $classname)); |
|
1626 | 1626 | } |
1627 | - $modelName=self::_get_model_classname($classname); |
|
1628 | - return self::_get_model_instance_with_name($modelName, $timezone ); |
|
1627 | + $modelName = self::_get_model_classname($classname); |
|
1628 | + return self::_get_model_instance_with_name($modelName, $timezone); |
|
1629 | 1629 | } |
1630 | 1630 | |
1631 | 1631 | |
@@ -1636,10 +1636,10 @@ discard block |
||
1636 | 1636 | * @param null $timezone |
1637 | 1637 | * @return EEM_Base |
1638 | 1638 | */ |
1639 | - protected static function _get_model_instance_with_name($model_classname, $timezone = NULL){ |
|
1640 | - $model_classname = str_replace( 'EEM_', '', $model_classname ); |
|
1641 | - $model = EE_Registry::instance()->load_model( $model_classname ); |
|
1642 | - $model->set_timezone( $timezone ); |
|
1639 | + protected static function _get_model_instance_with_name($model_classname, $timezone = NULL) { |
|
1640 | + $model_classname = str_replace('EEM_', '', $model_classname); |
|
1641 | + $model = EE_Registry::instance()->load_model($model_classname); |
|
1642 | + $model->set_timezone($timezone); |
|
1643 | 1643 | return $model; |
1644 | 1644 | } |
1645 | 1645 | |
@@ -1651,10 +1651,10 @@ discard block |
||
1651 | 1651 | * @param null $model_name |
1652 | 1652 | * @return string like EEM_Attendee |
1653 | 1653 | */ |
1654 | - private static function _get_model_classname( $model_name = null){ |
|
1655 | - if(strpos($model_name,"EE_")===0){ |
|
1656 | - $model_classname=str_replace("EE_","EEM_",$model_name); |
|
1657 | - }else{ |
|
1654 | + private static function _get_model_classname($model_name = null) { |
|
1655 | + if (strpos($model_name, "EE_") === 0) { |
|
1656 | + $model_classname = str_replace("EE_", "EEM_", $model_name); |
|
1657 | + } else { |
|
1658 | 1658 | $model_classname = "EEM_".$model_name; |
1659 | 1659 | } |
1660 | 1660 | return $model_classname; |
@@ -1668,11 +1668,11 @@ discard block |
||
1668 | 1668 | * @throws EE_Error |
1669 | 1669 | * @return string |
1670 | 1670 | */ |
1671 | - protected static function _get_primary_key_name( $classname = NULL ){ |
|
1672 | - if( ! $classname){ |
|
1673 | - throw new EE_Error(sprintf(__("What were you thinking calling _get_primary_key_name(%s)", "event_espresso"),$classname)); |
|
1671 | + protected static function _get_primary_key_name($classname = NULL) { |
|
1672 | + if ( ! $classname) { |
|
1673 | + throw new EE_Error(sprintf(__("What were you thinking calling _get_primary_key_name(%s)", "event_espresso"), $classname)); |
|
1674 | 1674 | } |
1675 | - return self::_get_model( $classname )->get_primary_key_field()->get_name(); |
|
1675 | + return self::_get_model($classname)->get_primary_key_field()->get_name(); |
|
1676 | 1676 | } |
1677 | 1677 | |
1678 | 1678 | |
@@ -1684,12 +1684,12 @@ discard block |
||
1684 | 1684 | * Usually defaults for integer primary keys are 0; string primary keys are usually NULL). |
1685 | 1685 | * @return mixed, if the primary key is of type INT it'll be an int. Otherwise it could be a string |
1686 | 1686 | */ |
1687 | - public function ID(){ |
|
1687 | + public function ID() { |
|
1688 | 1688 | //now that we know the name of the variable, use a variable variable to get its value and return its |
1689 | - if( $this->get_model()->has_primary_key_field() ) { |
|
1690 | - return $this->_fields[self::_get_primary_key_name( get_class($this) )]; |
|
1691 | - }else{ |
|
1692 | - return $this->get_model()->get_index_primary_key_string( $this->_fields ); |
|
1689 | + if ($this->get_model()->has_primary_key_field()) { |
|
1690 | + return $this->_fields[self::_get_primary_key_name(get_class($this))]; |
|
1691 | + } else { |
|
1692 | + return $this->get_model()->get_index_primary_key_string($this->_fields); |
|
1693 | 1693 | } |
1694 | 1694 | } |
1695 | 1695 | |
@@ -1707,38 +1707,38 @@ discard block |
||
1707 | 1707 | * @throws EE_Error |
1708 | 1708 | * @return EE_Base_Class the object the relation was added to |
1709 | 1709 | */ |
1710 | - public function _add_relation_to( $otherObjectModelObjectOrID,$relationName, $extra_join_model_fields_n_values = array(), $cache_id = NULL ){ |
|
1710 | + public function _add_relation_to($otherObjectModelObjectOrID, $relationName, $extra_join_model_fields_n_values = array(), $cache_id = NULL) { |
|
1711 | 1711 | //if this thing exists in the DB, save the relation to the DB |
1712 | - if( $this->ID() ){ |
|
1713 | - $otherObject = $this->get_model()->add_relationship_to( $this, $otherObjectModelObjectOrID, $relationName, $extra_join_model_fields_n_values ); |
|
1712 | + if ($this->ID()) { |
|
1713 | + $otherObject = $this->get_model()->add_relationship_to($this, $otherObjectModelObjectOrID, $relationName, $extra_join_model_fields_n_values); |
|
1714 | 1714 | //clear cache so future get_many_related and get_first_related() return new results. |
1715 | - $this->clear_cache( $relationName, $otherObject, TRUE ); |
|
1716 | - if( $otherObject instanceof EE_Base_Class ) { |
|
1717 | - $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this ); |
|
1715 | + $this->clear_cache($relationName, $otherObject, TRUE); |
|
1716 | + if ($otherObject instanceof EE_Base_Class) { |
|
1717 | + $otherObject->clear_cache($this->get_model()->get_this_model_name(), $this); |
|
1718 | 1718 | } |
1719 | 1719 | } else { |
1720 | 1720 | //this thing doesn't exist in the DB, so just cache it |
1721 | - if( ! $otherObjectModelObjectOrID instanceof EE_Base_Class){ |
|
1722 | - throw new EE_Error( sprintf( |
|
1723 | - __( 'Before a model object is saved to the database, calls to _add_relation_to must be passed an actual object, not just an ID. You provided %s as the model object to a %s', 'event_espresso' ), |
|
1721 | + if ( ! $otherObjectModelObjectOrID instanceof EE_Base_Class) { |
|
1722 | + throw new EE_Error(sprintf( |
|
1723 | + __('Before a model object is saved to the database, calls to _add_relation_to must be passed an actual object, not just an ID. You provided %s as the model object to a %s', 'event_espresso'), |
|
1724 | 1724 | $otherObjectModelObjectOrID, |
1725 | - get_class( $this ) |
|
1725 | + get_class($this) |
|
1726 | 1726 | )); |
1727 | 1727 | } else { |
1728 | 1728 | $otherObject = $otherObjectModelObjectOrID; |
1729 | 1729 | } |
1730 | - $this->cache( $relationName, $otherObjectModelObjectOrID, $cache_id ); |
|
1730 | + $this->cache($relationName, $otherObjectModelObjectOrID, $cache_id); |
|
1731 | 1731 | } |
1732 | - if( $otherObject instanceof EE_Base_Class ) { |
|
1732 | + if ($otherObject instanceof EE_Base_Class) { |
|
1733 | 1733 | //fix the reciprocal relation too |
1734 | - if( $otherObject->ID() ) { |
|
1734 | + if ($otherObject->ID()) { |
|
1735 | 1735 | //its saved so assumed relations exist in the DB, so we can just |
1736 | 1736 | //clear the cache so future queries use the updated info in the DB |
1737 | - $otherObject->clear_cache( $this->get_model()->get_this_model_name(), null, true ); |
|
1737 | + $otherObject->clear_cache($this->get_model()->get_this_model_name(), null, true); |
|
1738 | 1738 | } else { |
1739 | 1739 | |
1740 | 1740 | //it's not saved, so it caches relations like this |
1741 | - $otherObject->cache( $this->get_model()->get_this_model_name(), $this ); |
|
1741 | + $otherObject->cache($this->get_model()->get_this_model_name(), $this); |
|
1742 | 1742 | } |
1743 | 1743 | } |
1744 | 1744 | return $otherObject; |
@@ -1761,17 +1761,17 @@ discard block |
||
1761 | 1761 | * Also remember that if an exact match isn't found for these extra cols/val pairs, then a NEW row is created in the join table. |
1762 | 1762 | * @return EE_Base_Class the relation was removed from |
1763 | 1763 | */ |
1764 | - public function _remove_relation_to($otherObjectModelObjectOrID,$relationName, $where_query = array() ){ |
|
1765 | - if ( $this->ID() ) { |
|
1764 | + public function _remove_relation_to($otherObjectModelObjectOrID, $relationName, $where_query = array()) { |
|
1765 | + if ($this->ID()) { |
|
1766 | 1766 | //if this exists in the DB, save the relation change to the DB too |
1767 | - $otherObject = $this->get_model()->remove_relationship_to( $this, $otherObjectModelObjectOrID, $relationName, $where_query ); |
|
1768 | - $this->clear_cache( $relationName, $otherObject ); |
|
1767 | + $otherObject = $this->get_model()->remove_relationship_to($this, $otherObjectModelObjectOrID, $relationName, $where_query); |
|
1768 | + $this->clear_cache($relationName, $otherObject); |
|
1769 | 1769 | } else { |
1770 | 1770 | //this doesn't exist in the DB, just remove it from the cache |
1771 | - $otherObject = $this->clear_cache( $relationName, $otherObjectModelObjectOrID ); |
|
1771 | + $otherObject = $this->clear_cache($relationName, $otherObjectModelObjectOrID); |
|
1772 | 1772 | } |
1773 | - if( $otherObject instanceof EE_Base_Class ) { |
|
1774 | - $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this ); |
|
1773 | + if ($otherObject instanceof EE_Base_Class) { |
|
1774 | + $otherObject->clear_cache($this->get_model()->get_this_model_name(), $this); |
|
1775 | 1775 | } |
1776 | 1776 | return $otherObject; |
1777 | 1777 | } |
@@ -1782,18 +1782,18 @@ discard block |
||
1782 | 1782 | * @param array $where_query_params like EEM_Base::get_all's $query_params[0] (where conditions) |
1783 | 1783 | * @return EE_Base_Class |
1784 | 1784 | */ |
1785 | - public function _remove_relations($relationName,$where_query_params = array()){ |
|
1786 | - if ( $this->ID() ) { |
|
1785 | + public function _remove_relations($relationName, $where_query_params = array()) { |
|
1786 | + if ($this->ID()) { |
|
1787 | 1787 | //if this exists in the DB, save the relation change to the DB too |
1788 | - $otherObjects = $this->get_model()->remove_relations( $this, $relationName, $where_query_params ); |
|
1789 | - $this->clear_cache( $relationName, null, true ); |
|
1788 | + $otherObjects = $this->get_model()->remove_relations($this, $relationName, $where_query_params); |
|
1789 | + $this->clear_cache($relationName, null, true); |
|
1790 | 1790 | } else { |
1791 | 1791 | //this doesn't exist in the DB, just remove it from the cache |
1792 | - $otherObjects = $this->clear_cache( $relationName, null, true ); |
|
1792 | + $otherObjects = $this->clear_cache($relationName, null, true); |
|
1793 | 1793 | } |
1794 | - if( is_array( $otherObjects ) ) { |
|
1795 | - foreach ( $otherObjects as $otherObject ) { |
|
1796 | - $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this ); |
|
1794 | + if (is_array($otherObjects)) { |
|
1795 | + foreach ($otherObjects as $otherObject) { |
|
1796 | + $otherObject->clear_cache($this->get_model()->get_this_model_name(), $this); |
|
1797 | 1797 | } |
1798 | 1798 | } |
1799 | 1799 | return $otherObjects; |
@@ -1811,26 +1811,26 @@ discard block |
||
1811 | 1811 | * @return EE_Base_Class[] Results not necessarily indexed by IDs, because some results might not have primary keys |
1812 | 1812 | * or might not be saved yet. Consider using EEM_Base::get_IDs() on these results if you want IDs |
1813 | 1813 | */ |
1814 | - public function get_many_related($relationName,$query_params = array()){ |
|
1815 | - if($this->ID()){//this exists in the DB, so get the related things from either the cache or the DB |
|
1814 | + public function get_many_related($relationName, $query_params = array()) { |
|
1815 | + if ($this->ID()) {//this exists in the DB, so get the related things from either the cache or the DB |
|
1816 | 1816 | //if there are query parameters, forget about caching the related model objects. |
1817 | - if( $query_params ){ |
|
1817 | + if ($query_params) { |
|
1818 | 1818 | $related_model_objects = $this->get_model()->get_all_related($this, $relationName, $query_params); |
1819 | - }else{ |
|
1819 | + } else { |
|
1820 | 1820 | //did we already cache the result of this query? |
1821 | 1821 | $cached_results = $this->get_all_from_cache($relationName); |
1822 | - if ( ! $cached_results ){ |
|
1822 | + if ( ! $cached_results) { |
|
1823 | 1823 | $related_model_objects = $this->get_model()->get_all_related($this, $relationName, $query_params); |
1824 | 1824 | //if no query parameters were passed, then we got all the related model objects |
1825 | 1825 | //for that relation. We can cache them then. |
1826 | - foreach($related_model_objects as $related_model_object){ |
|
1826 | + foreach ($related_model_objects as $related_model_object) { |
|
1827 | 1827 | $this->cache($relationName, $related_model_object); |
1828 | 1828 | } |
1829 | - }else{ |
|
1829 | + } else { |
|
1830 | 1830 | $related_model_objects = $cached_results; |
1831 | 1831 | } |
1832 | 1832 | } |
1833 | - }else{//this doesn't exist itn eh DB, so just get the related things from the cache |
|
1833 | + } else {//this doesn't exist itn eh DB, so just get the related things from the cache |
|
1834 | 1834 | $related_model_objects = $this->get_all_from_cache($relationName); |
1835 | 1835 | } |
1836 | 1836 | return $related_model_objects; |
@@ -1847,8 +1847,8 @@ discard block |
||
1847 | 1847 | * @param bool $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE; |
1848 | 1848 | * @return int |
1849 | 1849 | */ |
1850 | - public function count_related($relation_name, $query_params =array(),$field_to_count = NULL, $distinct = FALSE){ |
|
1851 | - return $this->get_model()->count_related($this,$relation_name,$query_params,$field_to_count,$distinct); |
|
1850 | + public function count_related($relation_name, $query_params = array(), $field_to_count = NULL, $distinct = FALSE) { |
|
1851 | + return $this->get_model()->count_related($this, $relation_name, $query_params, $field_to_count, $distinct); |
|
1852 | 1852 | } |
1853 | 1853 | |
1854 | 1854 | |
@@ -1862,7 +1862,7 @@ discard block |
||
1862 | 1862 | * By default, uses primary key (which doesn't make much sense, so you should probably change it) |
1863 | 1863 | * @return int |
1864 | 1864 | */ |
1865 | - public function sum_related($relation_name, $query_params = array(), $field_to_sum = null){ |
|
1865 | + public function sum_related($relation_name, $query_params = array(), $field_to_sum = null) { |
|
1866 | 1866 | return $this->get_model()->sum_related($this, $relation_name, $query_params, $field_to_sum); |
1867 | 1867 | } |
1868 | 1868 | |
@@ -1874,34 +1874,34 @@ discard block |
||
1874 | 1874 | * @param array $query_params like EEM_Base::get_all |
1875 | 1875 | * @return EE_Base_Class (not an array, a single object) |
1876 | 1876 | */ |
1877 | - public function get_first_related($relationName,$query_params = array()){ |
|
1878 | - if($this->ID()){//this exists in the DB, get from the cache OR the DB |
|
1877 | + public function get_first_related($relationName, $query_params = array()) { |
|
1878 | + if ($this->ID()) {//this exists in the DB, get from the cache OR the DB |
|
1879 | 1879 | |
1880 | 1880 | //if they've provided some query parameters, don't bother trying to cache the result |
1881 | 1881 | //also make sure we're not caching the result of get_first_related |
1882 | 1882 | //on a relation which should have an array of objects (because the cache might have an array of objects) |
1883 | - if ($query_params || ! $this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation){ |
|
1884 | - $related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params); |
|
1885 | - }else{ |
|
1883 | + if ($query_params || ! $this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation) { |
|
1884 | + $related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params); |
|
1885 | + } else { |
|
1886 | 1886 | //first, check if we've already cached the result of this query |
1887 | 1887 | $cached_result = $this->get_one_from_cache($relationName); |
1888 | - if ( ! $cached_result ){ |
|
1888 | + if ( ! $cached_result) { |
|
1889 | 1889 | |
1890 | 1890 | $related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params); |
1891 | - $this->cache($relationName,$related_model_object); |
|
1892 | - }else{ |
|
1891 | + $this->cache($relationName, $related_model_object); |
|
1892 | + } else { |
|
1893 | 1893 | $related_model_object = $cached_result; |
1894 | 1894 | } |
1895 | 1895 | } |
1896 | - }else{ |
|
1896 | + } else { |
|
1897 | 1897 | //this doesn't exist in the Db, but maybe the relation is of type belongs to, and so the related thing might |
1898 | - if( $this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation){ |
|
1899 | - $related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params); |
|
1900 | - }else{ |
|
1898 | + if ($this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation) { |
|
1899 | + $related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params); |
|
1900 | + } else { |
|
1901 | 1901 | $related_model_object = null; |
1902 | 1902 | } |
1903 | 1903 | //this doesn't exist in the DB and apparently the thing it belongs to doesn't either, just get what's cached on this object |
1904 | - if( ! $related_model_object){ |
|
1904 | + if ( ! $related_model_object) { |
|
1905 | 1905 | $related_model_object = $this->get_one_from_cache($relationName); |
1906 | 1906 | } |
1907 | 1907 | |
@@ -1920,12 +1920,12 @@ discard block |
||
1920 | 1920 | * @param array $query_params like EEM_Base::get_all's |
1921 | 1921 | * @return int how many deleted |
1922 | 1922 | */ |
1923 | - public function delete_related($relationName,$query_params = array()){ |
|
1924 | - if($this->ID()){ |
|
1925 | - $count = $this->get_model()->delete_related($this, $relationName, $query_params); |
|
1926 | - }else{ |
|
1923 | + public function delete_related($relationName, $query_params = array()) { |
|
1924 | + if ($this->ID()) { |
|
1925 | + $count = $this->get_model()->delete_related($this, $relationName, $query_params); |
|
1926 | + } else { |
|
1927 | 1927 | $count = count($this->get_all_from_cache($relationName)); |
1928 | - $this->clear_cache($relationName,NULL,TRUE); |
|
1928 | + $this->clear_cache($relationName, NULL, TRUE); |
|
1929 | 1929 | } |
1930 | 1930 | return $count; |
1931 | 1931 | } |
@@ -1940,13 +1940,13 @@ discard block |
||
1940 | 1940 | * @param array $query_params like EEM_Base::get_all's |
1941 | 1941 | * @return int how many deleted (including those soft deleted) |
1942 | 1942 | */ |
1943 | - public function delete_related_permanently($relationName,$query_params = array()){ |
|
1944 | - if($this->ID()){ |
|
1945 | - $count = $this->get_model()->delete_related_permanently($this, $relationName, $query_params); |
|
1946 | - }else{ |
|
1943 | + public function delete_related_permanently($relationName, $query_params = array()) { |
|
1944 | + if ($this->ID()) { |
|
1945 | + $count = $this->get_model()->delete_related_permanently($this, $relationName, $query_params); |
|
1946 | + } else { |
|
1947 | 1947 | $count = count($this->get_all_from_cache($relationName)); |
1948 | 1948 | } |
1949 | - $this->clear_cache($relationName,NULL,TRUE); |
|
1949 | + $this->clear_cache($relationName, NULL, TRUE); |
|
1950 | 1950 | return $count; |
1951 | 1951 | } |
1952 | 1952 | |
@@ -1962,7 +1962,7 @@ discard block |
||
1962 | 1962 | * @param string $field_name property to check |
1963 | 1963 | * @return bool TRUE if existing,FALSE if not. |
1964 | 1964 | */ |
1965 | - public function is_set( $field_name ) { |
|
1965 | + public function is_set($field_name) { |
|
1966 | 1966 | return isset($this->_fields[$field_name]); |
1967 | 1967 | } |
1968 | 1968 | |
@@ -1974,12 +1974,12 @@ discard block |
||
1974 | 1974 | * @throws EE_Error |
1975 | 1975 | * @return bool TRUE if existing, throw EE_Error if not. |
1976 | 1976 | */ |
1977 | - protected function _property_exists( $properties ) { |
|
1977 | + protected function _property_exists($properties) { |
|
1978 | 1978 | |
1979 | - foreach ( (array) $properties as $property_name ) { |
|
1979 | + foreach ((array) $properties as $property_name) { |
|
1980 | 1980 | //first make sure this property exists |
1981 | - if ( ! $this->_fields[ $property_name ] ) |
|
1982 | - throw new EE_Error( sprintf( __('Trying to retrieve a non-existent property (%s). Double check the spelling please', 'event_espresso'), $property_name ) ); |
|
1981 | + if ( ! $this->_fields[$property_name]) |
|
1982 | + throw new EE_Error(sprintf(__('Trying to retrieve a non-existent property (%s). Double check the spelling please', 'event_espresso'), $property_name)); |
|
1983 | 1983 | } |
1984 | 1984 | |
1985 | 1985 | return TRUE; |
@@ -1996,7 +1996,7 @@ discard block |
||
1996 | 1996 | $fields = $this->get_model()->field_settings(FALSE); |
1997 | 1997 | $properties = array(); |
1998 | 1998 | //remove prepended underscore |
1999 | - foreach ( $fields as $field_name => $settings ) { |
|
1999 | + foreach ($fields as $field_name => $settings) { |
|
2000 | 2000 | $properties[$field_name] = $this->get($field_name); |
2001 | 2001 | } |
2002 | 2002 | return $properties; |
@@ -2026,14 +2026,14 @@ discard block |
||
2026 | 2026 | * @throws EE_Error |
2027 | 2027 | * @return mixed whatever the plugin which calls add_filter decides |
2028 | 2028 | */ |
2029 | - public function __call($methodName,$args){ |
|
2030 | - $className=get_class($this); |
|
2031 | - $tagName="FHEE__{$className}__{$methodName}"; |
|
2032 | - if(!has_filter($tagName)){ |
|
2033 | - throw new EE_Error(sprintf(__("Method %s on class %s does not exist! You can create one with the following code in functions.php or in a plugin: add_filter('%s','my_callback',10,3);function my_callback(\$previousReturnValue,EE_Base_Class \$object, \$argsArray){/*function body*/return \$whatever;}","event_espresso"), |
|
2034 | - $methodName,$className,$tagName)); |
|
2029 | + public function __call($methodName, $args) { |
|
2030 | + $className = get_class($this); |
|
2031 | + $tagName = "FHEE__{$className}__{$methodName}"; |
|
2032 | + if ( ! has_filter($tagName)) { |
|
2033 | + throw new EE_Error(sprintf(__("Method %s on class %s does not exist! You can create one with the following code in functions.php or in a plugin: add_filter('%s','my_callback',10,3);function my_callback(\$previousReturnValue,EE_Base_Class \$object, \$argsArray){/*function body*/return \$whatever;}", "event_espresso"), |
|
2034 | + $methodName, $className, $tagName)); |
|
2035 | 2035 | } |
2036 | - return apply_filters($tagName,null,$this,$args); |
|
2036 | + return apply_filters($tagName, null, $this, $args); |
|
2037 | 2037 | } |
2038 | 2038 | |
2039 | 2039 | |
@@ -2048,22 +2048,22 @@ discard block |
||
2048 | 2048 | * @return int records updated (or BOOLEAN if we actually ended up inserting the extra meta row) |
2049 | 2049 | * NOTE: if the values haven't changed, returns 0 |
2050 | 2050 | */ |
2051 | - public function update_extra_meta($meta_key,$meta_value,$previous_value = NULL){ |
|
2052 | - $query_params = array(array( |
|
2051 | + public function update_extra_meta($meta_key, $meta_value, $previous_value = NULL) { |
|
2052 | + $query_params = array(array( |
|
2053 | 2053 | 'EXM_key'=>$meta_key, |
2054 | 2054 | 'OBJ_ID'=>$this->ID(), |
2055 | 2055 | 'EXM_type'=>$this->get_model()->get_this_model_name())); |
2056 | - if($previous_value !== NULL){ |
|
2056 | + if ($previous_value !== NULL) { |
|
2057 | 2057 | $query_params[0]['EXM_value'] = $meta_value; |
2058 | 2058 | } |
2059 | 2059 | $existing_rows_like_that = EEM_Extra_Meta::instance()->get_all($query_params); |
2060 | - if( ! $existing_rows_like_that){ |
|
2060 | + if ( ! $existing_rows_like_that) { |
|
2061 | 2061 | return $this->add_extra_meta($meta_key, $meta_value); |
2062 | - }else{ |
|
2063 | - foreach( $existing_rows_like_that as $existing_row){ |
|
2064 | - $existing_row->save( array( 'EXM_value' => $meta_value ) ); |
|
2062 | + } else { |
|
2063 | + foreach ($existing_rows_like_that as $existing_row) { |
|
2064 | + $existing_row->save(array('EXM_value' => $meta_value)); |
|
2065 | 2065 | } |
2066 | - return count( $existing_rows_like_that ); |
|
2066 | + return count($existing_rows_like_that); |
|
2067 | 2067 | } |
2068 | 2068 | } |
2069 | 2069 | |
@@ -2076,10 +2076,10 @@ discard block |
||
2076 | 2076 | * @param boolean $unique |
2077 | 2077 | * @return boolean |
2078 | 2078 | */ |
2079 | - public function add_extra_meta($meta_key,$meta_value,$unique = false){ |
|
2080 | - if($unique){ |
|
2081 | - $existing_extra_meta = EEM_Extra_Meta::instance()->get_one(array(array('EXM_key'=>$meta_key,'OBJ_ID'=>$this->ID(),'EXM_type'=>$this->_get_model_classname(get_class($this))))); |
|
2082 | - if($existing_extra_meta){ |
|
2079 | + public function add_extra_meta($meta_key, $meta_value, $unique = false) { |
|
2080 | + if ($unique) { |
|
2081 | + $existing_extra_meta = EEM_Extra_Meta::instance()->get_one(array(array('EXM_key'=>$meta_key, 'OBJ_ID'=>$this->ID(), 'EXM_type'=>$this->_get_model_classname(get_class($this))))); |
|
2082 | + if ($existing_extra_meta) { |
|
2083 | 2083 | return false; |
2084 | 2084 | } |
2085 | 2085 | } |
@@ -2099,12 +2099,12 @@ discard block |
||
2099 | 2099 | * @param string $meta_value |
2100 | 2100 | * @return int number of extra meta rows deleted |
2101 | 2101 | */ |
2102 | - public function delete_extra_meta($meta_key,$meta_value = NULL){ |
|
2103 | - $query_params = array(array( |
|
2102 | + public function delete_extra_meta($meta_key, $meta_value = NULL) { |
|
2103 | + $query_params = array(array( |
|
2104 | 2104 | 'EXM_key'=>$meta_key, |
2105 | 2105 | 'OBJ_ID'=>$this->ID(), |
2106 | 2106 | 'EXM_type'=>$this->get_model()->get_this_model_name())); |
2107 | - if($meta_value !== NULL){ |
|
2107 | + if ($meta_value !== NULL) { |
|
2108 | 2108 | $query_params[0]['EXM_value'] = $meta_value; |
2109 | 2109 | } |
2110 | 2110 | $count_deleted = EEM_Extra_Meta::instance()->delete($query_params); |
@@ -2120,25 +2120,25 @@ discard block |
||
2120 | 2120 | * @param mixed $default if we don't find anything, what should we return? |
2121 | 2121 | * @return mixed single value if $single; array if ! $single |
2122 | 2122 | */ |
2123 | - public function get_extra_meta($meta_key,$single = FALSE,$default = NULL){ |
|
2124 | - if($single){ |
|
2125 | - $result = $this->get_first_related('Extra_Meta',array(array('EXM_key'=>$meta_key))); |
|
2126 | - if ( $result instanceof EE_Extra_Meta ){ |
|
2123 | + public function get_extra_meta($meta_key, $single = FALSE, $default = NULL) { |
|
2124 | + if ($single) { |
|
2125 | + $result = $this->get_first_related('Extra_Meta', array(array('EXM_key'=>$meta_key))); |
|
2126 | + if ($result instanceof EE_Extra_Meta) { |
|
2127 | 2127 | return $result->value(); |
2128 | - }else{ |
|
2128 | + } else { |
|
2129 | 2129 | return $default; |
2130 | 2130 | } |
2131 | - }else{ |
|
2132 | - $results = $this->get_many_related('Extra_Meta',array(array('EXM_key'=>$meta_key))); |
|
2133 | - if($results){ |
|
2131 | + } else { |
|
2132 | + $results = $this->get_many_related('Extra_Meta', array(array('EXM_key'=>$meta_key))); |
|
2133 | + if ($results) { |
|
2134 | 2134 | $values = array(); |
2135 | - foreach($results as $result){ |
|
2136 | - if ( $result instanceof EE_Extra_Meta ){ |
|
2135 | + foreach ($results as $result) { |
|
2136 | + if ($result instanceof EE_Extra_Meta) { |
|
2137 | 2137 | $values[$result->ID()] = $result->value(); |
2138 | 2138 | } |
2139 | 2139 | } |
2140 | 2140 | return $values; |
2141 | - }else{ |
|
2141 | + } else { |
|
2142 | 2142 | return $default; |
2143 | 2143 | } |
2144 | 2144 | } |
@@ -2155,20 +2155,20 @@ discard block |
||
2155 | 2155 | * @param boolean $one_of_each_key |
2156 | 2156 | * @return array |
2157 | 2157 | */ |
2158 | - public function all_extra_meta_array($one_of_each_key = true){ |
|
2158 | + public function all_extra_meta_array($one_of_each_key = true) { |
|
2159 | 2159 | $return_array = array(); |
2160 | - if($one_of_each_key){ |
|
2160 | + if ($one_of_each_key) { |
|
2161 | 2161 | $extra_meta_objs = $this->get_many_related('Extra_Meta', array('group_by'=>'EXM_key')); |
2162 | - foreach($extra_meta_objs as $extra_meta_obj){ |
|
2163 | - if ( $extra_meta_obj instanceof EE_Extra_Meta ) { |
|
2162 | + foreach ($extra_meta_objs as $extra_meta_obj) { |
|
2163 | + if ($extra_meta_obj instanceof EE_Extra_Meta) { |
|
2164 | 2164 | $return_array[$extra_meta_obj->key()] = $extra_meta_obj->value(); |
2165 | 2165 | } |
2166 | 2166 | } |
2167 | - }else{ |
|
2167 | + } else { |
|
2168 | 2168 | $extra_meta_objs = $this->get_many_related('Extra_Meta'); |
2169 | - foreach($extra_meta_objs as $extra_meta_obj){ |
|
2170 | - if ( $extra_meta_obj instanceof EE_Extra_Meta ) { |
|
2171 | - if( ! isset($return_array[$extra_meta_obj->key()])){ |
|
2169 | + foreach ($extra_meta_objs as $extra_meta_obj) { |
|
2170 | + if ($extra_meta_obj instanceof EE_Extra_Meta) { |
|
2171 | + if ( ! isset($return_array[$extra_meta_obj->key()])) { |
|
2172 | 2172 | $return_array[$extra_meta_obj->key()] = array(); |
2173 | 2173 | } |
2174 | 2174 | $return_array[$extra_meta_obj->key()][$extra_meta_obj->ID()] = $extra_meta_obj->value(); |
@@ -2181,19 +2181,19 @@ discard block |
||
2181 | 2181 | * Gets a pretty nice displayable nice for this model object. Often overridden |
2182 | 2182 | * @return string |
2183 | 2183 | */ |
2184 | - public function name(){ |
|
2184 | + public function name() { |
|
2185 | 2185 | //find a field that's not a text field |
2186 | 2186 | $field_we_can_use = $this->get_model()->get_a_field_of_type('EE_Text_Field_Base'); |
2187 | - if($field_we_can_use){ |
|
2187 | + if ($field_we_can_use) { |
|
2188 | 2188 | return $this->get($field_we_can_use->get_name()); |
2189 | - }else{ |
|
2189 | + } else { |
|
2190 | 2190 | $first_few_properties = $this->model_field_array(); |
2191 | - $first_few_properties = array_slice($first_few_properties,0,3); |
|
2191 | + $first_few_properties = array_slice($first_few_properties, 0, 3); |
|
2192 | 2192 | $name_parts = array(); |
2193 | - foreach( $first_few_properties as $name=> $value ){ |
|
2193 | + foreach ($first_few_properties as $name=> $value) { |
|
2194 | 2194 | $name_parts[] = "$name:$value"; |
2195 | 2195 | } |
2196 | - return implode(",",$name_parts); |
|
2196 | + return implode(",", $name_parts); |
|
2197 | 2197 | } |
2198 | 2198 | } |
2199 | 2199 | |
@@ -2202,11 +2202,11 @@ discard block |
||
2202 | 2202 | * Checks if this model object has been proven to already be in the entity map |
2203 | 2203 | * @return boolean |
2204 | 2204 | */ |
2205 | - public function in_entity_map(){ |
|
2206 | - if( $this->ID() && $this->get_model()->get_from_entity_map( $this->ID() ) === $this ) { |
|
2205 | + public function in_entity_map() { |
|
2206 | + if ($this->ID() && $this->get_model()->get_from_entity_map($this->ID()) === $this) { |
|
2207 | 2207 | //well, if we looked, did we find it in the entity map? |
2208 | 2208 | return TRUE; |
2209 | - }else{ |
|
2209 | + } else { |
|
2210 | 2210 | return FALSE; |
2211 | 2211 | } |
2212 | 2212 | } |
@@ -2217,21 +2217,21 @@ discard block |
||
2217 | 2217 | * @throws EE_Error if this model object isn't in the entity mapper (because then you should |
2218 | 2218 | * just use what's in the entity mapper and refresh it) and WP_DEBUG is TRUE |
2219 | 2219 | */ |
2220 | - public function refresh_from_db(){ |
|
2221 | - if( $this->ID() && $this->in_entity_map() ){ |
|
2222 | - $this->get_model()->refresh_entity_map_from_db( $this->ID() ); |
|
2223 | - }else{ |
|
2220 | + public function refresh_from_db() { |
|
2221 | + if ($this->ID() && $this->in_entity_map()) { |
|
2222 | + $this->get_model()->refresh_entity_map_from_db($this->ID()); |
|
2223 | + } else { |
|
2224 | 2224 | //if it doesn't have ID, you shouldn't be asking to refresh it from teh database (because its not in the database) |
2225 | 2225 | //if it has an ID but it's not in the map, and you're asking me to refresh it |
2226 | 2226 | //that's kinda dangerous. You should just use what's in the entity map, or add this to the entity map if there's |
2227 | 2227 | //absolutely nothing in it for this ID |
2228 | - if( WP_DEBUG ) { |
|
2228 | + if (WP_DEBUG) { |
|
2229 | 2229 | throw new EE_Error( |
2230 | 2230 | sprintf( |
2231 | - __( 'Trying to refresh a model object with ID "%1$s" that\'s not in the entity map? First off: you should put it in the entity map by calling %2$s. Second off, if you want what\'s in the database right now, you should just call %3$s yourself and discard this model object.', 'event_espresso' ), |
|
2231 | + __('Trying to refresh a model object with ID "%1$s" that\'s not in the entity map? First off: you should put it in the entity map by calling %2$s. Second off, if you want what\'s in the database right now, you should just call %3$s yourself and discard this model object.', 'event_espresso'), |
|
2232 | 2232 | $this->ID(), |
2233 | - get_class( $this->get_model() ) . '::instance()->add_to_entity_map()', |
|
2234 | - get_class( $this->get_model() ) . '::instance()->refresh_entity_map()' |
|
2233 | + get_class($this->get_model()).'::instance()->add_to_entity_map()', |
|
2234 | + get_class($this->get_model()).'::instance()->refresh_entity_map()' |
|
2235 | 2235 | ) |
2236 | 2236 | ); |
2237 | 2237 | } |
@@ -2243,8 +2243,8 @@ discard block |
||
2243 | 2243 | * (probably a bad assumption they have made, oh well) |
2244 | 2244 | * @return string |
2245 | 2245 | */ |
2246 | - public function __toString(){ |
|
2247 | - return sprintf( '%s (%s)', $this->name(), $this->ID() ); |
|
2246 | + public function __toString() { |
|
2247 | + return sprintf('%s (%s)', $this->name(), $this->ID()); |
|
2248 | 2248 | } |
2249 | 2249 | |
2250 | 2250 | /** |
@@ -2276,16 +2276,16 @@ discard block |
||
2276 | 2276 | * @return array |
2277 | 2277 | */ |
2278 | 2278 | public function __sleep() { |
2279 | - foreach( $this->get_model()->relation_settings() as $relation_name => $relation_obj ) { |
|
2280 | - if( $relation_obj instanceof EE_Belongs_To_Relation ) { |
|
2281 | - $classname = 'EE_' . $this->get_model()->get_this_model_name(); |
|
2282 | - if( $this->get_one_from_cache( $relation_name ) instanceof $classname && |
|
2283 | - $this->get_one_from_cache( $relation_name )->ID() ) { |
|
2284 | - $this->clear_cache( $relation_name, $this->get_one_from_cache( $relation_name )->ID() ); |
|
2279 | + foreach ($this->get_model()->relation_settings() as $relation_name => $relation_obj) { |
|
2280 | + if ($relation_obj instanceof EE_Belongs_To_Relation) { |
|
2281 | + $classname = 'EE_'.$this->get_model()->get_this_model_name(); |
|
2282 | + if ($this->get_one_from_cache($relation_name) instanceof $classname && |
|
2283 | + $this->get_one_from_cache($relation_name)->ID()) { |
|
2284 | + $this->clear_cache($relation_name, $this->get_one_from_cache($relation_name)->ID()); |
|
2285 | 2285 | } |
2286 | 2286 | } |
2287 | 2287 | } |
2288 | - return array_keys( get_object_vars( $this ) ); |
|
2288 | + return array_keys(get_object_vars($this)); |
|
2289 | 2289 | } |
2290 | 2290 | |
2291 | 2291 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param array $props_n_values incoming values |
30 | 30 | * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
31 | 31 | * used.) |
32 | - * @param array $date_formats incoming date_formats in an array where the first value is the |
|
32 | + * @param string[] $date_formats incoming date_formats in an array where the first value is the |
|
33 | 33 | * date_format and the second value is the time format |
34 | 34 | * @return EE_Payment |
35 | 35 | */ |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | /** |
291 | 291 | * get Payment Amount |
292 | 292 | * @access public |
293 | - * @return float |
|
293 | + * @return boolean |
|
294 | 294 | */ |
295 | 295 | public function amount() { |
296 | 296 | return $this->get( 'PAY_amount' ); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | /** |
370 | 370 | * Gets redirect_url |
371 | - * @return string |
|
371 | + * @return boolean |
|
372 | 372 | */ |
373 | 373 | function redirect_url() { |
374 | 374 | return $this->get('PAY_redirect_url'); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Gets redirect_args |
381 | - * @return array |
|
381 | + * @return boolean |
|
382 | 382 | */ |
383 | 383 | function redirect_args() { |
384 | 384 | return $this->get('PAY_redirect_args'); |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | /** |
516 | 516 | * Gets all the extra meta info on this payment |
517 | 517 | * @param array $query_params like EEM_Base::get_all |
518 | - * @return EE_Extra_Meta |
|
518 | + * @return EE_Base_Class[] |
|
519 | 519 | */ |
520 | 520 | public function extra_meta( $query_params = array() ) { |
521 | 521 | return $this->get_many_related( 'Extra_Meta', $query_params ); |
@@ -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 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @subpackage includes/classes/EE_Payment.class.php |
23 | 23 | * @author Brent Christensen |
24 | 24 | */ |
25 | -class EE_Payment extends EE_Base_Class implements EEI_Payment{ |
|
25 | +class EE_Payment extends EE_Base_Class implements EEI_Payment { |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | * date_format and the second value is the time format |
34 | 34 | * @return EE_Payment |
35 | 35 | */ |
36 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
37 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
38 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
36 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
37 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
38 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | * the website will be used. |
47 | 47 | * @return EE_Payment |
48 | 48 | */ |
49 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
50 | - return new self( $props_n_values, TRUE, $timezone ); |
|
49 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
50 | + return new self($props_n_values, TRUE, $timezone); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @param int $TXN_ID |
60 | 60 | */ |
61 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
62 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
61 | + public function set_transaction_id($TXN_ID = 0) { |
|
62 | + $this->set('TXN_ID', $TXN_ID); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return EE_Transaction |
70 | 70 | */ |
71 | 71 | public function transaction() { |
72 | - return $this->get_first_related( 'Transaction' ); |
|
72 | + return $this->get_first_related('Transaction'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @access public |
81 | 81 | * @param string $STS_ID |
82 | 82 | */ |
83 | - public function set_status( $STS_ID = '' ) { |
|
84 | - $this->set( 'STS_ID', $STS_ID ); |
|
83 | + public function set_status($STS_ID = '') { |
|
84 | + $this->set('STS_ID', $STS_ID); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | * @access public |
93 | 93 | * @param int $timestamp |
94 | 94 | */ |
95 | - public function set_timestamp( $timestamp = 0 ) { |
|
96 | - $this->set( 'PAY_timestamp', $timestamp ); |
|
95 | + public function set_timestamp($timestamp = 0) { |
|
96 | + $this->set('PAY_timestamp', $timestamp); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @access public |
105 | 105 | * @param string $PAY_source |
106 | 106 | */ |
107 | - public function set_source( $PAY_source = '' ) { |
|
108 | - $this->set('PAY_source',$PAY_source); |
|
107 | + public function set_source($PAY_source = '') { |
|
108 | + $this->set('PAY_source', $PAY_source); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @access public |
117 | 117 | * @param float $amount |
118 | 118 | */ |
119 | - public function set_amount( $amount = 0.00 ) { |
|
120 | - $this->set( 'PAY_amount', $amount ); |
|
119 | + public function set_amount($amount = 0.00) { |
|
120 | + $this->set('PAY_amount', $amount); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | * @access public |
129 | 129 | * @param string $gateway_response |
130 | 130 | */ |
131 | - public function set_gateway_response( $gateway_response = '' ) { |
|
132 | - $this->set( 'PAY_gateway_response', $gateway_response ); |
|
131 | + public function set_gateway_response($gateway_response = '') { |
|
132 | + $this->set('PAY_gateway_response', $gateway_response); |
|
133 | 133 | } |
134 | 134 | /** |
135 | 135 | * Returns the name of the paymetn method used on this payment (previously known merely as 'gateway') |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | * @deprecated |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function gateway(){ |
|
142 | - EE_Error::doing_it_wrong('EE_Payment::gateway', __( 'The method EE_Payment::gateway() has been deprecated. Consider instead using EE_Payment::payment_method()->name()', 'event_espresso' ), '4.6.0' ); |
|
143 | - if( $this->payment_method() ){ |
|
141 | + public function gateway() { |
|
142 | + EE_Error::doing_it_wrong('EE_Payment::gateway', __('The method EE_Payment::gateway() has been deprecated. Consider instead using EE_Payment::payment_method()->name()', 'event_espresso'), '4.6.0'); |
|
143 | + if ($this->payment_method()) { |
|
144 | 144 | return $this->payment_method()->name(); |
145 | - }else{ |
|
146 | - return __( 'Unknown', 'event_espresso' ); |
|
145 | + } else { |
|
146 | + return __('Unknown', 'event_espresso'); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @access public |
156 | 156 | * @param string $txn_id_chq_nmbr |
157 | 157 | */ |
158 | - public function set_txn_id_chq_nmbr( $txn_id_chq_nmbr = '' ) { |
|
159 | - $this->set( 'PAY_txn_id_chq_nmbr', $txn_id_chq_nmbr ); |
|
158 | + public function set_txn_id_chq_nmbr($txn_id_chq_nmbr = '') { |
|
159 | + $this->set('PAY_txn_id_chq_nmbr', $txn_id_chq_nmbr); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @access public |
168 | 168 | * @param string $po_number |
169 | 169 | */ |
170 | - public function set_po_number( $po_number = '' ) { |
|
171 | - $this->set( 'PAY_po_number', $po_number ); |
|
170 | + public function set_po_number($po_number = '') { |
|
171 | + $this->set('PAY_po_number', $po_number); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * @access public |
180 | 180 | * @param string $extra_accntng |
181 | 181 | */ |
182 | - public function set_extra_accntng( $extra_accntng = '' ) { |
|
183 | - $this->set( 'PAY_extra_accntng', $extra_accntng ); |
|
182 | + public function set_extra_accntng($extra_accntng = '') { |
|
183 | + $this->set('PAY_extra_accntng', $extra_accntng); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | * @access public |
192 | 192 | * @param bool $via_admin |
193 | 193 | */ |
194 | - public function set_payment_made_via_admin( $via_admin = FALSE ) { |
|
195 | - if($via_admin){ |
|
196 | - $this->set('PAY_source', EEM_Payment_Method::scope_admin); |
|
197 | - }else{ |
|
194 | + public function set_payment_made_via_admin($via_admin = FALSE) { |
|
195 | + if ($via_admin) { |
|
196 | + $this->set('PAY_source', EEM_Payment_Method::scope_admin); |
|
197 | + } else { |
|
198 | 198 | $this->set('PAY_source', EEM_Payment_Method::scope_cart); |
199 | 199 | } |
200 | 200 | |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | * @access public |
209 | 209 | * @param string $details |
210 | 210 | */ |
211 | - public function set_details( $details = '' ) { |
|
212 | - if ( is_array( $details ) ) { |
|
213 | - array_walk_recursive( $details, array( $this, '_strip_all_tags_within_array' )); |
|
211 | + public function set_details($details = '') { |
|
212 | + if (is_array($details)) { |
|
213 | + array_walk_recursive($details, array($this, '_strip_all_tags_within_array')); |
|
214 | 214 | } else { |
215 | - $details = wp_strip_all_tags( $details ); |
|
215 | + $details = wp_strip_all_tags($details); |
|
216 | 216 | } |
217 | - $this->set( 'PAY_details', $details ); |
|
217 | + $this->set('PAY_details', $details); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @access public |
241 | 241 | */ |
242 | 242 | public function TXN_ID() { |
243 | - return $this->get( 'TXN_ID' ); |
|
243 | + return $this->get('TXN_ID'); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | * @param null $date_or_time |
272 | 272 | * @return string |
273 | 273 | */ |
274 | - public function timestamp( $dt_frmt = '', $tm_frmt = '', $date_or_time = NULL ) { |
|
275 | - return $this->get_datetime('PAY_timestamp', $dt_frmt, $tm_frmt, $date_or_time ); |
|
274 | + public function timestamp($dt_frmt = '', $tm_frmt = '', $date_or_time = NULL) { |
|
275 | + return $this->get_datetime('PAY_timestamp', $dt_frmt, $tm_frmt, $date_or_time); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @return float |
294 | 294 | */ |
295 | 295 | public function amount() { |
296 | - return $this->get( 'PAY_amount' ); |
|
296 | + return $this->get('PAY_amount'); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * @return mixed |
303 | 303 | */ |
304 | 304 | public function amount_no_code() { |
305 | - return $this->get_pretty( 'PAY_amount', 'no_currency_code' ); |
|
305 | + return $this->get_pretty('PAY_amount', 'no_currency_code'); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @access public |
313 | 313 | */ |
314 | 314 | public function gateway_response() { |
315 | - return $this->get( 'PAY_gateway_response' ); |
|
315 | + return $this->get('PAY_gateway_response'); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @access public |
323 | 323 | */ |
324 | 324 | public function txn_id_chq_nmbr() { |
325 | - return $this->get( 'PAY_txn_id_chq_nmbr' ); |
|
325 | + return $this->get('PAY_txn_id_chq_nmbr'); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @access public |
333 | 333 | */ |
334 | 334 | public function po_number() { |
335 | - return $this->get( 'PAY_po_number' ); |
|
335 | + return $this->get('PAY_po_number'); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * @access public |
343 | 343 | */ |
344 | 344 | public function extra_accntng() { |
345 | - return $this->get( 'PAY_extra_accntng' ); |
|
345 | + return $this->get('PAY_extra_accntng'); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @access public |
363 | 363 | */ |
364 | 364 | public function details() { |
365 | - return $this->get( 'PAY_details' ); |
|
365 | + return $this->get('PAY_details'); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -391,8 +391,8 @@ discard block |
||
391 | 391 | * @param bool $show_icons |
392 | 392 | * @return void |
393 | 393 | */ |
394 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
395 | - echo $this->pretty_status( $show_icons ); |
|
394 | + public function e_pretty_status($show_icons = FALSE) { |
|
395 | + echo $this->pretty_status($show_icons); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | * @param bool $show_icons |
403 | 403 | * @return string |
404 | 404 | */ |
405 | - public function pretty_status( $show_icons = FALSE ) { |
|
406 | - $status = EEM_Status::instance()->localized_status( array( $this->STS_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
405 | + public function pretty_status($show_icons = FALSE) { |
|
406 | + $status = EEM_Status::instance()->localized_status(array($this->STS_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
407 | 407 | $icon = ''; |
408 | - switch ( $this->STS_ID() ) { |
|
408 | + switch ($this->STS_ID()) { |
|
409 | 409 | case EEM_Payment::status_id_approved: |
410 | 410 | $icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : ''; |
411 | 411 | break; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | $icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : ''; |
420 | 420 | break; |
421 | 421 | } |
422 | - return $icon . $status[ $this->STS_ID() ]; |
|
422 | + return $icon.$status[$this->STS_ID()]; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * @return boolean whether the payment is approved or not |
431 | 431 | */ |
432 | 432 | public function is_approved() { |
433 | - return $this->status_is( EEM_Payment::status_id_approved ); |
|
433 | + return $this->status_is(EEM_Payment::status_id_approved); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -442,8 +442,8 @@ discard block |
||
442 | 442 | * one of the status_id_* on the EEM_Payment model |
443 | 443 | * @return boolean whether the status of this payment equals the status id |
444 | 444 | */ |
445 | - protected function status_is( $STS_ID ) { |
|
446 | - if ( $STS_ID == $this->STS_ID() ) { |
|
445 | + protected function status_is($STS_ID) { |
|
446 | + if ($STS_ID == $this->STS_ID()) { |
|
447 | 447 | return TRUE; |
448 | 448 | } else { |
449 | 449 | return FALSE; |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @return boolean whether the payment is pending or not |
458 | 458 | */ |
459 | 459 | public function is_pending() { |
460 | - return $this->status_is( EEM_Payment::status_id_pending ); |
|
460 | + return $this->status_is(EEM_Payment::status_id_pending); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | * @return boolean |
468 | 468 | */ |
469 | 469 | public function is_cancelled() { |
470 | - return $this->status_is( EEM_Payment::status_id_cancelled ); |
|
470 | + return $this->status_is(EEM_Payment::status_id_cancelled); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @return boolean |
478 | 478 | */ |
479 | 479 | public function is_declined() { |
480 | - return $this->status_is( EEM_Payment::status_id_declined ); |
|
480 | + return $this->status_is(EEM_Payment::status_id_declined); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | * @return boolean |
488 | 488 | */ |
489 | 489 | public function is_failed() { |
490 | - return $this->status_is( EEM_Payment::status_id_failed ); |
|
490 | + return $this->status_is(EEM_Payment::status_id_failed); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | * @return EE_Status |
508 | 508 | */ |
509 | 509 | public function status_obj() { |
510 | - return $this->get_first_related( 'Status' ); |
|
510 | + return $this->get_first_related('Status'); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | * @param array $query_params like EEM_Base::get_all |
518 | 518 | * @return EE_Extra_Meta |
519 | 519 | */ |
520 | - public function extra_meta( $query_params = array() ) { |
|
521 | - return $this->get_many_related( 'Extra_Meta', $query_params ); |
|
520 | + public function extra_meta($query_params = array()) { |
|
521 | + return $this->get_many_related('Extra_Meta', $query_params); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * offline ones, dont' create payments) |
530 | 530 | * @return EE_Payment_Method |
531 | 531 | */ |
532 | - function payment_method(){ |
|
532 | + function payment_method() { |
|
533 | 533 | return $this->get_first_related('Payment_Method'); |
534 | 534 | } |
535 | 535 | |
@@ -546,12 +546,12 @@ discard block |
||
546 | 546 | * @param string $inside_form_html |
547 | 547 | * @return string html |
548 | 548 | */ |
549 | - function redirect_form( $inside_form_html = NULL ) { |
|
549 | + function redirect_form($inside_form_html = NULL) { |
|
550 | 550 | $redirect_url = $this->redirect_url(); |
551 | - if ( ! empty( $redirect_url )) { |
|
551 | + if ( ! empty($redirect_url)) { |
|
552 | 552 | EE_Registry::instance()->load_helper('HTML'); |
553 | 553 | // what ? no inner form content? |
554 | - if( $inside_form_html === NULL ) { |
|
554 | + if ($inside_form_html === NULL) { |
|
555 | 555 | $inside_form_html = EEH_HTML::p( |
556 | 556 | sprintf( |
557 | 557 | __('If you are not automatically redirected to the payment website within 10 seconds... %1$s %2$s Click Here %3$s', 'event_espresso'), |
@@ -569,17 +569,17 @@ discard block |
||
569 | 569 | ); |
570 | 570 | //if it's a GET request, we need to remove all the GET params in the querystring |
571 | 571 | //and put them into the form instead |
572 | - if( $method == 'GET' ) { |
|
573 | - $querystring = parse_url( $redirect_url, PHP_URL_QUERY ); |
|
572 | + if ($method == 'GET') { |
|
573 | + $querystring = parse_url($redirect_url, PHP_URL_QUERY); |
|
574 | 574 | $get_params = null; |
575 | - parse_str( $querystring, $get_params ); |
|
576 | - $inside_form_html .= $this->_args_as_inputs( $get_params ); |
|
577 | - $redirect_url = str_replace( '?' . $querystring, '', $redirect_url ); |
|
575 | + parse_str($querystring, $get_params); |
|
576 | + $inside_form_html .= $this->_args_as_inputs($get_params); |
|
577 | + $redirect_url = str_replace('?'.$querystring, '', $redirect_url); |
|
578 | 578 | } |
579 | - $form = EEH_HTML::nl(1) . '<form method="' . $method . '" name="gateway_form" action="' . $redirect_url . '">'; |
|
580 | - $form .= EEH_HTML::nl(1) . $this->redirect_args_as_inputs(); |
|
579 | + $form = EEH_HTML::nl(1).'<form method="'.$method.'" name="gateway_form" action="'.$redirect_url.'">'; |
|
580 | + $form .= EEH_HTML::nl(1).$this->redirect_args_as_inputs(); |
|
581 | 581 | $form .= $inside_form_html; |
582 | - $form .= EEH_HTML::nl(-1) . '</form>' . EEH_HTML::nl(-1); |
|
582 | + $form .= EEH_HTML::nl(-1).'</form>'.EEH_HTML::nl(-1); |
|
583 | 583 | return $form; |
584 | 584 | } else { |
585 | 585 | return NULL; |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | * and returns the html as a string |
595 | 595 | * @return string |
596 | 596 | */ |
597 | - function redirect_args_as_inputs(){ |
|
598 | - return $this->_args_as_inputs( $this->redirect_args() ); |
|
597 | + function redirect_args_as_inputs() { |
|
598 | + return $this->_args_as_inputs($this->redirect_args()); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | /** |
@@ -604,12 +604,12 @@ discard block |
||
604 | 604 | * @param array $args key-value pairs |
605 | 605 | * @return string |
606 | 606 | */ |
607 | - protected function _args_as_inputs( $args ) { |
|
607 | + protected function _args_as_inputs($args) { |
|
608 | 608 | $html = ''; |
609 | - if( $args !== NULL && is_array( $args )) { |
|
609 | + if ($args !== NULL && is_array($args)) { |
|
610 | 610 | EE_Registry::instance()->load_helper('HTML'); |
611 | - foreach( $args as $name => $value){ |
|
612 | - $html .= EEH_HTML::nl(0) . '<input type="hidden" name="' . $name . '" value="' . esc_attr( $value ) . '"/>'; |
|
611 | + foreach ($args as $name => $value) { |
|
612 | + $html .= EEH_HTML::nl(0).'<input type="hidden" name="'.$name.'" value="'.esc_attr($value).'"/>'; |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | return $html; |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | * object itself) |
625 | 625 | * @return string for the currency code |
626 | 626 | */ |
627 | - public function currency_code(){ |
|
627 | + public function currency_code() { |
|
628 | 628 | return EE_Config::instance()->currency->code; |
629 | 629 | } |
630 | 630 | |
@@ -638,14 +638,14 @@ discard block |
||
638 | 638 | * @access private |
639 | 639 | * @param mixed $item |
640 | 640 | */ |
641 | - private function _strip_all_tags_within_array( &$item ) { |
|
642 | - if( is_object( $item ) ) { |
|
641 | + private function _strip_all_tags_within_array(&$item) { |
|
642 | + if (is_object($item)) { |
|
643 | 643 | $item = (array) $item; |
644 | 644 | } |
645 | - if( is_array( $item ) ){ |
|
646 | - array_walk_recursive( $item, array( $this, '_strip_all_tags_within_array' ) ); |
|
647 | - }else{ |
|
648 | - $item = wp_strip_all_tags( $item ); |
|
645 | + if (is_array($item)) { |
|
646 | + array_walk_recursive($item, array($this, '_strip_all_tags_within_array')); |
|
647 | + } else { |
|
648 | + $item = wp_strip_all_tags($item); |
|
649 | 649 | } |
650 | 650 | } |
651 | 651 | |
@@ -654,13 +654,13 @@ discard block |
||
654 | 654 | * is approved and was created during this request). False otherwise. |
655 | 655 | * @return boolean |
656 | 656 | */ |
657 | - public function just_approved(){ |
|
658 | - EE_Registry::instance()->load_helper( 'Array' ); |
|
659 | - $original_status =EEH_Array::is_set( $this->_props_n_values_provided_in_constructor, 'STS_ID', $this->get_model()->field_settings_for( 'STS_ID' )->get_default_value() ); |
|
657 | + public function just_approved() { |
|
658 | + EE_Registry::instance()->load_helper('Array'); |
|
659 | + $original_status = EEH_Array::is_set($this->_props_n_values_provided_in_constructor, 'STS_ID', $this->get_model()->field_settings_for('STS_ID')->get_default_value()); |
|
660 | 660 | $current_status = $this->status(); |
661 | - if( $original_status !== EEM_Payment::status_id_approved && $current_status === EEM_Payment::status_id_approved ){ |
|
661 | + if ($original_status !== EEM_Payment::status_id_approved && $current_status === EEM_Payment::status_id_approved) { |
|
662 | 662 | return TRUE; |
663 | - }else{ |
|
663 | + } else { |
|
664 | 664 | return FALSE; |
665 | 665 | } |
666 | 666 | } |
@@ -672,11 +672,11 @@ discard block |
||
672 | 672 | * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property (in cases where the same property may be used for different outputs - i.e. datetime, money etc.) |
673 | 673 | * @return mixed |
674 | 674 | */ |
675 | - public function get_pretty($field_name, $extra_cache_ref = NULL){ |
|
676 | - if( $field_name == 'PAY_gateway' ){ |
|
675 | + public function get_pretty($field_name, $extra_cache_ref = NULL) { |
|
676 | + if ($field_name == 'PAY_gateway') { |
|
677 | 677 | return $this->gateway(); |
678 | 678 | } |
679 | - return $this->_get_cached_property( $field_name, TRUE, $extra_cache_ref ); |
|
679 | + return $this->_get_cached_property($field_name, TRUE, $extra_cache_ref); |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | |
@@ -686,8 +686,8 @@ discard block |
||
686 | 686 | * @param array $query_params like EEM_Base::get_all |
687 | 687 | * @return EE_Registration_Payment[] |
688 | 688 | */ |
689 | - public function registration_payments( $query_params = array() ) { |
|
690 | - return $this->get_many_related( 'Registration_Payment', $query_params ); |
|
689 | + public function registration_payments($query_params = array()) { |
|
690 | + return $this->get_many_related('Registration_Payment', $query_params); |
|
691 | 691 | } |
692 | 692 | |
693 | 693 |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Registrations_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
61 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' )); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | + add_action('wp_loaded', array($this, 'wp_loaded')); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | public function wp_loaded() { |
67 | 67 | // when adding a new registration... |
68 | - if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) { |
|
68 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') { |
|
69 | 69 | EE_System::do_not_cache(); |
70 | 70 | if ( |
71 | - ! isset( $this->_req_data[ 'processing_registration' ] ) |
|
72 | - || absint( $this->_req_data[ 'processing_registration' ] ) !== 1 |
|
71 | + ! isset($this->_req_data['processing_registration']) |
|
72 | + || absint($this->_req_data['processing_registration']) !== 1 |
|
73 | 73 | ) { |
74 | 74 | // and it's NOT the attendee information reg step |
75 | 75 | // force cookie expiration by setting time to last week |
76 | - setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' ); |
|
76 | + setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
77 | 77 | // and update the global |
78 | - $_COOKIE[ 'ee_registration_added' ] = 0; |
|
78 | + $_COOKIE['ee_registration_added'] = 0; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | 'trash' => 'post.php' |
110 | 110 | ); |
111 | 111 | |
112 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
112 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
113 | 113 | //add filters so that the comment urls don't take users to a confusing 404 page |
114 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
114 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | - public function clear_comment_link( $link, $comment, $args ) { |
|
118 | + public function clear_comment_link($link, $comment, $args) { |
|
119 | 119 | //gotta make sure this only happens on this route |
120 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
121 | - if ( $post_type == 'espresso_attendees' ) |
|
120 | + $post_type = get_post_type($comment->comment_post_ID); |
|
121 | + if ($post_type == 'espresso_attendees') |
|
122 | 122 | return '#commentsdiv'; |
123 | 123 | return $link; |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function _ajax_hooks() { |
128 | 128 | //todo: all hooks for registrations ajax goes in here |
129 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
129 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
142 | 142 | 'edit' => __('Edit Contact', 'event_espresso'), |
143 | 143 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
144 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
145 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
144 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
145 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
146 | 146 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
147 | 147 | ), |
148 | 148 | 'publishbox' => array( |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
172 | 172 | |
173 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
173 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
176 | 176 | |
177 | 177 | $this->_page_routes = array( |
178 | 178 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | 'restore_registrations' => array( |
207 | 207 | 'func' => '_trash_or_restore_registrations', |
208 | - 'args' => array( 'trash' => FALSE ), |
|
208 | + 'args' => array('trash' => FALSE), |
|
209 | 209 | 'noheader' => TRUE, |
210 | 210 | 'capability' => 'ee_delete_registrations' |
211 | 211 | ), |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'filename' => 'registrations_overview_other' |
438 | 438 | ) |
439 | 439 | ), |
440 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
440 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
441 | 441 | 'qtips' => array('Registration_List_Table_Tips'), |
442 | 442 | 'list_table' => 'EE_Registrations_List_Table', |
443 | 443 | 'require_nonce' => FALSE |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | 'nav' => array( |
448 | 448 | 'label' => __('REG Details', 'event_espresso'), |
449 | 449 | 'order' => 15, |
450 | - 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
450 | + 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
451 | 451 | 'persistent' => FALSE |
452 | 452 | ), |
453 | 453 | 'help_tabs' => array( |
@@ -468,8 +468,8 @@ discard block |
||
468 | 468 | 'filename' => 'registrations_details_registrant_details' |
469 | 469 | ) |
470 | 470 | ), |
471 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
472 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
471 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
472 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
473 | 473 | 'require_nonce' => FALSE |
474 | 474 | ), |
475 | 475 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | 'order' => 15, |
494 | 494 | 'persistent' => FALSE |
495 | 495 | ), |
496 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
496 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
497 | 497 | 'require_nonce' => FALSE |
498 | 498 | ), |
499 | 499 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | 'label' => __('Edit Contact', 'event_espresso'), |
503 | 503 | 'order' => 15, |
504 | 504 | 'persistent' => FALSE, |
505 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
505 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
506 | 506 | ), |
507 | 507 | 'metaboxes' => array('attendee_editor_metaboxes'), |
508 | 508 | 'require_nonce' => FALSE |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | 'filename' => 'registrations_contact_list_other' |
533 | 533 | ) |
534 | 534 | ), |
535 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
535 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
536 | 536 | 'metaboxes' => array(), |
537 | 537 | 'require_nonce' => FALSE |
538 | 538 | ), |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | protected function _add_screen_options() {} |
552 | 552 | protected function _add_feature_pointers() {} |
553 | 553 | public function admin_init() { |
554 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
554 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
555 | 555 | } |
556 | 556 | public function admin_notices() {} |
557 | 557 | public function admin_footer_scripts() {} |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | * @return void |
570 | 570 | */ |
571 | 571 | private function _get_registration_status_array() { |
572 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
572 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | |
@@ -592,11 +592,11 @@ discard block |
||
592 | 592 | public function load_scripts_styles() { |
593 | 593 | //style |
594 | 594 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
595 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
595 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
596 | 596 | wp_enqueue_style('espresso_reg'); |
597 | 597 | |
598 | 598 | //script |
599 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
599 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
600 | 600 | wp_enqueue_script('espresso_reg'); |
601 | 601 | } |
602 | 602 | |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | public function load_scripts_styles_edit_attendee() { |
606 | 606 | //stuff to only show up on our attendee edit details page. |
607 | 607 | $attendee_details_translations = array( |
608 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
608 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
609 | 609 | ); |
610 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
610 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
611 | 611 | wp_enqueue_script('jquery-validate'); |
612 | 612 | } |
613 | 613 | |
@@ -616,8 +616,8 @@ discard block |
||
616 | 616 | //styles |
617 | 617 | wp_enqueue_style('espresso-ui-theme'); |
618 | 618 | //scripts |
619 | - $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
620 | - $this->_reg_custom_questions_form->wp_enqueue_scripts( true ); |
|
619 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
620 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | |
628 | 628 | public function load_scripts_styles_contact_list() { |
629 | 629 | wp_deregister_style('espresso_reg'); |
630 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
630 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
631 | 631 | wp_enqueue_style('espresso_att'); |
632 | 632 | } |
633 | 633 | |
@@ -636,9 +636,9 @@ discard block |
||
636 | 636 | |
637 | 637 | |
638 | 638 | public function load_scripts_styles_new_registration() { |
639 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
639 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
640 | 640 | wp_enqueue_script('ee-spco-for-admin'); |
641 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
641 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
642 | 642 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
643 | 643 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
644 | 644 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -677,23 +677,23 @@ discard block |
||
677 | 677 | |
678 | 678 | /** setup reg status bulk actions **/ |
679 | 679 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
680 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
680 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
681 | 681 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
682 | 682 | } |
683 | 683 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
684 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
684 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
685 | 685 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
686 | 686 | } |
687 | 687 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
688 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
688 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
689 | 689 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
690 | 690 | } |
691 | 691 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
692 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
692 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
693 | 693 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
694 | 694 | } |
695 | 695 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
696 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
696 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
697 | 697 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
698 | 698 | } |
699 | 699 | |
@@ -702,29 +702,29 @@ discard block |
||
702 | 702 | 'slug' => 'all', |
703 | 703 | 'label' => __('View All Registrations', 'event_espresso'), |
704 | 704 | 'count' => 0, |
705 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
705 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
706 | 706 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
707 | - ) ) |
|
707 | + )) |
|
708 | 708 | ), |
709 | 709 | 'month' => array( |
710 | 710 | 'slug' => 'month', |
711 | 711 | 'label' => __('This Month', 'event_espresso'), |
712 | 712 | 'count' => 0, |
713 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
713 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
714 | 714 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
715 | 715 | )) |
716 | 716 | ), |
717 | 717 | 'today' => array( |
718 | 718 | 'slug' => 'today', |
719 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
719 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
720 | 720 | 'count' => 0, |
721 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
721 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
722 | 722 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
723 | 723 | )) |
724 | 724 | ) |
725 | 725 | ); |
726 | 726 | |
727 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
727 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
728 | 728 | $this->_views['incomplete'] = array( |
729 | 729 | 'slug' => 'incomplete', |
730 | 730 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | ) |
761 | 761 | ); |
762 | 762 | |
763 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
763 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
764 | 764 | $this->_views['trash'] = array( |
765 | 765 | 'slug' => 'trash', |
766 | 766 | 'label' => __('Trash', 'event_espresso'), |
@@ -799,42 +799,42 @@ discard block |
||
799 | 799 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
800 | 800 | ), |
801 | 801 | ); |
802 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
802 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
803 | 803 | $fc_items['resend_registration'] = array( |
804 | 804 | 'class' => 'dashicons dashicons-email-alt', |
805 | 805 | 'desc' => __('Resend Registration Details', 'event_espresso') |
806 | 806 | ); |
807 | 807 | } else { |
808 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
808 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | $sc_items = array( |
812 | 812 | 'approved_status' => array( |
813 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
814 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
813 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
814 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
815 | 815 | ), |
816 | 816 | 'pending_status' => array( |
817 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
818 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
817 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
818 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
819 | 819 | ), |
820 | 820 | 'incomplete_status' => array( |
821 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
822 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
821 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
822 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
823 | 823 | ), |
824 | 824 | 'not_approved' => array( |
825 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
826 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
825 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
826 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
827 | 827 | ), |
828 | 828 | 'declined_status' => array( |
829 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
830 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
829 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
830 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
831 | 831 | ), |
832 | 832 | 'cancelled_status' => array( |
833 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
834 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
833 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
834 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
835 | 835 | ) |
836 | 836 | ); |
837 | - return array_merge( $fc_items, $sc_items ); |
|
837 | + return array_merge($fc_items, $sc_items); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | |
@@ -847,15 +847,15 @@ discard block |
||
847 | 847 | |
848 | 848 | |
849 | 849 | protected function _registrations_overview_list_table() { |
850 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
851 | - if ( $EVT_ID ) { |
|
852 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
853 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
850 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
851 | + if ($EVT_ID) { |
|
852 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
853 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
854 | 854 | } |
855 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
856 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
855 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
856 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
857 | 857 | } |
858 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
858 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
859 | 859 | $this->display_admin_list_table_page_with_no_sidebar(); |
860 | 860 | } |
861 | 861 | |
@@ -870,19 +870,19 @@ discard block |
||
870 | 870 | */ |
871 | 871 | private function _set_registration_object() { |
872 | 872 | //get out if we've already set the object |
873 | - if ( is_object( $this->_registration )) { |
|
873 | + if (is_object($this->_registration)) { |
|
874 | 874 | return TRUE; |
875 | 875 | } |
876 | 876 | |
877 | 877 | $REG = EEM_Registration::instance(); |
878 | 878 | |
879 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
879 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
880 | 880 | |
881 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
881 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
882 | 882 | return TRUE; |
883 | 883 | else { |
884 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
885 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
884 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
885 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
886 | 886 | $this->_registration = NULL; |
887 | 887 | return FALSE; |
888 | 888 | } |
@@ -901,25 +901,25 @@ discard block |
||
901 | 901 | * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set) |
902 | 902 | * @return mixed (int|array) int = count || array of registration objects |
903 | 903 | */ |
904 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
905 | - |
|
906 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
907 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
908 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
909 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
910 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
911 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
904 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
905 | + |
|
906 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
907 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
908 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
909 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
910 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
911 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
912 | 912 | $start_date = FALSE; |
913 | 913 | $end_date = FALSE; |
914 | 914 | $_where = array(); |
915 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
916 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
915 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
916 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
917 | 917 | |
918 | 918 | //set orderby |
919 | 919 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
920 | 920 | |
921 | 921 | |
922 | - switch ( $this->_req_data['orderby'] ) { |
|
922 | + switch ($this->_req_data['orderby']) { |
|
923 | 923 | case '_REG_ID': |
924 | 924 | $orderby = 'REG_ID'; |
925 | 925 | break; |
@@ -939,26 +939,26 @@ discard block |
||
939 | 939 | $orderby = 'REG_date'; |
940 | 940 | } |
941 | 941 | |
942 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
943 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
944 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
942 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
943 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
944 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
945 | 945 | |
946 | 946 | |
947 | - $offset = ($current_page-1)*$per_page; |
|
948 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
947 | + $offset = ($current_page - 1) * $per_page; |
|
948 | + $limit = $count ? NULL : array($offset, $per_page); |
|
949 | 949 | |
950 | - if($EVT_ID){ |
|
951 | - $_where['EVT_ID']=$EVT_ID; |
|
950 | + if ($EVT_ID) { |
|
951 | + $_where['EVT_ID'] = $EVT_ID; |
|
952 | 952 | } |
953 | - if($CAT_ID){ |
|
953 | + if ($CAT_ID) { |
|
954 | 954 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
955 | 955 | } |
956 | - if ( $incomplete ) { |
|
956 | + if ($incomplete) { |
|
957 | 957 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
958 | 958 | } else if ( ! $trash) { |
959 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
959 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
960 | 960 | } |
961 | - if($reg_status){ |
|
961 | + if ($reg_status) { |
|
962 | 962 | $_where['STS_ID'] = $reg_status; |
963 | 963 | } |
964 | 964 | |
@@ -970,105 +970,105 @@ discard block |
||
970 | 970 | $time_start = ' 00:00:00'; |
971 | 971 | $time_end = ' 23:59:59'; |
972 | 972 | |
973 | - if($today_a || $today ){ |
|
973 | + if ($today_a || $today) { |
|
974 | 974 | $curdate = date('Y-m-d', current_time('timestamp')); |
975 | - $_where['REG_date']= array('BETWEEN', |
|
975 | + $_where['REG_date'] = array('BETWEEN', |
|
976 | 976 | array( |
977 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
978 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
977 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
978 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
979 | 979 | )); |
980 | - }elseif($this_month_a || $this_month){ |
|
980 | + }elseif ($this_month_a || $this_month) { |
|
981 | 981 | $this_month_r = date('m', current_time('timestamp')); |
982 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
983 | - $_where['REG_date']= array('BETWEEN', |
|
982 | + $days_this_month = date('t', current_time('timestamp')); |
|
983 | + $_where['REG_date'] = array('BETWEEN', |
|
984 | 984 | array( |
985 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
986 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
985 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
986 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
987 | 987 | )); |
988 | - }elseif($month_range){ |
|
988 | + }elseif ($month_range) { |
|
989 | 989 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
990 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
991 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
992 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
993 | - $_where['REG_date']= array('BETWEEN', |
|
994 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
995 | - }elseif($start_date && $end_date){ |
|
990 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
991 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
992 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
993 | + $_where['REG_date'] = array('BETWEEN', |
|
994 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
995 | + }elseif ($start_date && $end_date) { |
|
996 | 996 | throw new EE_Error("not yet supported"); |
997 | - }elseif($start_date){ |
|
997 | + }elseif ($start_date) { |
|
998 | 998 | throw new EE_Error("not yet supported"); |
999 | - }elseif($end_date){ |
|
999 | + }elseif ($end_date) { |
|
1000 | 1000 | throw new EE_Error("not yet supported"); |
1001 | 1001 | } |
1002 | 1002 | |
1003 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
1004 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1003 | + if ( ! empty($this->_req_data['s'])) { |
|
1004 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1005 | 1005 | $_where['OR'] = array( |
1006 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
1007 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1008 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
1009 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
1010 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1011 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1012 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1013 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
1014 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1015 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1016 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1017 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1018 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1019 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1020 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1021 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1022 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
1023 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
1006 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1007 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1008 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1009 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
1010 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1011 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1012 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1013 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1014 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1015 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1016 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1017 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1018 | + 'REG_code' => array('LIKE', $sstr), |
|
1019 | + 'REG_count' => array('LIKE', $sstr), |
|
1020 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1021 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1022 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
1023 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
1024 | 1024 | ); |
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | //capability checks |
1028 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
1028 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
1029 | 1029 | $_where['AND'] = array( |
1030 | 1030 | 'Event.EVT_wp_user' => get_current_user_id() |
1031 | 1031 | ); |
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | |
1035 | - if( $count ){ |
|
1036 | - if ( $trash ) { |
|
1037 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1038 | - } else if ( $incomplete ) { |
|
1039 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1035 | + if ($count) { |
|
1036 | + if ($trash) { |
|
1037 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1038 | + } else if ($incomplete) { |
|
1039 | + return EEM_Registration::instance()->count(array($_where)); |
|
1040 | 1040 | } else { |
1041 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1041 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1042 | 1042 | } |
1043 | 1043 | } else { |
1044 | 1044 | //make sure we remove default where conditions cause all registrations matching query are returned |
1045 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1046 | - if ( $per_page !== -1 ) { |
|
1045 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1046 | + if ($per_page !== -1) { |
|
1047 | 1047 | $query_params['limit'] = $limit; |
1048 | 1048 | } |
1049 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1049 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1050 | 1050 | |
1051 | 1051 | |
1052 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1052 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1053 | 1053 | $first_registration = $registrations[0]; |
1054 | 1054 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1055 | 1055 | $event_name = $first_registration->event_obj()->name(); |
1056 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1056 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1057 | 1057 | // edit event link |
1058 | - if ( $event_name != '' ) { |
|
1059 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1060 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1061 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1058 | + if ($event_name != '') { |
|
1059 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1060 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1061 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1062 | 1062 | } |
1063 | 1063 | |
1064 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1065 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1064 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1065 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1066 | 1066 | |
1067 | 1067 | $this->_template_args['before_admin_page_content'] = ' |
1068 | 1068 | <div id="admin-page-header"> |
1069 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1070 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1071 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1069 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1070 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1071 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1072 | 1072 | </div> |
1073 | 1073 | '; |
1074 | 1074 | |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | |
1107 | 1107 | $this->_set_registration_object(); |
1108 | 1108 | |
1109 | - if ( is_object( $this->_registration )) { |
|
1109 | + if (is_object($this->_registration)) { |
|
1110 | 1110 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1111 | 1111 | $this->_session = $transaction->session_data(); |
1112 | 1112 | |
@@ -1114,10 +1114,10 @@ discard block |
||
1114 | 1114 | |
1115 | 1115 | |
1116 | 1116 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1117 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1117 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1118 | 1118 | |
1119 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y','g:i:s a') ; |
|
1120 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1119 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a'); |
|
1120 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1121 | 1121 | |
1122 | 1122 | $this->_template_args['grand_total'] = $transaction->total(); |
1123 | 1123 | |
@@ -1125,19 +1125,19 @@ discard block |
||
1125 | 1125 | // link back to overview |
1126 | 1126 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1127 | 1127 | $this->_template_args['registration'] = $this->_registration; |
1128 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1129 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1130 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1128 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1129 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1130 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1131 | 1131 | |
1132 | 1132 | //next and previous links |
1133 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1134 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1135 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1136 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1133 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1134 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1135 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1136 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1137 | 1137 | |
1138 | 1138 | // grab header |
1139 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1140 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1139 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1140 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1141 | 1141 | |
1142 | 1142 | } else { |
1143 | 1143 | |
@@ -1156,17 +1156,17 @@ discard block |
||
1156 | 1156 | |
1157 | 1157 | |
1158 | 1158 | protected function _registration_details_metaboxes() { |
1159 | - do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this ); |
|
1159 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
1160 | 1160 | $this->_set_registration_object(); |
1161 | 1161 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1162 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1163 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1164 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1165 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1162 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1163 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1164 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1165 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1166 | 1166 | } |
1167 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1168 | - if ( $this->_registration->group_size() > 1 ) { |
|
1169 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1167 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1168 | + if ($this->_registration->group_size() > 1) { |
|
1169 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1170 | 1170 | } |
1171 | 1171 | } |
1172 | 1172 | |
@@ -1187,23 +1187,23 @@ discard block |
||
1187 | 1187 | |
1188 | 1188 | //let's get an array of all possible buttons that we can just reference |
1189 | 1189 | $status_buttons = $this->_get_reg_status_buttons(); |
1190 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1191 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1190 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1191 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1192 | 1192 | $template_args['attendee'] = $this->_registration->attendee(); |
1193 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1194 | - if ( $this->_set_registration_object() ) { |
|
1193 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1194 | + if ($this->_set_registration_object()) { |
|
1195 | 1195 | $current_status = $this->_registration->status_ID(); |
1196 | - unset( $status_buttons[$current_status] ); |
|
1197 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1198 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1196 | + unset($status_buttons[$current_status]); |
|
1197 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1198 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1199 | 1199 | } |
1200 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1200 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1201 | 1201 | } |
1202 | 1202 | $template_args['form_url'] = REG_ADMIN_URL; |
1203 | 1203 | $template_args['REG_ID'] = $this->_registration->ID(); |
1204 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1204 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1205 | 1205 | |
1206 | - EEH_Template::display_template( $template, $template_args ); |
|
1206 | + EEH_Template::display_template($template, $template_args); |
|
1207 | 1207 | |
1208 | 1208 | } |
1209 | 1209 | |
@@ -1217,11 +1217,11 @@ discard block |
||
1217 | 1217 | private function _get_reg_status_buttons() { |
1218 | 1218 | |
1219 | 1219 | $buttons = array( |
1220 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1221 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1222 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1223 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1224 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1220 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1221 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1222 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1223 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1224 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1225 | 1225 | ); |
1226 | 1226 | return $buttons; |
1227 | 1227 | } |
@@ -1235,13 +1235,13 @@ discard block |
||
1235 | 1235 | * |
1236 | 1236 | * @return array (array with reg_id(s) updated and whether update was successful. |
1237 | 1237 | */ |
1238 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1239 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1238 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1239 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1240 | 1240 | |
1241 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1241 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1242 | 1242 | |
1243 | 1243 | //notify? |
1244 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1244 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1245 | 1245 | $this->_process_resend_registration(); |
1246 | 1246 | } |
1247 | 1247 | |
@@ -1259,19 +1259,19 @@ discard block |
||
1259 | 1259 | * @param bool $status |
1260 | 1260 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1261 | 1261 | */ |
1262 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1262 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1263 | 1263 | $success = true; |
1264 | 1264 | // set default status if none is passed |
1265 | 1265 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1266 | 1266 | |
1267 | 1267 | //typecast and sanitize reg_id |
1268 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1268 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1269 | 1269 | |
1270 | 1270 | //loop through REG_ID's and change status |
1271 | - foreach ( $reg_ids as $r_id ) { |
|
1272 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1273 | - if ( $registration instanceof EE_Registration ) { |
|
1274 | - $registration->set_status( $status ); |
|
1271 | + foreach ($reg_ids as $r_id) { |
|
1272 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1273 | + if ($registration instanceof EE_Registration) { |
|
1274 | + $registration->set_status($status); |
|
1275 | 1275 | $result = $registration->save(); |
1276 | 1276 | |
1277 | 1277 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1283,7 +1283,7 @@ discard block |
||
1283 | 1283 | $this->_req_data['_REG_ID'] = $reg_ids; |
1284 | 1284 | |
1285 | 1285 | //return $success and processed registrations |
1286 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1286 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | |
@@ -1295,37 +1295,37 @@ discard block |
||
1295 | 1295 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1296 | 1296 | * @return void |
1297 | 1297 | */ |
1298 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1298 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1299 | 1299 | |
1300 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1300 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1301 | 1301 | |
1302 | 1302 | |
1303 | - $success = isset( $result['success'] ) && $result['success']; |
|
1303 | + $success = isset($result['success']) && $result['success']; |
|
1304 | 1304 | |
1305 | 1305 | //setup success message |
1306 | - if ( $success ) { |
|
1307 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1308 | - EE_Error::add_success( $msg ); |
|
1306 | + if ($success) { |
|
1307 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1308 | + EE_Error::add_success($msg); |
|
1309 | 1309 | } else { |
1310 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1310 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1311 | 1311 | } |
1312 | 1312 | |
1313 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1313 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1314 | 1314 | //unset nonces |
1315 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1316 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1317 | - unset( $this->_req_data[$ref] ); |
|
1315 | + foreach ($this->_req_data as $ref => $value) { |
|
1316 | + if (strpos($ref, 'nonce') !== false) { |
|
1317 | + unset($this->_req_data[$ref]); |
|
1318 | 1318 | continue; |
1319 | 1319 | } |
1320 | 1320 | |
1321 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1321 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1322 | 1322 | $this->_req_data[$ref] = $value; |
1323 | 1323 | } |
1324 | 1324 | |
1325 | 1325 | //merge request vars so that the reloaded list table contains any existing filter query params |
1326 | - $route = array_merge( $this->_req_data, $route ); |
|
1326 | + $route = array_merge($this->_req_data, $route); |
|
1327 | 1327 | |
1328 | - $this->_redirect_after_action( false, '', '', $route, true ); |
|
1328 | + $this->_redirect_after_action(false, '', '', $route, true); |
|
1329 | 1329 | } |
1330 | 1330 | |
1331 | 1331 | |
@@ -1337,29 +1337,29 @@ discard block |
||
1337 | 1337 | protected function _change_reg_status() { |
1338 | 1338 | $this->_req_data['return'] = 'view_registration'; |
1339 | 1339 | //set notify based on whether the send notifications toggle is set or not |
1340 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1341 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1340 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1341 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1342 | 1342 | |
1343 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1344 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1345 | - $this->approve_registration( $notify ); |
|
1343 | + switch ($this->_req_data['_reg_status_id']) { |
|
1344 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1345 | + $this->approve_registration($notify); |
|
1346 | 1346 | break; |
1347 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1348 | - $this->pending_registration( $notify ); |
|
1347 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1348 | + $this->pending_registration($notify); |
|
1349 | 1349 | break; |
1350 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1351 | - $this->not_approve_registration( $notify ); |
|
1350 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1351 | + $this->not_approve_registration($notify); |
|
1352 | 1352 | break; |
1353 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1354 | - $this->decline_registration( $notify ); |
|
1353 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1354 | + $this->decline_registration($notify); |
|
1355 | 1355 | break; |
1356 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1357 | - $this->cancel_registration( $notify ); |
|
1356 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1357 | + $this->cancel_registration($notify); |
|
1358 | 1358 | break; |
1359 | 1359 | default : |
1360 | 1360 | $result['success'] = false; |
1361 | - unset( $this->_req_data['return'] ); |
|
1362 | - $this->_reg_status_change_return( '', false ); |
|
1361 | + unset($this->_req_data['return']); |
|
1362 | + $this->_reg_status_change_return('', false); |
|
1363 | 1363 | break; |
1364 | 1364 | } |
1365 | 1365 | } |
@@ -1372,8 +1372,8 @@ discard block |
||
1372 | 1372 | * @param bool $notify whether or not to notify the registrant about their approval. |
1373 | 1373 | * @return void |
1374 | 1374 | */ |
1375 | - protected function approve_registration( $notify = false ) { |
|
1376 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1375 | + protected function approve_registration($notify = false) { |
|
1376 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | |
@@ -1385,8 +1385,8 @@ discard block |
||
1385 | 1385 | * @param bool $notify whether or not to notify the registrant about their approval. |
1386 | 1386 | * @return void |
1387 | 1387 | */ |
1388 | - protected function decline_registration( $notify = false ) { |
|
1389 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1388 | + protected function decline_registration($notify = false) { |
|
1389 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1390 | 1390 | } |
1391 | 1391 | |
1392 | 1392 | |
@@ -1398,8 +1398,8 @@ discard block |
||
1398 | 1398 | * @param bool $notify whether or not to notify the registrant about their approval. |
1399 | 1399 | * @return void |
1400 | 1400 | */ |
1401 | - protected function cancel_registration( $notify = false ) { |
|
1402 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1401 | + protected function cancel_registration($notify = false) { |
|
1402 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1403 | 1403 | } |
1404 | 1404 | |
1405 | 1405 | |
@@ -1412,8 +1412,8 @@ discard block |
||
1412 | 1412 | * @param bool $notify whether or not to notify the registrant about their approval. |
1413 | 1413 | * @return void |
1414 | 1414 | */ |
1415 | - protected function not_approve_registration( $notify = false ) { |
|
1416 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1415 | + protected function not_approve_registration($notify = false) { |
|
1416 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1417 | 1417 | } |
1418 | 1418 | |
1419 | 1419 | |
@@ -1424,8 +1424,8 @@ discard block |
||
1424 | 1424 | * @param bool $notify whether or not to notify the registrant about their approval. |
1425 | 1425 | * @return void |
1426 | 1426 | */ |
1427 | - protected function pending_registration( $notify = false ) { |
|
1428 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1427 | + protected function pending_registration($notify = false) { |
|
1428 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | |
@@ -1439,75 +1439,75 @@ discard block |
||
1439 | 1439 | public function _reg_details_meta_box() { |
1440 | 1440 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1441 | 1441 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1442 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1442 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1443 | 1443 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1444 | 1444 | $this->_session = $transaction->session_data(); |
1445 | 1445 | |
1446 | 1446 | $filters = new EE_Line_Item_Filter_Collection(); |
1447 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1448 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1449 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1447 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1448 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1449 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1450 | 1450 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1451 | 1451 | |
1452 | 1452 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1453 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1454 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1453 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1454 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1455 | 1455 | |
1456 | 1456 | |
1457 | 1457 | $attendee = $this->_registration->attendee(); |
1458 | 1458 | |
1459 | 1459 | |
1460 | - $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; |
|
1461 | - $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; |
|
1460 | + $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; |
|
1461 | + $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; |
|
1462 | 1462 | |
1463 | 1463 | |
1464 | 1464 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1465 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1465 | + $payment = $transaction->get_first_related('Payment'); |
|
1466 | 1466 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1467 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1467 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1468 | 1468 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1469 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1469 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1470 | 1470 | $reg_details = array( |
1471 | 1471 | 'payment_method' => $payment_method->name(), |
1472 | 1472 | 'response_msg' => $payment->gateway_response(), |
1473 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1473 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1474 | 1474 | 'registration_session' => $this->_registration->session_ID(), |
1475 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1476 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1475 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1476 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1477 | 1477 | ); |
1478 | 1478 | |
1479 | 1479 | |
1480 | - if ( isset( $reg_details['registration_id'] )) { |
|
1480 | + if (isset($reg_details['registration_id'])) { |
|
1481 | 1481 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1482 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1482 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1483 | 1483 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1484 | 1484 | } |
1485 | 1485 | |
1486 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1486 | + if (isset($reg_details['payment_method'])) { |
|
1487 | 1487 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1488 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1488 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1489 | 1489 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1490 | 1490 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1491 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1491 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1492 | 1492 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1493 | 1493 | } |
1494 | 1494 | |
1495 | 1495 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1496 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1496 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1497 | 1497 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1498 | 1498 | |
1499 | 1499 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1500 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1500 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1501 | 1501 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1502 | 1502 | |
1503 | 1503 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1504 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1504 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1505 | 1505 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1506 | 1506 | |
1507 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1507 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1508 | 1508 | |
1509 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1510 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1509 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1510 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1511 | 1511 | |
1512 | 1512 | } |
1513 | 1513 | |
@@ -1521,14 +1521,14 @@ discard block |
||
1521 | 1521 | */ |
1522 | 1522 | public function _reg_questions_meta_box() { |
1523 | 1523 | //allow someone to override this method entirely |
1524 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1525 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1526 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1524 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1525 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1526 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1527 | 1527 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1528 | 1528 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1529 | 1529 | |
1530 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1531 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1530 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1531 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1532 | 1532 | } |
1533 | 1533 | } |
1534 | 1534 | |
@@ -1542,12 +1542,12 @@ discard block |
||
1542 | 1542 | * @param string $output |
1543 | 1543 | * @return string |
1544 | 1544 | */ |
1545 | - public function form_before_question_group( $output ) { |
|
1545 | + public function form_before_question_group($output) { |
|
1546 | 1546 | EE_Error::doing_it_wrong( |
1547 | - __CLASS__ . '::' . __FUNCTION__, |
|
1548 | - __( 'This method would have been protected but was used on a filter callback' |
|
1547 | + __CLASS__.'::'.__FUNCTION__, |
|
1548 | + __('This method would have been protected but was used on a filter callback' |
|
1549 | 1549 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1550 | - 'event_espresso' ), |
|
1550 | + 'event_espresso'), |
|
1551 | 1551 | '4.8.32.rc.000' |
1552 | 1552 | ); |
1553 | 1553 | return ' |
@@ -1566,20 +1566,20 @@ discard block |
||
1566 | 1566 | * @param string $output |
1567 | 1567 | * @return string |
1568 | 1568 | */ |
1569 | - public function form_after_question_group( $output ) { |
|
1569 | + public function form_after_question_group($output) { |
|
1570 | 1570 | EE_Error::doing_it_wrong( |
1571 | - __CLASS__ . '::' . __FUNCTION__, |
|
1572 | - __( 'This method would have been protected but was used on a filter callback' |
|
1571 | + __CLASS__.'::'.__FUNCTION__, |
|
1572 | + __('This method would have been protected but was used on a filter callback' |
|
1573 | 1573 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1574 | - 'event_espresso' ), |
|
1574 | + 'event_espresso'), |
|
1575 | 1575 | '4.8.32.rc.000' |
1576 | 1576 | ); |
1577 | 1577 | return ' |
1578 | 1578 | <tr class="hide-if-no-js"> |
1579 | 1579 | <th> </th> |
1580 | 1580 | <td class="reg-admin-edit-attendee-question-td"> |
1581 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1582 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1581 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1582 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1583 | 1583 | <div class="dashicons dashicons-edit"></div> |
1584 | 1584 | </a> |
1585 | 1585 | </td> |
@@ -1599,18 +1599,18 @@ discard block |
||
1599 | 1599 | * @param string $label |
1600 | 1600 | * @return string |
1601 | 1601 | */ |
1602 | - public function form_form_field_label_wrap( $label ) { |
|
1602 | + public function form_form_field_label_wrap($label) { |
|
1603 | 1603 | EE_Error::doing_it_wrong( |
1604 | - __CLASS__ . '::' . __FUNCTION__, |
|
1605 | - __( 'This method would have been protected but was used on a filter callback' |
|
1604 | + __CLASS__.'::'.__FUNCTION__, |
|
1605 | + __('This method would have been protected but was used on a filter callback' |
|
1606 | 1606 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1607 | - 'event_espresso' ), |
|
1607 | + 'event_espresso'), |
|
1608 | 1608 | '4.8.32.rc.000' |
1609 | 1609 | ); |
1610 | 1610 | return ' |
1611 | 1611 | <tr> |
1612 | 1612 | <th> |
1613 | - ' . $label . ' |
|
1613 | + ' . $label.' |
|
1614 | 1614 | </th>'; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1624,17 +1624,17 @@ discard block |
||
1624 | 1624 | * @param string $input |
1625 | 1625 | * @return string |
1626 | 1626 | */ |
1627 | - public function form_form_field_input__wrap( $input ) { |
|
1627 | + public function form_form_field_input__wrap($input) { |
|
1628 | 1628 | EE_Error::doing_it_wrong( |
1629 | - __CLASS__ . '::' . __FUNCTION__, |
|
1630 | - __( 'This method would have been protected but was used on a filter callback' |
|
1629 | + __CLASS__.'::'.__FUNCTION__, |
|
1630 | + __('This method would have been protected but was used on a filter callback' |
|
1631 | 1631 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1632 | - 'event_espresso' ), |
|
1632 | + 'event_espresso'), |
|
1633 | 1633 | '4.8.32.rc.000' |
1634 | 1634 | ); |
1635 | 1635 | return ' |
1636 | 1636 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1637 | - ' . $input . ' |
|
1637 | + ' . $input.' |
|
1638 | 1638 | </td> |
1639 | 1639 | </tr>'; |
1640 | 1640 | } |
@@ -1648,14 +1648,14 @@ discard block |
||
1648 | 1648 | * @return void |
1649 | 1649 | */ |
1650 | 1650 | protected function _update_attendee_registration_form() { |
1651 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1652 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1653 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1654 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1655 | - if( $success ) { |
|
1651 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1652 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1653 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1654 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1655 | + if ($success) { |
|
1656 | 1656 | $what = __('Registration Form', 'event_espresso'); |
1657 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1658 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1657 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1658 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1659 | 1659 | } |
1660 | 1660 | } |
1661 | 1661 | } |
@@ -1666,11 +1666,11 @@ discard block |
||
1666 | 1666 | * @param int $REG_ID |
1667 | 1667 | * @return EE_Registration_Custom_Questions_Form |
1668 | 1668 | */ |
1669 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1670 | - if( ! $this->_reg_custom_questions_form ) { |
|
1671 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1672 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1673 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1669 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1670 | + if ( ! $this->_reg_custom_questions_form) { |
|
1671 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1672 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1673 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1674 | 1674 | } |
1675 | 1675 | return $this->_reg_custom_questions_form; |
1676 | 1676 | } |
@@ -1683,17 +1683,17 @@ discard block |
||
1683 | 1683 | * @param bool $REG_ID |
1684 | 1684 | * @return bool |
1685 | 1685 | */ |
1686 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1686 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1687 | 1687 | |
1688 | 1688 | if ( ! $REG_ID) { |
1689 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1689 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1690 | 1690 | } |
1691 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1692 | - $form->receive_form_submission( $this->_req_data ); |
|
1691 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1692 | + $form->receive_form_submission($this->_req_data); |
|
1693 | 1693 | $success = false; |
1694 | - if( $form->is_valid() ) { |
|
1695 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1696 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1694 | + if ($form->is_valid()) { |
|
1695 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1696 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1697 | 1697 | $where_conditions = array( |
1698 | 1698 | 'QST_ID' => $question_id, |
1699 | 1699 | 'REG_ID' => $REG_ID |
@@ -1701,19 +1701,19 @@ discard block |
||
1701 | 1701 | $possibly_new_values = array( |
1702 | 1702 | 'ANS_value' => $input->normalized_value() |
1703 | 1703 | ); |
1704 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1705 | - if( $answer instanceof EE_Answer ) { |
|
1706 | - $success = $answer->save( $possibly_new_values ); |
|
1704 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1705 | + if ($answer instanceof EE_Answer) { |
|
1706 | + $success = $answer->save($possibly_new_values); |
|
1707 | 1707 | } else { |
1708 | 1708 | //insert it then |
1709 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1710 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1709 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1710 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1711 | 1711 | $success = $answer->save(); |
1712 | 1712 | } |
1713 | 1713 | } |
1714 | 1714 | } |
1715 | 1715 | } else { |
1716 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1716 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1717 | 1717 | } |
1718 | 1718 | return $success; |
1719 | 1719 | } |
@@ -1731,30 +1731,30 @@ discard block |
||
1731 | 1731 | $registrations = $REG->get_all(array( |
1732 | 1732 | array( |
1733 | 1733 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1734 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1734 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1735 | 1735 | ), |
1736 | 1736 | 'force_join'=>array('Attendee'))); |
1737 | 1737 | |
1738 | 1738 | $this->_template_args['attendees'] = array(); |
1739 | 1739 | $this->_template_args['attendee_notice'] = ''; |
1740 | 1740 | EE_Registry::instance()->load_helper('Array'); |
1741 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1742 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1741 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1742 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1743 | 1743 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1744 | 1744 | } else { |
1745 | 1745 | |
1746 | 1746 | $att_nmbr = 1; |
1747 | - foreach ( $registrations as $registration ) { |
|
1747 | + foreach ($registrations as $registration) { |
|
1748 | 1748 | /* @var $registration EE_Registration */ |
1749 | 1749 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1750 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1751 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1752 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1753 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1750 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1751 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1752 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1753 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1754 | 1754 | |
1755 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1755 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1756 | 1756 | |
1757 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1757 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1758 | 1758 | |
1759 | 1759 | $att_nmbr++; |
1760 | 1760 | } |
@@ -1766,8 +1766,8 @@ discard block |
||
1766 | 1766 | |
1767 | 1767 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1768 | 1768 | } |
1769 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1770 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1769 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1770 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1771 | 1771 | |
1772 | 1772 | } |
1773 | 1773 | |
@@ -1788,11 +1788,11 @@ discard block |
||
1788 | 1788 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1789 | 1789 | |
1790 | 1790 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not) |
1791 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1791 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1792 | 1792 | $primary_registration = $this->_registration->get_primary_registration(); |
1793 | 1793 | $primary_attendee = $primary_registration->attendee(); |
1794 | 1794 | |
1795 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1795 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1796 | 1796 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1797 | 1797 | $primary_registration = NULL; |
1798 | 1798 | } |
@@ -1801,28 +1801,28 @@ discard block |
||
1801 | 1801 | } |
1802 | 1802 | |
1803 | 1803 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1804 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1805 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1806 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1804 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1805 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1806 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1807 | 1807 | $this->_template_args['phone'] = $attendee->phone(); |
1808 | 1808 | |
1809 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1810 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1809 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1810 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1811 | 1811 | |
1812 | 1812 | |
1813 | 1813 | //edit link |
1814 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1815 | - $this->_template_args['att_edit_label'] = __('View/Edit Contact' ); |
|
1814 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1815 | + $this->_template_args['att_edit_label'] = __('View/Edit Contact'); |
|
1816 | 1816 | |
1817 | 1817 | //create link |
1818 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1818 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1819 | 1819 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1820 | 1820 | |
1821 | 1821 | $this->_template_args['att_check'] = $att_check; |
1822 | 1822 | |
1823 | 1823 | |
1824 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1825 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1824 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1825 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1826 | 1826 | } |
1827 | 1827 | |
1828 | 1828 | |
@@ -1835,7 +1835,7 @@ discard block |
||
1835 | 1835 | * @access protected |
1836 | 1836 | * @return void |
1837 | 1837 | */ |
1838 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1838 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1839 | 1839 | $REGM = EEM_Registration::instance(); |
1840 | 1840 | |
1841 | 1841 | $success = 1; |
@@ -1845,26 +1845,26 @@ discard block |
||
1845 | 1845 | $dtts = array(); |
1846 | 1846 | |
1847 | 1847 | //if empty _REG_ID then get out because there's nothing to do |
1848 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1848 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1849 | 1849 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1850 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1851 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1850 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1851 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1852 | 1852 | } |
1853 | 1853 | |
1854 | 1854 | //Checkboxes |
1855 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1855 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1856 | 1856 | // if array has more than one element than success message should be plural |
1857 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1857 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1858 | 1858 | // cycle thru checkboxes |
1859 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1859 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1860 | 1860 | |
1861 | 1861 | $REG = $REGM->get_one_by_ID($REG_ID); |
1862 | 1862 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1863 | - if ( $payment_count > 0 ) { |
|
1864 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1863 | + if ($payment_count > 0) { |
|
1864 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1865 | 1865 | $error = 1; |
1866 | 1866 | $success = 0; |
1867 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1867 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1868 | 1868 | continue; //can't trash this registration because it has payments. |
1869 | 1869 | } |
1870 | 1870 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1873,7 +1873,7 @@ discard block |
||
1873 | 1873 | $dtts = array_merge($dtts, $dtt); |
1874 | 1874 | |
1875 | 1875 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1876 | - if ( !$updated ) { |
|
1876 | + if ( ! $updated) { |
|
1877 | 1877 | $success = 0; |
1878 | 1878 | } else { |
1879 | 1879 | $success = 2; |
@@ -1888,7 +1888,7 @@ discard block |
||
1888 | 1888 | $tickets[$ticket->ID()] = $ticket; |
1889 | 1889 | $dtts = $ticket->get_many_related('Datetime'); |
1890 | 1890 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1891 | - if ( ! $updated ) { |
|
1891 | + if ( ! $updated) { |
|
1892 | 1892 | $success = 0; |
1893 | 1893 | } |
1894 | 1894 | |
@@ -1898,10 +1898,10 @@ discard block |
||
1898 | 1898 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1899 | 1899 | EEM_Datetime::instance()->update_sold($dtts); |
1900 | 1900 | |
1901 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1902 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1901 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1902 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1903 | 1903 | $overwrite_msgs = $error ? TRUE : FALSE; |
1904 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1904 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1905 | 1905 | } |
1906 | 1906 | |
1907 | 1907 | |
@@ -1925,16 +1925,16 @@ discard block |
||
1925 | 1925 | $success = 1; |
1926 | 1926 | |
1927 | 1927 | //Checkboxes |
1928 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1928 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1929 | 1929 | // if array has more than one element than success message should be plural |
1930 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1930 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1931 | 1931 | // cycle thru checkboxes |
1932 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1932 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1933 | 1933 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1934 | - if ( ! $REG instanceof EE_Registration ) |
|
1934 | + if ( ! $REG instanceof EE_Registration) |
|
1935 | 1935 | continue; |
1936 | 1936 | $deleted = $this->_delete_registration($REG); |
1937 | - if ( !$deleted ) { |
|
1937 | + if ( ! $deleted) { |
|
1938 | 1938 | $success = 0; |
1939 | 1939 | } |
1940 | 1940 | } |
@@ -1944,15 +1944,15 @@ discard block |
||
1944 | 1944 | $REG_ID = $this->_req_data['_REG_ID']; |
1945 | 1945 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1946 | 1946 | $deleted = $this->_delete_registration($REG); |
1947 | - if ( ! $deleted ) { |
|
1947 | + if ( ! $deleted) { |
|
1948 | 1948 | $success = 0; |
1949 | 1949 | } |
1950 | 1950 | |
1951 | 1951 | } |
1952 | 1952 | |
1953 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1954 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1955 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1953 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1954 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1955 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1956 | 1956 | } |
1957 | 1957 | |
1958 | 1958 | |
@@ -1964,31 +1964,31 @@ discard block |
||
1964 | 1964 | * @param EE_Registration $REG registration to be deleted permenantly |
1965 | 1965 | * @return boolean true = successful deletion, false = fail. |
1966 | 1966 | */ |
1967 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1967 | + protected function _delete_registration(EE_Registration $REG) { |
|
1968 | 1968 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
1969 | 1969 | $TXN = $REG->get_first_related('Transaction'); |
1970 | 1970 | $REGS = $TXN->get_many_related('Registration'); |
1971 | 1971 | |
1972 | 1972 | $all_trashed = TRUE; |
1973 | - foreach ( $REGS as $registration ) { |
|
1974 | - if ( ! $registration->get('REG_deleted') ) |
|
1973 | + foreach ($REGS as $registration) { |
|
1974 | + if ( ! $registration->get('REG_deleted')) |
|
1975 | 1975 | $all_trashed = FALSE; |
1976 | 1976 | } |
1977 | 1977 | |
1978 | - if ( ! $all_trashed ) { |
|
1979 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1978 | + if ( ! $all_trashed) { |
|
1979 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1980 | 1980 | return false; |
1981 | 1981 | } |
1982 | 1982 | |
1983 | 1983 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
1984 | - foreach ( $REGS as $registration ) { |
|
1984 | + foreach ($REGS as $registration) { |
|
1985 | 1985 | |
1986 | 1986 | //delete related answers |
1987 | 1987 | $registration->delete_related_permanently('Answer'); |
1988 | 1988 | |
1989 | 1989 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1990 | 1990 | $attendee = $registration->get_first_related('Attendee'); |
1991 | - if ( $attendee instanceof EE_Attendee ) { |
|
1991 | + if ($attendee instanceof EE_Attendee) { |
|
1992 | 1992 | $registration->_remove_relation_to($attendee, 'Attendee'); |
1993 | 1993 | } |
1994 | 1994 | |
@@ -1998,7 +1998,7 @@ discard block |
||
1998 | 1998 | //now delete permanently the checkins related to this registration. |
1999 | 1999 | $registration->delete_related_permanently('Checkin'); |
2000 | 2000 | |
2001 | - if ( $registration->ID() === $REG->ID() ) |
|
2001 | + if ($registration->ID() === $REG->ID()) |
|
2002 | 2002 | continue; //we don't want to delete permanently the existing registration just yet. |
2003 | 2003 | |
2004 | 2004 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2031,35 +2031,35 @@ discard block |
||
2031 | 2031 | * @return void |
2032 | 2032 | */ |
2033 | 2033 | public function new_registration() { |
2034 | - if ( ! $this->_set_reg_event() ) { |
|
2035 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2034 | + if ( ! $this->_set_reg_event()) { |
|
2035 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2036 | 2036 | } |
2037 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2037 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2038 | 2038 | // gotta start with a clean slate if we're not coming here via ajax |
2039 | 2039 | if ( |
2040 | - ! defined('DOING_AJAX' ) |
|
2041 | - && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) ) |
|
2040 | + ! defined('DOING_AJAX') |
|
2041 | + && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error'])) |
|
2042 | 2042 | ) { |
2043 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2043 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2044 | 2044 | } |
2045 | 2045 | |
2046 | - $this->_template_args['event_name'] = '' ; |
|
2046 | + $this->_template_args['event_name'] = ''; |
|
2047 | 2047 | // event name |
2048 | - if ( $this->_reg_event ) { |
|
2048 | + if ($this->_reg_event) { |
|
2049 | 2049 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2050 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2051 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2052 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2050 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2051 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2052 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2053 | 2053 | } |
2054 | 2054 | |
2055 | 2055 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2056 | 2056 | |
2057 | - if ( defined('DOING_AJAX' ) ) { |
|
2057 | + if (defined('DOING_AJAX')) { |
|
2058 | 2058 | $this->_return_json(); |
2059 | 2059 | } |
2060 | 2060 | // grab header |
2061 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2062 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2061 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2062 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2063 | 2063 | |
2064 | 2064 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2065 | 2065 | // the details template wrapper |
@@ -2076,7 +2076,7 @@ discard block |
||
2076 | 2076 | * @return string html |
2077 | 2077 | */ |
2078 | 2078 | protected function _get_registration_step_content() { |
2079 | - if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) { |
|
2079 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
2080 | 2080 | $warning_msg = sprintf( |
2081 | 2081 | __( |
2082 | 2082 | '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
@@ -2092,7 +2092,7 @@ discard block |
||
2092 | 2092 | '</b>' |
2093 | 2093 | ); |
2094 | 2094 | return ' |
2095 | - <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
|
2095 | + <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div> |
|
2096 | 2096 | <script > |
2097 | 2097 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
2098 | 2098 | // after just adding a new registration... we gotta try to put a stop to that !!! |
@@ -2127,16 +2127,16 @@ discard block |
||
2127 | 2127 | $cart = EE_Registry::instance()->SSN->cart(); |
2128 | 2128 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2129 | 2129 | |
2130 | - switch ( $step ) { |
|
2130 | + switch ($step) { |
|
2131 | 2131 | case 'ticket' : |
2132 | 2132 | $hidden_fields['processing_registration']['value'] = 1; |
2133 | 2133 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2134 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2134 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2135 | 2135 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2136 | 2136 | $template_args['show_notification_toggle'] = FALSE; |
2137 | 2137 | break; |
2138 | 2138 | case 'questions' : |
2139 | - $hidden_fields[ 'processing_registration' ][ 'value' ] = 2; |
|
2139 | + $hidden_fields['processing_registration']['value'] = 2; |
|
2140 | 2140 | $template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso'); |
2141 | 2141 | //in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run. |
2142 | 2142 | $template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin(); |
@@ -2145,10 +2145,10 @@ discard block |
||
2145 | 2145 | break; |
2146 | 2146 | } |
2147 | 2147 | |
2148 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2148 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2149 | 2149 | |
2150 | 2150 | return EEH_Template::display_template( |
2151 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2151 | + REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2152 | 2152 | ); |
2153 | 2153 | } |
2154 | 2154 | |
@@ -2163,11 +2163,11 @@ discard block |
||
2163 | 2163 | * @return boolean |
2164 | 2164 | */ |
2165 | 2165 | private function _set_reg_event() { |
2166 | - if ( is_object( $this->_reg_event )) { |
|
2166 | + if (is_object($this->_reg_event)) { |
|
2167 | 2167 | return TRUE; |
2168 | 2168 | } |
2169 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2170 | - if ( ! $EVT_ID ) { |
|
2169 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2170 | + if ( ! $EVT_ID) { |
|
2171 | 2171 | return FALSE; |
2172 | 2172 | } |
2173 | 2173 | |
@@ -2188,82 +2188,82 @@ discard block |
||
2188 | 2188 | public function process_reg_step() { |
2189 | 2189 | EE_System::do_not_cache(); |
2190 | 2190 | $this->_set_reg_event(); |
2191 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2191 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2192 | 2192 | |
2193 | 2193 | //what step are we on? |
2194 | 2194 | $cart = EE_Registry::instance()->SSN->cart(); |
2195 | 2195 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2196 | 2196 | |
2197 | 2197 | //if doing ajax then we need to verify the nonce |
2198 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2199 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2200 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2198 | + if (defined('DOING_AJAX')) { |
|
2199 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2200 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2201 | 2201 | } |
2202 | 2202 | |
2203 | - switch ( $step ) { |
|
2203 | + switch ($step) { |
|
2204 | 2204 | |
2205 | 2205 | case 'ticket' : |
2206 | 2206 | //process ticket selection |
2207 | 2207 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2208 | - if ( $success ) { |
|
2209 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2208 | + if ($success) { |
|
2209 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2210 | 2210 | } else { |
2211 | 2211 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2212 | 2212 | } |
2213 | - if ( defined('DOING_AJAX') ) { |
|
2213 | + if (defined('DOING_AJAX')) { |
|
2214 | 2214 | $this->new_registration(); //display next step |
2215 | 2215 | } else { |
2216 | 2216 | $query_args['action'] = 'new_registration'; |
2217 | 2217 | $query_args['processing_registration'] = 1; |
2218 | 2218 | $query_args['event_id'] = $this->_reg_event->ID(); |
2219 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2219 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2220 | 2220 | } |
2221 | 2221 | break; |
2222 | 2222 | |
2223 | 2223 | case 'questions' : |
2224 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2225 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2224 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2225 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2226 | 2226 | } |
2227 | 2227 | //process registration |
2228 | 2228 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2229 | - if ( $cart instanceof EE_Cart ) { |
|
2229 | + if ($cart instanceof EE_Cart) { |
|
2230 | 2230 | $grand_total = $cart->get_cart_grand_total(); |
2231 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
2231 | + if ($grand_total instanceof EE_Line_Item) { |
|
2232 | 2232 | $grand_total->save_this_and_descendants_to_txn(); |
2233 | 2233 | } |
2234 | 2234 | } |
2235 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2235 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2236 | 2236 | $query_args = array( |
2237 | 2237 | 'action' => 'new_registration', |
2238 | 2238 | 'processing_registration' => 2, |
2239 | 2239 | 'event_id' => $this->_reg_event->ID() |
2240 | 2240 | ); |
2241 | 2241 | |
2242 | - if ( defined('DOING_AJAX' )) { |
|
2242 | + if (defined('DOING_AJAX')) { |
|
2243 | 2243 | //display registration form again because there are errors (maybe validation?) |
2244 | 2244 | $this->new_registration(); |
2245 | 2245 | return; |
2246 | 2246 | } else { |
2247 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2247 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2248 | 2248 | return; |
2249 | 2249 | } |
2250 | 2250 | } |
2251 | 2251 | /** @type EE_Transaction_Payments $transaction_payments */ |
2252 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2252 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2253 | 2253 | // maybe update status, and make sure to save transaction if not done already |
2254 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2254 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2255 | 2255 | $transaction->save(); |
2256 | 2256 | } |
2257 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2257 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2258 | 2258 | $this->_req_data = array(); |
2259 | 2259 | $query_args = array( |
2260 | 2260 | 'action' => 'redirect_to_txn', |
2261 | 2261 | 'TXN_ID' => $transaction->ID(), |
2262 | 2262 | 'EVT_ID' => $this->_reg_event->ID(), |
2263 | - 'event_name' => urlencode( $this->_reg_event->name() ), |
|
2263 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
2264 | 2264 | 'redirect_from' => 'new_registration' |
2265 | 2265 | ); |
2266 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2266 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2267 | 2267 | break; |
2268 | 2268 | } |
2269 | 2269 | |
@@ -2280,21 +2280,21 @@ discard block |
||
2280 | 2280 | */ |
2281 | 2281 | public function redirect_to_txn() { |
2282 | 2282 | EE_System::do_not_cache(); |
2283 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2283 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2284 | 2284 | $query_args = array( |
2285 | 2285 | 'action' => 'view_transaction', |
2286 | - 'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] ) : 0, |
|
2286 | + 'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0, |
|
2287 | 2287 | 'page' => 'espresso_transactions' |
2288 | 2288 | ); |
2289 | - if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) { |
|
2290 | - $query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ]; |
|
2291 | - $query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] ); |
|
2292 | - $query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ]; |
|
2289 | + if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) { |
|
2290 | + $query_args['EVT_ID'] = $this->_req_data['EVT_ID']; |
|
2291 | + $query_args['event_name'] = urlencode($this->_req_data['event_name']); |
|
2292 | + $query_args['redirect_from'] = $this->_req_data['redirect_from']; |
|
2293 | 2293 | } |
2294 | 2294 | EE_Error::add_success( |
2295 | - __( 'Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso' ) |
|
2295 | + __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') |
|
2296 | 2296 | ); |
2297 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2297 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2298 | 2298 | } |
2299 | 2299 | |
2300 | 2300 | |
@@ -2305,7 +2305,7 @@ discard block |
||
2305 | 2305 | * @return void |
2306 | 2306 | */ |
2307 | 2307 | protected function _attendee_contact_list_table() { |
2308 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2308 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2309 | 2309 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2310 | 2310 | $this->display_admin_list_table_page_with_no_sidebar(); |
2311 | 2311 | } |
@@ -2320,10 +2320,10 @@ discard block |
||
2320 | 2320 | * @access public |
2321 | 2321 | * @return array |
2322 | 2322 | */ |
2323 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2323 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2324 | 2324 | |
2325 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2326 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2325 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2326 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2327 | 2327 | $ATT_MDL = EEM_Attendee::instance(); |
2328 | 2328 | |
2329 | 2329 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2351,47 +2351,47 @@ discard block |
||
2351 | 2351 | $orderby = 'ATT_lname'; |
2352 | 2352 | } |
2353 | 2353 | |
2354 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2354 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2355 | 2355 | |
2356 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2357 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2358 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2356 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2357 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2358 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2359 | 2359 | |
2360 | 2360 | $_where = array(); |
2361 | 2361 | |
2362 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2363 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2362 | + if (isset($this->_req_data['s'])) { |
|
2363 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2364 | 2364 | $_where['OR'] = array( |
2365 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2366 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2367 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2368 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2369 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2370 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2371 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2372 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2373 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2374 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2375 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2376 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2377 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2378 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2379 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2380 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2381 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2365 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2366 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2367 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2368 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2369 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2370 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2371 | + 'ATT_email' => array('LIKE', $sstr), |
|
2372 | + 'ATT_address' => array('LIKE', $sstr), |
|
2373 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2374 | + 'ATT_city' => array('LIKE', $sstr), |
|
2375 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2376 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2377 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2378 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2379 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2380 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2381 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2382 | 2382 | ); |
2383 | 2383 | } |
2384 | 2384 | |
2385 | 2385 | |
2386 | - $offset = ($current_page-1)*$per_page; |
|
2387 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2386 | + $offset = ($current_page - 1) * $per_page; |
|
2387 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2388 | 2388 | |
2389 | - if ( $trash ) { |
|
2390 | - $_where['status'] = array( '!=', 'publish' ); |
|
2391 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2389 | + if ($trash) { |
|
2390 | + $_where['status'] = array('!=', 'publish'); |
|
2391 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2392 | 2392 | } else { |
2393 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2394 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2393 | + $_where['status'] = array('IN', array('publish')); |
|
2394 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2395 | 2395 | } |
2396 | 2396 | |
2397 | 2397 | return $all_attendees; |
@@ -2408,10 +2408,10 @@ discard block |
||
2408 | 2408 | */ |
2409 | 2409 | protected function _resend_registration() { |
2410 | 2410 | $this->_process_resend_registration(); |
2411 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2411 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2412 | 2412 | 'action' => 'default' |
2413 | 2413 | ); |
2414 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2414 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2415 | 2415 | } |
2416 | 2416 | |
2417 | 2417 | |
@@ -2419,27 +2419,27 @@ discard block |
||
2419 | 2419 | |
2420 | 2420 | |
2421 | 2421 | |
2422 | - public function _registrations_report(){ |
|
2423 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2424 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2422 | + public function _registrations_report() { |
|
2423 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2424 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2425 | 2425 | array( |
2426 | 2426 | 'page' => 'espresso_batch', |
2427 | 2427 | 'batch' => 'file', |
2428 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2429 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2430 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2431 | - )) ); |
|
2428 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2429 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2430 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2431 | + ))); |
|
2432 | 2432 | } else { |
2433 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2433 | + EE_Registry::instance()->load_helper('File'); |
|
2434 | 2434 | $new_request_args = array( |
2435 | 2435 | 'export' => 'report', |
2436 | 2436 | 'action' => 'registrations_report_for_event', |
2437 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2437 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2438 | 2438 | ); |
2439 | 2439 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2440 | 2440 | |
2441 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2442 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2441 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2442 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2443 | 2443 | $EE_Export = EE_Export::instance($this->_req_data); |
2444 | 2444 | $EE_Export->export(); |
2445 | 2445 | } |
@@ -2448,28 +2448,28 @@ discard block |
||
2448 | 2448 | |
2449 | 2449 | |
2450 | 2450 | |
2451 | - public function _contact_list_export(){ |
|
2452 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2453 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2454 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2451 | + public function _contact_list_export() { |
|
2452 | + EE_Registry::instance()->load_helper('File'); |
|
2453 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2454 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2455 | 2455 | $EE_Export = EE_Export::instance($this->_req_data); |
2456 | 2456 | $EE_Export->export_attendees(); |
2457 | 2457 | } |
2458 | 2458 | } |
2459 | 2459 | |
2460 | - public function _contact_list_report(){ |
|
2461 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2462 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2460 | + public function _contact_list_report() { |
|
2461 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2462 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2463 | 2463 | array( |
2464 | 2464 | 'page' => 'espresso_batch', |
2465 | 2465 | 'batch' => 'file', |
2466 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2467 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2468 | - )) ); |
|
2466 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2467 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2468 | + ))); |
|
2469 | 2469 | } else { |
2470 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2471 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2472 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2470 | + EE_Registry::instance()->load_helper('File'); |
|
2471 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2472 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2473 | 2473 | $EE_Export = EE_Export::instance($this->_req_data); |
2474 | 2474 | $EE_Export->report_attendees(); |
2475 | 2475 | } |
@@ -2489,73 +2489,73 @@ discard block |
||
2489 | 2489 | * @return void |
2490 | 2490 | */ |
2491 | 2491 | protected function _duplicate_attendee() { |
2492 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2492 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2493 | 2493 | //verify we have necessary info |
2494 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2495 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2496 | - $query_args = array( 'action' => $action ); |
|
2494 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2495 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2496 | + $query_args = array('action' => $action); |
|
2497 | 2497 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2498 | 2498 | } |
2499 | 2499 | |
2500 | 2500 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2501 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2501 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2502 | 2502 | $attendee = $registration->attendee(); |
2503 | 2503 | |
2504 | 2504 | //remove relation of existing attendee on registration |
2505 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2505 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2506 | 2506 | //new attendee |
2507 | 2507 | $new_attendee = clone $attendee; |
2508 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2508 | + $new_attendee->set('ATT_ID', 0); |
|
2509 | 2509 | $new_attendee->save(); |
2510 | 2510 | |
2511 | 2511 | //add new attendee to reg |
2512 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2512 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2513 | 2513 | |
2514 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2514 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2515 | 2515 | |
2516 | 2516 | //redirect to edit page for attendee |
2517 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2517 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2518 | 2518 | |
2519 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2519 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2520 | 2520 | } |
2521 | 2521 | |
2522 | 2522 | |
2523 | 2523 | //related to cpt routes |
2524 | 2524 | protected function _insert_update_cpt_item($post_id, $post) { |
2525 | 2525 | $success = true; |
2526 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2526 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2527 | 2527 | //for attendee updates |
2528 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2528 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2529 | 2529 | //note we should only be UPDATING attendees at this point. |
2530 | 2530 | $updated_fields = array( |
2531 | 2531 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2532 | 2532 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2533 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2533 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2534 | 2534 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2535 | 2535 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2536 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2537 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2538 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2539 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2540 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2541 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2536 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2537 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2538 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2539 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2540 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2541 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2542 | 2542 | ); |
2543 | - foreach ( $updated_fields as $field => $value ) { |
|
2543 | + foreach ($updated_fields as $field => $value) { |
|
2544 | 2544 | $attendee->set($field, $value); |
2545 | 2545 | } |
2546 | 2546 | |
2547 | 2547 | $success = $attendee->save(); |
2548 | 2548 | |
2549 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2550 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2551 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2552 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2549 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2550 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2551 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2552 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2553 | 2553 | } |
2554 | 2554 | } |
2555 | 2555 | } |
2556 | 2556 | |
2557 | - if ( $success === FALSE ) |
|
2558 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2557 | + if ($success === FALSE) |
|
2558 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2559 | 2559 | |
2560 | 2560 | } |
2561 | 2561 | |
@@ -2575,17 +2575,17 @@ discard block |
||
2575 | 2575 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2576 | 2576 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2577 | 2577 | |
2578 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2579 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2578 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2579 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2580 | 2580 | } |
2581 | 2581 | |
2582 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2582 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2583 | 2583 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2584 | 2584 | } |
2585 | 2585 | |
2586 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2587 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2588 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2586 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2587 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2588 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2589 | 2589 | } |
2590 | 2590 | |
2591 | 2591 | |
@@ -2594,10 +2594,10 @@ discard block |
||
2594 | 2594 | * @param WP_Post $post wp post object |
2595 | 2595 | * @return string attendee contact info ( and form ) |
2596 | 2596 | */ |
2597 | - public function attendee_contact_info( $post ) { |
|
2597 | + public function attendee_contact_info($post) { |
|
2598 | 2598 | //get attendee object ( should already have it ) |
2599 | 2599 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2600 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2600 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2601 | 2601 | EEH_Template::display_template($template, $this->_template_args); |
2602 | 2602 | } |
2603 | 2603 | |
@@ -2613,12 +2613,12 @@ discard block |
||
2613 | 2613 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2614 | 2614 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2615 | 2615 | new EE_Question_Form_Input( |
2616 | - EE_Question::new_instance( array( |
|
2616 | + EE_Question::new_instance(array( |
|
2617 | 2617 | 'QST_ID' => 0, |
2618 | 2618 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2619 | 2619 | 'QST_system' => 'admin-state' |
2620 | 2620 | )), |
2621 | - EE_Answer::new_instance( array( |
|
2621 | + EE_Answer::new_instance(array( |
|
2622 | 2622 | 'ANS_ID' => 0, |
2623 | 2623 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2624 | 2624 | )), |
@@ -2631,12 +2631,12 @@ discard block |
||
2631 | 2631 | )); |
2632 | 2632 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2633 | 2633 | new EE_Question_Form_Input( |
2634 | - EE_Question::new_instance( array( |
|
2634 | + EE_Question::new_instance(array( |
|
2635 | 2635 | 'QST_ID' => 0, |
2636 | 2636 | 'QST_display_text' => __('Country', 'event_espresso'), |
2637 | 2637 | 'QST_system' => 'admin-country' |
2638 | 2638 | )), |
2639 | - EE_Answer::new_instance( array( |
|
2639 | + EE_Answer::new_instance(array( |
|
2640 | 2640 | 'ANS_ID' => 0, |
2641 | 2641 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2642 | 2642 | )), |
@@ -2647,8 +2647,8 @@ discard block |
||
2647 | 2647 | 'append_qstn_id' => FALSE |
2648 | 2648 | ) |
2649 | 2649 | )); |
2650 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2651 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2650 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2651 | + EEH_Template::display_template($template, $this->_template_args); |
|
2652 | 2652 | |
2653 | 2653 | } |
2654 | 2654 | |
@@ -2658,11 +2658,11 @@ discard block |
||
2658 | 2658 | * @access protected |
2659 | 2659 | * @return void |
2660 | 2660 | */ |
2661 | - public function attendee_registrations_meta_box( $post ) { |
|
2661 | + public function attendee_registrations_meta_box($post) { |
|
2662 | 2662 | |
2663 | 2663 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2664 | 2664 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2665 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2665 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2666 | 2666 | EEH_Template::display_template($template, $this->_template_args); |
2667 | 2667 | |
2668 | 2668 | } |
@@ -2676,8 +2676,8 @@ discard block |
||
2676 | 2676 | * @return string html for new form. |
2677 | 2677 | */ |
2678 | 2678 | public function after_title_form_fields($post) { |
2679 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2680 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2679 | + if ($post->post_type == 'espresso_attendees') { |
|
2680 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2681 | 2681 | $template_args['attendee'] = $this->_cpt_model_obj; |
2682 | 2682 | EEH_Template::display_template($template, $template_args); |
2683 | 2683 | } |
@@ -2694,21 +2694,21 @@ discard block |
||
2694 | 2694 | * @access protected |
2695 | 2695 | * @return void |
2696 | 2696 | */ |
2697 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2697 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2698 | 2698 | |
2699 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2699 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2700 | 2700 | |
2701 | 2701 | $ATT_MDL = EEM_Attendee::instance(); |
2702 | 2702 | |
2703 | 2703 | $success = 1; |
2704 | 2704 | //Checkboxes |
2705 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2705 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2706 | 2706 | // if array has more than one element than success message should be plural |
2707 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2707 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2708 | 2708 | // cycle thru checkboxes |
2709 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2710 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2711 | - if ( !$updated ) { |
|
2709 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2710 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2711 | + if ( ! $updated) { |
|
2712 | 2712 | $success = 0; |
2713 | 2713 | } |
2714 | 2714 | } |
@@ -2717,18 +2717,18 @@ discard block |
||
2717 | 2717 | // grab single id and delete |
2718 | 2718 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2719 | 2719 | //get attendee |
2720 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2720 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2721 | 2721 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2722 | 2722 | $updated = $att->save(); |
2723 | - if ( ! $updated ) { |
|
2723 | + if ( ! $updated) { |
|
2724 | 2724 | $success = 0; |
2725 | 2725 | } |
2726 | 2726 | |
2727 | 2727 | } |
2728 | 2728 | |
2729 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2730 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2731 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2729 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2730 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2731 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2732 | 2732 | |
2733 | 2733 | } |
2734 | 2734 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -118,8 +120,9 @@ discard block |
||
118 | 120 | public function clear_comment_link( $link, $comment, $args ) { |
119 | 121 | //gotta make sure this only happens on this route |
120 | 122 | $post_type = get_post_type( $comment->comment_post_ID); |
121 | - if ( $post_type == 'espresso_attendees' ) |
|
122 | - return '#commentsdiv'; |
|
123 | + if ( $post_type == 'espresso_attendees' ) { |
|
124 | + return '#commentsdiv'; |
|
125 | + } |
|
123 | 126 | return $link; |
124 | 127 | } |
125 | 128 | |
@@ -878,9 +881,9 @@ discard block |
||
878 | 881 | |
879 | 882 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
880 | 883 | |
881 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
882 | - return TRUE; |
|
883 | - else { |
|
884 | + if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) { |
|
885 | + return TRUE; |
|
886 | + } else { |
|
884 | 887 | $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
885 | 888 | EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
886 | 889 | $this->_registration = NULL; |
@@ -977,7 +980,7 @@ discard block |
||
977 | 980 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
978 | 981 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
979 | 982 | )); |
980 | - }elseif($this_month_a || $this_month){ |
|
983 | + } elseif($this_month_a || $this_month){ |
|
981 | 984 | $this_month_r = date('m', current_time('timestamp')); |
982 | 985 | $days_this_month = date( 't', current_time('timestamp') ); |
983 | 986 | $_where['REG_date']= array('BETWEEN', |
@@ -985,18 +988,18 @@ discard block |
||
985 | 988 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
986 | 989 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
987 | 990 | )); |
988 | - }elseif($month_range){ |
|
991 | + } elseif($month_range){ |
|
989 | 992 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
990 | 993 | $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
991 | 994 | $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
992 | 995 | $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
993 | 996 | $_where['REG_date']= array('BETWEEN', |
994 | 997 | array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
995 | - }elseif($start_date && $end_date){ |
|
998 | + } elseif($start_date && $end_date){ |
|
996 | 999 | throw new EE_Error("not yet supported"); |
997 | - }elseif($start_date){ |
|
1000 | + } elseif($start_date){ |
|
998 | 1001 | throw new EE_Error("not yet supported"); |
999 | - }elseif($end_date){ |
|
1002 | + } elseif($end_date){ |
|
1000 | 1003 | throw new EE_Error("not yet supported"); |
1001 | 1004 | } |
1002 | 1005 | |
@@ -1931,8 +1934,9 @@ discard block |
||
1931 | 1934 | // cycle thru checkboxes |
1932 | 1935 | while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
1933 | 1936 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1934 | - if ( ! $REG instanceof EE_Registration ) |
|
1935 | - continue; |
|
1937 | + if ( ! $REG instanceof EE_Registration ) { |
|
1938 | + continue; |
|
1939 | + } |
|
1936 | 1940 | $deleted = $this->_delete_registration($REG); |
1937 | 1941 | if ( !$deleted ) { |
1938 | 1942 | $success = 0; |
@@ -1971,8 +1975,9 @@ discard block |
||
1971 | 1975 | |
1972 | 1976 | $all_trashed = TRUE; |
1973 | 1977 | foreach ( $REGS as $registration ) { |
1974 | - if ( ! $registration->get('REG_deleted') ) |
|
1975 | - $all_trashed = FALSE; |
|
1978 | + if ( ! $registration->get('REG_deleted') ) { |
|
1979 | + $all_trashed = FALSE; |
|
1980 | + } |
|
1976 | 1981 | } |
1977 | 1982 | |
1978 | 1983 | if ( ! $all_trashed ) { |
@@ -1998,8 +2003,10 @@ discard block |
||
1998 | 2003 | //now delete permanently the checkins related to this registration. |
1999 | 2004 | $registration->delete_related_permanently('Checkin'); |
2000 | 2005 | |
2001 | - if ( $registration->ID() === $REG->ID() ) |
|
2002 | - continue; //we don't want to delete permanently the existing registration just yet. |
|
2006 | + if ( $registration->ID() === $REG->ID() ) { |
|
2007 | + continue; |
|
2008 | + } |
|
2009 | + //we don't want to delete permanently the existing registration just yet. |
|
2003 | 2010 | |
2004 | 2011 | //remove relation to transaction for these registrations if NOT the existing registrations |
2005 | 2012 | $registration->_remove_relations('Transaction'); |
@@ -2554,8 +2561,9 @@ discard block |
||
2554 | 2561 | } |
2555 | 2562 | } |
2556 | 2563 | |
2557 | - if ( $success === FALSE ) |
|
2558 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2564 | + if ( $success === FALSE ) { |
|
2565 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2566 | + } |
|
2559 | 2567 | |
2560 | 2568 | } |
2561 | 2569 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <div id="admin-primary-mbox-dv" class="admin-primary-mbox-dv"> |
2 | 2 | |
3 | 3 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
4 | - <span class="dashicons dashicons-cart"></span><?php _e( 'Transaction Items', 'event_espresso' );?> |
|
4 | + <span class="dashicons dashicons-cart"></span><?php _e('Transaction Items', 'event_espresso'); ?> |
|
5 | 5 | </h3> |
6 | 6 | |
7 | 7 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -10,27 +10,27 @@ discard block |
||
10 | 10 | </div> |
11 | 11 | |
12 | 12 | <a id="display-additional-transaction-session-info" class="display-the-hidden smaller-text" rel="additional-transaction-session-info"> |
13 | - <span class="dashicons dashicons-plus-alt"></span><?php _e( 'view additional transaction session details', 'event_espresso' );?> |
|
13 | + <span class="dashicons dashicons-plus-alt"></span><?php _e('view additional transaction session details', 'event_espresso'); ?> |
|
14 | 14 | </a> |
15 | 15 | |
16 | 16 | <div id="additional-transaction-session-info-dv" class="hidden"> |
17 | 17 | |
18 | 18 | <a id="hide-additional-transaction-session-info" class="hide-the-displayed hidden smaller-text" rel="additional-transaction-session-info"> |
19 | - <span class="dashicons dashicons-dismiss"></span><?php _e( 'hide additional transaction session details', 'event_espresso' );?> |
|
19 | + <span class="dashicons dashicons-dismiss"></span><?php _e('hide additional transaction session details', 'event_espresso'); ?> |
|
20 | 20 | </a> |
21 | 21 | <br class="clear"/> |
22 | 22 | |
23 | - <h3 class="admin-primary-mbox-h4"><?php _e( 'Transaction Session Details', 'event_espresso' );?></h3> |
|
23 | + <h3 class="admin-primary-mbox-h4"><?php _e('Transaction Session Details', 'event_espresso'); ?></h3> |
|
24 | 24 | |
25 | 25 | <table id="admin-primary-mbox-txn-extra-session-info-tbl" class="form-table skinny-rows"> |
26 | 26 | <tbody> |
27 | - <?php foreach ( $txn_details as $key => $txn_detail ) : ?> |
|
27 | + <?php foreach ($txn_details as $key => $txn_detail) : ?> |
|
28 | 28 | <tr> |
29 | 29 | <th> |
30 | - <label for="<?php echo $key;?>"><?php echo $txn_detail['label'];?></label> |
|
30 | + <label for="<?php echo $key; ?>"><?php echo $txn_detail['label']; ?></label> |
|
31 | 31 | </th> |
32 | 32 | <td> |
33 | - <?php echo $txn_detail['value'];?> |
|
33 | + <?php echo $txn_detail['value']; ?> |
|
34 | 34 | </td> |
35 | 35 | </tr> |
36 | 36 | <?php endforeach; // $txn_details?> |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | <br class="clear"/> |
41 | 41 | |
42 | 42 | |
43 | - <?php if ( $attendee instanceof EE_Attendee && ( $grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty( $payments ) ) ) : ?> |
|
43 | + <?php if ($attendee instanceof EE_Attendee && ($grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty($payments))) : ?> |
|
44 | 44 | |
45 | 45 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
46 | - <span class="ee-icon ee-icon-cash"></span><?php _e( 'Payment Details', 'event_espresso' );?> |
|
46 | + <span class="ee-icon ee-icon-cash"></span><?php _e('Payment Details', 'event_espresso'); ?> |
|
47 | 47 | </h3> |
48 | 48 | |
49 | 49 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -52,79 +52,79 @@ discard block |
||
52 | 52 | <tr> |
53 | 53 | <th></th> |
54 | 54 | <th class="jst-cntr"></th> |
55 | - <th class="jst-cntr"><?php _e( 'ID', 'event_espresso' );?></th> |
|
56 | - <th class="jst-left"><?php _e( 'Date', 'event_espresso' );?></th> |
|
57 | - <th class="jst-cntr"><?php _e( 'Source', 'event_espresso' );?></th> |
|
58 | - <th class="jst-left"><?php _e( 'Method', 'event_espresso' );?></th> |
|
59 | - <th class="jst-left"><?php _e( 'Gateway Response', 'event_espresso' );?></th> |
|
60 | - <th class="jst-left"><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></th> |
|
61 | - <th class="jst-left"><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></th> |
|
62 | - <th class="jst-left"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></th> |
|
63 | - <!--<th class="jst-left"><?php _e( 'Details', 'event_espresso' );?></th>--> |
|
64 | - <th class="jst-cntr"><?php _e( 'Amount', 'event_espresso' );?></th> |
|
55 | + <th class="jst-cntr"><?php _e('ID', 'event_espresso'); ?></th> |
|
56 | + <th class="jst-left"><?php _e('Date', 'event_espresso'); ?></th> |
|
57 | + <th class="jst-cntr"><?php _e('Source', 'event_espresso'); ?></th> |
|
58 | + <th class="jst-left"><?php _e('Method', 'event_espresso'); ?></th> |
|
59 | + <th class="jst-left"><?php _e('Gateway Response', 'event_espresso'); ?></th> |
|
60 | + <th class="jst-left"><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></th> |
|
61 | + <th class="jst-left"><?php _e('P.O. / S.O. #', 'event_espresso'); ?></th> |
|
62 | + <th class="jst-left"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></th> |
|
63 | + <!--<th class="jst-left"><?php _e('Details', 'event_espresso'); ?></th>--> |
|
64 | + <th class="jst-cntr"><?php _e('Amount', 'event_espresso'); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if ( $payments ) : ?> |
|
68 | + <?php if ($payments) : ?> |
|
69 | 69 | <?php $payment_total = 0; ?> |
70 | - <?php foreach ( $payments as $PAY_ID => $payment ) : |
|
71 | - $existing_reg_payment_json = isset( $existing_reg_payments[ $PAY_ID ] ) |
|
72 | - ? wp_json_encode( $existing_reg_payments[ $PAY_ID ] ) |
|
70 | + <?php foreach ($payments as $PAY_ID => $payment) : |
|
71 | + $existing_reg_payment_json = isset($existing_reg_payments[$PAY_ID]) |
|
72 | + ? wp_json_encode($existing_reg_payments[$PAY_ID]) |
|
73 | 73 | : '{}'; |
74 | 74 | ?> |
75 | - <tr id="txn-admin-payment-tr-<?php echo $PAY_ID;?>"> |
|
75 | + <tr id="txn-admin-payment-tr-<?php echo $PAY_ID; ?>"> |
|
76 | 76 | <td> |
77 | 77 | <span id="payment-status-<?php echo $PAY_ID; ?>" class="ee-status-strip-td ee-status-strip pymt-status-<?php echo $payment->STS_ID(); ?>"></span> |
78 | - <div id="payment-STS_ID-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->STS_ID();?></div> |
|
79 | - <div id="reg-payments-<?php echo $PAY_ID;?>" class="hidden"><?php echo $existing_reg_payment_json; ?></div> |
|
78 | + <div id="payment-STS_ID-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->STS_ID(); ?></div> |
|
79 | + <div id="reg-payments-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $existing_reg_payment_json; ?></div> |
|
80 | 80 | </td> |
81 | 81 | <td class=" jst-cntr"> |
82 | 82 | <ul class="txn-overview-actions-ul"> |
83 | 83 | <li> |
84 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
84 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
85 | 85 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
86 | 86 | </a> |
87 | 87 | </li> |
88 | 88 | <li> |
89 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
89 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
90 | 90 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
91 | 91 | </a> |
92 | 92 | </li> |
93 | 93 | </ul> |
94 | 94 | </td> |
95 | 95 | <td class=" jst-rght"> |
96 | - <div id="payment-id-<?php echo $PAY_ID;?>"><?php echo $PAY_ID;?></div> |
|
96 | + <div id="payment-id-<?php echo $PAY_ID; ?>"><?php echo $PAY_ID; ?></div> |
|
97 | 97 | </td> |
98 | 98 | <td class=" jst-left"> |
99 | - <div id="payment-date-<?php echo $PAY_ID;?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a');?></div> |
|
99 | + <div id="payment-date-<?php echo $PAY_ID; ?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a'); ?></div> |
|
100 | 100 | </td> |
101 | 101 | <td class=" jst-cntr"> |
102 | - <div id="payment-method-<?php echo $PAY_ID;?>"> |
|
103 | - <?php echo $payment->source();?> |
|
102 | + <div id="payment-method-<?php echo $PAY_ID; ?>"> |
|
103 | + <?php echo $payment->source(); ?> |
|
104 | 104 | </div> |
105 | 105 | </td> |
106 | 106 | <td class=" jst-left"> |
107 | - <div id="payment-gateway-<?php echo $PAY_ID;?>"> |
|
108 | - <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso');?> |
|
107 | + <div id="payment-gateway-<?php echo $PAY_ID; ?>"> |
|
108 | + <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'); ?> |
|
109 | 109 | </div> |
110 | - <div id="payment-gateway-id-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0;?></div> |
|
110 | + <div id="payment-gateway-id-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0; ?></div> |
|
111 | 111 | </td> |
112 | 112 | <td class=" jst-left"> |
113 | - <div id="payment-response-<?php echo $PAY_ID;?>"><?php echo $payment->gateway_response();?></div> |
|
113 | + <div id="payment-response-<?php echo $PAY_ID; ?>"><?php echo $payment->gateway_response(); ?></div> |
|
114 | 114 | </td> |
115 | 115 | <td class=" jst-left"> |
116 | - <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->txn_id_chq_nmbr();?></div> |
|
116 | + <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->txn_id_chq_nmbr(); ?></div> |
|
117 | 117 | </td> |
118 | 118 | <td class=" jst-left"> |
119 | - <div id="payment-po-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->po_number();?></div> |
|
119 | + <div id="payment-po-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->po_number(); ?></div> |
|
120 | 120 | </td> |
121 | 121 | <td class=" jst-left"> |
122 | - <div id="payment-accntng-<?php echo $PAY_ID;?>"><?php echo $payment->extra_accntng();?></div> |
|
122 | + <div id="payment-accntng-<?php echo $PAY_ID; ?>"><?php echo $payment->extra_accntng(); ?></div> |
|
123 | 123 | </td> |
124 | 124 | <td class=" jst-rght"> |
125 | - <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-' . $payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
126 | - <span class="<?php echo $payment_class;?>"> |
|
127 | - <div id="payment-amount-<?php echo $PAY_ID;?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE ); ?></div> |
|
125 | + <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-'.$payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
126 | + <span class="<?php echo $payment_class; ?>"> |
|
127 | + <div id="payment-amount-<?php echo $PAY_ID; ?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE); ?></div> |
|
128 | 128 | </span> |
129 | 129 | </td> |
130 | 130 | </tr> |
@@ -134,25 +134,25 @@ discard block |
||
134 | 134 | <?php endforeach; // $payment?> |
135 | 135 | <?php |
136 | 136 | $pay_totals_class = $payment_total > $grand_raw_total ? ' important-notice' : ''; |
137 | - $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">' . __( 'This transaction has been overpaid ! ', 'event_espresso' ) . '</span>' : ''; |
|
137 | + $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">'.__('This transaction has been overpaid ! ', 'event_espresso').'</span>' : ''; |
|
138 | 138 | ?> |
139 | 139 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden"> |
140 | 140 | <td class=" jst-rght" colspan="11"> |
141 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
141 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
142 | 142 | </td> |
143 | 143 | </tr> |
144 | - <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class;?>"> |
|
145 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid . sprintf( __( 'Payments Total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );?></span></th> |
|
146 | - <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE);?></span></th> |
|
144 | + <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class; ?>"> |
|
145 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid.sprintf(__('Payments Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); ?></span></th> |
|
146 | + <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE); ?></span></th> |
|
147 | 147 | </tr> |
148 | 148 | <?php else : ?> |
149 | 149 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr"> |
150 | 150 | <td class=" jst-rght" colspan="11"> |
151 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
151 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
152 | 152 | </td> |
153 | 153 | </tr> |
154 | 154 | <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr hidden"> |
155 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __( 'Payments Total', 'event_espresso' );?></span></th> |
|
155 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __('Payments Total', 'event_espresso'); ?></span></th> |
|
156 | 156 | <th class=" jst-rght"><span id="txn-admin-payment-total"></span></th> |
157 | 157 | </tr> |
158 | 158 | <?php endif; // $payments?> |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | <td class=" jst-cntr"> |
166 | 166 | <ul class="txn-overview-actions-ul"> |
167 | 167 | <li> |
168 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
168 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
169 | 169 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
170 | 170 | </a> |
171 | 171 | </li> |
172 | 172 | <li> |
173 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
173 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
174 | 174 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
175 | 175 | </a> |
176 | 176 | </li> |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | <ul id="txn-admin-payment-options-ul"> |
218 | 218 | <li> |
219 | 219 | <a id="display-txn-admin-apply-payment" class="button-primary no-icon no-hide" rel="txn-admin-apply-payment" > <!--display-the-hidden --> |
220 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
220 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
221 | 221 | </a> |
222 | 222 | </li> |
223 | 223 | <li> |
224 | 224 | <a id="display-txn-admin-apply-refund" class="button-secondary no-icon no-hide" rel="txn-admin-apply-refund" > <!--display-the-hidden --> |
225 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
225 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
226 | 226 | </a> |
227 | 227 | </li> |
228 | 228 | </ul> |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | |
233 | 233 | <h2 id="admin-modal-dialog-apply-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
234 | 234 | <div class="ee-icon ee-icon-cash-add float-left"></div> |
235 | - <?php echo __( 'Apply a Payment to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
235 | + <?php echo __('Apply a Payment to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
236 | 236 | </h2> |
237 | 237 | |
238 | 238 | <h2 id="admin-modal-dialog-edit-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
239 | 239 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
240 | 240 | <?php |
241 | 241 | echo sprintf( |
242 | - __( 'Edit Payment #%s for Transaction #%s', 'event_espresso' ), |
|
242 | + __('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
243 | 243 | '<span></span>', |
244 | 244 | $txn_nmbr['value'] |
245 | 245 | ); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
251 | 251 | <?php |
252 | 252 | echo sprintf( |
253 | - __( 'Edit Refund #%s for Transaction #%s', 'event_espresso' ), |
|
253 | + __('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
254 | 254 | '<span></span>', |
255 | 255 | $txn_nmbr['value'] |
256 | 256 | ); |
@@ -259,14 +259,14 @@ discard block |
||
259 | 259 | |
260 | 260 | <h2 id="admin-modal-dialog-apply-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
261 | 261 | <div class="ee-icon ee-icon-cash-remove float-left"></div> |
262 | - <?php echo __( 'Apply a Refund to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
262 | + <?php echo __('Apply a Refund to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
263 | 263 | </h2> |
264 | 264 | |
265 | 265 | <form name="txn-admin-apply-payment-frm" id="txn-admin-apply-payment-frm" action="<?php echo $apply_payment_form_url; ?>"> |
266 | 266 | <div class="admin-modal-dialog-wrap"> |
267 | 267 | <div class="admin-modal-dialog-inner"> |
268 | 268 | |
269 | - <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_apply_payment_nonce' );?>"/> |
|
269 | + <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce('espresso_apply_payment_nonce'); ?>"/> |
|
270 | 270 | <input type="hidden" name="espresso_ajax" id="espresso-ajax" value="0"/> |
271 | 271 | <input type="hidden" name="noheader" id="txn-admin-noheader-inp" value="0"/> |
272 | 272 | <input type="hidden" name="txn_admin_payment[PAY_ID]" id="txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
@@ -274,108 +274,108 @@ discard block |
||
274 | 274 | <input type="hidden" name="txn_admin_payment[type]" id="txn-admin-payment-type-inp" value="1"/> |
275 | 275 | <input type="hidden" name="txn_admin_payment[details]" id="txn-admin-payment-details-inp" value=""/> |
276 | 276 | <input type="hidden" name="txn_admin_delete_payment_form_url" id="txn-admin-delete-payment-form-url-inp" value="<?php echo $delete_payment_form_url; ?>"/> |
277 | - <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date( 'Y-m-d h:i a', current_time( 'timestamp' )); ?>"/> |
|
277 | + <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date('Y-m-d h:i a', current_time('timestamp')); ?>"/> |
|
278 | 278 | |
279 | 279 | <div class="txn-admin-apply-payment-date-dv admin-modal-dialog-row"> |
280 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
281 | - <label for="txn-admin-payment-date-inp" class=""><?php _e( 'Payment Date', 'event_espresso' );?></label> |
|
282 | - <input name="[date]txn_admin_payment" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date( 'Y-m-d g:i a', current_time( 'timestamp' )); ?>"/> |
|
283 | - <p class="description"><?php _e( 'The date the payment was actually made on', 'event_espresso' );?></p> |
|
280 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
281 | + <label for="txn-admin-payment-date-inp" class=""><?php _e('Payment Date', 'event_espresso'); ?></label> |
|
282 | + <input name="[date]txn_admin_payment" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date('Y-m-d g:i a', current_time('timestamp')); ?>"/> |
|
283 | + <p class="description"><?php _e('The date the payment was actually made on', 'event_espresso'); ?></p> |
|
284 | 284 | </div> |
285 | 285 | |
286 | 286 | <div class="txn-admin-apply-payment-amount-dv admin-modal-dialog-row"> |
287 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
288 | - <label for="txn-admin-payment-amount-inp" class=""><?php _e( 'Amount', 'event_espresso' );?></label> |
|
287 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
288 | + <label for="txn-admin-payment-amount-inp" class=""><?php _e('Amount', 'event_espresso'); ?></label> |
|
289 | 289 | <input name="txn_admin_payment[amount]" id="txn-admin-payment-amount-inp" class="txn-admin-apply-payment-inp required" type="text" value=""/> |
290 | - <p class="description"><?php _e( 'The amount of the payment', 'event_espresso' );?></p> |
|
290 | + <p class="description"><?php _e('The amount of the payment', 'event_espresso'); ?></p> |
|
291 | 291 | </div> |
292 | 292 | |
293 | 293 | <div class="txn-admin-apply-payment-method-dv admin-modal-dialog-row"> |
294 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
295 | - <label for="txn-admin-payment-method-inp" class=""><?php _e( 'Method of Payment', 'event_espresso' );?></label> |
|
294 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
295 | + <label for="txn-admin-payment-method-inp" class=""><?php _e('Method of Payment', 'event_espresso'); ?></label> |
|
296 | 296 | <select name="txn_admin_payment[PMD_ID]" id="txn-admin-payment-method-slct" class="txn-admin-apply-payment-slct required" type="text" > |
297 | - <?php foreach ( $payment_methods as $method ) : ?> |
|
297 | + <?php foreach ($payment_methods as $method) : ?> |
|
298 | 298 | <?php $selected = $method->slug() == 'cash' ? ' selected="selected"' : ''; ?> |
299 | - <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key( $method->admin_desc() ) ? substr( $method->admin_desc(), 0, 128) : $method->admin_name() ; ?> </option> |
|
299 | + <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key($method->admin_desc()) ? substr($method->admin_desc(), 0, 128) : $method->admin_name(); ?> </option> |
|
300 | 300 | <?php endforeach; ?> |
301 | 301 | </select> |
302 | - <p class="description"><?php _e( 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso' );?></p> |
|
302 | + <p class="description"><?php _e('Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso'); ?></p> |
|
303 | 303 | </div> |
304 | 304 | |
305 | 305 | <div class="mop-PP mop-CC mop-CHQ mop"> |
306 | 306 | <div class="txn-admin-apply-payment-gw-txn-id-dv admin-modal-dialog-row"> |
307 | - <label for="txn-admin-payment-txn-id-inp" class=""><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></label> |
|
307 | + <label for="txn-admin-payment-txn-id-inp" class=""><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></label> |
|
308 | 308 | <input name="txn_admin_payment[txn_id_chq_nmbr]" id="txn-admin-payment-txn-id-chq-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
309 | - <p class="description"><?php _e( 'The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso' );?></p> |
|
309 | + <p class="description"><?php _e('The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso'); ?></p> |
|
310 | 310 | </div> |
311 | 311 | </div> |
312 | 312 | |
313 | 313 | <div class="mop-CC mop" style="display:none"> |
314 | 314 | <div class="txn-admin-apply-payment-response-dv admin-modal-dialog-row"> |
315 | - <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e( 'Gateway Response', 'event_espresso' );?></label> |
|
315 | + <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e('Gateway Response', 'event_espresso'); ?></label> |
|
316 | 316 | <input name="txn_admin_payment[gateway_response]" id="txn-admin-payment-gateway-response-inp" class="txn-admin-apply-payment-inp" type="text"/> |
317 | - <p class="description"><?php _e( 'The gateway response string (optional)', 'event_espresso' );?></p> |
|
317 | + <p class="description"><?php _e('The gateway response string (optional)', 'event_espresso'); ?></p> |
|
318 | 318 | </div> |
319 | 319 | </div> |
320 | 320 | |
321 | 321 | <div class="mop-PP mop-CC mop"> |
322 | 322 | <div class="txn-admin-apply-payment-status-dv admin-modal-dialog-row"> |
323 | - <label for="txn-admin-payment-status-inp" class=""><?php _e( 'Payment Status', 'event_espresso' );?></label> |
|
323 | + <label for="txn-admin-payment-status-inp" class=""><?php _e('Payment Status', 'event_espresso'); ?></label> |
|
324 | 324 | <select name="txn_admin_payment[status]" id="txn-admin-payment-status-slct" class="txn-admin-apply-payment-slct" type="text" > |
325 | - <?php foreach ( $payment_status as $STS_ID => $STS_code ) : ?> |
|
325 | + <?php foreach ($payment_status as $STS_ID => $STS_code) : ?> |
|
326 | 326 | <?php $selected = $STS_ID == 'PAP' ? ' selected="selected"' : ''; ?> |
327 | 327 | <option id="payment-status-opt-<?php echo $STS_ID; ?>" value="<?php echo $STS_ID; ?>"<?php echo $selected; ?>><?php echo $STS_code; ?> </option> |
328 | 328 | <?php endforeach; ?> |
329 | 329 | </select> |
330 | - <p class="description"><?php _e( 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso' );?></p> |
|
330 | + <p class="description"><?php _e('Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso'); ?></p> |
|
331 | 331 | </div> |
332 | 332 | </div> |
333 | 333 | |
334 | 334 | <div class="txn-admin-apply-payment-po-nmbr-dv admin-modal-dialog-row"> |
335 | - <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></label> |
|
335 | + <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e('P.O. / S.O. #', 'event_espresso'); ?></label> |
|
336 | 336 | <input name="txn_admin_payment[po_number]" id="txn-admin-payment-po-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
337 | - <p class="description"><?php _e( 'The Purchase or Sales Order Number if any (optional)', 'event_espresso' );?></p> |
|
337 | + <p class="description"><?php _e('The Purchase or Sales Order Number if any (optional)', 'event_espresso'); ?></p> |
|
338 | 338 | </div> |
339 | 339 | |
340 | 340 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
341 | - <label for="txn-admin-payment-accounting-inp" class="last"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></label> |
|
341 | + <label for="txn-admin-payment-accounting-inp" class="last"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></label> |
|
342 | 342 | <input name="txn_admin_payment[accounting]" id="txn-admin-payment-accounting-inp" class="txn-admin-apply-payment-inp" type="text" value="<?php echo $REG_code; ?>" maxlength="100"/> <input type="hidden" id="txn-admin-reg-code-inp" value="<?php echo $REG_code; ?>"/> |
343 | - <p class="description"><?php _e( 'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso' );?></p> |
|
343 | + <p class="description"><?php _e('An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso'); ?></p> |
|
344 | 344 | </div> |
345 | 345 | |
346 | 346 | <div class="txn-admin-apply-payment-registrations-dv admin-modal-dialog-row"> |
347 | - <label for="txn-admin-payment-registrations-inp" class="last"><?php _e( 'Registrations to Apply Payment to:', 'event_espresso' ); ?></label> |
|
347 | + <label for="txn-admin-payment-registrations-inp" class="last"><?php _e('Registrations to Apply Payment to:', 'event_espresso'); ?></label> |
|
348 | 348 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
349 | 349 | <input type="radio" value="1" id="txn-admin-apply-payment-to-all-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" checked="checked"/> |
350 | - <?php _e( 'ALL Registrations', 'event_espresso' ); ?> |
|
350 | + <?php _e('ALL Registrations', 'event_espresso'); ?> |
|
351 | 351 | </label> |
352 | 352 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
353 | 353 | <input type="radio" value="0" id="txn-admin-apply-payment-to-some-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" /> |
354 | - <?php _e( 'Just the following Registrations', 'event_espresso' ); ?> |
|
354 | + <?php _e('Just the following Registrations', 'event_espresso'); ?> |
|
355 | 355 | </label> |
356 | 356 | <?php echo $registrations_to_apply_payment_to; ?> |
357 | 357 | </div> |
358 | 358 | |
359 | 359 | <div class="txn-admin-payment-reg-status-dv admin-modal-dialog-row"> |
360 | - <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
360 | + <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
361 | 361 | <?php echo $status_change_select; ?> |
362 | - <p class="description"><?php _e( 'If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso' ); ?></p> |
|
362 | + <p class="description"><?php _e('If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso'); ?></p> |
|
363 | 363 | <br/> |
364 | 364 | </div> |
365 | 365 | |
366 | 366 | <div class="txn-admin-apply-payment-send-notifications-dv admin-modal-dialog-row"> |
367 | 367 | |
368 | - <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
368 | + <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
369 | 369 | <label class="txn-admin-payment-send-notifications-lbl"> |
370 | 370 | <input type="checkbox" value="1" name="txn_payments[send_notifications]" checked="checked" aria-checked="true" style="vertical-align: middle;"> |
371 | - <?php _e( 'Payment Messages?', 'event_espresso' ); ?> |
|
371 | + <?php _e('Payment Messages?', 'event_espresso'); ?> |
|
372 | 372 | </label> |
373 | 373 | <label class="txn-admin-payment-send-notifications-lbl"> |
374 | 374 | <input type="checkbox" value="1" name="txn_reg_status_change[send_notifications]" style="vertical-align: middle;"> |
375 | - <?php _e( 'Registration Messages?', 'event_espresso' ); ?> |
|
375 | + <?php _e('Registration Messages?', 'event_espresso'); ?> |
|
376 | 376 | </label> |
377 | 377 | <br class="clear-float"/> |
378 | - <p class="description"><?php printf( __('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />' ); ?></p> |
|
378 | + <p class="description"><?php printf(__('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />'); ?></p> |
|
379 | 379 | <label></label> |
380 | 380 | </div> |
381 | 381 | <div class="clear"></div> |
@@ -386,27 +386,27 @@ discard block |
||
386 | 386 | <ul id="admin-modal-dialog-options-ul"> |
387 | 387 | <li> |
388 | 388 | <a id="txn-admin-modal-dialog-apply-payment-lnk" class="button-primary no-icon" style="display:none;" > |
389 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
389 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
390 | 390 | </a> |
391 | 391 | </li> |
392 | 392 | <li> |
393 | 393 | <a id="txn-admin-modal-dialog-edit-payment-lnk" class="button-primary no-icon" style="display:none;" > |
394 | - <?php _e( 'Save Payment Details', 'event_espresso' );?> |
|
394 | + <?php _e('Save Payment Details', 'event_espresso'); ?> |
|
395 | 395 | </a> |
396 | 396 | </li> |
397 | 397 | <li> |
398 | 398 | <a id="txn-admin-modal-dialog-edit-refund-lnk" class="button-primary no-icon" style="display:none;" > |
399 | - <?php _e( 'Save Refund Details', 'event_espresso' );?> |
|
399 | + <?php _e('Save Refund Details', 'event_espresso'); ?> |
|
400 | 400 | </a> |
401 | 401 | </li> |
402 | 402 | <li> |
403 | 403 | <a id="txn-admin-modal-dialog-apply-refund-lnk" class="button-primary no-icon" style="display:none;" > |
404 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
404 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
405 | 405 | </a> |
406 | 406 | </li> |
407 | 407 | <li> |
408 | 408 | <a id="txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
409 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
409 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
410 | 410 | </a> |
411 | 411 | </li> |
412 | 412 | <li> |
@@ -423,29 +423,29 @@ discard block |
||
423 | 423 | |
424 | 424 | <h2 id="admin-modal-dialog-delete-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
425 | 425 | <span class="ee-icon ee-icon-cash-add"></span> |
426 | - <?php echo __( 'Delete Payment/Refund for Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
426 | + <?php echo __('Delete Payment/Refund for Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
427 | 427 | </h2> |
428 | 428 | |
429 | 429 | <form name="txn-admin-delete-payment-frm" id="txn-admin-delete-payment-frm" action="<?php echo $delete_payment_url; ?>"> |
430 | 430 | <div class="admin-modal-dialog-wrap"> |
431 | 431 | <div class="admin-modal-dialog-inner"> |
432 | 432 | |
433 | - <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_delete_payment_nonce' );?>"/> |
|
433 | + <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce('espresso_delete_payment_nonce'); ?>"/> |
|
434 | 434 | <input type="hidden" name="delete_espresso_ajax" id="delete-espresso-ajax" value="0"/> |
435 | 435 | <input type="hidden" name="delete_noheader" id="delete-txn-admin-noheader-inp" value="0"/> |
436 | 436 | <input type="hidden" name="delete_txn_admin_payment[PAY_ID]" id="delete-txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
437 | 437 | <input type="hidden" name="delete_txn_admin_payment[TXN_ID]" id="delete-txn-admin-payment-txn-id-inp" value="<?php echo $txn_nmbr['value']; ?>"/> |
438 | 438 | |
439 | 439 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
440 | - <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
440 | + <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
441 | 441 | <?php echo $delete_status_change_select; ?> |
442 | - <p class="description"><?php printf( __('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>' ); ?></p> |
|
442 | + <p class="description"><?php printf(__('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
443 | 443 | </div> |
444 | 444 | |
445 | 445 | <div class="ee-attention txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
446 | - <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
446 | + <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
447 | 447 | <input type="checkbox" value="1" name="delete_txn_reg_status_change[send_notifications]"> |
448 | - <p class="description"><?php _e( 'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso' );?></p> |
|
448 | + <p class="description"><?php _e('If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso'); ?></p> |
|
449 | 449 | </div> |
450 | 450 | <div class="clear"></div> |
451 | 451 | |
@@ -455,12 +455,12 @@ discard block |
||
455 | 455 | <ul id="del-admin-modal-dialog-options-ul"> |
456 | 456 | <li> |
457 | 457 | <a id="txn-admin-modal-dialog-delete-lnk" class="button-primary no-icon" style="display:none;" > |
458 | - <?php _e( 'Delete', 'event_espresso' );?> |
|
458 | + <?php _e('Delete', 'event_espresso'); ?> |
|
459 | 459 | </a> |
460 | 460 | </li> |
461 | 461 | <li> |
462 | 462 | <a id="del-txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
463 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
463 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
464 | 464 | </a> |
465 | 465 | </li> |
466 | 466 | <li> |
@@ -476,30 +476,30 @@ discard block |
||
476 | 476 | <?php endif; // $grand_raw_total > 0?> |
477 | 477 | |
478 | 478 | <?php |
479 | - if ( WP_DEBUG ) { |
|
480 | - $delivered_messages = get_option( 'EED_Messages__payment', array() ); |
|
481 | - if ( isset( $delivered_messages[ $TXN_ID ] )) { |
|
479 | + if (WP_DEBUG) { |
|
480 | + $delivered_messages = get_option('EED_Messages__payment', array()); |
|
481 | + if (isset($delivered_messages[$TXN_ID])) { |
|
482 | 482 | ?> |
483 | - <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e( 'Messages Sent to Primary Registrant', 'event_espresso' );?></h4> |
|
483 | + <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e('Messages Sent to Primary Registrant', 'event_espresso'); ?></h4> |
|
484 | 484 | |
485 | 485 | <div class="admin-primary-mbox-tbl-wrap"> |
486 | 486 | <table class="admin-primary-mbox-tbl"> |
487 | 487 | <thead> |
488 | 488 | <tr> |
489 | - <th class="jst-left"><?php _e( 'Date & Time', 'event_espresso' );?></th> |
|
490 | - <th class="jst-left"><?php _e( 'Message Type', 'event_espresso' );?></th> |
|
491 | - <th class="jst-left"><?php _e( 'Payment Status Upon Sending', 'event_espresso' );?></th> |
|
492 | - <th class="jst-left"><?php _e( 'TXN Status Upon Sending', 'event_espresso' );?></th> |
|
489 | + <th class="jst-left"><?php _e('Date & Time', 'event_espresso'); ?></th> |
|
490 | + <th class="jst-left"><?php _e('Message Type', 'event_espresso'); ?></th> |
|
491 | + <th class="jst-left"><?php _e('Payment Status Upon Sending', 'event_espresso'); ?></th> |
|
492 | + <th class="jst-left"><?php _e('TXN Status Upon Sending', 'event_espresso'); ?></th> |
|
493 | 493 | </tr> |
494 | 494 | </thead> |
495 | 495 | <tbody> |
496 | - <?php foreach ( $delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message ) : |
|
496 | + <?php foreach ($delivered_messages[$TXN_ID] as $timestamp => $delivered_message) : |
|
497 | 497 | ?> |
498 | 498 | <tr> |
499 | - <td class="jst-left"><?php echo gmdate( get_option('date_format') . ' ' . get_option('time_format'), ( $timestamp + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );?></td> |
|
500 | - <td class="jst-left"><?php echo isset( $delivered_message['message_type'] ) ? $delivered_message['message_type'] : '';?></td> |
|
501 | - <td class="jst-left"><?php echo isset( $delivered_message['pay_status'] ) ? $delivered_message['pay_status'] : '';?></td> |
|
502 | - <td class="jst-left"><?php echo isset( $delivered_message['txn_status'] ) ? $delivered_message['txn_status'] : '';?></td> |
|
499 | + <td class="jst-left"><?php echo gmdate(get_option('date_format').' '.get_option('time_format'), ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))); ?></td> |
|
500 | + <td class="jst-left"><?php echo isset($delivered_message['message_type']) ? $delivered_message['message_type'] : ''; ?></td> |
|
501 | + <td class="jst-left"><?php echo isset($delivered_message['pay_status']) ? $delivered_message['pay_status'] : ''; ?></td> |
|
502 | + <td class="jst-left"><?php echo isset($delivered_message['txn_status']) ? $delivered_message['txn_status'] : ''; ?></td> |
|
503 | 503 | </tr> |
504 | 504 | <?php endforeach; // $delivered_messages?> |
505 | 505 | </tbody> |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public static function instance() { |
63 | 63 | // check if class object is instantiated, and instantiated properly |
64 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Front_Controller )) { |
|
64 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Front_Controller)) { |
|
65 | 65 | self::$_instance = new self(); |
66 | 66 | } |
67 | 67 | return self::$_instance; |
@@ -79,37 +79,37 @@ discard block |
||
79 | 79 | */ |
80 | 80 | private function __construct() { |
81 | 81 | // make sure template tags are loaded immediately so that themes don't break |
82 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 ); |
|
82 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10); |
|
83 | 83 | // determine how to integrate WP_Query with the EE models |
84 | - add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' )); |
|
84 | + add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy')); |
|
85 | 85 | // load other resources and begin to actually run shortcodes and modules |
86 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 ); |
|
86 | + add_action('wp_loaded', array($this, 'wp_loaded'), 5); |
|
87 | 87 | // analyse the incoming WP request |
88 | - add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 ); |
|
88 | + add_action('parse_request', array($this, 'get_request'), 1, 1); |
|
89 | 89 | // process any content shortcodes |
90 | - add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 ); |
|
90 | + add_action('parse_request', array($this, '_initialize_shortcodes'), 5); |
|
91 | 91 | // process request with module factory |
92 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 ); |
|
92 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1); |
|
93 | 93 | // before headers sent |
94 | - add_action( 'wp', array( $this, 'wp' ), 5 ); |
|
94 | + add_action('wp', array($this, 'wp'), 5); |
|
95 | 95 | // load css and js |
96 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 ); |
|
96 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1); |
|
97 | 97 | // header |
98 | - add_action('wp_head', array( $this, 'header_meta_tag' ), 5 ); |
|
99 | - add_filter( 'template_include', array( $this, 'template_include' ), 1 ); |
|
98 | + add_action('wp_head', array($this, 'header_meta_tag'), 5); |
|
99 | + add_filter('template_include', array($this, 'template_include'), 1); |
|
100 | 100 | // display errors |
101 | - add_action('loop_start', array( $this, 'display_errors' ), 2 ); |
|
101 | + add_action('loop_start', array($this, 'display_errors'), 2); |
|
102 | 102 | // the content |
103 | - add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 ); |
|
103 | + add_filter('the_content', array($this, 'the_content'), 5, 1); |
|
104 | 104 | //exclude our private cpt comments |
105 | - add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 ); |
|
105 | + add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1); |
|
106 | 106 | //make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://) |
107 | - add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 ); |
|
107 | + add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1); |
|
108 | 108 | // action hook EE |
109 | - do_action( 'AHEE__EE_Front_Controller__construct__done',$this ); |
|
109 | + do_action('AHEE__EE_Front_Controller__construct__done', $this); |
|
110 | 110 | // for checking that browser cookies are enabled |
111 | - if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) { |
|
112 | - setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' ); |
|
111 | + if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) { |
|
112 | + setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/'); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | * @return void |
130 | 130 | */ |
131 | 131 | public function load_espresso_template_tags() { |
132 | - if ( is_readable( EE_PUBLIC . 'template_tags.php' )) { |
|
133 | - require_once( EE_PUBLIC . 'template_tags.php' ); |
|
132 | + if (is_readable(EE_PUBLIC.'template_tags.php')) { |
|
133 | + require_once(EE_PUBLIC.'template_tags.php'); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | * @param array $clauses array of comment clauses setup by WP_Comment_Query |
146 | 146 | * @return array array of comment clauses with modifications. |
147 | 147 | */ |
148 | - public function filter_wp_comments( $clauses ) { |
|
148 | + public function filter_wp_comments($clauses) { |
|
149 | 149 | global $wpdb; |
150 | - if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) { |
|
150 | + if (strpos($clauses['join'], $wpdb->posts) !== FALSE) { |
|
151 | 151 | $cpts = EE_Register_CPTs::get_private_CPTs(); |
152 | - foreach ( $cpts as $cpt => $details ) { |
|
153 | - $clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt ); |
|
152 | + foreach ($cpts as $cpt => $details) { |
|
153 | + $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | return $clauses; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @return void |
168 | 168 | */ |
169 | 169 | public function employ_CPT_Strategy() { |
170 | - if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){ |
|
171 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
170 | + if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) { |
|
171 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param string $url incoming url |
181 | 181 | * @return string final assembled url |
182 | 182 | */ |
183 | - public function maybe_force_admin_ajax_ssl( $url ) { |
|
184 | - if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) { |
|
185 | - $url = str_replace( 'http://', 'https://', $url ); |
|
183 | + public function maybe_force_admin_ajax_ssl($url) { |
|
184 | + if (is_ssl() && preg_match('/admin-ajax.php/', $url)) { |
|
185 | + $url = str_replace('http://', 'https://', $url); |
|
186 | 186 | } |
187 | 187 | return $url; |
188 | 188 | } |
@@ -219,12 +219,12 @@ discard block |
||
219 | 219 | * @param WP $WP |
220 | 220 | * @return void |
221 | 221 | */ |
222 | - public function get_request( WP $WP ) { |
|
223 | - do_action( 'AHEE__EE_Front_Controller__get_request__start' ); |
|
222 | + public function get_request(WP $WP) { |
|
223 | + do_action('AHEE__EE_Front_Controller__get_request__start'); |
|
224 | 224 | /** @var EE_Request_Handler $Request_Handler */ |
225 | - $Request_Handler = EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
226 | - $Request_Handler->parse_request( $WP ); |
|
227 | - do_action( 'AHEE__EE_Front_Controller__get_request__complete' ); |
|
225 | + $Request_Handler = EE_Registry::instance()->load_core('Request_Handler'); |
|
226 | + $Request_Handler->parse_request($WP); |
|
227 | + do_action('AHEE__EE_Front_Controller__get_request__complete'); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | |
@@ -236,22 +236,22 @@ discard block |
||
236 | 236 | * @param WP $WP |
237 | 237 | * @return void |
238 | 238 | */ |
239 | - public function _initialize_shortcodes( WP $WP ) { |
|
240 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this ); |
|
239 | + public function _initialize_shortcodes(WP $WP) { |
|
240 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this); |
|
241 | 241 | // grab post_name from request |
242 | - $current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get( 'post_name' )); |
|
242 | + $current_post = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get('post_name')); |
|
243 | 243 | // if it's not set, then check if frontpage is blog |
244 | - if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'posts' ) { |
|
244 | + if (empty($current_post) && get_option('show_on_front') == 'posts') { |
|
245 | 245 | // yup.. this is the posts page, prepare to load all shortcode modules |
246 | 246 | $current_post = 'posts'; |
247 | - } else if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'page' ) { |
|
247 | + } else if (empty($current_post) && get_option('show_on_front') == 'page') { |
|
248 | 248 | // some other page is set as the homepage |
249 | - $page_on_front = get_option( 'page_on_front' ); |
|
250 | - if ( $page_on_front ) { |
|
249 | + $page_on_front = get_option('page_on_front'); |
|
250 | + if ($page_on_front) { |
|
251 | 251 | // k now we need to find the post_name for this page |
252 | 252 | global $wpdb; |
253 | 253 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='page' AND post_status='publish' AND ID=%d"; |
254 | - $page_on_front = $wpdb->get_var( $wpdb->prepare( $SQL, $page_on_front )); |
|
254 | + $page_on_front = $wpdb->get_var($wpdb->prepare($SQL, $page_on_front)); |
|
255 | 255 | // set the current post slug to what it actually is |
256 | 256 | $current_post = $page_on_front ? $page_on_front : $current_post; |
257 | 257 | } |
@@ -259,58 +259,58 @@ discard block |
||
259 | 259 | // where are posts being displayed ? |
260 | 260 | $page_for_posts = EE_Config::get_page_for_posts(); |
261 | 261 | // in case $current_post is hierarchical like: /parent-page/current-page |
262 | - $current_post = basename( $current_post ); |
|
262 | + $current_post = basename($current_post); |
|
263 | 263 | // are we on a category page? |
264 | - $term_exists = is_array( term_exists( $current_post, 'category' )) || array_key_exists( 'category_name', $WP->query_vars ); |
|
264 | + $term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name', $WP->query_vars); |
|
265 | 265 | // make sure shortcodes are set |
266 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes )) { |
|
266 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes)) { |
|
267 | 267 | // d( EE_Registry::instance()->CFG->core->post_shortcodes ); |
268 | 268 | // cycle thru all posts with shortcodes set |
269 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) { |
|
269 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes) { |
|
270 | 270 | // filter shortcodes so |
271 | - $post_shortcodes = apply_filters( 'FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes ); |
|
271 | + $post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes); |
|
272 | 272 | // now cycle thru shortcodes |
273 | - foreach ( $post_shortcodes as $shortcode_class => $post_id ) { |
|
273 | + foreach ($post_shortcodes as $shortcode_class => $post_id) { |
|
274 | 274 | // are we on this page, or on the blog page, or an EE CPT category page ? |
275 | - if ( $current_post == $post_name || $term_exists ) { |
|
275 | + if ($current_post == $post_name || $term_exists) { |
|
276 | 276 | // verify shortcode is in list of registered shortcodes |
277 | - if ( ! isset( EE_Registry::instance()->shortcodes->{$shortcode_class} )) { |
|
278 | - if ( $current_post != $page_for_posts && current_user_can( 'edit_post', $post_id )) { |
|
279 | - $msg = sprintf( __( 'The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso' ), $shortcode_class ); |
|
280 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
281 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
277 | + if ( ! isset(EE_Registry::instance()->shortcodes->{$shortcode_class} )) { |
|
278 | + if ($current_post != $page_for_posts && current_user_can('edit_post', $post_id)) { |
|
279 | + $msg = sprintf(__('The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso'), $shortcode_class); |
|
280 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
281 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
282 | 282 | } |
283 | - add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' )); |
|
283 | + add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor')); |
|
284 | 284 | continue; |
285 | 285 | } |
286 | 286 | // is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ? |
287 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $current_post ] ) || $term_exists || $current_post == $page_for_posts ) { |
|
287 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$current_post]) || $term_exists || $current_post == $page_for_posts) { |
|
288 | 288 | // let's pause to reflect on this... |
289 | - $sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class ); |
|
289 | + $sc_reflector = new ReflectionClass('EES_'.$shortcode_class); |
|
290 | 290 | // ensure that class is actually a shortcode |
291 | - if ( ! $sc_reflector->isSubclassOf( 'EES_Shortcode' ) && defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE ) { |
|
292 | - $msg = sprintf( __( 'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso' ), $shortcode_class ); |
|
293 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
294 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
291 | + if ( ! $sc_reflector->isSubclassOf('EES_Shortcode') && defined('WP_DEBUG') && WP_DEBUG === TRUE) { |
|
292 | + $msg = sprintf(__('The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso'), $shortcode_class); |
|
293 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
294 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
295 | 295 | continue; |
296 | 296 | } |
297 | 297 | // and pass the request object to the run method |
298 | 298 | EE_Registry::instance()->shortcodes->{$shortcode_class} = $sc_reflector->newInstance(); |
299 | 299 | // fire the shortcode class's run method, so that it can activate resources |
300 | - EE_Registry::instance()->shortcodes->{$shortcode_class}->run( $WP ); |
|
300 | + EE_Registry::instance()->shortcodes->{$shortcode_class}->run($WP); |
|
301 | 301 | } |
302 | 302 | // if this is NOT the "Posts page" and we have a valid entry for the "Posts page" in our tracked post_shortcodes array |
303 | - } else if ( $post_name != $page_for_posts && isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] )) { |
|
303 | + } else if ($post_name != $page_for_posts && isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
304 | 304 | // and the shortcode is not being tracked for this page |
305 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] )) { |
|
305 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])) { |
|
306 | 306 | // then remove the "fallback" shortcode processor |
307 | - remove_shortcode( $shortcode_class ); |
|
307 | + remove_shortcode($shortcode_class); |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | } |
311 | 311 | } |
312 | 312 | } |
313 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this ); |
|
313 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
@@ -322,20 +322,20 @@ discard block |
||
322 | 322 | * @param WP_Query $WP_Query |
323 | 323 | * @return void |
324 | 324 | */ |
325 | - public function pre_get_posts( $WP_Query ) { |
|
325 | + public function pre_get_posts($WP_Query) { |
|
326 | 326 | // only load Module_Request_Router if this is the main query |
327 | - if ( $WP_Query->is_main_query() ) { |
|
327 | + if ($WP_Query->is_main_query()) { |
|
328 | 328 | // load module request router |
329 | - $Module_Request_Router = EE_Registry::instance()->load_core( 'Module_Request_Router' ); |
|
329 | + $Module_Request_Router = EE_Registry::instance()->load_core('Module_Request_Router'); |
|
330 | 330 | // verify object |
331 | - if ( $Module_Request_Router instanceof EE_Module_Request_Router ) { |
|
331 | + if ($Module_Request_Router instanceof EE_Module_Request_Router) { |
|
332 | 332 | // cycle thru module routes |
333 | - while ( $route = $Module_Request_Router->get_route( $WP_Query )) { |
|
333 | + while ($route = $Module_Request_Router->get_route($WP_Query)) { |
|
334 | 334 | // determine module and method for route |
335 | - $module = $Module_Request_Router->resolve_route( $route[0], $route[1] ); |
|
336 | - if( $module instanceof EED_Module ) { |
|
335 | + $module = $Module_Request_Router->resolve_route($route[0], $route[1]); |
|
336 | + if ($module instanceof EED_Module) { |
|
337 | 337 | // get registered view for route |
338 | - $this->_template_path = $Module_Request_Router->get_view( $route ); |
|
338 | + $this->_template_path = $Module_Request_Router->get_view($route); |
|
339 | 339 | // grab module name |
340 | 340 | $module_name = $module->module_name(); |
341 | 341 | // map the module to the module objects |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @return void |
363 | 363 | */ |
364 | 364 | public function wp() { |
365 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
365 | + EE_Registry::instance()->load_helper('Template'); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -380,30 +380,30 @@ discard block |
||
380 | 380 | public function wp_enqueue_scripts() { |
381 | 381 | |
382 | 382 | // css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_css', '__return_false' ); |
383 | - if ( apply_filters( 'FHEE_load_css', TRUE ) ) { |
|
383 | + if (apply_filters('FHEE_load_css', TRUE)) { |
|
384 | 384 | |
385 | 385 | EE_Registry::instance()->CFG->template_settings->enable_default_style = TRUE; |
386 | 386 | //Load the ThemeRoller styles if enabled |
387 | - if ( isset( EE_Registry::instance()->CFG->template_settings->enable_default_style ) && EE_Registry::instance()->CFG->template_settings->enable_default_style ) { |
|
387 | + if (isset(EE_Registry::instance()->CFG->template_settings->enable_default_style) && EE_Registry::instance()->CFG->template_settings->enable_default_style) { |
|
388 | 388 | |
389 | 389 | //Load custom style sheet if available |
390 | - if ( isset( EE_Registry::instance()->CFG->template_settings->custom_style_sheet )) { |
|
391 | - wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION ); |
|
390 | + if (isset(EE_Registry::instance()->CFG->template_settings->custom_style_sheet)) { |
|
391 | + wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION); |
|
392 | 392 | wp_enqueue_style('espresso_custom_css'); |
393 | 393 | } |
394 | 394 | |
395 | - EE_Registry::instance()->load_helper( 'File' ); |
|
396 | - if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) { |
|
397 | - wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
395 | + EE_Registry::instance()->load_helper('File'); |
|
396 | + if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) { |
|
397 | + wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
398 | 398 | } else { |
399 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
399 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
400 | 400 | } |
401 | 401 | wp_enqueue_style('espresso_default'); |
402 | 402 | |
403 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) { |
|
404 | - wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
403 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) { |
|
404 | + wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
405 | 405 | } else { |
406 | - wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
406 | + wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | } |
@@ -411,29 +411,29 @@ discard block |
||
411 | 411 | } |
412 | 412 | |
413 | 413 | // js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_js', '__return_false' ); |
414 | - if ( apply_filters( 'FHEE_load_js', TRUE ) ) { |
|
414 | + if (apply_filters('FHEE_load_js', TRUE)) { |
|
415 | 415 | |
416 | - wp_enqueue_script( 'jquery' ); |
|
416 | + wp_enqueue_script('jquery'); |
|
417 | 417 | //let's make sure that all required scripts have been setup |
418 | - if ( function_exists( 'wp_script_is' )) { |
|
419 | - if ( ! wp_script_is( 'jquery' )) { |
|
418 | + if (function_exists('wp_script_is')) { |
|
419 | + if ( ! wp_script_is('jquery')) { |
|
420 | 420 | $msg = sprintf( |
421 | - __( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ), |
|
421 | + __('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'), |
|
422 | 422 | '<em><br />', |
423 | 423 | '</em>' |
424 | 424 | ); |
425 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
425 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | // load core js |
429 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
430 | - wp_enqueue_script( 'espresso_core' ); |
|
431 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
429 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
430 | + wp_enqueue_script('espresso_core'); |
|
431 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
432 | 432 | |
433 | 433 | } |
434 | 434 | |
435 | 435 | //qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); |
436 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
436 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
437 | 437 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
438 | 438 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
439 | 439 | } |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | |
442 | 442 | //accounting.js library |
443 | 443 | // @link http://josscrowcroft.github.io/accounting.js/ |
444 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
445 | - $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js'; |
|
446 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
447 | - wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE ); |
|
448 | - wp_enqueue_script( 'ee-accounting' ); |
|
444 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
445 | + $acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js'; |
|
446 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
447 | + wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE); |
|
448 | + wp_enqueue_script('ee-accounting'); |
|
449 | 449 | |
450 | 450 | $currency_config = array( |
451 | 451 | 'currency' => array( |
@@ -468,21 +468,21 @@ discard block |
||
468 | 468 | wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config); |
469 | 469 | } |
470 | 470 | |
471 | - if ( ! function_exists( 'wp_head' )) { |
|
471 | + if ( ! function_exists('wp_head')) { |
|
472 | 472 | $msg = sprintf( |
473 | - __( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
473 | + __('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
474 | 474 | '<em><br />', |
475 | 475 | '</em>' |
476 | 476 | ); |
477 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
477 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
478 | 478 | } |
479 | - if ( ! function_exists( 'wp_footer' )) { |
|
479 | + if ( ! function_exists('wp_footer')) { |
|
480 | 480 | $msg = sprintf( |
481 | - __( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
481 | + __('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
482 | 482 | '<em><br />', |
483 | 483 | '</em>' |
484 | 484 | ); |
485 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
485 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @return void |
497 | 497 | */ |
498 | 498 | public function header_meta_tag() { |
499 | - print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />")); |
|
499 | + print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />")); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | * @param $the_content |
511 | 511 | * @return string |
512 | 512 | */ |
513 | - public function the_content( $the_content ) { |
|
513 | + public function the_content($the_content) { |
|
514 | 514 | // nothing gets loaded at this point unless other systems turn this hookpoint on by using: add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
515 | - if ( apply_filters( 'FHEE_run_EE_the_content', FALSE ) ) { |
|
515 | + if (apply_filters('FHEE_run_EE_the_content', FALSE)) { |
|
516 | 516 | } |
517 | 517 | return $the_content; |
518 | 518 | } |
@@ -537,9 +537,9 @@ discard block |
||
537 | 537 | */ |
538 | 538 | public function display_errors() { |
539 | 539 | static $shown_already = FALSE; |
540 | - do_action( 'AHEE__EE_Front_Controller__display_errors__begin' ); |
|
540 | + do_action('AHEE__EE_Front_Controller__display_errors__begin'); |
|
541 | 541 | if ( |
542 | - apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE ) |
|
542 | + apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE) |
|
543 | 543 | && ! $shown_already |
544 | 544 | && is_main_query() |
545 | 545 | && ! is_feed() |
@@ -548,10 +548,10 @@ discard block |
||
548 | 548 | ) { |
549 | 549 | echo EE_Error::get_notices(); |
550 | 550 | $shown_already = TRUE; |
551 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
552 | - EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' ); |
|
551 | + EE_Registry::instance()->load_helper('Template'); |
|
552 | + EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php'); |
|
553 | 553 | } |
554 | - do_action( 'AHEE__EE_Front_Controller__display_errors__end' ); |
|
554 | + do_action('AHEE__EE_Front_Controller__display_errors__end'); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | |
@@ -566,12 +566,12 @@ discard block |
||
566 | 566 | * @param string $template_include_path |
567 | 567 | * @return string |
568 | 568 | */ |
569 | - public function template_include( $template_include_path = NULL ) { |
|
570 | - if ( EE_Registry::instance()->REQ->is_espresso_page() ) { |
|
571 | - $this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path ); |
|
572 | - $template_path = EEH_Template::locate_template( $this->_template_path, array(), false ); |
|
573 | - $this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path; |
|
574 | - $this->_template = basename( $this->_template_path ); |
|
569 | + public function template_include($template_include_path = NULL) { |
|
570 | + if (EE_Registry::instance()->REQ->is_espresso_page()) { |
|
571 | + $this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path); |
|
572 | + $template_path = EEH_Template::locate_template($this->_template_path, array(), false); |
|
573 | + $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path; |
|
574 | + $this->_template = basename($this->_template_path); |
|
575 | 575 | return $this->_template_path; |
576 | 576 | } |
577 | 577 | return $template_include_path; |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | * @param bool $with_path |
587 | 587 | * @return string |
588 | 588 | */ |
589 | - public function get_selected_template( $with_path = FALSE ) { |
|
589 | + public function get_selected_template($with_path = FALSE) { |
|
590 | 590 | return $with_path ? $this->_template_path : $this->_template; |
591 | 591 | } |
592 | 592 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param EE_Response $response |
51 | 51 | * @return EE_Response |
52 | 52 | */ |
53 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
53 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
54 | 54 | $this->request = $request; |
55 | 55 | $this->response = $response; |
56 | 56 | // central repository for classes |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | // workarounds for PHP < 5.3 |
59 | 59 | $this->_load_class_tools(); |
60 | 60 | // PSR4 Autoloaders |
61 | - EE_Registry::instance()->load_core( 'EE_Psr4AutoloaderInit' ); |
|
61 | + EE_Registry::instance()->load_core('EE_Psr4AutoloaderInit'); |
|
62 | 62 | // deprecated functions |
63 | - espresso_load_required( 'EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php' ); |
|
63 | + espresso_load_required('EE_Deprecated', EE_CORE.'EE_Deprecated.core.php'); |
|
64 | 64 | // load interfaces |
65 | - espresso_load_required( 'EEI_Payment_Method_Interfaces', EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php' ); |
|
65 | + espresso_load_required('EEI_Payment_Method_Interfaces', EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php'); |
|
66 | 66 | //// WP cron jobs |
67 | - EE_Registry::instance()->load_core( 'Cron_Tasks' ); |
|
68 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
69 | - EE_Registry::instance()->load_core( 'EE_System' ); |
|
67 | + EE_Registry::instance()->load_core('Cron_Tasks'); |
|
68 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
69 | + EE_Registry::instance()->load_core('EE_System'); |
|
70 | 70 | |
71 | 71 | return $this->response; |
72 | 72 | } |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | private function _load_registry() { |
83 | - if ( is_readable( EE_CORE . 'EE_Registry.core.php' )) { |
|
84 | - require_once( EE_CORE . 'EE_Registry.core.php' ); |
|
83 | + if (is_readable(EE_CORE.'EE_Registry.core.php')) { |
|
84 | + require_once(EE_CORE.'EE_Registry.core.php'); |
|
85 | 85 | } else { |
86 | - $msg = __( 'The EE_Registry core class could not be loaded.', 'event_espresso' ); |
|
87 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
88 | - wp_die( EE_Error::get_notices() ); |
|
86 | + $msg = __('The EE_Registry core class could not be loaded.', 'event_espresso'); |
|
87 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
88 | + wp_die(EE_Error::get_notices()); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | * @return void |
98 | 98 | */ |
99 | 99 | private function _load_class_tools() { |
100 | - if ( is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) { |
|
101 | - require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' ); |
|
100 | + if (is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) { |
|
101 | + require_once(EE_HELPERS.'EEH_Class_Tools.helper.php'); |
|
102 | 102 | } else { |
103 | - $msg = __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' ); |
|
104 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
103 | + $msg = __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'); |
|
104 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param \EE_Request $request |
117 | 117 | * @param \EE_Response $response |
118 | 118 | */ |
119 | - public function handle_response( EE_Request $request, EE_Response $response ) { |
|
119 | + public function handle_response(EE_Request $request, EE_Response $response) { |
|
120 | 120 | //EEH_Debug_Tools::printr( $request, '$request', __FILE__, __LINE__ ); |
121 | 121 | //EEH_Debug_Tools::printr( $response, '$response', __FILE__, __LINE__ ); |
122 | 122 | //die(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class EE_Transaction_Payments |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function instance() { |
46 | 46 | // check if class object is instantiated |
47 | - if ( ! self::$_instance instanceof EE_Transaction_Payments ) { |
|
47 | + if ( ! self::$_instance instanceof EE_Transaction_Payments) { |
|
48 | 48 | self::$_instance = new self(); |
49 | 49 | } |
50 | 50 | return self::$_instance; |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @param string $old_txn_status |
74 | 74 | */ |
75 | - public function set_old_txn_status( $old_txn_status ) { |
|
75 | + public function set_old_txn_status($old_txn_status) { |
|
76 | 76 | // only set the first time |
77 | - if ( $this->_old_txn_status === null ) { |
|
77 | + if ($this->_old_txn_status === null) { |
|
78 | 78 | $this->_old_txn_status = $old_txn_status; |
79 | 79 | } |
80 | 80 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * @param string $new_txn_status |
95 | 95 | */ |
96 | - public function set_new_txn_status( $new_txn_status ) { |
|
96 | + public function set_new_txn_status($new_txn_status) { |
|
97 | 97 | $this->_new_txn_status = $new_txn_status; |
98 | 98 | } |
99 | 99 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return bool |
106 | 106 | */ |
107 | 107 | public function txn_status_updated() { |
108 | - return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
108 | + return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -124,22 +124,22 @@ discard block |
||
124 | 124 | * @param boolean $update_txn whether to save the TXN |
125 | 125 | * @return boolean whether the TXN was saved |
126 | 126 | */ |
127 | - public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){ |
|
127 | + public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) { |
|
128 | 128 | // verify transaction |
129 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
130 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
129 | + if ( ! $transaction instanceof EE_Transaction) { |
|
130 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
131 | 131 | return false; |
132 | 132 | } |
133 | 133 | // set incoming TXN_Status |
134 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
134 | + $this->set_old_txn_status($transaction->status_ID()); |
|
135 | 135 | // calculate total paid |
136 | - $total_paid = $this->recalculate_total_payments_for_transaction( $transaction ); |
|
136 | + $total_paid = $this->recalculate_total_payments_for_transaction($transaction); |
|
137 | 137 | // if total paid has changed |
138 | - if ( $total_paid != $transaction->paid() ) { |
|
139 | - $transaction->set_paid( $total_paid ); |
|
138 | + if ($total_paid != $transaction->paid()) { |
|
139 | + $transaction->set_paid($total_paid); |
|
140 | 140 | // maybe update status, and make sure to save transaction if not done already |
141 | - if ( ! $this->update_transaction_status_based_on_total_paid( $transaction, $update_txn )) { |
|
142 | - if ( $update_txn ) { |
|
141 | + if ( ! $this->update_transaction_status_based_on_total_paid($transaction, $update_txn)) { |
|
142 | + if ($update_txn) { |
|
143 | 143 | return $transaction->save() ? true : false; |
144 | 144 | } |
145 | 145 | } else { |
@@ -160,18 +160,18 @@ discard block |
||
160 | 160 | * @param string $payment_status, one of EEM_Payment's statuses, like 'PAP' (Approved). By default, searches for approved payments |
161 | 161 | * @return mixed float on success, false on fail |
162 | 162 | */ |
163 | - public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
|
163 | + public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved) { |
|
164 | 164 | // verify transaction |
165 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
166 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
165 | + if ( ! $transaction instanceof EE_Transaction) { |
|
166 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | // ensure Payment model is loaded |
170 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
170 | + EE_Registry::instance()->load_model('Payment'); |
|
171 | 171 | // calls EEM_Base::sum() |
172 | 172 | return EEM_Payment::instance()->sum( |
173 | 173 | // query params |
174 | - array( array( 'TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status )), |
|
174 | + array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)), |
|
175 | 175 | // field to sum |
176 | 176 | 'PAY_amount' |
177 | 177 | ); |
@@ -187,37 +187,37 @@ discard block |
||
187 | 187 | * @return boolean whether the TXN was saved |
188 | 188 | * @throws \EE_Error |
189 | 189 | */ |
190 | - public function update_transaction_status_based_on_total_paid( EE_Transaction $transaction, $update_txn = TRUE ) { |
|
190 | + public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = TRUE) { |
|
191 | 191 | // verify transaction |
192 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
192 | + if ( ! $transaction instanceof EE_Transaction) { |
|
193 | 193 | EE_Error::add_error( |
194 | - __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), |
|
194 | + __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
|
195 | 195 | __FILE__, __FUNCTION__, __LINE__ |
196 | 196 | ); |
197 | 197 | return FALSE; |
198 | 198 | } |
199 | - EE_Registry::instance()->load_helper( 'Money' ); |
|
199 | + EE_Registry::instance()->load_helper('Money'); |
|
200 | 200 | // set incoming TXN_Status |
201 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
201 | + $this->set_old_txn_status($transaction->status_ID()); |
|
202 | 202 | // set transaction status based on comparison of TXN_paid vs TXN_total |
203 | - if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total(), '>' ) ){ |
|
203 | + if (EEH_Money::compare_floats($transaction->paid(), $transaction->total(), '>')) { |
|
204 | 204 | $new_txn_status = EEM_Transaction::overpaid_status_code; |
205 | - } else if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total() ) ) { |
|
205 | + } else if (EEH_Money::compare_floats($transaction->paid(), $transaction->total())) { |
|
206 | 206 | $new_txn_status = EEM_Transaction::complete_status_code; |
207 | - } else if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total(), '<' ) ) { |
|
207 | + } else if (EEH_Money::compare_floats($transaction->paid(), $transaction->total(), '<')) { |
|
208 | 208 | $new_txn_status = EEM_Transaction::incomplete_status_code; |
209 | 209 | } else { |
210 | 210 | EE_Error::add_error( |
211 | - __( 'The total paid calculation for this transaction is inaccurate.', 'event_espresso' ), |
|
211 | + __('The total paid calculation for this transaction is inaccurate.', 'event_espresso'), |
|
212 | 212 | __FILE__, __FUNCTION__, __LINE__ |
213 | 213 | ); |
214 | 214 | return FALSE; |
215 | 215 | } |
216 | - if ( $new_txn_status !== $transaction->status_ID() ) { |
|
216 | + if ($new_txn_status !== $transaction->status_ID()) { |
|
217 | 217 | // set incoming TXN_Status |
218 | - $this->set_new_txn_status( $new_txn_status ); |
|
219 | - $transaction->set_status( $new_txn_status ); |
|
220 | - if ( $update_txn ) { |
|
218 | + $this->set_new_txn_status($new_txn_status); |
|
219 | + $transaction->set_status($new_txn_status); |
|
220 | + if ($update_txn) { |
|
221 | 221 | return $transaction->save() ? TRUE : FALSE; |
222 | 222 | } |
223 | 223 | } |
@@ -236,17 +236,17 @@ discard block |
||
236 | 236 | * @param EE_Payment $payment |
237 | 237 | * @return boolean |
238 | 238 | */ |
239 | - public function delete_payment_and_update_transaction( EE_Payment $payment ) { |
|
239 | + public function delete_payment_and_update_transaction(EE_Payment $payment) { |
|
240 | 240 | // verify payment |
241 | - if ( ! $payment instanceof EE_Payment ) { |
|
242 | - EE_Error::add_error( __( 'A valid Payment object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
241 | + if ( ! $payment instanceof EE_Payment) { |
|
242 | + EE_Error::add_error(__('A valid Payment object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
243 | 243 | return false; |
244 | 244 | } |
245 | - if ( ! $this->delete_registration_payments_and_update_registrations( $payment ) ) { |
|
245 | + if ( ! $this->delete_registration_payments_and_update_registrations($payment)) { |
|
246 | 246 | return false; |
247 | 247 | } |
248 | - if ( ! $payment->delete() ) { |
|
249 | - EE_Error::add_error( __( 'The payment could not be deleted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
248 | + if ( ! $payment->delete()) { |
|
249 | + EE_Error::add_error(__('The payment could not be deleted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
250 | 250 | return false; |
251 | 251 | } |
252 | 252 | |
@@ -257,14 +257,14 @@ discard block |
||
257 | 257 | || $transaction->status_ID() === EEM_Transaction::failed_status_code |
258 | 258 | || $payment->amount() === 0 |
259 | 259 | ) { |
260 | - EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) ); |
|
260 | + EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso')); |
|
261 | 261 | return true; |
262 | 262 | } |
263 | 263 | |
264 | 264 | |
265 | 265 | //if this fails, that just means that the transaction didn't get its status changed and/or updated. |
266 | 266 | //however the payment was still deleted. |
267 | - if ( ! $this->calculate_total_payments_and_update_status( $transaction ) ) { |
|
267 | + if ( ! $this->calculate_total_payments_and_update_status($transaction)) { |
|
268 | 268 | |
269 | 269 | EE_Error::add_attention( |
270 | 270 | __( |
@@ -298,28 +298,28 @@ discard block |
||
298 | 298 | * @return bool |
299 | 299 | * @throws \EE_Error |
300 | 300 | */ |
301 | - public function delete_registration_payments_and_update_registrations( EE_Payment $payment, $reg_payment_query_params = array() ) { |
|
301 | + public function delete_registration_payments_and_update_registrations(EE_Payment $payment, $reg_payment_query_params = array()) { |
|
302 | 302 | $save_payment = false; |
303 | - $reg_payment_query_params = ! empty( $reg_payment_query_params ) ? $reg_payment_query_params : array( array( 'PAY_ID' => $payment->ID() ) ); |
|
304 | - $registration_payments = EEM_Registration_Payment::instance()->get_all( $reg_payment_query_params ); |
|
305 | - if ( ! empty( $registration_payments )) { |
|
306 | - foreach ( $registration_payments as $registration_payment ) { |
|
307 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
303 | + $reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params : array(array('PAY_ID' => $payment->ID())); |
|
304 | + $registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params); |
|
305 | + if ( ! empty($registration_payments)) { |
|
306 | + foreach ($registration_payments as $registration_payment) { |
|
307 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
308 | 308 | $amount_paid = $registration_payment->amount(); |
309 | 309 | $registration = $registration_payment->registration(); |
310 | - if ( $registration instanceof EE_Registration ) { |
|
311 | - $registration->set_paid( $registration->paid() - $amount_paid ); |
|
312 | - if ( $registration->save() ) { |
|
313 | - if ( $registration_payment->delete() ) { |
|
314 | - $registration->_remove_relation_to( $payment, 'Payment' ); |
|
315 | - $payment->_remove_relation_to( $registration, 'Registration' ); |
|
310 | + if ($registration instanceof EE_Registration) { |
|
311 | + $registration->set_paid($registration->paid() - $amount_paid); |
|
312 | + if ($registration->save()) { |
|
313 | + if ($registration_payment->delete()) { |
|
314 | + $registration->_remove_relation_to($payment, 'Payment'); |
|
315 | + $payment->_remove_relation_to($registration, 'Registration'); |
|
316 | 316 | } |
317 | 317 | $save_payment = true; |
318 | 318 | } |
319 | 319 | } else { |
320 | 320 | EE_Error::add_error( |
321 | 321 | sprintf( |
322 | - __( 'An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso' ), |
|
322 | + __('An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso'), |
|
323 | 323 | $registration_payment->ID() |
324 | 324 | ), |
325 | 325 | __FILE__, __FUNCTION__, __LINE__ |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | } else { |
330 | 330 | EE_Error::add_error( |
331 | 331 | sprintf( |
332 | - __( 'An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso' ), |
|
332 | + __('An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso'), |
|
333 | 333 | $payment->ID() |
334 | 334 | ), |
335 | 335 | __FILE__, __FUNCTION__, __LINE__ |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
341 | - if ( $save_payment ) { |
|
341 | + if ($save_payment) { |
|
342 | 342 | $payment->save(); |
343 | 343 | } |
344 | 344 | return true; |
@@ -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 |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | * @param string $timezone |
34 | 34 | * @param array $date_formats |
35 | 35 | */ |
36 | - protected function __construct( $fieldValues = NULL, $bydb = FALSE, $timezone = NULL, $date_formats = array() ) { |
|
37 | - if ( !isset( $fieldValues[ 'ATT_full_name' ] ) ) { |
|
38 | - $fname = isset( $fieldValues[ 'ATT_fname' ] ) ? $fieldValues[ 'ATT_fname' ] . ' ' : ''; |
|
39 | - $lname = isset( $fieldValues[ 'ATT_lname' ] ) ? $fieldValues[ 'ATT_lname' ] : ''; |
|
40 | - $fieldValues[ 'ATT_full_name' ] = $fname . $lname; |
|
36 | + protected function __construct($fieldValues = NULL, $bydb = FALSE, $timezone = NULL, $date_formats = array()) { |
|
37 | + if ( ! isset($fieldValues['ATT_full_name'])) { |
|
38 | + $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'].' ' : ''; |
|
39 | + $lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : ''; |
|
40 | + $fieldValues['ATT_full_name'] = $fname.$lname; |
|
41 | 41 | } |
42 | - if ( !isset( $fieldValues[ 'ATT_slug' ] ) ) { |
|
42 | + if ( ! isset($fieldValues['ATT_slug'])) { |
|
43 | 43 | // $fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20)); |
44 | - $fieldValues[ 'ATT_slug' ] = sanitize_title( $fieldValues[ 'ATT_full_name' ] ); |
|
44 | + $fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']); |
|
45 | 45 | } |
46 | - if ( !isset( $fieldValues[ 'ATT_short_bio' ] ) && isset( $fieldValues[ 'ATT_bio' ] ) ) { |
|
47 | - $fieldValues[ 'ATT_short_bio' ] = substr( $fieldValues[ 'ATT_bio' ], 0, 50 ); |
|
46 | + if ( ! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) { |
|
47 | + $fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50); |
|
48 | 48 | } |
49 | - parent::__construct( $fieldValues, $bydb, $timezone, $date_formats ); |
|
49 | + parent::__construct($fieldValues, $bydb, $timezone, $date_formats); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * date_format and the second value is the time format |
61 | 61 | * @return EE_Attendee |
62 | 62 | */ |
63 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
64 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
65 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
63 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
64 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
65 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * the website will be used. |
74 | 74 | * @return EE_Attendee |
75 | 75 | */ |
76 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
77 | - return new self( $props_n_values, TRUE, $timezone ); |
|
76 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
77 | + return new self($props_n_values, TRUE, $timezone); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @access public |
86 | 86 | * @param string $fname |
87 | 87 | */ |
88 | - public function set_fname( $fname = '' ) { |
|
89 | - $this->set( 'ATT_fname', $fname ); |
|
88 | + public function set_fname($fname = '') { |
|
89 | + $this->set('ATT_fname', $fname); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @access public |
98 | 98 | * @param string $lname |
99 | 99 | */ |
100 | - public function set_lname( $lname = '' ) { |
|
101 | - $this->set( 'ATT_lname', $lname ); |
|
100 | + public function set_lname($lname = '') { |
|
101 | + $this->set('ATT_lname', $lname); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @access public |
110 | 110 | * @param string $address |
111 | 111 | */ |
112 | - public function set_address( $address = '' ) { |
|
113 | - $this->set( 'ATT_address', $address ); |
|
112 | + public function set_address($address = '') { |
|
113 | + $this->set('ATT_address', $address); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @access public |
122 | 122 | * @param string $address2 |
123 | 123 | */ |
124 | - public function set_address2( $address2 = '' ) { |
|
125 | - $this->set( 'ATT_address2', $address2 ); |
|
124 | + public function set_address2($address2 = '') { |
|
125 | + $this->set('ATT_address2', $address2); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @access public |
134 | 134 | * @param string $city |
135 | 135 | */ |
136 | - public function set_city( $city = '' ) { |
|
137 | - $this->set( 'ATT_city', $city ); |
|
136 | + public function set_city($city = '') { |
|
137 | + $this->set('ATT_city', $city); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | * @access public |
146 | 146 | * @param int $STA_ID |
147 | 147 | */ |
148 | - public function set_state( $STA_ID = 0 ) { |
|
149 | - $this->set( 'STA_ID', $STA_ID ); |
|
148 | + public function set_state($STA_ID = 0) { |
|
149 | + $this->set('STA_ID', $STA_ID); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | * @access public |
158 | 158 | * @param string $CNT_ISO |
159 | 159 | */ |
160 | - public function set_country( $CNT_ISO = '' ) { |
|
161 | - $this->set( 'CNT_ISO', $CNT_ISO ); |
|
160 | + public function set_country($CNT_ISO = '') { |
|
161 | + $this->set('CNT_ISO', $CNT_ISO); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * @access public |
170 | 170 | * @param string $zip |
171 | 171 | */ |
172 | - public function set_zip( $zip = '' ) { |
|
173 | - $this->set( 'ATT_zip', $zip ); |
|
172 | + public function set_zip($zip = '') { |
|
173 | + $this->set('ATT_zip', $zip); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | * @access public |
182 | 182 | * @param string $email |
183 | 183 | */ |
184 | - public function set_email( $email = '' ) { |
|
185 | - $this->set( 'ATT_email', $email ); |
|
184 | + public function set_email($email = '') { |
|
185 | + $this->set('ATT_email', $email); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | * @access public |
194 | 194 | * @param string $phone |
195 | 195 | */ |
196 | - public function set_phone( $phone = '' ) { |
|
197 | - $this->set( 'ATT_phone', $phone ); |
|
196 | + public function set_phone($phone = '') { |
|
197 | + $this->set('ATT_phone', $phone); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | * @access public |
206 | 206 | * @param bool $ATT_deleted |
207 | 207 | */ |
208 | - public function set_deleted( $ATT_deleted = FALSE ) { |
|
209 | - $this->set( 'ATT_deleted', $ATT_deleted ); |
|
208 | + public function set_deleted($ATT_deleted = FALSE) { |
|
209 | + $this->set('ATT_deleted', $ATT_deleted); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @return int |
220 | 220 | */ |
221 | 221 | public function wp_user() { |
222 | - return $this->get( 'ATT_author' ); |
|
222 | + return $this->get('ATT_author'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @return string |
231 | 231 | */ |
232 | 232 | public function fname() { |
233 | - return $this->get( 'ATT_fname' ); |
|
233 | + return $this->get('ATT_fname'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | * @param bool $apply_html_entities |
251 | 251 | * @return string |
252 | 252 | */ |
253 | - public function full_name( $apply_html_entities = FALSE ) { |
|
254 | - $full_name = $this->fname() . ' ' . $this->lname(); |
|
255 | - return $apply_html_entities ? htmlentities( $full_name, ENT_QUOTES, 'UTF-8' ) : $full_name; |
|
253 | + public function full_name($apply_html_entities = FALSE) { |
|
254 | + $full_name = $this->fname().' '.$this->lname(); |
|
255 | + return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @return string |
264 | 264 | */ |
265 | 265 | public function lname() { |
266 | - return $this->get( 'ATT_lname' ); |
|
266 | + return $this->get('ATT_lname'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -277,26 +277,26 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function full_address_as_array() { |
279 | 279 | $full_address_array = array(); |
280 | - $initial_address_fields = array( 'ATT_address', 'ATT_address2', 'ATT_city', ); |
|
281 | - foreach ( $initial_address_fields as $address_field_name ) { |
|
282 | - $address_fields_value = $this->get( $address_field_name ); |
|
283 | - if ( !empty( $address_fields_value ) ) { |
|
284 | - $full_address_array[ ] = $address_fields_value; |
|
280 | + $initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',); |
|
281 | + foreach ($initial_address_fields as $address_field_name) { |
|
282 | + $address_fields_value = $this->get($address_field_name); |
|
283 | + if ( ! empty($address_fields_value)) { |
|
284 | + $full_address_array[] = $address_fields_value; |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | //now handle state and country |
288 | 288 | $state_obj = $this->state_obj(); |
289 | - if ( !empty( $state_obj ) ) { |
|
290 | - $full_address_array[ ] = $state_obj->name(); |
|
289 | + if ( ! empty($state_obj)) { |
|
290 | + $full_address_array[] = $state_obj->name(); |
|
291 | 291 | } |
292 | 292 | $country_obj = $this->country_obj(); |
293 | - if ( !empty( $country_obj ) ) { |
|
294 | - $full_address_array[ ] = $country_obj->name(); |
|
293 | + if ( ! empty($country_obj)) { |
|
294 | + $full_address_array[] = $country_obj->name(); |
|
295 | 295 | } |
296 | 296 | //lastly get the xip |
297 | 297 | $zip_value = $this->zip(); |
298 | - if ( !empty( $zip_value ) ) { |
|
299 | - $full_address_array[ ] = $zip_value; |
|
298 | + if ( ! empty($zip_value)) { |
|
299 | + $full_address_array[] = $zip_value; |
|
300 | 300 | } |
301 | 301 | return $full_address_array; |
302 | 302 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @return string |
309 | 309 | */ |
310 | 310 | public function address() { |
311 | - return $this->get( 'ATT_address' ); |
|
311 | + return $this->get('ATT_address'); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @return string |
319 | 319 | */ |
320 | 320 | public function address2() { |
321 | - return $this->get( 'ATT_address2' ); |
|
321 | + return $this->get('ATT_address2'); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | * @return string |
329 | 329 | */ |
330 | 330 | public function city() { |
331 | - return $this->get( 'ATT_city' ); |
|
331 | + return $this->get('ATT_city'); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @return string |
339 | 339 | */ |
340 | 340 | public function state_ID() { |
341 | - return $this->get( 'STA_ID' ); |
|
341 | + return $this->get('STA_ID'); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * @return string |
348 | 348 | */ |
349 | 349 | public function state_abbrev() { |
350 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' ); |
|
350 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso'); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -357,18 +357,18 @@ discard block |
||
357 | 357 | * @return EE_State |
358 | 358 | */ |
359 | 359 | public function state_obj() { |
360 | - return $this->get_first_related( 'State' ); |
|
360 | + return $this->get_first_related('State'); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
364 | 364 | * Returns the state's name, otherwise 'Unknown' |
365 | 365 | * @return string |
366 | 366 | */ |
367 | - public function state_name(){ |
|
368 | - if( $this->state_obj() ){ |
|
367 | + public function state_name() { |
|
368 | + if ($this->state_obj()) { |
|
369 | 369 | return $this->state_obj()->name(); |
370 | - }else{ |
|
371 | - return __( 'Unknown', 'event_espresso' ); |
|
370 | + } else { |
|
371 | + return __('Unknown', 'event_espresso'); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @return string |
382 | 382 | */ |
383 | 383 | public function state() { |
384 | - if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) { |
|
384 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
385 | 385 | return $this->state_abbrev(); |
386 | 386 | } else { |
387 | 387 | return $this->state_name(); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | * @return string |
396 | 396 | */ |
397 | 397 | public function country_ID() { |
398 | - return $this->get( 'CNT_ISO' ); |
|
398 | + return $this->get('CNT_ISO'); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -405,18 +405,18 @@ discard block |
||
405 | 405 | * @return EE_Country |
406 | 406 | */ |
407 | 407 | public function country_obj() { |
408 | - return $this->get_first_related( 'Country' ); |
|
408 | + return $this->get_first_related('Country'); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
412 | 412 | * Returns the country's name if known, otherwise 'Unknown' |
413 | 413 | * @return string |
414 | 414 | */ |
415 | - public function country_name(){ |
|
416 | - if( $this->country_obj() ){ |
|
415 | + public function country_name() { |
|
416 | + if ($this->country_obj()) { |
|
417 | 417 | return $this->country_obj()->name(); |
418 | - }else{ |
|
419 | - return __( 'Unknown', 'event_espresso' ); |
|
418 | + } else { |
|
419 | + return __('Unknown', 'event_espresso'); |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @return string |
430 | 430 | */ |
431 | 431 | public function country() { |
432 | - if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) { |
|
432 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
433 | 433 | return $this->country_ID(); |
434 | 434 | } else { |
435 | 435 | return $this->country_name(); |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | * @return string |
444 | 444 | */ |
445 | 445 | public function zip() { |
446 | - return $this->get( 'ATT_zip' ); |
|
446 | + return $this->get('ATT_zip'); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @return string |
454 | 454 | */ |
455 | 455 | public function email() { |
456 | - return $this->get( 'ATT_email' ); |
|
456 | + return $this->get('ATT_email'); |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @return string |
464 | 464 | */ |
465 | 465 | public function phone() { |
466 | - return $this->get( 'ATT_phone' ); |
|
466 | + return $this->get('ATT_phone'); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | * @return bool |
474 | 474 | */ |
475 | 475 | public function deleted() { |
476 | - return $this->get( 'ATT_deleted' ); |
|
476 | + return $this->get('ATT_deleted'); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -483,8 +483,8 @@ discard block |
||
483 | 483 | * @param array $query_params |
484 | 484 | * @return EE_Registration[] |
485 | 485 | */ |
486 | - public function get_registrations( $query_params = array() ) { |
|
487 | - return $this->get_many_related( 'Registration', $query_params ); |
|
486 | + public function get_registrations($query_params = array()) { |
|
487 | + return $this->get_many_related('Registration', $query_params); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | * @return EE_Registration |
495 | 495 | */ |
496 | 496 | public function get_most_recent_registration() { |
497 | - return $this->get_first_related( 'Registration', array( 'order_by' => array( 'REG_date' => 'DESC' ) ) ); //null, 'REG_date', 'DESC', '=', 'OBJECT_K'); |
|
497 | + return $this->get_first_related('Registration', array('order_by' => array('REG_date' => 'DESC'))); //null, 'REG_date', 'DESC', '=', 'OBJECT_K'); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | * @param int $event_id |
505 | 505 | * @return EE_Registration |
506 | 506 | */ |
507 | - public function get_most_recent_registration_for_event( $event_id ) { |
|
508 | - return $this->get_first_related( 'Registration', array(array( 'EVT_ID' => $event_id ), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' ); |
|
507 | + public function get_most_recent_registration_for_event($event_id) { |
|
508 | + return $this->get_first_related('Registration', array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC'))); //, '=', 'OBJECT_K' ); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * @return array |
516 | 516 | */ |
517 | 517 | public function events() { |
518 | - return $this->get_many_related( 'Event' ); |
|
518 | + return $this->get_many_related('Event'); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | /** |
@@ -524,17 +524,17 @@ discard block |
||
524 | 524 | * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class |
525 | 525 | * @return EE_Form_Section_Proper |
526 | 526 | */ |
527 | - public function billing_info_for_payment_method($payment_method){ |
|
527 | + public function billing_info_for_payment_method($payment_method) { |
|
528 | 528 | $pm_type = $payment_method->type_obj(); |
529 | - if( ! $pm_type instanceof EE_PMT_Base ){ |
|
529 | + if ( ! $pm_type instanceof EE_PMT_Base) { |
|
530 | 530 | return NULL; |
531 | 531 | } |
532 | - $billing_info = $this->get_post_meta( $this->get_billing_info_postmeta_name( $payment_method ), true ); |
|
533 | - if ( ! $billing_info){ |
|
532 | + $billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true); |
|
533 | + if ( ! $billing_info) { |
|
534 | 534 | return NULL; |
535 | 535 | } |
536 | 536 | $billing_form = $pm_type->billing_form(); |
537 | - $billing_form->receive_form_submission( array( $billing_form->name() => $billing_info ), FALSE ); |
|
537 | + $billing_form->receive_form_submission(array($billing_form->name() => $billing_info), FALSE); |
|
538 | 538 | return $billing_form; |
539 | 539 | } |
540 | 540 | |
@@ -544,10 +544,10 @@ discard block |
||
544 | 544 | * @param EE_Payment_Method $payment_method |
545 | 545 | * @return string |
546 | 546 | */ |
547 | - public function get_billing_info_postmeta_name($payment_method){ |
|
548 | - if( $payment_method->type_obj() instanceof EE_PMT_Base ){ |
|
549 | - return 'billing_info_' . $payment_method->type_obj()->system_name(); |
|
550 | - }else{ |
|
547 | + public function get_billing_info_postmeta_name($payment_method) { |
|
548 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
549 | + return 'billing_info_'.$payment_method->type_obj()->system_name(); |
|
550 | + } else { |
|
551 | 551 | return NULL; |
552 | 552 | } |
553 | 553 | } |
@@ -558,13 +558,13 @@ discard block |
||
558 | 558 | * @param EE_Payment_Method $payment_method |
559 | 559 | * @return boolean |
560 | 560 | */ |
561 | - public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method){ |
|
562 | - if( ! $billing_form instanceof EE_Billing_Attendee_Info_Form ){ |
|
563 | - EE_Error::add_error( __( 'Cannot save billing info because there is none.', 'event_espresso' ) ); |
|
561 | + public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method) { |
|
562 | + if ( ! $billing_form instanceof EE_Billing_Attendee_Info_Form) { |
|
563 | + EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso')); |
|
564 | 564 | return false; |
565 | 565 | } |
566 | 566 | $billing_form->clean_sensitive_data(); |
567 | - return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name( $payment_method ), $billing_form->input_values( true ) ); |
|
567 | + return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name($payment_method), $billing_form->input_values(true)); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_Change_Log extends EE_Base_Class{ |
|
28 | +class EE_Change_Log extends EE_Base_Class { |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * date_format and the second value is the time format |
37 | 37 | * @return EE_Attendee |
38 | 38 | */ |
39 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
40 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
41 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
39 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
40 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
41 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | * the website will be used. |
50 | 50 | * @return EE_Attendee |
51 | 51 | */ |
52 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
53 | - return new self( $props_n_values, TRUE, $timezone ); |
|
52 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
53 | + return new self($props_n_values, TRUE, $timezone); |
|
54 | 54 | } |
55 | 55 | /** |
56 | 56 | * Gets message |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | * Gets the model object attached to this log |
148 | 148 | * @return EE_Base_Class |
149 | 149 | */ |
150 | - function object(){ |
|
150 | + function object() { |
|
151 | 151 | $model_name_of_related_obj = $this->OBJ_type(); |
152 | 152 | $is_model_name = EE_Registry::instance()->is_model_name($model_name_of_related_obj); |
153 | - if( ! $is_model_name ){ |
|
153 | + if ( ! $is_model_name) { |
|
154 | 154 | return null; |
155 | - }else{ |
|
155 | + } else { |
|
156 | 156 | return $this->get_first_related($model_name_of_related_obj); |
157 | 157 | } |
158 | 158 | } |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | * @param boolean $save |
166 | 166 | * @return boolean if $save=true, NULL is $save=false |
167 | 167 | */ |
168 | - function set_object($object, $save = TRUE ) { |
|
169 | - if($object instanceof EE_Base_Class){ |
|
168 | + function set_object($object, $save = TRUE) { |
|
169 | + if ($object instanceof EE_Base_Class) { |
|
170 | 170 | $this->set_OBJ_type($object->get_model()->get_this_model_name()); |
171 | 171 | $this->set_OBJ_ID($object->ID()); |
172 | - }else{ |
|
172 | + } else { |
|
173 | 173 | $this->set_OBJ_type(NULL); |
174 | 174 | $this->set_OBJ_ID(NULL); |
175 | 175 | } |
176 | - if($save){ |
|
176 | + if ($save) { |
|
177 | 177 | return $this->save(); |
178 | - }else{ |
|
178 | + } else { |
|
179 | 179 | return NULL; |
180 | 180 | } |
181 | 181 | } |