@@ -1,24 +1,24 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This file contains the module for the messages system |
|
| 4 | - * |
|
| 5 | - * @since 4.5.0 |
|
| 6 | - * @package Event Espresso |
|
| 7 | - * @subpackage modules, messages |
|
| 8 | - */ |
|
| 3 | + * This file contains the module for the messages system |
|
| 4 | + * |
|
| 5 | + * @since 4.5.0 |
|
| 6 | + * @package Event Espresso |
|
| 7 | + * @subpackage modules, messages |
|
| 8 | + */ |
|
| 9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
| 10 | 10 | /** |
| 11 | - * |
|
| 12 | - * Messages module. Takes care of registering all the triggers for messages. |
|
| 13 | - * |
|
| 14 | - * @since 4.5.0 |
|
| 15 | - * |
|
| 16 | - * @package Event Espresso |
|
| 17 | - * @subpackage modules, messages |
|
| 18 | - * @author Darren Ethier |
|
| 19 | - * |
|
| 20 | - * ------------------------------------------------------------------------ |
|
| 21 | - */ |
|
| 11 | + * |
|
| 12 | + * Messages module. Takes care of registering all the triggers for messages. |
|
| 13 | + * |
|
| 14 | + * @since 4.5.0 |
|
| 15 | + * |
|
| 16 | + * @package Event Espresso |
|
| 17 | + * @subpackage modules, messages |
|
| 18 | + * @author Darren Ethier |
|
| 19 | + * |
|
| 20 | + * ------------------------------------------------------------------------ |
|
| 21 | + */ |
|
| 22 | 22 | class EED_Messages extends EED_Module { |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -912,11 +912,11 @@ discard block |
||
| 912 | 912 | sprintf( |
| 913 | 913 | _n( |
| 914 | 914 | '%d message successfully queued for resending.', |
| 915 | - '%d messages successfully queued for resending.', |
|
| 916 | - $queue_count, |
|
| 917 | - 'event_espresso' |
|
| 918 | - ), |
|
| 919 | - $queue_count |
|
| 915 | + '%d messages successfully queued for resending.', |
|
| 916 | + $queue_count, |
|
| 917 | + 'event_espresso' |
|
| 918 | + ), |
|
| 919 | + $queue_count |
|
| 920 | 920 | ) |
| 921 | 921 | ); |
| 922 | 922 | } else { |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 | protected $_model_version_info; |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * Sets the version the user requested |
|
| 30 | - * @param string $version eg '4.8' |
|
| 31 | - */ |
|
| 29 | + * Sets the version the user requested |
|
| 30 | + * @param string $version eg '4.8' |
|
| 31 | + */ |
|
| 32 | 32 | public function set_requested_version( $version ) { |
| 33 | 33 | parent::set_requested_version( $version ); |
| 34 | 34 | $this->_model_version_info = new Model_Version_Info( $version ); |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | use EventEspresso\core\libraries\rest_api\controllers\Base as Controller_Base; |
| 4 | 4 | use EventEspresso\core\libraries\rest_api\Model_Version_Info; |
| 5 | 5 | |
| 6 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 7 | - exit( 'No direct script access allowed' ); |
|
| 6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 7 | + exit('No direct script access allowed'); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | * Sets the version the user requested |
| 30 | 30 | * @param string $version eg '4.8' |
| 31 | 31 | */ |
| 32 | - public function set_requested_version( $version ) { |
|
| 33 | - parent::set_requested_version( $version ); |
|
| 34 | - $this->_model_version_info = new Model_Version_Info( $version ); |
|
| 32 | + public function set_requested_version($version) { |
|
| 33 | + parent::set_requested_version($version); |
|
| 34 | + $this->_model_version_info = new Model_Version_Info($version); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * @return \EventEspresso\core\libraries\rest_api\Model_Version_Info |
| 44 | 44 | * @throws \EE_Error |
| 45 | 45 | */ |
| 46 | - public function get_model_version_info(){ |
|
| 47 | - if( ! $this->_model_version_info ) { |
|
| 46 | + public function get_model_version_info() { |
|
| 47 | + if ( ! $this->_model_version_info) { |
|
| 48 | 48 | throw new \EE_Error( |
| 49 | 49 | sprintf( |
| 50 | 50 | __( |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | * @param array $classnames |
| 67 | 67 | * @return boolean |
| 68 | 68 | */ |
| 69 | - public function is_subclass_of_one( $object, $classnames ) { |
|
| 70 | - foreach( $classnames as $classname ) { |
|
| 71 | - if( is_a( $object, $classname ) ) { |
|
| 69 | + public function is_subclass_of_one($object, $classnames) { |
|
| 70 | + foreach ($classnames as $classname) { |
|
| 71 | + if (is_a($object, $classname)) { |
|
| 72 | 72 | return true; |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $validation_error_message = $default_validation_strategy->get_validation_error_message(); |
| 43 | 43 | } |
| 44 | 44 | throw new EE_Validation_Error( $validation_error_message, 'float_only' ); |
| 45 | - }else{ |
|
| 45 | + } else{ |
|
| 46 | 46 | return floatval($normalized_value); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public function unnormalize($normalized_value) { |
| 56 | 56 | if( empty( $normalized_value ) ){ |
| 57 | 57 | return '0.00'; |
| 58 | - }else{ |
|
| 58 | + } else{ |
|
| 59 | 59 | return "$normalized_value"; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace EventEspresso\core\libraries\rest_api; |
| 3 | 3 | |
| 4 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 5 | - exit( 'No direct script access allowed' ); |
|
| 4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 5 | + exit('No direct script access allowed'); |
|
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | /** |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | protected $_cached_fields_on_models = array(); |
| 89 | 89 | |
| 90 | 90 | |
| 91 | - public function __construct( $requested_version ) { |
|
| 91 | + public function __construct($requested_version) { |
|
| 92 | 92 | $this->_requested_version = $requested_version; |
| 93 | 93 | $this->_model_changes = array( |
| 94 | 94 | '4.8.28' => array( |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | 'table_column' => 'N/A', |
| 111 | 111 | 'always_available' => true, |
| 112 | 112 | ); |
| 113 | - foreach( $this->_resource_changes as $version => $model_classnames ) { |
|
| 114 | - foreach( $model_classnames as $model_classname => $extra_fields ) { |
|
| 115 | - foreach( $extra_fields as $fieldname => $field_data ) { |
|
| 116 | - $this->_resource_changes[ $model_classname ][ $fieldname ][ 'name' ] = $fieldname; |
|
| 117 | - foreach( $defaults as $attribute => $default_value ) { |
|
| 118 | - if( ! isset( $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] ) ) { |
|
| 119 | - $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] = $default_value; |
|
| 113 | + foreach ($this->_resource_changes as $version => $model_classnames) { |
|
| 114 | + foreach ($model_classnames as $model_classname => $extra_fields) { |
|
| 115 | + foreach ($extra_fields as $fieldname => $field_data) { |
|
| 116 | + $this->_resource_changes[$model_classname][$fieldname]['name'] = $fieldname; |
|
| 117 | + foreach ($defaults as $attribute => $default_value) { |
|
| 118 | + if ( ! isset($this->_resource_changes[$model_classname][$fieldname][$attribute])) { |
|
| 119 | + $this->_resource_changes[$model_classname][$fieldname][$attribute] = $default_value; |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | * @return array |
| 133 | 133 | */ |
| 134 | 134 | public function model_changes_between_requested_version_and_current() { |
| 135 | - if( $this->_cached_model_changes_between_requested_version_and_current === null ) { |
|
| 135 | + if ($this->_cached_model_changes_between_requested_version_and_current === null) { |
|
| 136 | 136 | $model_changes = array(); |
| 137 | - foreach( $this->model_changes() as $version => $models_changed_in_version ) { |
|
| 138 | - if( $version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version() ) { |
|
| 139 | - $model_changes[ $version ] = $models_changed_in_version; |
|
| 137 | + foreach ($this->model_changes() as $version => $models_changed_in_version) { |
|
| 138 | + if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) { |
|
| 139 | + $model_changes[$version] = $models_changed_in_version; |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | $this->_cached_model_changes_between_requested_version_and_current = $model_changes; |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | * @return array |
| 153 | 153 | */ |
| 154 | 154 | public function resource_changes_between_requested_version_and_current() { |
| 155 | - if( $this->_cached_resource_changes_between_requested_version_and_current === null ) { |
|
| 155 | + if ($this->_cached_resource_changes_between_requested_version_and_current === null) { |
|
| 156 | 156 | $resource_changes = array(); |
| 157 | - foreach( $this->resource_changes() as $version => $model_classnames ) { |
|
| 158 | - if( $version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version() ) { |
|
| 159 | - $resource_changes[ $version ] = $model_classnames; |
|
| 157 | + foreach ($this->resource_changes() as $version => $model_classnames) { |
|
| 158 | + if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) { |
|
| 159 | + $resource_changes[$version] = $model_classnames; |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | $this->_cached_resource_changes_between_requested_version_and_current = $resource_changes; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * If a request was sent to 'wp-json/ee/v4.7/events' this would be '4.7' |
| 169 | 169 | * @return string like '4.6' |
| 170 | 170 | */ |
| 171 | - public function requested_version(){ |
|
| 171 | + public function requested_version() { |
|
| 172 | 172 | return $this->_requested_version; |
| 173 | 173 | } |
| 174 | 174 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * If a version is missing then we don't know anything about what changes it introduced from the previous version |
| 183 | 183 | * @return array |
| 184 | 184 | */ |
| 185 | - public function model_changes(){ |
|
| 185 | + public function model_changes() { |
|
| 186 | 186 | return $this->_model_changes; |
| 187 | 187 | } |
| 188 | 188 | |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | * @return array keys are model names, values are their classname |
| 194 | 194 | */ |
| 195 | 195 | public function models_for_requested_version() { |
| 196 | - if( $this->_cached_models_for_requested_version === null ) { |
|
| 196 | + if ($this->_cached_models_for_requested_version === null) { |
|
| 197 | 197 | $all_models_in_current_version = \EE_Registry::instance()->non_abstract_db_models; |
| 198 | - foreach( $this->model_changes_between_requested_version_and_current() as $version => $models_changed ) { |
|
| 199 | - foreach( $models_changed as $model_name => $new_indicator_or_fields_added ) { |
|
| 200 | - if( $new_indicator_or_fields_added === Model_Version_Info::model_added ) { |
|
| 201 | - unset( $all_models_in_current_version[ $model_name ] ); |
|
| 198 | + foreach ($this->model_changes_between_requested_version_and_current() as $version => $models_changed) { |
|
| 199 | + foreach ($models_changed as $model_name => $new_indicator_or_fields_added) { |
|
| 200 | + if ($new_indicator_or_fields_added === Model_Version_Info::model_added) { |
|
| 201 | + unset($all_models_in_current_version[$model_name]); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -217,11 +217,11 @@ discard block |
||
| 217 | 217 | * @param string $model_name eg 'Event' |
| 218 | 218 | * @return boolean |
| 219 | 219 | */ |
| 220 | - public function is_model_name_in_this_version( $model_name ) { |
|
| 220 | + public function is_model_name_in_this_version($model_name) { |
|
| 221 | 221 | $model_names = $this->models_for_requested_version(); |
| 222 | - if( isset( $model_names[ $model_name ] ) ) { |
|
| 222 | + if (isset($model_names[$model_name])) { |
|
| 223 | 223 | return true; |
| 224 | - }else{ |
|
| 224 | + } else { |
|
| 225 | 225 | return false; |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -236,10 +236,10 @@ discard block |
||
| 236 | 236 | * @return \EEM_Base |
| 237 | 237 | * @throws \EE_Error |
| 238 | 238 | */ |
| 239 | - public function load_model( $model_name ) { |
|
| 240 | - if( $this->is_model_name_in_this_version( $model_name ) ) { |
|
| 241 | - return \EE_Registry::instance()->load_model( $model_name ); |
|
| 242 | - }else{ |
|
| 239 | + public function load_model($model_name) { |
|
| 240 | + if ($this->is_model_name_in_this_version($model_name)) { |
|
| 241 | + return \EE_Registry::instance()->load_model($model_name); |
|
| 242 | + } else { |
|
| 243 | 243 | throw new \EE_Error( |
| 244 | 244 | sprintf( |
| 245 | 245 | __( |
@@ -261,21 +261,21 @@ discard block |
||
| 261 | 261 | * @param \EEM_Base $model |
| 262 | 262 | * @return array|\EE_Model_Field_Base[] |
| 263 | 263 | */ |
| 264 | - public function fields_on_model_in_this_version( $model ) { |
|
| 265 | - if( ! isset( $this->_cached_fields_on_models[ $model->get_this_model_name() ] ) ) { |
|
| 264 | + public function fields_on_model_in_this_version($model) { |
|
| 265 | + if ( ! isset($this->_cached_fields_on_models[$model->get_this_model_name()])) { |
|
| 266 | 266 | //get all model changes between the requested version and current core version |
| 267 | 267 | $changes = $this->model_changes_between_requested_version_and_current(); |
| 268 | 268 | //fetch all fields currently on this model |
| 269 | 269 | $current_fields = $model->field_settings(); |
| 270 | 270 | //remove all fields that have been added since |
| 271 | - foreach( $changes as $version => $changes_in_version ) { |
|
| 272 | - if( |
|
| 273 | - isset( $changes_in_version[ $model->get_this_model_name() ] ) |
|
| 274 | - && $changes_in_version[ $model->get_this_model_name() ] !== Model_Version_Info::model_added |
|
| 271 | + foreach ($changes as $version => $changes_in_version) { |
|
| 272 | + if ( |
|
| 273 | + isset($changes_in_version[$model->get_this_model_name()]) |
|
| 274 | + && $changes_in_version[$model->get_this_model_name()] !== Model_Version_Info::model_added |
|
| 275 | 275 | ) { |
| 276 | 276 | $current_fields = array_diff_key( |
| 277 | 277 | $current_fields, |
| 278 | - array_flip( $changes_in_version[ $model->get_this_model_name() ] ) |
|
| 278 | + array_flip($changes_in_version[$model->get_this_model_name()]) |
|
| 279 | 279 | ); |
| 280 | 280 | } |
| 281 | 281 | } |
@@ -293,9 +293,9 @@ discard block |
||
| 293 | 293 | * @param array $classnames |
| 294 | 294 | * @return boolean |
| 295 | 295 | */ |
| 296 | - public function is_subclass_of_one( $object, $classnames ) { |
|
| 297 | - foreach( $classnames as $classname ) { |
|
| 298 | - if( is_a( $object, $classname ) ) { |
|
| 296 | + public function is_subclass_of_one($object, $classnames) { |
|
| 297 | + foreach ($classnames as $classname) { |
|
| 298 | + if (is_a($object, $classname)) { |
|
| 299 | 299 | return true; |
| 300 | 300 | } |
| 301 | 301 | } |
@@ -306,10 +306,10 @@ discard block |
||
| 306 | 306 | * Returns the list of model field classes that that the API basically ignores |
| 307 | 307 | * @return array |
| 308 | 308 | */ |
| 309 | - public function fields_ignored(){ |
|
| 309 | + public function fields_ignored() { |
|
| 310 | 310 | return apply_filters( |
| 311 | 311 | 'FHEE__Controller_Model_Read_fields_ignored', |
| 312 | - array( 'EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field' ) |
|
| 312 | + array('EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field') |
|
| 313 | 313 | ); |
| 314 | 314 | } |
| 315 | 315 | |
@@ -318,8 +318,8 @@ discard block |
||
| 318 | 318 | * @param EE_Model_Field_Base |
| 319 | 319 | * @return boolean |
| 320 | 320 | */ |
| 321 | - public function field_is_ignored( $field_obj ){ |
|
| 322 | - return $this->is_subclass_of_one( $field_obj, $this->fields_ignored() ); |
|
| 321 | + public function field_is_ignored($field_obj) { |
|
| 322 | + return $this->is_subclass_of_one($field_obj, $this->fields_ignored()); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | public function fields_that_have_rendered_format() { |
| 331 | 331 | return apply_filters( |
| 332 | 332 | 'FHEE__Controller_Model_Read__fields_raw', |
| 333 | - array( 'EE_Post_Content_Field', 'EE_Full_HTML_Field' ) |
|
| 333 | + array('EE_Post_Content_Field', 'EE_Full_HTML_Field') |
|
| 334 | 334 | ); |
| 335 | 335 | } |
| 336 | 336 | |
@@ -339,8 +339,8 @@ discard block |
||
| 339 | 339 | * @param EE_Model_Field_Base |
| 340 | 340 | * @return boolean |
| 341 | 341 | */ |
| 342 | - public function field_has_rendered_format( $field_obj ){ |
|
| 343 | - return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_rendered_format() ); |
|
| 342 | + public function field_has_rendered_format($field_obj) { |
|
| 343 | + return $this->is_subclass_of_one($field_obj, $this->fields_that_have_rendered_format()); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | /** |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | public function fields_that_have_pretty_format() { |
| 353 | 353 | return apply_filters( |
| 354 | 354 | 'FHEE__Controller_Model_Read__fields_pretty', |
| 355 | - array( 'EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field' ) |
|
| 355 | + array('EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field') |
|
| 356 | 356 | ); |
| 357 | 357 | } |
| 358 | 358 | |
@@ -361,8 +361,8 @@ discard block |
||
| 361 | 361 | * @param EE_Model_Field_Base |
| 362 | 362 | * @return boolean |
| 363 | 363 | */ |
| 364 | - public function field_has_pretty_format( $field_obj ){ |
|
| 365 | - return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_pretty_format() ); |
|
| 364 | + public function field_has_pretty_format($field_obj) { |
|
| 365 | + return $this->is_subclass_of_one($field_obj, $this->fields_that_have_pretty_format()); |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | /** |
@@ -379,12 +379,12 @@ discard block |
||
| 379 | 379 | * @param \EEM_Base $model |
| 380 | 380 | * @return array |
| 381 | 381 | */ |
| 382 | - public function extra_resource_properties_for_model( $model ) { |
|
| 382 | + public function extra_resource_properties_for_model($model) { |
|
| 383 | 383 | $extra_properties = array(); |
| 384 | - foreach( $this->resource_changes_between_requested_version_and_current() as $version => $model_classnames ) { |
|
| 385 | - foreach( $model_classnames as $model_classname => $properties_added_in_this_version ) { |
|
| 386 | - if( is_subclass_of( $model, $model_classname ) ) { |
|
| 387 | - $extra_properties = array_merge( $extra_properties, $properties_added_in_this_version ); |
|
| 384 | + foreach ($this->resource_changes_between_requested_version_and_current() as $version => $model_classnames) { |
|
| 385 | + foreach ($model_classnames as $model_classname => $properties_added_in_this_version) { |
|
| 386 | + if (is_subclass_of($model, $model_classname)) { |
|
| 387 | + $extra_properties = array_merge($extra_properties, $properties_added_in_this_version); |
|
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | } |
@@ -44,11 +44,11 @@ |
||
| 44 | 44 | |
| 45 | 45 | if( $field_obj instanceof \EE_Boolean_Field ) { |
| 46 | 46 | $datatype = 'Boolean'; |
| 47 | - }elseif( $field_obj->get_wpdb_data_type() == '%d' ) { |
|
| 47 | + } elseif( $field_obj->get_wpdb_data_type() == '%d' ) { |
|
| 48 | 48 | $datatype = 'Number'; |
| 49 | - }elseif( $field_name instanceof \EE_Serialized_Text_Field ) { |
|
| 49 | + } elseif( $field_name instanceof \EE_Serialized_Text_Field ) { |
|
| 50 | 50 | $datatype = 'Object'; |
| 51 | - }else{ |
|
| 51 | + } else{ |
|
| 52 | 52 | $datatype = 'String'; |
| 53 | 53 | } |
| 54 | 54 | $field_json = array( |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace EventEspresso\core\libraries\rest_api\controllers\model; |
| 3 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 4 | - exit( 'No direct script access allowed' ); |
|
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 4 | + exit('No direct script access allowed'); |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -18,75 +18,75 @@ discard block |
||
| 18 | 18 | class Meta extends Base { |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - public static function handle_request_models_meta( \WP_REST_Request $request ) { |
|
| 21 | + public static function handle_request_models_meta(\WP_REST_Request $request) { |
|
| 22 | 22 | $controller = new Meta(); |
| 23 | 23 | $matches = $controller->parse_route( |
| 24 | 24 | $request->get_route(), |
| 25 | - '~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . 'resources~', |
|
| 26 | - array( 'version' ) ); |
|
| 27 | - if( $matches instanceof \WP_REST_Response ) { |
|
| 25 | + '~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'resources~', |
|
| 26 | + array('version') ); |
|
| 27 | + if ($matches instanceof \WP_REST_Response) { |
|
| 28 | 28 | return $matches; |
| 29 | 29 | } |
| 30 | - $controller->set_requested_version( $matches[ 'version' ] ); |
|
| 31 | - return $controller->send_response( $controller->_get_models_metadata_entity() ); |
|
| 30 | + $controller->set_requested_version($matches['version']); |
|
| 31 | + return $controller->send_response($controller->_get_models_metadata_entity()); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /* |
| 35 | 35 | * Gets the model metadata resource entity |
| 36 | 36 | * @return array for JSON response, describing all the models available in teh requested version |
| 37 | 37 | */ |
| 38 | - protected function _get_models_metadata_entity(){ |
|
| 38 | + protected function _get_models_metadata_entity() { |
|
| 39 | 39 | $response = array(); |
| 40 | - foreach( $this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname ){ |
|
| 41 | - $model = $this->get_model_version_info()->load_model( $model_name ); |
|
| 40 | + foreach ($this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname) { |
|
| 41 | + $model = $this->get_model_version_info()->load_model($model_name); |
|
| 42 | 42 | $fields_json = array(); |
| 43 | - foreach( $this->get_model_version_info()->fields_on_model_in_this_version( $model ) as $field_name => $field_obj ) { |
|
| 44 | - if( $this->get_model_version_info()->field_is_ignored( $field_obj ) ) { |
|
| 43 | + foreach ($this->get_model_version_info()->fields_on_model_in_this_version($model) as $field_name => $field_obj) { |
|
| 44 | + if ($this->get_model_version_info()->field_is_ignored($field_obj)) { |
|
| 45 | 45 | continue; |
| 46 | 46 | } |
| 47 | - if( $field_obj instanceof \EE_Boolean_Field ) { |
|
| 47 | + if ($field_obj instanceof \EE_Boolean_Field) { |
|
| 48 | 48 | $datatype = 'Boolean'; |
| 49 | - }elseif( $field_obj->get_wpdb_data_type() == '%d' ) { |
|
| 49 | + }elseif ($field_obj->get_wpdb_data_type() == '%d') { |
|
| 50 | 50 | $datatype = 'Number'; |
| 51 | - }elseif( $field_name instanceof \EE_Serialized_Text_Field ) { |
|
| 51 | + }elseif ($field_name instanceof \EE_Serialized_Text_Field) { |
|
| 52 | 52 | $datatype = 'Object'; |
| 53 | - }else{ |
|
| 53 | + } else { |
|
| 54 | 54 | $datatype = 'String'; |
| 55 | 55 | } |
| 56 | 56 | $default_value = $field_obj->get_default_value(); |
| 57 | - if( $default_value === EE_INF ) { |
|
| 57 | + if ($default_value === EE_INF) { |
|
| 58 | 58 | $default_value = EE_INF_IN_DB; |
| 59 | - } elseif( $field_obj instanceof \EE_Datetime_Field && |
|
| 60 | - $default_value instanceof \DateTime ) { |
|
| 61 | - $default_value = $default_value->format( 'c' ); |
|
| 59 | + } elseif ($field_obj instanceof \EE_Datetime_Field && |
|
| 60 | + $default_value instanceof \DateTime) { |
|
| 61 | + $default_value = $default_value->format('c'); |
|
| 62 | 62 | } |
| 63 | 63 | $field_json = array( |
| 64 | 64 | 'name' => $field_name, |
| 65 | 65 | 'nicename' => $field_obj->get_nicename(), |
| 66 | - 'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format( $field_obj ), |
|
| 67 | - 'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format( $field_obj ), |
|
| 68 | - 'type' => str_replace('EE_', '', get_class( $field_obj ) ), |
|
| 66 | + 'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format($field_obj), |
|
| 67 | + 'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format($field_obj), |
|
| 68 | + 'type' => str_replace('EE_', '', get_class($field_obj)), |
|
| 69 | 69 | 'datatype' => $datatype, |
| 70 | 70 | 'nullable' => $field_obj->is_nullable(), |
| 71 | 71 | 'default' => $default_value, |
| 72 | 72 | 'table_alias' => $field_obj->get_table_alias(), |
| 73 | 73 | 'table_column' => $field_obj->get_table_column(), |
| 74 | 74 | ); |
| 75 | - $fields_json[ $field_json[ 'name' ] ] = $field_json; |
|
| 75 | + $fields_json[$field_json['name']] = $field_json; |
|
| 76 | 76 | |
| 77 | 77 | } |
| 78 | - $fields_json = array_merge( $fields_json, $this->get_model_version_info()->extra_resource_properties_for_model( $model ) ); |
|
| 79 | - $response[ $model_name ]['fields'] = apply_filters( 'FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model ); |
|
| 78 | + $fields_json = array_merge($fields_json, $this->get_model_version_info()->extra_resource_properties_for_model($model)); |
|
| 79 | + $response[$model_name]['fields'] = apply_filters('FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model); |
|
| 80 | 80 | $relations_json = array(); |
| 81 | - foreach( $model->relation_settings() as $relation_name => $relation_obj ) { |
|
| 81 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
| 82 | 82 | $relation_json = array( |
| 83 | 83 | 'name' => $relation_name, |
| 84 | - 'type' => str_replace( 'EE_', '', get_class( $relation_obj ) ), |
|
| 84 | + 'type' => str_replace('EE_', '', get_class($relation_obj)), |
|
| 85 | 85 | 'single' => $relation_obj instanceof \EE_Belongs_To_Relation ? true : false, |
| 86 | 86 | ); |
| 87 | - $relations_json[ $relation_name ] = $relation_json; |
|
| 87 | + $relations_json[$relation_name] = $relation_json; |
|
| 88 | 88 | } |
| 89 | - $response[ $model_name ][ 'relations' ] = apply_filters( 'FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model ); |
|
| 89 | + $response[$model_name]['relations'] = apply_filters('FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model); |
|
| 90 | 90 | } |
| 91 | 91 | return $response; |
| 92 | 92 | } |
@@ -96,23 +96,23 @@ discard block |
||
| 96 | 96 | * @param WP_REST_Response $rest_response_obj |
| 97 | 97 | * @return WP_REST_Response |
| 98 | 98 | */ |
| 99 | - public static function filter_ee_metadata_into_index( $rest_response_obj ) { |
|
| 99 | + public static function filter_ee_metadata_into_index($rest_response_obj) { |
|
| 100 | 100 | $response_data = $rest_response_obj->get_data(); |
| 101 | 101 | $addons = array(); |
| 102 | - foreach( \EE_Registry::instance()->addons as $addon){ |
|
| 102 | + foreach (\EE_Registry::instance()->addons as $addon) { |
|
| 103 | 103 | $addon_json = array( |
| 104 | 104 | 'name' => $addon->name(), |
| 105 | 105 | 'version' => $addon->version() |
| 106 | 106 | ); |
| 107 | - $addons[ $addon_json[ 'name' ] ] = $addon_json; |
|
| 107 | + $addons[$addon_json['name']] = $addon_json; |
|
| 108 | 108 | } |
| 109 | - $response_data[ 'ee' ] = array( |
|
| 109 | + $response_data['ee'] = array( |
|
| 110 | 110 | 'version' => \EEM_System_Status::instance()->get_ee_version(), |
| 111 | 111 | 'addons' => $addons, |
| 112 | 112 | 'maintenance_mode' => \EE_Maintenance_Mode::instance()->real_level(), |
| 113 | - 'served_core_versions' => array_keys( \EED_Core_Rest_Api::versions_served() ) |
|
| 113 | + 'served_core_versions' => array_keys(\EED_Core_Rest_Api::versions_served()) |
|
| 114 | 114 | ); |
| 115 | - $rest_response_obj->set_data( $response_data ); |
|
| 115 | + $rest_response_obj->set_data($response_data); |
|
| 116 | 116 | return $rest_response_obj; |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | global $post_type, $post; |
| 3 | 3 | //action for registering metaboxes |
| 4 | -do_action( 'add_meta_boxes', $post_type, $post ); |
|
| 4 | +do_action('add_meta_boxes', $post_type, $post); |
|
| 5 | 5 | ?> |
| 6 | 6 | <div id="admin-page-header"> |
| 7 | 7 | <?php echo $admin_page_header; ?> |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | <!-- admin-page-header --> |
| 11 | 11 | <div id="post-body" class="metabox-holder columns-2"> |
| 12 | 12 | |
| 13 | - <?php if ( ! empty( $post_body_content )) : ?> |
|
| 13 | + <?php if ( ! empty($post_body_content)) : ?> |
|
| 14 | 14 | <div id="post-body-content"> |
| 15 | 15 | <?php echo $post_body_content; ?> |
| 16 | 16 | </div> |
@@ -18,13 +18,13 @@ discard block |
||
| 18 | 18 | <?php endif; ?> |
| 19 | 19 | |
| 20 | 20 | <div id="postbox-container-1" class="postbox-container"> |
| 21 | - <?php do_meta_boxes( $current_page, 'side', NULL ); ?> |
|
| 21 | + <?php do_meta_boxes($current_page, 'side', NULL); ?> |
|
| 22 | 22 | </div> |
| 23 | 23 | <!-- postbox-container-1 --> |
| 24 | 24 | |
| 25 | 25 | <div id="postbox-container-2" class="postbox-container"> |
| 26 | - <?php do_meta_boxes( $current_page, 'normal', NULL ); ?> |
|
| 27 | - <?php do_meta_boxes( $current_page, 'advanced', NULL ); ?> |
|
| 26 | + <?php do_meta_boxes($current_page, 'normal', NULL); ?> |
|
| 27 | + <?php do_meta_boxes($current_page, 'advanced', NULL); ?> |
|
| 28 | 28 | </div> |
| 29 | 29 | <!-- postbox-container-2 --> |
| 30 | 30 | |
@@ -69,104 +69,104 @@ discard block |
||
| 69 | 69 | * @param array $options |
| 70 | 70 | * @return mixed |
| 71 | 71 | */ |
| 72 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
| 72 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
| 73 | 73 | |
| 74 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 75 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
| 74 | + EE_Registry::instance()->load_helper('Template'); |
|
| 75 | + EE_Registry::instance()->load_helper('HTML'); |
|
| 76 | 76 | |
| 77 | 77 | $html = ''; |
| 78 | 78 | // set some default options and merge with incoming |
| 79 | 79 | $default_options = array( |
| 80 | - 'show_desc' => true, // true false |
|
| 80 | + 'show_desc' => true, // true false |
|
| 81 | 81 | 'odd' => false |
| 82 | 82 | ); |
| 83 | - $options = array_merge( $default_options, (array)$options ); |
|
| 83 | + $options = array_merge($default_options, (array) $options); |
|
| 84 | 84 | |
| 85 | - switch( $line_item->type() ) { |
|
| 85 | + switch ($line_item->type()) { |
|
| 86 | 86 | |
| 87 | 87 | case EEM_Line_Item::type_line_item: |
| 88 | 88 | $this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes; |
| 89 | - if ( $line_item->OBJ_type() == 'Ticket' ) { |
|
| 89 | + if ($line_item->OBJ_type() == 'Ticket') { |
|
| 90 | 90 | // item row |
| 91 | - $html .= $this->_ticket_row( $line_item, $options ); |
|
| 91 | + $html .= $this->_ticket_row($line_item, $options); |
|
| 92 | 92 | // got any kids? |
| 93 | - foreach ( $line_item->children() as $child_line_item ) { |
|
| 94 | - $this->display_line_item( $child_line_item, $options ); |
|
| 93 | + foreach ($line_item->children() as $child_line_item) { |
|
| 94 | + $this->display_line_item($child_line_item, $options); |
|
| 95 | 95 | } |
| 96 | 96 | } else { |
| 97 | 97 | // item row |
| 98 | - $html .= $this->_item_row( $line_item, $options ); |
|
| 98 | + $html .= $this->_item_row($line_item, $options); |
|
| 99 | 99 | // got any kids? |
| 100 | - foreach ( $line_item->children() as $child_line_item ) { |
|
| 101 | - $this->display_line_item( $child_line_item, $options ); |
|
| 100 | + foreach ($line_item->children() as $child_line_item) { |
|
| 101 | + $this->display_line_item($child_line_item, $options); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | break; |
| 105 | 105 | |
| 106 | 106 | case EEM_Line_Item::type_sub_line_item: |
| 107 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
| 107 | + $html .= $this->_sub_item_row($line_item, $options); |
|
| 108 | 108 | break; |
| 109 | 109 | |
| 110 | 110 | case EEM_Line_Item::type_sub_total: |
| 111 | 111 | static $sub_total = 0; |
| 112 | 112 | $event_sub_total = 0; |
| 113 | - $text = __( 'Sub-Total', 'event_espresso' ); |
|
| 114 | - if ( $line_item->OBJ_type() == 'Event' ) { |
|
| 115 | - $options[ 'event_id' ] = $event_id = $line_item->OBJ_ID(); |
|
| 116 | - if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
| 117 | - $event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] ); |
|
| 118 | - if ( $event instanceof EE_Event ) { |
|
| 119 | - if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) { |
|
| 113 | + $text = __('Sub-Total', 'event_espresso'); |
|
| 114 | + if ($line_item->OBJ_type() == 'Event') { |
|
| 115 | + $options['event_id'] = $event_id = $line_item->OBJ_ID(); |
|
| 116 | + if ( ! isset($this->_events[$options['event_id']])) { |
|
| 117 | + $event = EEM_Event::instance()->get_one_by_ID($options['event_id']); |
|
| 118 | + if ($event instanceof EE_Event) { |
|
| 119 | + if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) { |
|
| 120 | 120 | return ''; |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | - $this->_events[ $options[ 'event_id' ] ] = 0; |
|
| 124 | - $html .= $this->_event_row( $line_item ); |
|
| 125 | - $text = __( 'Event Sub-Total', 'event_espresso' ); |
|
| 123 | + $this->_events[$options['event_id']] = 0; |
|
| 124 | + $html .= $this->_event_row($line_item); |
|
| 125 | + $text = __('Event Sub-Total', 'event_espresso'); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | $child_line_items = $line_item->children(); |
| 129 | 129 | // loop thru children |
| 130 | - foreach( $child_line_items as $child_line_item ) { |
|
| 130 | + foreach ($child_line_items as $child_line_item) { |
|
| 131 | 131 | // recursively feed children back into this method |
| 132 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
| 132 | + $html .= $this->display_line_item($child_line_item, $options); |
|
| 133 | 133 | } |
| 134 | - $event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0; |
|
| 134 | + $event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0; |
|
| 135 | 135 | $sub_total += $event_sub_total; |
| 136 | 136 | if ( |
| 137 | 137 | ( |
| 138 | 138 | // event subtotals |
| 139 | 139 | $line_item->code() != 'pre-tax-subtotal' && |
| 140 | - count( $child_line_items ) > 1 |
|
| 140 | + count($child_line_items) > 1 |
|
| 141 | 141 | ) |
| 142 | 142 | || |
| 143 | 143 | ( |
| 144 | 144 | // pre-tax subtotals |
| 145 | 145 | $line_item->code() == 'pre-tax-subtotal' && |
| 146 | - count( $this->_events ) > 1 |
|
| 146 | + count($this->_events) > 1 |
|
| 147 | 147 | ) |
| 148 | 148 | ) { |
| 149 | 149 | $options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total; |
| 150 | - $html .= $this->_sub_total_row( $line_item, $text, $options ); |
|
| 150 | + $html .= $this->_sub_total_row($line_item, $text, $options); |
|
| 151 | 151 | } |
| 152 | 152 | break; |
| 153 | 153 | |
| 154 | 154 | case EEM_Line_Item::type_tax: |
| 155 | - if ( $this->_show_taxes ) { |
|
| 156 | - $this->_taxes_html .= $this->_tax_row( $line_item, $options ); |
|
| 155 | + if ($this->_show_taxes) { |
|
| 156 | + $this->_taxes_html .= $this->_tax_row($line_item, $options); |
|
| 157 | 157 | } |
| 158 | 158 | break; |
| 159 | 159 | |
| 160 | 160 | case EEM_Line_Item::type_tax_sub_total: |
| 161 | - if ( $this->_show_taxes ) { |
|
| 161 | + if ($this->_show_taxes) { |
|
| 162 | 162 | $child_line_items = $line_item->children(); |
| 163 | 163 | // loop thru children |
| 164 | - foreach( $child_line_items as $child_line_item ) { |
|
| 164 | + foreach ($child_line_items as $child_line_item) { |
|
| 165 | 165 | // recursively feed children back into this method |
| 166 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
| 166 | + $html .= $this->display_line_item($child_line_item, $options); |
|
| 167 | 167 | } |
| 168 | - if ( count( $child_line_items ) > 1 ) { |
|
| 169 | - $this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) ); |
|
| 168 | + if (count($child_line_items) > 1) { |
|
| 169 | + $this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso')); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | break; |
@@ -175,25 +175,25 @@ discard block |
||
| 175 | 175 | // get all child line items |
| 176 | 176 | $children = $line_item->children(); |
| 177 | 177 | // loop thru all non-tax child line items |
| 178 | - foreach( $children as $child_line_item ) { |
|
| 179 | - if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) { |
|
| 178 | + foreach ($children as $child_line_item) { |
|
| 179 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
| 180 | 180 | // recursively feed children back into this method |
| 181 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
| 181 | + $html .= $this->display_line_item($child_line_item, $options); |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // now loop thru tax child line items |
| 186 | - foreach( $children as $child_line_item ) { |
|
| 187 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) { |
|
| 186 | + foreach ($children as $child_line_item) { |
|
| 187 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
| 188 | 188 | // recursively feed children back into this method |
| 189 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
| 189 | + $html .= $this->display_line_item($child_line_item, $options); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | $html .= $this->_taxes_html; |
| 193 | - $html .= $this->_total_row( $line_item, __('Total', 'event_espresso') ); |
|
| 193 | + $html .= $this->_total_row($line_item, __('Total', 'event_espresso')); |
|
| 194 | 194 | |
| 195 | 195 | |
| 196 | - $html .= $this->_payments_and_amount_owing_rows( $line_item, $options ); |
|
| 196 | + $html .= $this->_payments_and_amount_owing_rows($line_item, $options); |
|
| 197 | 197 | break; |
| 198 | 198 | |
| 199 | 199 | } |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | * @param EE_Line_Item $line_item |
| 209 | 209 | * @return mixed |
| 210 | 210 | */ |
| 211 | - private function _event_row( EE_Line_Item $line_item ) { |
|
| 211 | + private function _event_row(EE_Line_Item $line_item) { |
|
| 212 | 212 | // start of row |
| 213 | - $html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' ); |
|
| 213 | + $html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd'); |
|
| 214 | 214 | // event name td |
| 215 | - $html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' ); |
|
| 215 | + $html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"'); |
|
| 216 | 216 | // end of row |
| 217 | 217 | $html .= EEH_HTML::trx(); |
| 218 | 218 | return $html; |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | * @param array $options |
| 228 | 228 | * @return mixed |
| 229 | 229 | */ |
| 230 | - private function _ticket_row( EE_Line_Item $line_item, $options = array() ) { |
|
| 230 | + private function _ticket_row(EE_Line_Item $line_item, $options = array()) { |
|
| 231 | 231 | // start of row |
| 232 | 232 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
| 233 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
| 233 | + $html = EEH_HTML::tr('', '', $row_class); |
|
| 234 | 234 | // name && desc |
| 235 | 235 | $name_and_desc = apply_filters( |
| 236 | 236 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
@@ -239,23 +239,23 @@ discard block |
||
| 239 | 239 | ); |
| 240 | 240 | $name_and_desc .= apply_filters( |
| 241 | 241 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
| 242 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
| 242 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
| 243 | 243 | $line_item, |
| 244 | 244 | $options |
| 245 | 245 | ); |
| 246 | 246 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
| 247 | 247 | // name td |
| 248 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
| 248 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
| 249 | 249 | // price td |
| 250 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
| 250 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
| 251 | 251 | // quantity td |
| 252 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
| 252 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
| 253 | 253 | $this->_total_items += $line_item->quantity(); |
| 254 | 254 | // determine total for line item |
| 255 | 255 | $total = $line_item->total(); |
| 256 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
| 256 | + $this->_events[$options['event_id']] += $total; |
|
| 257 | 257 | // total td |
| 258 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
| 258 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
| 259 | 259 | // end of row |
| 260 | 260 | $html .= EEH_HTML::trx(); |
| 261 | 261 | return $html; |
@@ -270,41 +270,41 @@ discard block |
||
| 270 | 270 | * @param array $options |
| 271 | 271 | * @return mixed |
| 272 | 272 | */ |
| 273 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
| 273 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
| 274 | 274 | // start of row |
| 275 | 275 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
| 276 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
| 277 | - $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type() . ': ' : ''; |
|
| 276 | + $html = EEH_HTML::tr('', '', $row_class); |
|
| 277 | + $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type().': ' : ''; |
|
| 278 | 278 | // name && desc |
| 279 | 279 | $name_and_desc = apply_filters( |
| 280 | 280 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
| 281 | - $obj_name . $line_item->name(), |
|
| 281 | + $obj_name.$line_item->name(), |
|
| 282 | 282 | $line_item |
| 283 | 283 | ); |
| 284 | 284 | $name_and_desc .= apply_filters( |
| 285 | 285 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
| 286 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
| 286 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
| 287 | 287 | $line_item, |
| 288 | 288 | $options |
| 289 | 289 | ); |
| 290 | 290 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
| 291 | 291 | // name td |
| 292 | - $html .= EEH_HTML::td( $name_and_desc, '', 'item_l' ); |
|
| 292 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
| 293 | 293 | // price td |
| 294 | - if ( $line_item->is_percent() ) { |
|
| 295 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' ); |
|
| 294 | + if ($line_item->is_percent()) { |
|
| 295 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght'); |
|
| 296 | 296 | } else { |
| 297 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
| 297 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
| 298 | 298 | } |
| 299 | 299 | // quantity td |
| 300 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
| 300 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
| 301 | 301 | //$total = $line_item->total() * $line_item->quantity(); |
| 302 | 302 | $total = $line_item->total(); |
| 303 | - if( isset( $options[ 'event_id' ] ) && isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
| 304 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
| 303 | + if (isset($options['event_id']) && isset($this->_events[$options['event_id']])) { |
|
| 304 | + $this->_events[$options['event_id']] += $total; |
|
| 305 | 305 | } |
| 306 | 306 | // total td |
| 307 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
| 307 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
| 308 | 308 | // end of row |
| 309 | 309 | $html .= EEH_HTML::trx(); |
| 310 | 310 | return $html; |
@@ -319,22 +319,22 @@ discard block |
||
| 319 | 319 | * @param array $options |
| 320 | 320 | * @return mixed |
| 321 | 321 | */ |
| 322 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
| 322 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
| 323 | 323 | // start of row |
| 324 | - $html = EEH_HTML::tr( '', 'item sub-item-row' ); |
|
| 324 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
| 325 | 325 | // name && desc |
| 326 | 326 | $name_and_desc = $line_item->name(); |
| 327 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
| 327 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
| 328 | 328 | // name td |
| 329 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
| 329 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
| 330 | 330 | // discount/surcharge td |
| 331 | - if ( $line_item->is_percent() ) { |
|
| 332 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c' ); |
|
| 331 | + if ($line_item->is_percent()) { |
|
| 332 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
| 333 | 333 | } else { |
| 334 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
| 334 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
| 335 | 335 | } |
| 336 | 336 | // total td |
| 337 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
| 337 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
| 338 | 338 | // end of row |
| 339 | 339 | $html .= EEH_HTML::trx(); |
| 340 | 340 | return $html; |
@@ -349,21 +349,21 @@ discard block |
||
| 349 | 349 | * @param array $options |
| 350 | 350 | * @return mixed |
| 351 | 351 | */ |
| 352 | - private function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
| 352 | + private function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
| 353 | 353 | // start of row |
| 354 | - $html = EEH_HTML::tr( '', 'item sub-item tax-total' ); |
|
| 354 | + $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
| 355 | 355 | // name && desc |
| 356 | 356 | $name_and_desc = $line_item->name(); |
| 357 | - $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>'; |
|
| 358 | - $name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : ''; |
|
| 357 | + $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>'; |
|
| 358 | + $name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : ''; |
|
| 359 | 359 | // name td |
| 360 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
| 360 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
| 361 | 361 | // percent td |
| 362 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', ' jst-rght', '' ); |
|
| 362 | + $html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', ''); |
|
| 363 | 363 | // empty td (price) |
| 364 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
| 364 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
| 365 | 365 | // total td |
| 366 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
| 366 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
| 367 | 367 | // end of row |
| 368 | 368 | $html .= EEH_HTML::trx(); |
| 369 | 369 | return $html; |
@@ -378,17 +378,17 @@ discard block |
||
| 378 | 378 | * @param string $text |
| 379 | 379 | * @return mixed |
| 380 | 380 | */ |
| 381 | - private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) { |
|
| 381 | + private function _total_tax_row(EE_Line_Item $line_item, $text = '') { |
|
| 382 | 382 | $html = ''; |
| 383 | - if ( $line_item->total() ) { |
|
| 383 | + if ($line_item->total()) { |
|
| 384 | 384 | // start of row |
| 385 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
| 385 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
| 386 | 386 | // total td |
| 387 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' ); |
|
| 387 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"'); |
|
| 388 | 388 | // empty td (price) |
| 389 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
| 389 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
| 390 | 390 | // total td |
| 391 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
| 391 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
| 392 | 392 | // end of row |
| 393 | 393 | $html .= EEH_HTML::trx(); |
| 394 | 394 | } |
@@ -405,15 +405,15 @@ discard block |
||
| 405 | 405 | * @param array $options |
| 406 | 406 | * @return mixed |
| 407 | 407 | */ |
| 408 | - private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
|
| 408 | + private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) { |
|
| 409 | 409 | $html = ''; |
| 410 | - if ( $line_item->total() ) { |
|
| 410 | + if ($line_item->total()) { |
|
| 411 | 411 | // start of row |
| 412 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
| 412 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
| 413 | 413 | // total td |
| 414 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
| 414 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
| 415 | 415 | // total td |
| 416 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' ); |
|
| 416 | + $html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght'); |
|
| 417 | 417 | // end of row |
| 418 | 418 | $html .= EEH_HTML::trx(); |
| 419 | 419 | } |
@@ -430,13 +430,13 @@ discard block |
||
| 430 | 430 | * @param string $text |
| 431 | 431 | * @return mixed |
| 432 | 432 | */ |
| 433 | - private function _total_row( EE_Line_Item $line_item, $text = '' ) { |
|
| 433 | + private function _total_row(EE_Line_Item $line_item, $text = '') { |
|
| 434 | 434 | // start of row |
| 435 | - $html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' ); |
|
| 435 | + $html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd'); |
|
| 436 | 436 | // total td |
| 437 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
| 437 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
| 438 | 438 | // total td |
| 439 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
| 439 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
| 440 | 440 | // end of row |
| 441 | 441 | $html .= EEH_HTML::trx(); |
| 442 | 442 | return $html; |
@@ -451,30 +451,30 @@ discard block |
||
| 451 | 451 | * @param array $options |
| 452 | 452 | * @return mixed |
| 453 | 453 | */ |
| 454 | - private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) { |
|
| 454 | + private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) { |
|
| 455 | 455 | $html = ''; |
| 456 | 456 | $owing = $line_item->total(); |
| 457 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() ); |
|
| 458 | - if ( $transaction instanceof EE_Transaction ) { |
|
| 457 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID()); |
|
| 458 | + if ($transaction instanceof EE_Transaction) { |
|
| 459 | 459 | $registration_payments = array(); |
| 460 | - $registrations = ! empty( $options['registrations'] ) |
|
| 461 | - ? $options[ 'registrations' ] |
|
| 460 | + $registrations = ! empty($options['registrations']) |
|
| 461 | + ? $options['registrations'] |
|
| 462 | 462 | : $transaction->registrations(); |
| 463 | - foreach ( $registrations as $registration ) { |
|
| 464 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
| 463 | + foreach ($registrations as $registration) { |
|
| 464 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
| 465 | 465 | $registration_payments = $registration_payments + $registration->registration_payments(); |
| 466 | 466 | } |
| 467 | 467 | } |
| 468 | - if ( ! empty( $registration_payments )) { |
|
| 469 | - foreach ( $registration_payments as $registration_payment ) { |
|
| 470 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
| 468 | + if ( ! empty($registration_payments)) { |
|
| 469 | + foreach ($registration_payments as $registration_payment) { |
|
| 470 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
| 471 | 471 | $owing = $owing - $registration_payment->amount(); |
| 472 | 472 | $payment = $registration_payment->payment(); |
| 473 | - if ( $payment instanceof EE_Payment ) { |
|
| 473 | + if ($payment instanceof EE_Payment) { |
|
| 474 | 474 | $payment_desc = sprintf( |
| 475 | - __( 'Payment%1$s Received: %2$s', 'event_espresso' ), |
|
| 475 | + __('Payment%1$s Received: %2$s', 'event_espresso'), |
|
| 476 | 476 | $payment->txn_id_chq_nmbr() != '' |
| 477 | - ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> ' |
|
| 477 | + ? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> ' |
|
| 478 | 478 | : '', |
| 479 | 479 | $payment->timestamp() |
| 480 | 480 | ); |
@@ -482,12 +482,12 @@ discard block |
||
| 482 | 482 | $payment_desc = ''; |
| 483 | 483 | } |
| 484 | 484 | // start of row |
| 485 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
| 485 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
| 486 | 486 | // payment desc |
| 487 | - $html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' ); |
|
| 487 | + $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"'); |
|
| 488 | 488 | // total td |
| 489 | 489 | $html .= EEH_HTML::td( |
| 490 | - EEH_Template::format_currency( $registration_payment->amount(), false, false ), |
|
| 490 | + EEH_Template::format_currency($registration_payment->amount(), false, false), |
|
| 491 | 491 | '', |
| 492 | 492 | 'total jst-rght' |
| 493 | 493 | ); |
@@ -495,17 +495,17 @@ discard block |
||
| 495 | 495 | $html .= EEH_HTML::trx(); |
| 496 | 496 | } |
| 497 | 497 | } |
| 498 | - if ( $line_item->total() ) { |
|
| 498 | + if ($line_item->total()) { |
|
| 499 | 499 | // start of row |
| 500 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
| 500 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
| 501 | 501 | // total td |
| 502 | 502 | $html .= EEH_HTML::td( |
| 503 | 503 | __('Amount Owing', 'event_espresso'), |
| 504 | - '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
| 504 | + '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
| 505 | 505 | ); |
| 506 | 506 | // total td |
| 507 | 507 | $html .= EEH_HTML::td( |
| 508 | - EEH_Template::format_currency( $owing, false, false ), '', 'total jst-rght' |
|
| 508 | + EEH_Template::format_currency($owing, false, false), '', 'total jst-rght' |
|
| 509 | 509 | ); |
| 510 | 510 | // end of row |
| 511 | 511 | $html .= EEH_HTML::trx(); |
@@ -26,16 +26,16 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * ------------------------------------------------------------------------ |
| 28 | 28 | */ |
| 29 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
| 29 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
| 30 | 30 | |
| 31 | 31 | class EEM_Extra_Meta extends EEM_Base { |
| 32 | 32 | |
| 33 | 33 | // private instance of the Attendee object |
| 34 | 34 | protected static $_instance = NULL; |
| 35 | 35 | |
| 36 | - protected function __construct( $timezone = NULL ) { |
|
| 37 | - $this->singular_item = __('Extra Meta','event_espresso'); |
|
| 38 | - $this->plural_item = __('Extra Metas','event_espresso'); |
|
| 36 | + protected function __construct($timezone = NULL) { |
|
| 37 | + $this->singular_item = __('Extra Meta', 'event_espresso'); |
|
| 38 | + $this->plural_item = __('Extra Metas', 'event_espresso'); |
|
| 39 | 39 | $this->_tables = array( |
| 40 | 40 | 'Extra_Meta'=> new EE_Primary_Table('esp_extra_meta', 'EXM_ID') |
| 41 | 41 | ); |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | )); |
| 52 | 52 | $this->_model_relations = array(); |
| 53 | - foreach($models_this_can_attach_to as $model){ |
|
| 53 | + foreach ($models_this_can_attach_to as $model) { |
|
| 54 | 54 | $this->_model_relations[$model] = new EE_Belongs_To_Any_Relation(); |
| 55 | 55 | } |
| 56 | - foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) { |
|
| 57 | - $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'EXM_key', 'EXM_value' ); |
|
| 56 | + foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
|
| 57 | + $this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value'); |
|
| 58 | 58 | } |
| 59 | - parent::__construct( $timezone ); |
|
| 59 | + parent::__construct($timezone); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
@@ -31,20 +31,20 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * ------------------------------------------------------------------------ |
| 33 | 33 | */ |
| 34 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
| 34 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
| 35 | 35 | |
| 36 | 36 | class EEM_Post_Meta extends EEM_Base { |
| 37 | 37 | |
| 38 | 38 | // private instance of the EE_Post_Meta object |
| 39 | 39 | protected static $_instance = NULL; |
| 40 | 40 | |
| 41 | - protected function __construct( $timezone = NULL ) { |
|
| 42 | - $this->singular_item = __('Post Meta','event_espresso'); |
|
| 43 | - $this->plural_item = __('Post Metas','event_espresso'); |
|
| 41 | + protected function __construct($timezone = NULL) { |
|
| 42 | + $this->singular_item = __('Post Meta', 'event_espresso'); |
|
| 43 | + $this->plural_item = __('Post Metas', 'event_espresso'); |
|
| 44 | 44 | $this->_tables = array( |
| 45 | 45 | 'Post_Meta'=> new EE_Primary_Table('postmeta', 'meta_id') |
| 46 | 46 | ); |
| 47 | - $models_this_can_attach_to = array_keys( EE_Registry::instance()->cpt_models() ); |
|
| 47 | + $models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models()); |
|
| 48 | 48 | $this->_fields = array( |
| 49 | 49 | 'Post_Meta'=>array( |
| 50 | 50 | 'meta_id'=>new EE_Primary_Key_Int_Field('meta_id', __("Meta ID", "event_espresso")), |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | 'meta_value'=>new EE_Maybe_Serialized_Text_Field('meta_value', __("Meta Value", "event_espresso"), true) |
| 54 | 54 | )); |
| 55 | 55 | $this->_model_relations = array(); |
| 56 | - foreach($models_this_can_attach_to as $model){ |
|
| 56 | + foreach ($models_this_can_attach_to as $model) { |
|
| 57 | 57 | $this->_model_relations[$model] = new EE_Belongs_To_Relation(); |
| 58 | 58 | } |
| 59 | - foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) { |
|
| 60 | - $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'meta_key', 'meta_value' ); |
|
| 59 | + foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
|
| 60 | + $this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('meta_key', 'meta_value'); |
|
| 61 | 61 | } |
| 62 | - parent::__construct( $timezone ); |
|
| 62 | + parent::__construct($timezone); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 3 | - exit( 'No direct script access allowed' ); |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | + exit('No direct script access allowed'); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * @author Mike Nelson |
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | -class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base{ |
|
| 17 | +class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base { |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @param string $key_field_name |
| 34 | 34 | * @param string $value_field_name |
| 35 | 35 | */ |
| 36 | - public function __construct( $key_field_name, $value_field_name ) { |
|
| 36 | + public function __construct($key_field_name, $value_field_name) { |
|
| 37 | 37 | $this->_key_field_name = $key_field_name; |
| 38 | 38 | $this->_value_field_name = $value_field_name; |
| 39 | 39 | } |
@@ -45,21 +45,21 @@ discard block |
||
| 45 | 45 | * @throws EE_Error |
| 46 | 46 | */ |
| 47 | 47 | protected function _generate_restrictions() { |
| 48 | - $whitelisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array() ); |
|
| 49 | - $blacklisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array() ); |
|
| 48 | + $whitelisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array()); |
|
| 49 | + $blacklisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array()); |
|
| 50 | 50 | $conditions = array( |
| 51 | - $this->_key_field_name => array( 'NOT_LIKE', "\\\\_%" ),//each slash is escaped because we are using double quotes, and |
|
| 51 | + $this->_key_field_name => array('NOT_LIKE', "\\\\_%"), //each slash is escaped because we are using double quotes, and |
|
| 52 | 52 | //stripslashes will be called on this because the models assume this is from user input |
| 53 | - $this->_value_field_name => array( 'NOT_REGEXP', '^[aOs]:[\d]:.*$') |
|
| 53 | + $this->_value_field_name => array('NOT_REGEXP', '^[aOs]:[\d]:.*$') |
|
| 54 | 54 | ); |
| 55 | - if( ! empty( $blacklisted_meta_keys ) ) { |
|
| 56 | - $conditions[ $this->_key_field_name . '*blacklisted' ] = array( 'NOT_IN', $blacklisted_meta_keys ); |
|
| 55 | + if ( ! empty($blacklisted_meta_keys)) { |
|
| 56 | + $conditions[$this->_key_field_name.'*blacklisted'] = array('NOT_IN', $blacklisted_meta_keys); |
|
| 57 | 57 | } |
| 58 | - if( ! empty( $whitelisted_meta_keys ) ) { |
|
| 58 | + if ( ! empty($whitelisted_meta_keys)) { |
|
| 59 | 59 | $conditions = array( |
| 60 | 60 | 'OR*whitelisted-or-normal' => array( |
| 61 | 61 | 'AND' => $conditions, |
| 62 | - $this->_key_field_name . '*whitelisted' => array( 'IN', $whitelisted_meta_keys ) |
|
| 62 | + $this->_key_field_name.'*whitelisted' => array('IN', $whitelisted_meta_keys) |
|
| 63 | 63 | ) |
| 64 | 64 | ); |
| 65 | 65 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | //only allow access to non-protected metas if they're an admin |
| 68 | 68 | EE_Restriction_Generator_Base::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(), |
| 69 | 69 | //don't allow access to protected metas to anyone. If they want that, don't apply caps to the query |
| 70 | - 'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions( $conditions ), |
|
| 70 | + 'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions($conditions), |
|
| 71 | 71 | ); |
| 72 | 72 | } |
| 73 | 73 | } |