@@ -77,7 +77,7 @@ |
||
77 | 77 | } |
78 | 78 | foreach( $model->field_settings() as $field_name => $field_obj ){ |
79 | 79 | if( $model_version_info->field_has_rendered_format( $field_obj ) |
80 | - && isset( $entity[ $field_name ] ) |
|
80 | + && isset( $entity[ $field_name ] ) |
|
81 | 81 | && is_array( $entity[ $field_name ] ) |
82 | 82 | && isset( $entity[ $field_name ][ 'raw' ] ) |
83 | 83 | ) { |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api; |
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 | /** |
@@ -21,16 +21,16 @@ discard block |
||
21 | 21 | * @param string $model_context one of the return values from EEM_Base::valid_cap_contexts() |
22 | 22 | * @return boolean |
23 | 23 | */ |
24 | - public static function current_user_has_partial_access_to( $model, $model_context = \EEM_Base::caps_read ) { |
|
25 | - if( apply_filters( 'FHEE__Capabilities__current_user_has_partial_access_to__override_begin', false, $model, $model ) ) { |
|
24 | + public static function current_user_has_partial_access_to($model, $model_context = \EEM_Base::caps_read) { |
|
25 | + if (apply_filters('FHEE__Capabilities__current_user_has_partial_access_to__override_begin', false, $model, $model)) { |
|
26 | 26 | return true; |
27 | 27 | } |
28 | - foreach( $model->caps_missing( $model_context ) as $capability_name => $restriction_obj ) { |
|
29 | - if( $restriction_obj instanceof \EE_Return_None_Where_Conditions ){ |
|
28 | + foreach ($model->caps_missing($model_context) as $capability_name => $restriction_obj) { |
|
29 | + if ($restriction_obj instanceof \EE_Return_None_Where_Conditions) { |
|
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | } |
33 | - if( apply_filters( 'FHEE__Capabilities__current_user_has_partial_access_to__override_end', false, $model, $model ) ) { |
|
33 | + if (apply_filters('FHEE__Capabilities__current_user_has_partial_access_to__override_end', false, $model, $model)) { |
|
34 | 34 | return false; |
35 | 35 | } |
36 | 36 | return true; |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @param string $request_type one of the constants on WP_JSON_Server |
44 | 44 | * @return array |
45 | 45 | */ |
46 | - public static function get_missing_permissions( $model, $request_type = \EEM_Base::caps_read ) { |
|
47 | - return $model->caps_missing( $request_type ); |
|
46 | + public static function get_missing_permissions($model, $request_type = \EEM_Base::caps_read) { |
|
47 | + return $model->caps_missing($request_type); |
|
48 | 48 | } |
49 | 49 | /** |
50 | 50 | * Gets a string of all the capabilities the current user is missing that affected |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * @param string $model_context one of the return values from EEM_Base::valid_cap_contexts() |
55 | 55 | * @return string |
56 | 56 | */ |
57 | - public static function get_missing_permissions_string( $model, $model_context = \EEM_Base::caps_read ) { |
|
58 | - return implode(',', array_keys( self::get_missing_permissions( $model, $model_context ) ) ); |
|
57 | + public static function get_missing_permissions_string($model, $model_context = \EEM_Base::caps_read) { |
|
58 | + return implode(',', array_keys(self::get_missing_permissions($model, $model_context))); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -66,27 +66,27 @@ discard block |
||
66 | 66 | * @param Model_Version_Info $model_version_info |
67 | 67 | * @return array ready for converting into json |
68 | 68 | */ |
69 | - public static function filter_out_inaccessible_entity_fields( $entity, $model, $request_type, $model_version_info ) { |
|
69 | + public static function filter_out_inaccessible_entity_fields($entity, $model, $request_type, $model_version_info) { |
|
70 | 70 | //we only care to do this for frontend reads and when the user can't edit the item |
71 | - if( $request_type !== \EEM_Base::caps_read || |
|
72 | - $model->exists( array( |
|
73 | - array( $model->primary_key_name() => $entity[ $model->primary_key_name() ] ), |
|
71 | + if ($request_type !== \EEM_Base::caps_read || |
|
72 | + $model->exists(array( |
|
73 | + array($model->primary_key_name() => $entity[$model->primary_key_name()]), |
|
74 | 74 | 'default_where_conditions' => 'none', |
75 | - 'caps' => \EEM_Base::caps_edit ) ) ) { |
|
75 | + 'caps' => \EEM_Base::caps_edit ))) { |
|
76 | 76 | return $entity; |
77 | 77 | } |
78 | - foreach( $model->field_settings() as $field_name => $field_obj ){ |
|
79 | - if( $model_version_info->field_has_rendered_format( $field_obj ) |
|
80 | - && isset( $entity[ $field_name ] ) |
|
81 | - && is_array( $entity[ $field_name ] ) |
|
82 | - && isset( $entity[ $field_name ][ 'raw' ] ) |
|
78 | + foreach ($model->field_settings() as $field_name => $field_obj) { |
|
79 | + if ($model_version_info->field_has_rendered_format($field_obj) |
|
80 | + && isset($entity[$field_name]) |
|
81 | + && is_array($entity[$field_name]) |
|
82 | + && isset($entity[$field_name]['raw']) |
|
83 | 83 | ) { |
84 | - unset( $entity[ $field_name ][ 'raw' ] ); |
|
84 | + unset($entity[$field_name]['raw']); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | //theoretically we may want to filter out specific fields for specific models |
88 | 88 | |
89 | - return apply_filters( 'FHEE__Capabilities__filter_out_inaccessible_entity_fields', $entity, $model, $request_type ); |
|
89 | + return apply_filters('FHEE__Capabilities__filter_out_inaccessible_entity_fields', $entity, $model, $request_type); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 |
@@ -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 | |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | * @param \EE_Request $request |
71 | 71 | * @param \EE_Response $response |
72 | 72 | */ |
73 | - protected function __construct( EE_Request $request, EE_Response $response ) { |
|
73 | + protected function __construct(EE_Request $request, EE_Response $response) { |
|
74 | 74 | $this->_request = $request; |
75 | 75 | $this->_response = $response; |
76 | - add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) ); |
|
77 | - do_action( 'EE_Dependency_Map____construct' ); |
|
76 | + add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
77 | + do_action('EE_Dependency_Map____construct'); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | * @param \EE_Response $response |
96 | 96 | * @return \EE_Dependency_Map instance |
97 | 97 | */ |
98 | - public static function instance( EE_Request $request = null, EE_Response $response = null ) { |
|
98 | + public static function instance(EE_Request $request = null, EE_Response $response = null) { |
|
99 | 99 | // check if class object is instantiated, and instantiated properly |
100 | - if ( ! self::$_instance instanceof EE_Dependency_Map ) { |
|
101 | - self::$_instance = new EE_Dependency_Map( $request, $response ); |
|
100 | + if ( ! self::$_instance instanceof EE_Dependency_Map) { |
|
101 | + self::$_instance = new EE_Dependency_Map($request, $response); |
|
102 | 102 | } |
103 | 103 | return self::$_instance; |
104 | 104 | } |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | * @param array $dependencies |
111 | 111 | * @return boolean |
112 | 112 | */ |
113 | - public static function register_dependencies( $class, $dependencies ) { |
|
114 | - if ( ! isset( self::$_instance->_dependency_map[ $class ] ) ) { |
|
115 | - self::$_instance->_dependency_map[ $class ] = (array)$dependencies; |
|
113 | + public static function register_dependencies($class, $dependencies) { |
|
114 | + if ( ! isset(self::$_instance->_dependency_map[$class])) { |
|
115 | + self::$_instance->_dependency_map[$class] = (array) $dependencies; |
|
116 | 116 | return true; |
117 | 117 | } |
118 | 118 | return false; |
@@ -126,18 +126,18 @@ discard block |
||
126 | 126 | * @return bool |
127 | 127 | * @throws \EE_Error |
128 | 128 | */ |
129 | - public static function register_class_loader( $class_name, $loader = 'load_core' ) { |
|
129 | + public static function register_class_loader($class_name, $loader = 'load_core') { |
|
130 | 130 | // check that loader method starts with "load_" and exists in EE_Registry |
131 | - if ( strpos( $loader, 'load_' ) !== 0 || ! method_exists( 'EE_Registry', $loader ) ) { |
|
131 | + if (strpos($loader, 'load_') !== 0 || ! method_exists('EE_Registry', $loader)) { |
|
132 | 132 | throw new EE_Error( |
133 | 133 | sprintf( |
134 | - __( '"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso' ), |
|
134 | + __('"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso'), |
|
135 | 135 | $loader |
136 | 136 | ) |
137 | 137 | ); |
138 | 138 | } |
139 | - if ( ! isset( self::$_instance->_class_loaders[ $class_name ] ) ) { |
|
140 | - self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
139 | + if ( ! isset(self::$_instance->_class_loaders[$class_name])) { |
|
140 | + self::$_instance->_class_loaders[$class_name] = $loader; |
|
141 | 141 | return true; |
142 | 142 | } |
143 | 143 | return false; |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | * @param string $class_name |
161 | 161 | * @return boolean |
162 | 162 | */ |
163 | - public function has( $class_name = '' ) { |
|
164 | - return isset( $this->_dependency_map[ $class_name ] ) ? true : false; |
|
163 | + public function has($class_name = '') { |
|
164 | + return isset($this->_dependency_map[$class_name]) ? true : false; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param string $dependency |
174 | 174 | * @return bool |
175 | 175 | */ |
176 | - public function has_dependency_for_class( $class_name = '', $dependency = '' ) { |
|
177 | - return isset( $this->_dependency_map[ $class_name ], $this->_dependency_map[ $class_name ][ $dependency ] ) |
|
176 | + public function has_dependency_for_class($class_name = '', $dependency = '') { |
|
177 | + return isset($this->_dependency_map[$class_name], $this->_dependency_map[$class_name][$dependency]) |
|
178 | 178 | ? true |
179 | 179 | : false; |
180 | 180 | } |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | * @param string $dependency |
189 | 189 | * @return int |
190 | 190 | */ |
191 | - public function loading_strategy_for_class_dependency( $class_name = '', $dependency = '' ) { |
|
192 | - return $this->has_dependency_for_class( $class_name, $dependency ) |
|
193 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
191 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') { |
|
192 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
193 | + ? $this->_dependency_map[$class_name][$dependency] |
|
194 | 194 | : EE_Dependency_Map::not_registered; |
195 | 195 | } |
196 | 196 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | * @param string $class_name |
201 | 201 | * @return string | Closure |
202 | 202 | */ |
203 | - public function class_loader( $class_name ) { |
|
204 | - return isset( $this->_class_loaders[ $class_name ] ) ? $this->_class_loaders[ $class_name ] : ''; |
|
203 | + public function class_loader($class_name) { |
|
204 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
340 | 340 | 'EE_Message_Template_Group_Collection' => 'load_lib', |
341 | 341 | 'EE_Messages_Generator' => function() { |
342 | - return EE_Registry::instance()->load_lib( 'Messages_Generator', array(), false, false ); |
|
342 | + return EE_Registry::instance()->load_lib('Messages_Generator', array(), false, false); |
|
343 | 343 | }, |
344 | - 'EE_Messages_Template_Defaults' => function( $arguments = array() ) { |
|
345 | - return EE_Registry::instance()->load_lib( 'Messages_Template_Defaults', $arguments, false, false ); |
|
344 | + 'EE_Messages_Template_Defaults' => function($arguments = array()) { |
|
345 | + return EE_Registry::instance()->load_lib('Messages_Template_Defaults', $arguments, false, false); |
|
346 | 346 | }, |
347 | 347 | //load_model |
348 | 348 | 'EEM_Message_Template_Group' => 'load_model', |
349 | 349 | 'EEM_Message_Template' => 'load_model', |
350 | 350 | //load_helper |
351 | 351 | 'EEH_Parse_Shortcodes' => function() { |
352 | - if ( EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ) ) { |
|
352 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
353 | 353 | return new EEH_Parse_Shortcodes(); |
354 | 354 | } |
355 | 355 | return null; |