@@ -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 | 76 | $this->initialize(); |
77 | - do_action( 'EE_Dependency_Map____construct' ); |
|
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; |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * @param string $class_name |
179 | 179 | * @return boolean |
180 | 180 | */ |
181 | - public function has( $class_name = '' ) { |
|
182 | - return isset( $this->_dependency_map[ $class_name ] ) ? true : false; |
|
181 | + public function has($class_name = '') { |
|
182 | + return isset($this->_dependency_map[$class_name]) ? true : false; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | * @param string $dependency |
192 | 192 | * @return bool |
193 | 193 | */ |
194 | - public function has_dependency_for_class( $class_name = '', $dependency = '' ) { |
|
195 | - return isset( $this->_dependency_map[ $class_name ], $this->_dependency_map[ $class_name ][ $dependency ] ) |
|
194 | + public function has_dependency_for_class($class_name = '', $dependency = '') { |
|
195 | + return isset($this->_dependency_map[$class_name], $this->_dependency_map[$class_name][$dependency]) |
|
196 | 196 | ? true |
197 | 197 | : false; |
198 | 198 | } |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | * @param string $dependency |
207 | 207 | * @return int |
208 | 208 | */ |
209 | - public function loading_strategy_for_class_dependency( $class_name = '', $dependency = '' ) { |
|
210 | - return $this->has_dependency_for_class( $class_name, $dependency ) |
|
211 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
209 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') { |
|
210 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
211 | + ? $this->_dependency_map[$class_name][$dependency] |
|
212 | 212 | : EE_Dependency_Map::not_registered; |
213 | 213 | } |
214 | 214 | |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | * @param string $class_name |
219 | 219 | * @return string | Closure |
220 | 220 | */ |
221 | - public function class_loader( $class_name ) { |
|
222 | - return isset( $this->_class_loaders[ $class_name ] ) ? $this->_class_loaders[ $class_name ] : ''; |
|
221 | + public function class_loader($class_name) { |
|
222 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
@@ -361,17 +361,17 @@ discard block |
||
361 | 361 | 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
362 | 362 | 'EE_Message_Template_Group_Collection' => 'load_lib', |
363 | 363 | 'EE_Messages_Generator' => function() { |
364 | - return EE_Registry::instance()->load_lib( 'Messages_Generator', array(), false, false ); |
|
364 | + return EE_Registry::instance()->load_lib('Messages_Generator', array(), false, false); |
|
365 | 365 | }, |
366 | - 'EE_Messages_Template_Defaults' => function( $arguments = array() ) { |
|
367 | - return EE_Registry::instance()->load_lib( 'Messages_Template_Defaults', $arguments, false, false ); |
|
366 | + 'EE_Messages_Template_Defaults' => function($arguments = array()) { |
|
367 | + return EE_Registry::instance()->load_lib('Messages_Template_Defaults', $arguments, false, false); |
|
368 | 368 | }, |
369 | 369 | //load_model |
370 | 370 | 'EEM_Message_Template_Group' => 'load_model', |
371 | 371 | 'EEM_Message_Template' => 'load_model', |
372 | 372 | //load_helper |
373 | 373 | 'EEH_Parse_Shortcodes' => function() { |
374 | - if ( EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ) ) { |
|
374 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
375 | 375 | return new EEH_Parse_Shortcodes(); |
376 | 376 | } |
377 | 377 | return null; |
@@ -22,32 +22,32 @@ discard block |
||
22 | 22 | * @param EE_Response $response |
23 | 23 | * @return EE_Response |
24 | 24 | */ |
25 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
25 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
26 | 26 | $this->request = $request; |
27 | 27 | $this->response = $response; |
28 | 28 | //$this->response->add_output( "\n\t IN >> " . __CLASS__ ); |
29 | 29 | //$this->response->set_notice( 1, 'hey look at this' ); |
30 | 30 | // check required WP version |
31 | - if ( ! $this->_minimum_wp_version_required() ) { |
|
32 | - $this->request->un_set( 'activate', true ); |
|
33 | - add_action( 'admin_notices', array( $this, 'minimum_wp_version_error' ), 1 ); |
|
31 | + if ( ! $this->_minimum_wp_version_required()) { |
|
32 | + $this->request->un_set('activate', true); |
|
33 | + add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1); |
|
34 | 34 | //$this->response->add_output( "\n<br />" . 'minimum_wp_version_error' ); |
35 | 35 | $this->response->terminate_request(); |
36 | 36 | $this->response->deactivate_plugin(); |
37 | 37 | } |
38 | 38 | // check required PHP version |
39 | - if ( ! $this->_minimum_php_version_required() ) { |
|
40 | - $this->request->un_set( 'activate', true ); |
|
41 | - add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 ); |
|
39 | + if ( ! $this->_minimum_php_version_required()) { |
|
40 | + $this->request->un_set('activate', true); |
|
41 | + add_action('admin_notices', array($this, 'minimum_php_version_error'), 1); |
|
42 | 42 | //$this->response->add_output( "\n<br />" . 'minimum_php_version_error' ); |
43 | 43 | $this->response->terminate_request(); |
44 | 44 | $this->response->deactivate_plugin(); |
45 | 45 | } |
46 | 46 | // check recommended PHP version |
47 | - if ( ! $this->_minimum_php_version_recommended() ) { |
|
47 | + if ( ! $this->_minimum_php_version_recommended()) { |
|
48 | 48 | $this->_display_minimum_recommended_php_version_notice(); |
49 | 49 | } |
50 | - $this->response = $this->process_request_stack( $this->request, $this->response ); |
|
50 | + $this->response = $this->process_request_stack($this->request, $this->response); |
|
51 | 51 | return $this->response; |
52 | 52 | } |
53 | 53 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * @param string $min_version |
61 | 61 | * @return boolean |
62 | 62 | */ |
63 | - private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) { |
|
63 | + private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) { |
|
64 | 64 | global $wp_version; |
65 | - return version_compare( $wp_version, $min_version, '>=' ) ? true : false; |
|
65 | + return version_compare($wp_version, $min_version, '>=') ? true : false; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return boolean |
75 | 75 | */ |
76 | 76 | private function _minimum_wp_version_required() { |
77 | - return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED ); |
|
77 | + return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * @param string $min_version |
87 | 87 | * @return boolean |
88 | 88 | */ |
89 | - private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) { |
|
90 | - return version_compare( PHP_VERSION, $min_version, '>=' ) ? true : false; |
|
89 | + private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) { |
|
90 | + return version_compare(PHP_VERSION, $min_version, '>=') ? true : false; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return boolean |
100 | 100 | */ |
101 | 101 | private function _minimum_php_version_required() { |
102 | - return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED ); |
|
102 | + return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return boolean |
112 | 112 | */ |
113 | 113 | private function _minimum_php_version_recommended() { |
114 | - return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED ); |
|
114 | + return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | <p> |
129 | 129 | <?php |
130 | 130 | printf( |
131 | - __( 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ), |
|
131 | + __('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'), |
|
132 | 132 | EE_MIN_WP_VER_REQUIRED, |
133 | 133 | $wp_version, |
134 | 134 | '<br/>', |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | <p> |
154 | 154 | <?php |
155 | 155 | printf( |
156 | - __( 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
156 | + __('We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
157 | 157 | EE_MIN_PHP_VER_REQUIRED, |
158 | 158 | PHP_VERSION, |
159 | 159 | '<br/>', |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | */ |
176 | 176 | private function _display_minimum_recommended_php_version_notice() { |
177 | 177 | EE_Error::add_persistent_admin_notice( |
178 | - 'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended', |
|
178 | + 'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended', |
|
179 | 179 | sprintf( |
180 | - __( 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
180 | + __('Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
181 | 181 | EE_MIN_PHP_VER_RECOMMENDED, |
182 | 182 | PHP_VERSION, |
183 | 183 | '<br/>', |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param \EE_Request $request |
59 | 59 | * @param \EE_Response $response |
60 | 60 | */ |
61 | - public function __construct( \EE_Request $request, \EE_Response $response ) { |
|
61 | + public function __construct(\EE_Request $request, \EE_Response $response) { |
|
62 | 62 | $this->request = $request; |
63 | 63 | $this->response = $response; |
64 | 64 | } |
@@ -76,31 +76,31 @@ discard block |
||
76 | 76 | * @param WP_Query $WP_Query |
77 | 77 | * @return string | NULL |
78 | 78 | */ |
79 | - public function get_route( WP_Query $WP_Query ) { |
|
79 | + public function get_route(WP_Query $WP_Query) { |
|
80 | 80 | $this->WP_Query = $WP_Query; |
81 | 81 | // assume this if first route being called |
82 | 82 | $previous_route = FALSE; |
83 | 83 | // but is it really ??? |
84 | - if ( ! empty( self::$_previous_routes )) { |
|
84 | + if ( ! empty(self::$_previous_routes)) { |
|
85 | 85 | // get last run route |
86 | - $previous_routes = array_values( self::$_previous_routes ); |
|
87 | - $previous_route = array_pop( $previous_routes ); |
|
86 | + $previous_routes = array_values(self::$_previous_routes); |
|
87 | + $previous_route = array_pop($previous_routes); |
|
88 | 88 | } |
89 | 89 | // has another route already been run ? |
90 | - if ( $previous_route ) { |
|
90 | + if ($previous_route) { |
|
91 | 91 | // check if forwarding has been set |
92 | - $current_route = $this->get_forward( $previous_route ); |
|
92 | + $current_route = $this->get_forward($previous_route); |
|
93 | 93 | try { |
94 | 94 | //check for recursive forwarding |
95 | - if ( isset( self::$_previous_routes[ $current_route ] )) { |
|
95 | + if (isset(self::$_previous_routes[$current_route])) { |
|
96 | 96 | throw new EE_Error( |
97 | 97 | sprintf( |
98 | - __('An error occurred. The %s route has already been called, and therefore can not be forwarded to, because an infinite loop would be created and break the interweb.','event_espresso'), |
|
98 | + __('An error occurred. The %s route has already been called, and therefore can not be forwarded to, because an infinite loop would be created and break the interweb.', 'event_espresso'), |
|
99 | 99 | $current_route |
100 | 100 | ) |
101 | 101 | ); |
102 | 102 | } |
103 | - } catch ( EE_Error $e ) { |
|
103 | + } catch (EE_Error $e) { |
|
104 | 104 | $e->get_error(); |
105 | 105 | return NULL; |
106 | 106 | } |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | // grab all routes |
111 | 111 | $routes = EE_Registry::instance()->CFG->get_routes(); |
112 | 112 | //d( $routes ); |
113 | - foreach( $routes as $key => $route ) { |
|
113 | + foreach ($routes as $key => $route) { |
|
114 | 114 | // check request for module route |
115 | - if ( EE_Registry::instance()->REQ->is_set( $key )) { |
|
115 | + if (EE_Registry::instance()->REQ->is_set($key)) { |
|
116 | 116 | //echo '<b style="color:#2EA2CC;">key : <span style="color:#E76700">' . $key . '</span></b><br />'; |
117 | - $current_route = sanitize_text_field( EE_Registry::instance()->REQ->get( $key )); |
|
118 | - if ( $current_route ) { |
|
119 | - $current_route = array( $key, $current_route ); |
|
117 | + $current_route = sanitize_text_field(EE_Registry::instance()->REQ->get($key)); |
|
118 | + if ($current_route) { |
|
119 | + $current_route = array($key, $current_route); |
|
120 | 120 | //echo '<b style="color:#2EA2CC;">current_route : <span style="color:#E76700">' . $current_route . '</span></b><br />'; |
121 | 121 | break; |
122 | 122 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | } |
126 | 126 | // sorry, but I can't read what you route ! |
127 | - if ( empty( $current_route )) { |
|
127 | + if (empty($current_route)) { |
|
128 | 128 | return NULL; |
129 | 129 | } |
130 | 130 | //add route to previous routes array |
@@ -144,46 +144,46 @@ discard block |
||
144 | 144 | * @param string $current_route |
145 | 145 | * @return mixed EED_Module | boolean |
146 | 146 | */ |
147 | - public function resolve_route( $key, $current_route ) { |
|
147 | + public function resolve_route($key, $current_route) { |
|
148 | 148 | // get module method that route has been mapped to |
149 | - $module_method = EE_Config::get_route( $current_route, $key ); |
|
149 | + $module_method = EE_Config::get_route($current_route, $key); |
|
150 | 150 | //EEH_Debug_Tools::printr( $module_method, '$module_method <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
151 | 151 | // verify result was returned |
152 | - if ( empty( $module_method )) { |
|
153 | - $msg = sprintf( __( 'The requested route %s could not be mapped to any registered modules.', 'event_espresso' ), $current_route ); |
|
154 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
152 | + if (empty($module_method)) { |
|
153 | + $msg = sprintf(__('The requested route %s could not be mapped to any registered modules.', 'event_espresso'), $current_route); |
|
154 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
155 | 155 | return FALSE; |
156 | 156 | } |
157 | 157 | // verify that result is an array |
158 | - if ( ! is_array( $module_method )) { |
|
159 | - $msg = sprintf( __( 'The %s route has not been properly registered.', 'event_espresso' ), $current_route ); |
|
160 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
158 | + if ( ! is_array($module_method)) { |
|
159 | + $msg = sprintf(__('The %s route has not been properly registered.', 'event_espresso'), $current_route); |
|
160 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
161 | 161 | return FALSE; |
162 | 162 | } |
163 | 163 | // grab module name |
164 | 164 | $module_name = $module_method[0]; |
165 | 165 | // verify that a class method was registered properly |
166 | - if ( ! isset( $module_method[1] )) { |
|
167 | - $msg = sprintf( __( 'A class method for the %s route has not been properly registered.', 'event_espresso' ), $current_route ); |
|
168 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
166 | + if ( ! isset($module_method[1])) { |
|
167 | + $msg = sprintf(__('A class method for the %s route has not been properly registered.', 'event_espresso'), $current_route); |
|
168 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
169 | 169 | return FALSE; |
170 | 170 | } |
171 | 171 | // grab method |
172 | 172 | $method = $module_method[1]; |
173 | 173 | // verify that class exists |
174 | - if ( ! class_exists( $module_name )) { |
|
175 | - $msg = sprintf( __( 'The requested %s class could not be found.', 'event_espresso' ), $module_name ); |
|
176 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
174 | + if ( ! class_exists($module_name)) { |
|
175 | + $msg = sprintf(__('The requested %s class could not be found.', 'event_espresso'), $module_name); |
|
176 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
177 | 177 | return FALSE; |
178 | 178 | } |
179 | 179 | // verify that method exists |
180 | - if ( ! method_exists( $module_name, $method )) { |
|
181 | - $msg = sprintf( __( 'The class method %s for the %s route is in invalid.', 'event_espresso' ), $method, $current_route ); |
|
182 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
180 | + if ( ! method_exists($module_name, $method)) { |
|
181 | + $msg = sprintf(__('The class method %s for the %s route is in invalid.', 'event_espresso'), $method, $current_route); |
|
182 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
183 | 183 | return FALSE; |
184 | 184 | } |
185 | 185 | // instantiate module and call route method |
186 | - return $this->_module_router( $module_name, $method ); |
|
186 | + return $this->_module_router($module_name, $method); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -199,18 +199,18 @@ discard block |
||
199 | 199 | * @param \EE_Response $response |
200 | 200 | * @return EED_Module | NULL |
201 | 201 | */ |
202 | - public static function module_factory( $module_name, \EE_Request $request, \EE_Response $response ) { |
|
203 | - if ( $module_name === 'EED_Module' ) { |
|
204 | - EE_Error::add_error( sprintf( __( 'EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.', 'event_espresso' ), $module_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
202 | + public static function module_factory($module_name, \EE_Request $request, \EE_Response $response) { |
|
203 | + if ($module_name === 'EED_Module') { |
|
204 | + EE_Error::add_error(sprintf(__('EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.', 'event_espresso'), $module_name), __FILE__, __FUNCTION__, __LINE__); |
|
205 | 205 | return NULL; |
206 | 206 | } |
207 | 207 | // ensure that class is actually a module |
208 | - if ( ! is_subclass_of( $module_name, 'EED_Module' )) { |
|
209 | - EE_Error::add_error( sprintf( __( 'The requested %s module is not of the class EED_Module.', 'event_espresso' ), $module_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
208 | + if ( ! is_subclass_of($module_name, 'EED_Module')) { |
|
209 | + EE_Error::add_error(sprintf(__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name), __FILE__, __FUNCTION__, __LINE__); |
|
210 | 210 | return NULL; |
211 | 211 | } |
212 | 212 | // instantiate and return module class |
213 | - return new $module_name( $request, $response ); |
|
213 | + return new $module_name($request, $response); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | * @param string $method |
225 | 225 | * @return EED_Module | NULL |
226 | 226 | */ |
227 | - private function _module_router( $module_name, $method ) { |
|
227 | + private function _module_router($module_name, $method) { |
|
228 | 228 | // instantiate module class |
229 | - $module = EE_Module_Request_Router::module_factory( $module_name, $this->request, $this->response ); |
|
230 | - if ( $module instanceof EED_Module ) { |
|
229 | + $module = EE_Module_Request_Router::module_factory($module_name, $this->request, $this->response); |
|
230 | + if ($module instanceof EED_Module) { |
|
231 | 231 | // and call whatever action the route was for |
232 | 232 | try { |
233 | - $module->{$method}( $this->WP_Query ); |
|
234 | - } catch ( EE_Error $e ) { |
|
233 | + $module->{$method}($this->WP_Query); |
|
234 | + } catch (EE_Error $e) { |
|
235 | 235 | $e->get_error(); |
236 | 236 | return NULL; |
237 | 237 | } |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | * @param $current_route |
249 | 249 | * @return string |
250 | 250 | */ |
251 | - public function get_forward( $current_route ) { |
|
252 | - return EE_Config::get_forward( $current_route ); |
|
251 | + public function get_forward($current_route) { |
|
252 | + return EE_Config::get_forward($current_route); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | * @param $current_route |
262 | 262 | * @return string |
263 | 263 | */ |
264 | - public function get_view( $current_route ) { |
|
265 | - return EE_Config::get_view( $current_route ); |
|
264 | + public function get_view($current_route) { |
|
265 | + return EE_Config::get_view($current_route); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @param $b |
273 | 273 | * @return bool |
274 | 274 | */ |
275 | - public function __set($a,$b) { return FALSE; } |
|
275 | + public function __set($a, $b) { return FALSE; } |
|
276 | 276 | |
277 | 277 | |
278 | 278 |
@@ -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 | * ************************************************************************ |
@@ -44,32 +44,32 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @param array $deprecated_hooks |
46 | 46 | */ |
47 | -function ee_deprecated_hooks( array $deprecated_hooks = array() ) { |
|
48 | - foreach ( $deprecated_hooks as $deprecated_hook => $new_hook ) { |
|
47 | +function ee_deprecated_hooks(array $deprecated_hooks = array()) { |
|
48 | + foreach ($deprecated_hooks as $deprecated_hook => $new_hook) { |
|
49 | 49 | if ( |
50 | - ! is_string( $deprecated_hook ) |
|
51 | - || ! isset( $new_hook['replacement'] ) |
|
52 | - || ! is_string( $new_hook['replacement'] ) |
|
50 | + ! is_string($deprecated_hook) |
|
51 | + || ! isset($new_hook['replacement']) |
|
52 | + || ! is_string($new_hook['replacement']) |
|
53 | 53 | ) { |
54 | 54 | continue; |
55 | 55 | } |
56 | - $action = strpos( $new_hook['replacement'], 'AHEE' ) === 0 ? true : false; |
|
56 | + $action = strpos($new_hook['replacement'], 'AHEE') === 0 ? true : false; |
|
57 | 57 | $add_or_apply = $action ? 'add_action' : 'add_filter'; |
58 | 58 | $do_or_applies = $action ? 'do_action' : 'apply_filters'; |
59 | - if ( $new_hook['replacement'] ) { |
|
59 | + if ($new_hook['replacement']) { |
|
60 | 60 | $add_or_apply( |
61 | 61 | $new_hook['replacement'], |
62 | 62 | // let's use a closure for the callback since that's the only option |
63 | - function () use ( $deprecated_hook, $new_hook, $do_or_applies ) { |
|
63 | + function() use ($deprecated_hook, $new_hook, $do_or_applies) { |
|
64 | 64 | if ( |
65 | 65 | ee_deprecated_hook( |
66 | 66 | array( |
67 | 67 | $deprecated_hook => array( |
68 | 68 | 'version' => $new_hook['version'], |
69 | - 'alternative' => ! empty( $new_hook['message'] ) |
|
69 | + 'alternative' => ! empty($new_hook['message']) |
|
70 | 70 | ? $new_hook['message'] |
71 | 71 | : sprintf( |
72 | - __( 'Please use "%1$s" instead', 'event_espresso' ), |
|
72 | + __('Please use "%1$s" instead', 'event_espresso'), |
|
73 | 73 | $new_hook['replacement'] |
74 | 74 | ), |
75 | 75 | 'still_works' => $new_hook['replacement'] ? true : false |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | $args = func_get_args(); |
82 | 82 | // since the first argument for do_action and apply_filters is the hook name, |
83 | 83 | // we'll add that onto the start of the array |
84 | - array_unshift( $args, $deprecated_hook ); |
|
84 | + array_unshift($args, $deprecated_hook); |
|
85 | 85 | // then call do_action() or apply_filters() with our array of arguments |
86 | - call_user_func_array( $do_or_applies, $args ); |
|
86 | + call_user_func_array($do_or_applies, $args); |
|
87 | 87 | } |
88 | 88 | }, |
89 | - isset( $new_hook['priority'] ) ? $new_hook['priority'] : 10, |
|
90 | - isset( $new_hook['arguments'] ) ? $new_hook['arguments'] : null |
|
89 | + isset($new_hook['priority']) ? $new_hook['priority'] : 10, |
|
90 | + isset($new_hook['arguments']) ? $new_hook['arguments'] : null |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | } |
@@ -104,26 +104,26 @@ discard block |
||
104 | 104 | * } |
105 | 105 | * @return boolean |
106 | 106 | */ |
107 | -function ee_deprecated_hook( $hook = array() ) { |
|
108 | - if ( empty( $hook ) ) { |
|
107 | +function ee_deprecated_hook($hook = array()) { |
|
108 | + if (empty($hook)) { |
|
109 | 109 | return false; |
110 | 110 | } |
111 | - foreach ( $hook as $name => $deprecation_info ) { |
|
112 | - if ( has_action( $name ) || has_filter( $name ) ) { |
|
111 | + foreach ($hook as $name => $deprecation_info) { |
|
112 | + if (has_action($name) || has_filter($name)) { |
|
113 | 113 | EE_Error::doing_it_wrong( |
114 | 114 | $name, |
115 | 115 | sprintf( |
116 | - __( 'This action or filter is deprecated. %1$s%2$s', 'event_espresso' ), |
|
116 | + __('This action or filter is deprecated. %1$s%2$s', 'event_espresso'), |
|
117 | 117 | $deprecation_info['still_works'] |
118 | - ? __( 'It *may* work as an attempt to build in backwards compatibility.', 'event_espresso' ) |
|
119 | - : __( 'It has been completely removed.', 'event_espresso' ), |
|
120 | - isset( $deprecation_info['alternative'] ) |
|
118 | + ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') |
|
119 | + : __('It has been completely removed.', 'event_espresso'), |
|
120 | + isset($deprecation_info['alternative']) |
|
121 | 121 | ? $deprecation_info['alternative'] |
122 | - : __( 'Please read the current EE4 documentation further or contact Support.', 'event_espresso' ) |
|
122 | + : __('Please read the current EE4 documentation further or contact Support.', 'event_espresso') |
|
123 | 123 | ), |
124 | - isset( $deprecation_info['version'] ) |
|
124 | + isset($deprecation_info['version']) |
|
125 | 125 | ? $deprecation_info['version'] |
126 | - : __( 'recently', 'event_espresso' ), |
|
126 | + : __('recently', 'event_espresso'), |
|
127 | 127 | E_USER_DEPRECATED |
128 | 128 | ); |
129 | 129 | return true; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param \EE_Checkout $checkout |
142 | 142 | * @return string |
143 | 143 | */ |
144 | -function ee_deprecated__registration_checkout__button_text( $submit_button_text, EE_Checkout $checkout ) { |
|
144 | +function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout) { |
|
145 | 145 | // list of old filters |
146 | 146 | $deprecated_filters = array( |
147 | 147 | 'update_registration_details' => true, |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | 'proceed_to' => true, |
152 | 152 | ); |
153 | 153 | // loop thru and call doing_it_wrong() or remove any that aren't being used |
154 | - foreach ( $deprecated_filters as $deprecated_filter => $on ) { |
|
154 | + foreach ($deprecated_filters as $deprecated_filter => $on) { |
|
155 | 155 | // was this filter called ? |
156 | - if ( has_action( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter )) { |
|
156 | + if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) { |
|
157 | 157 | // only display doing_it_wrong() notice to Event Admins during non-AJAX requests |
158 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter' ) && ! defined( 'DOING_AJAX' ) ) { |
|
158 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter') && ! defined('DOING_AJAX')) { |
|
159 | 159 | EE_Error::doing_it_wrong( |
160 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
160 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
161 | 161 | sprintf( |
162 | - __( 'The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso' ), |
|
163 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
162 | + __('The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso'), |
|
163 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
164 | 164 | '<br />', |
165 | 165 | 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
166 | 166 | '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php' |
@@ -170,24 +170,24 @@ discard block |
||
170 | 170 | ); |
171 | 171 | } |
172 | 172 | } else { |
173 | - unset( $deprecated_filters[ $deprecated_filter ] ); |
|
173 | + unset($deprecated_filters[$deprecated_filter]); |
|
174 | 174 | } |
175 | 175 | } |
176 | - if ( ! empty( $deprecated_filters )) { |
|
177 | - |
|
178 | - if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset( $deprecated_filters[ 'update_registration_details' ] )) { |
|
179 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text ); |
|
180 | - } else if ( $checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset( $deprecated_filters[ 'process_payment' ] ) ) { |
|
181 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text ); |
|
182 | - } else if ( $checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset( $deprecated_filters[ 'finalize_registration' ] ) ) { |
|
183 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text ); |
|
176 | + if ( ! empty($deprecated_filters)) { |
|
177 | + |
|
178 | + if ($checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) { |
|
179 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text); |
|
180 | + } else if ($checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) { |
|
181 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text); |
|
182 | + } else if ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) { |
|
183 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text); |
|
184 | 184 | } |
185 | - if ( $checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
186 | - if ( $checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset( $deprecated_filters[ 'and_proceed_to_payment' ] ) ) { |
|
187 | - $submit_button_text .= apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text ); |
|
185 | + if ($checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
186 | + if ($checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) { |
|
187 | + $submit_button_text .= apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text); |
|
188 | 188 | } |
189 | - if ( $checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset( $deprecated_filters[ 'proceed_to' ] ) ) { |
|
190 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text ) . $checkout->next_step->name(); |
|
189 | + if ($checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) { |
|
190 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text).$checkout->next_step->name(); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | return $submit_button_text; |
196 | 196 | |
197 | 197 | } |
198 | -add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2 ); |
|
198 | +add_filter('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2); |
|
199 | 199 | |
200 | 200 | |
201 | 201 | |
@@ -206,16 +206,16 @@ discard block |
||
206 | 206 | * @param \EE_Checkout $checkout |
207 | 207 | * @param boolean $status_updates |
208 | 208 | */ |
209 | -function ee_deprecated_finalize_transaction( EE_Checkout $checkout, $status_updates ) { |
|
209 | +function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates) { |
|
210 | 210 | $action_ref = NULL; |
211 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__new_transaction' ) ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
212 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__all_transaction' ) ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
213 | - if ( $action_ref ) { |
|
211 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction') ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
212 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction') ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
213 | + if ($action_ref) { |
|
214 | 214 | |
215 | 215 | EE_Error::doing_it_wrong( |
216 | 216 | $action_ref, |
217 | 217 | sprintf( |
218 | - __( 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso' ), |
|
218 | + __('This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso'), |
|
219 | 219 | '<br />', |
220 | 220 | '/core/business/EE_Transaction_Processor.class.php', |
221 | 221 | 'AHEE__EE_Transaction_Processor__finalize', |
@@ -226,29 +226,29 @@ discard block |
||
226 | 226 | '4.6.0', |
227 | 227 | E_USER_DEPRECATED |
228 | 228 | ); |
229 | - switch ( $action_ref ) { |
|
229 | + switch ($action_ref) { |
|
230 | 230 | case 'AHEE__EE_Transaction__finalize__new_transaction' : |
231 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request ); |
|
231 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request); |
|
232 | 232 | break; |
233 | 233 | case 'AHEE__EE_Transaction__finalize__all_transaction' : |
234 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array( 'new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates ), $checkout->admin_request ); |
|
234 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates), $checkout->admin_request); |
|
235 | 235 | break; |
236 | 236 | } |
237 | 237 | } |
238 | 238 | } |
239 | -add_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2 ); |
|
239 | +add_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2); |
|
240 | 240 | /** |
241 | 241 | * ee_deprecated_finalize_registration |
242 | 242 | * |
243 | 243 | * @param EE_Registration $registration |
244 | 244 | */ |
245 | -function ee_deprecated_finalize_registration( EE_Registration $registration ) { |
|
246 | - $action_ref = has_action( 'AHEE__EE_Registration__finalize__update_and_new_reg' ) ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
247 | - if ( $action_ref ) { |
|
245 | +function ee_deprecated_finalize_registration(EE_Registration $registration) { |
|
246 | + $action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg') ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
247 | + if ($action_ref) { |
|
248 | 248 | EE_Error::doing_it_wrong( |
249 | 249 | $action_ref, |
250 | 250 | sprintf( |
251 | - __( 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso' ), |
|
251 | + __('This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso'), |
|
252 | 252 | '<br />', |
253 | 253 | '/core/business/EE_Registration_Processor.class.php', |
254 | 254 | 'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook' |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | '4.6.0', |
257 | 257 | E_USER_DEPRECATED |
258 | 258 | ); |
259 | - do_action( 'AHEE__EE_Registration__finalize__update_and_new_reg', $registration, ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ))); |
|
259 | + do_action('AHEE__EE_Registration__finalize__update_and_new_reg', $registration, (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX))); |
|
260 | 260 | } |
261 | 261 | } |
262 | -add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1 ); |
|
262 | +add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1); |
|
263 | 263 | |
264 | 264 | |
265 | 265 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return array |
282 | 282 | */ |
283 | -function ee_deprecated_get_templates( $templates, EE_messenger $messenger, EE_message_type $message_type, EE_Messages_Template_Pack $template_pack ) { |
|
283 | +function ee_deprecated_get_templates($templates, EE_messenger $messenger, EE_message_type $message_type, EE_Messages_Template_Pack $template_pack) { |
|
284 | 284 | $old_default_classnames = array( |
285 | 285 | 'EE_Messages_Email_Cancelled_Registration_Defaults', |
286 | 286 | 'EE_Messages_Email_Declined_Registration_Defaults', |
@@ -296,17 +296,17 @@ discard block |
||
296 | 296 | |
297 | 297 | $old_class_instance = new stdClass(); |
298 | 298 | |
299 | - foreach ( $old_default_classnames as $classname ) { |
|
300 | - $filter_ref = 'FHEE__' . $classname . '___create_new_templates___templates'; |
|
301 | - if ( has_filter( $filter_ref ) ) { |
|
302 | - EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Template_Pack___get_templates__templates" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
299 | + foreach ($old_default_classnames as $classname) { |
|
300 | + $filter_ref = 'FHEE__'.$classname.'___create_new_templates___templates'; |
|
301 | + if (has_filter($filter_ref)) { |
|
302 | + EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Template_Pack___get_templates__templates" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
303 | 303 | } |
304 | - $templates = apply_filters( $filter_ref, $templates, $old_class_instance ); |
|
304 | + $templates = apply_filters($filter_ref, $templates, $old_class_instance); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | return $templates; |
308 | 308 | } |
309 | -add_filter( 'FHEE__EE_Template_Pack___get_templates__templates', 'ee_deprecated_get_templates', 10, 4 ); |
|
309 | +add_filter('FHEE__EE_Template_Pack___get_templates__templates', 'ee_deprecated_get_templates', 10, 4); |
|
310 | 310 | |
311 | 311 | |
312 | 312 | /** |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | ); |
336 | 336 | |
337 | 337 | } |
338 | -add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks_for_shortcodes_modules_and_addons' ); |
|
338 | +add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks_for_shortcodes_modules_and_addons'); |
|
339 | 339 | |
340 | 340 | |
341 | 341 | |
@@ -358,25 +358,25 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @return string The default contents for the messenger, message type, context and field. |
360 | 360 | */ |
361 | -function ee_deprecated_get_default_field_content( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack ) { |
|
361 | +function ee_deprecated_get_default_field_content($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) { |
|
362 | 362 | |
363 | 363 | $classnames_to_try = array( |
364 | - get_class( $messenger ) => $messenger, |
|
365 | - get_class( $message_type ) => $message_type, |
|
364 | + get_class($messenger) => $messenger, |
|
365 | + get_class($message_type) => $message_type, |
|
366 | 366 | 'EE_Messages_Base' => $message_type |
367 | 367 | ); |
368 | 368 | |
369 | - foreach ( $classnames_to_try as $classname => $obj ) { |
|
370 | - $filter_ref = 'FHEE__' . $classname . '__get_default_field_content'; |
|
371 | - if ( has_filter( $filter_ref ) ) { |
|
372 | - EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_specific_template__contents" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
369 | + foreach ($classnames_to_try as $classname => $obj) { |
|
370 | + $filter_ref = 'FHEE__'.$classname.'__get_default_field_content'; |
|
371 | + if (has_filter($filter_ref)) { |
|
372 | + EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_specific_template__contents" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
373 | 373 | } |
374 | - $contents = apply_filters( $filter_ref, $contents, $obj ); |
|
374 | + $contents = apply_filters($filter_ref, $contents, $obj); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | return $contents; |
378 | 378 | } |
379 | -add_filter( 'FHEE__EE_Messages_Template_Pack__get_specific_template__contents', 'ee_deprecated_get_default_field_content', 10, 7 ); |
|
379 | +add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', 'ee_deprecated_get_default_field_content', 10, 7); |
|
380 | 380 | |
381 | 381 | |
382 | 382 | |
@@ -404,23 +404,23 @@ discard block |
||
404 | 404 | * |
405 | 405 | * @return string The path to the file being used. |
406 | 406 | */ |
407 | -function ee_deprecated_get_inline_css_template_filters( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack ) { |
|
407 | +function ee_deprecated_get_inline_css_template_filters($variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack) { |
|
408 | 408 | |
409 | - if ( $messenger == 'email' ) { |
|
409 | + if ($messenger == 'email') { |
|
410 | 410 | $filter_ref = $url ? 'FHEE__EE_Email_messenger__get_inline_css_template__css_url' : 'FHEE__EE_Email_messenger__get_inline_css_template__css_path'; |
411 | - } elseif ( $messenger == 'html' ) { |
|
411 | + } elseif ($messenger == 'html') { |
|
412 | 412 | $filter_ref = $url ? 'FHEE__EE_Html_messenger__get_inline_css_template__css_url' : 'FHEE__EE_Html_messenger__get_inline_css_template__css_path'; |
413 | 413 | } else { |
414 | 414 | return $variation_path; |
415 | 415 | } |
416 | 416 | |
417 | - if ( has_filter( $filter_ref ) ) { |
|
418 | - EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated. It is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_variation" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
417 | + if (has_filter($filter_ref)) { |
|
418 | + EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated. It is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_variation" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
419 | 419 | } |
420 | 420 | |
421 | - return apply_filters( $filter_ref, $variation_path, $url, $type ); |
|
421 | + return apply_filters($filter_ref, $variation_path, $url, $type); |
|
422 | 422 | } |
423 | -add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', 'ee_deprecated_get_inline_css_template_filters', 10, 8 ); |
|
423 | +add_filter('FHEE__EE_Messages_Template_Pack__get_variation', 'ee_deprecated_get_inline_css_template_filters', 10, 8); |
|
424 | 424 | |
425 | 425 | |
426 | 426 | |
@@ -436,78 +436,78 @@ discard block |
||
436 | 436 | class EE_Messages_Init extends EE_Base { |
437 | 437 | |
438 | 438 | public function __construct() { |
439 | - self::doing_it_wrong_call( __METHOD__ ); |
|
439 | + self::doing_it_wrong_call(__METHOD__); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
443 | 443 | * @param $method_name |
444 | 444 | */ |
445 | - public static function doing_it_wrong_call( $method_name ) { |
|
446 | - EE_Error::doing_it_wrong( __CLASS__, sprintf( __('The %s in this class is deprecated as of EE4.5.0. All functionality formerly in this class is now in the EED_Messages module.', 'event_espresso'), $method_name ), '4.5.0', E_USER_DEPRECATED ); |
|
445 | + public static function doing_it_wrong_call($method_name) { |
|
446 | + EE_Error::doing_it_wrong(__CLASS__, sprintf(__('The %s in this class is deprecated as of EE4.5.0. All functionality formerly in this class is now in the EED_Messages module.', 'event_espresso'), $method_name), '4.5.0', E_USER_DEPRECATED); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
450 | 450 | * @deprecated 4.5.0 |
451 | 451 | */ |
452 | 452 | public static function set_autoloaders() { |
453 | - self::doing_it_wrong_call( __METHOD__ ); |
|
453 | + self::doing_it_wrong_call(__METHOD__); |
|
454 | 454 | EED_Messages::set_autoloaders(); |
455 | 455 | } |
456 | 456 | |
457 | 457 | /** |
458 | 458 | * @deprecated 4.5.0 |
459 | 459 | */ |
460 | - public function payment_reminder( $transaction ) { |
|
461 | - self::doing_it_wrong_call( __METHOD__ ); |
|
462 | - EED_Messages::payment_reminder( $transaction ); |
|
460 | + public function payment_reminder($transaction) { |
|
461 | + self::doing_it_wrong_call(__METHOD__); |
|
462 | + EED_Messages::payment_reminder($transaction); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | /** |
466 | 466 | * @deprecated 4.5.0 |
467 | 467 | */ |
468 | - public function payment( $transaction, $payment ) { |
|
469 | - self::doing_it_wrong_call( __METHOD__ ); |
|
470 | - EED_Messages::payment( $transaction, $payment ); |
|
468 | + public function payment($transaction, $payment) { |
|
469 | + self::doing_it_wrong_call(__METHOD__); |
|
470 | + EED_Messages::payment($transaction, $payment); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | /** |
474 | 474 | * @deprecated 4.5.0 |
475 | 475 | */ |
476 | - public function cancelled_registration( $transaction ) { |
|
477 | - self::doing_it_wrong_call( __METHOD__ ); |
|
478 | - EED_Messages::cancelled_registration( $transaction ); |
|
476 | + public function cancelled_registration($transaction) { |
|
477 | + self::doing_it_wrong_call(__METHOD__); |
|
478 | + EED_Messages::cancelled_registration($transaction); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | /** |
482 | 482 | * @deprecated 4.5.0 |
483 | 483 | */ |
484 | - public function maybe_registration( $transaction, $reg_msg, $from_admin ) { |
|
485 | - self::doing_it_wrong_call( __METHOD__ ); |
|
486 | - EED_Messages::maybe_registration( $transaction, $reg_msg, $from_admin ); |
|
484 | + public function maybe_registration($transaction, $reg_msg, $from_admin) { |
|
485 | + self::doing_it_wrong_call(__METHOD__); |
|
486 | + EED_Messages::maybe_registration($transaction, $reg_msg, $from_admin); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
490 | 490 | * @deprecated 4.5.0 |
491 | 491 | */ |
492 | - public function process_resend( $success, $req_data ) { |
|
493 | - self::doing_it_wrong_call( __METHOD__ ); |
|
494 | - EED_Messages::process_resend( $req_data ); |
|
492 | + public function process_resend($success, $req_data) { |
|
493 | + self::doing_it_wrong_call(__METHOD__); |
|
494 | + EED_Messages::process_resend($req_data); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | /** |
498 | 498 | * @deprecated 4.5.0 |
499 | 499 | */ |
500 | - public function process_admin_payment( $success, $payment ) { |
|
501 | - self::doing_it_wrong_call( __METHOD__ ); |
|
502 | - EED_Messages::process_admin_payment( $payment ); |
|
500 | + public function process_admin_payment($success, $payment) { |
|
501 | + self::doing_it_wrong_call(__METHOD__); |
|
502 | + EED_Messages::process_admin_payment($payment); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
506 | 506 | * @deprecated 4.5.0 |
507 | 507 | */ |
508 | - public function send_newsletter_message( $contacts, $grp_id ) { |
|
509 | - self::doing_it_wrong_call( __METHOD__ ); |
|
510 | - EED_Messages::send_newsletter_message( $contacts, $grp_id ); |
|
508 | + public function send_newsletter_message($contacts, $grp_id) { |
|
509 | + self::doing_it_wrong_call(__METHOD__); |
|
510 | + EED_Messages::send_newsletter_message($contacts, $grp_id); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | |
@@ -528,13 +528,13 @@ discard block |
||
528 | 528 | * |
529 | 529 | * @return array additional cpts. |
530 | 530 | */ |
531 | -function ee_deprecated_get_cpts( $cpts ) { |
|
532 | - if ( has_filter( 'FHEE__EE_Register_CPTs__construct__CPTs' ) ) { |
|
533 | - EE_Error::doing_it_wrong( 'FHEE__EE_Register_CPTs__construct__CPTs', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_CPTs__cpts" found in EE_Register_CPTs::get_CPTs()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
531 | +function ee_deprecated_get_cpts($cpts) { |
|
532 | + if (has_filter('FHEE__EE_Register_CPTs__construct__CPTs')) { |
|
533 | + EE_Error::doing_it_wrong('FHEE__EE_Register_CPTs__construct__CPTs', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_CPTs__cpts" found in EE_Register_CPTs::get_CPTs()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
534 | 534 | } |
535 | - return apply_filters( 'FHEE__EE_Register_CPTs__construct__CPTs', $cpts ); |
|
535 | + return apply_filters('FHEE__EE_Register_CPTs__construct__CPTs', $cpts); |
|
536 | 536 | } |
537 | -add_filter( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', 'ee_deprecated_get_cpts', 10 ); |
|
537 | +add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', 'ee_deprecated_get_cpts', 10); |
|
538 | 538 | |
539 | 539 | |
540 | 540 | |
@@ -548,13 +548,13 @@ discard block |
||
548 | 548 | * |
549 | 549 | * @return array additional custom taxonomies. |
550 | 550 | */ |
551 | -function ee_deprecated_get_taxonomies( $cts ) { |
|
552 | - if ( has_filter( 'FHEE__EE_Register_CPTs__construct__taxonomies' ) ) { |
|
553 | - EE_Error::doing_it_wrong( 'FHEE__EE_Register_CPTs__construct__taxonomies', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_taxonomies__taxonomies" found in EE_Register_CPTs::get_taxonomies()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED ); |
|
551 | +function ee_deprecated_get_taxonomies($cts) { |
|
552 | + if (has_filter('FHEE__EE_Register_CPTs__construct__taxonomies')) { |
|
553 | + EE_Error::doing_it_wrong('FHEE__EE_Register_CPTs__construct__taxonomies', __('This filter is deprecated. It will still work for the time being. However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_taxonomies__taxonomies" found in EE_Register_CPTs::get_taxonomies()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED); |
|
554 | 554 | } |
555 | - return apply_filters( 'FHEE__EE_Register_CPTs__construct__taxonomies', $cts ); |
|
555 | + return apply_filters('FHEE__EE_Register_CPTs__construct__taxonomies', $cts); |
|
556 | 556 | } |
557 | -add_filter( 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', 'ee_deprecated_get_taxonomies', 10 ); |
|
557 | +add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', 'ee_deprecated_get_taxonomies', 10); |
|
558 | 558 | |
559 | 559 | |
560 | 560 | |
@@ -566,9 +566,9 @@ discard block |
||
566 | 566 | * @return boolean |
567 | 567 | */ |
568 | 568 | function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() { |
569 | - $in_use = has_filter( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns' ) |
|
570 | - || has_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' ); |
|
571 | - if( $in_use ) { |
|
569 | + $in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns') |
|
570 | + || has_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save'); |
|
571 | + if ($in_use) { |
|
572 | 572 | $msg = __( |
573 | 573 | 'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.' |
574 | 574 | . 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,' |
@@ -577,18 +577,18 @@ discard block |
||
577 | 577 | 'event_espresso' ) |
578 | 578 | ; |
579 | 579 | EE_Error::doing_it_wrong( |
580 | - __CLASS__ . '::' . __FUNCTION__, |
|
580 | + __CLASS__.'::'.__FUNCTION__, |
|
581 | 581 | $msg, |
582 | 582 | '4.8.32.rc.000' |
583 | 583 | ); |
584 | 584 | //it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed |
585 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
586 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
585 | + if (is_admin() && ! defined('DOING_AJAX')) { |
|
586 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
587 | 587 | } |
588 | 588 | } |
589 | 589 | return $in_use; |
590 | 590 | } |
591 | -add_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' ); |
|
591 | +add_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks'); |
|
592 | 592 | |
593 | 593 | /** |
594 | 594 | * @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165 |
@@ -597,34 +597,34 @@ discard block |
||
597 | 597 | * @param EE_Admin_Page $admin_page |
598 | 598 | * @return void |
599 | 599 | */ |
600 | -function ee_deprecated_update_attendee_registration_form_old( $admin_page ) { |
|
600 | +function ee_deprecated_update_attendee_registration_form_old($admin_page) { |
|
601 | 601 | //check if the old hooks are in use. If not, do the default |
602 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
603 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
602 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
603 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
604 | 604 | return; |
605 | 605 | } |
606 | 606 | $req_data = $admin_page->get_request_data(); |
607 | - $qstns = isset( $req_data['qstn'] ) ? $req_data['qstn'] : FALSE; |
|
608 | - $REG_ID = isset( $req_data['_REG_ID'] ) ? absint( $req_data['_REG_ID'] ) : FALSE; |
|
609 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
610 | - if ( ! $REG_ID || ! $qstns ) { |
|
611 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
607 | + $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : FALSE; |
|
608 | + $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : FALSE; |
|
609 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
610 | + if ( ! $REG_ID || ! $qstns) { |
|
611 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
612 | 612 | } |
613 | 613 | $success = TRUE; |
614 | 614 | |
615 | 615 | // allow others to get in on this awesome fun :D |
616 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
616 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
617 | 617 | // loop thru questions... FINALLY!!! |
618 | 618 | |
619 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
619 | + foreach ($qstns as $QST_ID => $qstn) { |
|
620 | 620 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
621 | - if ( !is_array($qstn) ) { |
|
622 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
621 | + if ( ! is_array($qstn)) { |
|
622 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
623 | 623 | continue; |
624 | 624 | } |
625 | 625 | |
626 | 626 | |
627 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
627 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
628 | 628 | //get answer |
629 | 629 | $query_params = array( |
630 | 630 | 0 => array( |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | ); |
636 | 636 | $answer = EEM_Answer::instance()->get_one($query_params); |
637 | 637 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
638 | - if ( ! $answer instanceof EE_Answer ) { |
|
638 | + if ( ! $answer instanceof EE_Answer) { |
|
639 | 639 | $set_values = array( |
640 | 640 | 'QST_ID' => $QST_ID, |
641 | 641 | 'REG_ID' => $REG_ID, |
@@ -650,11 +650,11 @@ discard block |
||
650 | 650 | } |
651 | 651 | } |
652 | 652 | $what = __('Registration Form', 'event_espresso'); |
653 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
654 | - $admin_page->redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
653 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
654 | + $admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
655 | 655 | exit; |
656 | 656 | } |
657 | -add_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1 ); |
|
657 | +add_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1); |
|
658 | 658 | /** |
659 | 659 | * Render the registration admin page's custom questions area in the old fashion |
660 | 660 | * and firing the old hooks. When this method is removed, we can probably also |
@@ -667,31 +667,31 @@ discard block |
||
667 | 667 | * @return bool |
668 | 668 | * @throws \EE_Error |
669 | 669 | */ |
670 | -function ee_deprecated_reg_questions_meta_box_old( $do_default_action, $admin_page, $registration ) { |
|
670 | +function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration) { |
|
671 | 671 | //check if the old hooks are in use. If not, do the default |
672 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
673 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
672 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
673 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
674 | 674 | return $do_default_action; |
675 | 675 | } |
676 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $admin_page, 'form_before_question_group' ), 10, 1 ); |
|
677 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $admin_page, 'form_after_question_group' ), 10, 1 ); |
|
678 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $admin_page, 'form_form_field_label_wrap' ), 10, 1 ); |
|
679 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $admin_page, 'form_form_field_input__wrap' ), 10, 1 ); |
|
676 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($admin_page, 'form_before_question_group'), 10, 1); |
|
677 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($admin_page, 'form_after_question_group'), 10, 1); |
|
678 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1); |
|
679 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1); |
|
680 | 680 | |
681 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $registration, $registration->get('EVT_ID') ); |
|
681 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($registration, $registration->get('EVT_ID')); |
|
682 | 682 | |
683 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
683 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
684 | 684 | $template_args = array( |
685 | - 'att_questions' => EEH_Form_Fields::generate_question_groups_html( $question_groups ), |
|
685 | + 'att_questions' => EEH_Form_Fields::generate_question_groups_html($question_groups), |
|
686 | 686 | 'reg_questions_form_action' => 'edit_registration', |
687 | 687 | 'REG_ID' => $registration->ID() |
688 | 688 | ); |
689 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
690 | - echo EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
689 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
690 | + echo EEH_Template::display_template($template_path, $template_args, TRUE); |
|
691 | 691 | //indicate that we should not do the default admin page code |
692 | 692 | return false; |
693 | 693 | } |
694 | -add_action( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3 ); |
|
694 | +add_action('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3); |
|
695 | 695 | |
696 | 696 | |
697 | 697 | |
@@ -732,9 +732,9 @@ discard block |
||
732 | 732 | '4.9.0' |
733 | 733 | ); |
734 | 734 | /** @var EE_Message_Resource_Manager $message_resource_manager */ |
735 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
736 | - $messenger = $message_resource_manager->get_messenger( $messenger_name ); |
|
737 | - $message_type = $message_resource_manager->get_message_type( $message_type_name ); |
|
735 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
736 | + $messenger = $message_resource_manager->get_messenger($messenger_name); |
|
737 | + $message_type = $message_resource_manager->get_message_type($message_type_name); |
|
738 | 738 | return EE_Registry::instance()->load_lib( |
739 | 739 | 'Messages_Template_Defaults', |
740 | 740 | array( |
@@ -799,15 +799,15 @@ discard block |
||
799 | 799 | /** |
800 | 800 | * @param string $method |
801 | 801 | */ |
802 | - public function _class_is_deprecated( $method ) { |
|
802 | + public function _class_is_deprecated($method) { |
|
803 | 803 | // EE_messages has been deprecated |
804 | 804 | EE_Error::doing_it_wrong( |
805 | - 'EE_messages::' . $method, |
|
806 | - __( 'EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.' ), |
|
805 | + 'EE_messages::'.$method, |
|
806 | + __('EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.'), |
|
807 | 807 | '4.9.0' |
808 | 808 | ); |
809 | 809 | // Please use EE_Message_Resource_Manager instead |
810 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
810 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | |
@@ -817,10 +817,10 @@ discard block |
||
817 | 817 | * @param string $messenger_name |
818 | 818 | * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive |
819 | 819 | */ |
820 | - public function ensure_messenger_is_active( $messenger_name ) { |
|
820 | + public function ensure_messenger_is_active($messenger_name) { |
|
821 | 821 | // EE_messages has been deprecated |
822 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
823 | - return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name ); |
|
822 | + $this->_class_is_deprecated(__FUNCTION__); |
|
823 | + return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -832,10 +832,10 @@ discard block |
||
832 | 832 | * @return bool true if it got activated (or was active) and false if not. |
833 | 833 | * @throws \EE_Error |
834 | 834 | */ |
835 | - public function ensure_message_type_is_active( $message_type, $messenger ) { |
|
835 | + public function ensure_message_type_is_active($message_type, $messenger) { |
|
836 | 836 | // EE_messages has been deprecated |
837 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
838 | - return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger ); |
|
837 | + $this->_class_is_deprecated(__FUNCTION__); |
|
838 | + return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | |
@@ -848,10 +848,10 @@ discard block |
||
848 | 848 | * they are already setup.) |
849 | 849 | * @return boolean an array of generated templates or false if nothing generated/activated. |
850 | 850 | */ |
851 | - public function activate_messenger( $messenger_name, $mts_to_activate = array() ) { |
|
851 | + public function activate_messenger($messenger_name, $mts_to_activate = array()) { |
|
852 | 852 | // EE_messages has been deprecated |
853 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
854 | - return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate ); |
|
853 | + $this->_class_is_deprecated(__FUNCTION__); |
|
854 | + return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate); |
|
855 | 855 | } |
856 | 856 | |
857 | 857 | |
@@ -863,10 +863,10 @@ discard block |
||
863 | 863 | * |
864 | 864 | * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
865 | 865 | */ |
866 | - public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) { |
|
866 | + public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) { |
|
867 | 867 | // EE_messages has been deprecated |
868 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
869 | - return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type ); |
|
868 | + $this->_class_is_deprecated(__FUNCTION__); |
|
869 | + return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type); |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | |
@@ -876,10 +876,10 @@ discard block |
||
876 | 876 | * @param string $messenger |
877 | 877 | * @return EE_messenger | null |
878 | 878 | */ |
879 | - public function get_messenger_if_active( $messenger ) { |
|
879 | + public function get_messenger_if_active($messenger) { |
|
880 | 880 | // EE_messages has been deprecated |
881 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
882 | - return $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
881 | + $this->_class_is_deprecated(__FUNCTION__); |
|
882 | + return $this->_message_resource_manager->get_active_messenger($messenger); |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | |
@@ -900,9 +900,9 @@ discard block |
||
900 | 900 | * 'message_type' => null |
901 | 901 | * ) |
902 | 902 | */ |
903 | - public function validate_for_use( EE_Message $message ) { |
|
903 | + public function validate_for_use(EE_Message $message) { |
|
904 | 904 | // EE_messages has been deprecated |
905 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
905 | + $this->_class_is_deprecated(__FUNCTION__); |
|
906 | 906 | return array( |
907 | 907 | 'messenger' => $message->messenger_object(), |
908 | 908 | 'message_type' => $message->message_type_object(), |
@@ -930,41 +930,41 @@ discard block |
||
930 | 930 | $send = true |
931 | 931 | ) { |
932 | 932 | // EE_messages has been deprecated |
933 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
933 | + $this->_class_is_deprecated(__FUNCTION__); |
|
934 | 934 | /** @type EE_Messages_Processor $processor */ |
935 | - $processor = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
935 | + $processor = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
936 | 936 | $error = false; |
937 | 937 | //try to intelligently determine what method we'll call based on the incoming data. |
938 | 938 | //if generating and sending are different then generate and send immediately. |
939 | - if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) { |
|
939 | + if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
940 | 940 | //in the legacy system, when generating and sending were different, that means all the |
941 | 941 | //vars are already in the request object. So let's just use that. |
942 | 942 | try { |
943 | 943 | /** @type EE_Message_To_Generate_From_Request $mtg */ |
944 | - $mtg = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' ); |
|
945 | - $processor->generate_and_send_now( $mtg ); |
|
946 | - } catch ( EE_Error $e ) { |
|
944 | + $mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
945 | + $processor->generate_and_send_now($mtg); |
|
946 | + } catch (EE_Error $e) { |
|
947 | 947 | $error_msg = __( |
948 | 948 | 'Please note that a system message failed to send due to a technical issue.', |
949 | 949 | 'event_espresso' |
950 | 950 | ); |
951 | 951 | // add specific message for developers if WP_DEBUG in on |
952 | - $error_msg .= '||' . $e->getMessage(); |
|
953 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
952 | + $error_msg .= '||'.$e->getMessage(); |
|
953 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
954 | 954 | $error = true; |
955 | 955 | } |
956 | 956 | } else { |
957 | - $processor->generate_for_all_active_messengers( $type, $vars, $send ); |
|
957 | + $processor->generate_for_all_active_messengers($type, $vars, $send); |
|
958 | 958 | //let's find out if there were any errors and how many successfully were queued. |
959 | 959 | $count_errors = $processor->get_queue()->count_STS_in_queue( |
960 | - array( EEM_Message::status_failed, EEM_Message::status_debug_only ) |
|
960 | + array(EEM_Message::status_failed, EEM_Message::status_debug_only) |
|
961 | 961 | ); |
962 | - $count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete ); |
|
963 | - $count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry ); |
|
962 | + $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
963 | + $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry); |
|
964 | 964 | $count_errors = $count_errors + $count_retry; |
965 | - if ( $count_errors > 0 ) { |
|
965 | + if ($count_errors > 0) { |
|
966 | 966 | $error = true; |
967 | - if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) { |
|
967 | + if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) { |
|
968 | 968 | $message = sprintf( |
969 | 969 | __( |
970 | 970 | 'There were %d errors and %d messages successfully queued for generation and sending', |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | $count_errors, |
974 | 974 | $count_queued |
975 | 975 | ); |
976 | - } elseif ( $count_errors > 1 && $count_queued === 1 ) { |
|
976 | + } elseif ($count_errors > 1 && $count_queued === 1) { |
|
977 | 977 | $message = sprintf( |
978 | 978 | __( |
979 | 979 | 'There were %d errors and %d message successfully queued for generation.', |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | $count_errors, |
983 | 983 | $count_queued |
984 | 984 | ); |
985 | - } elseif ( $count_errors === 1 && $count_queued > 1 ) { |
|
985 | + } elseif ($count_errors === 1 && $count_queued > 1) { |
|
986 | 986 | $message = sprintf( |
987 | 987 | __( |
988 | 988 | 'There was %d error and %d messages successfully queued for generation.', |
@@ -1000,9 +1000,9 @@ discard block |
||
1000 | 1000 | $count_errors |
1001 | 1001 | ); |
1002 | 1002 | } |
1003 | - EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ ); |
|
1003 | + EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__); |
|
1004 | 1004 | } else { |
1005 | - if ( $count_queued === 1 ) { |
|
1005 | + if ($count_queued === 1) { |
|
1006 | 1006 | $message = sprintf( |
1007 | 1007 | __( |
1008 | 1008 | '%d message successfully queued for generation.', |
@@ -1019,18 +1019,18 @@ discard block |
||
1019 | 1019 | $count_queued |
1020 | 1020 | ); |
1021 | 1021 | } |
1022 | - EE_Error::add_success( $message ); |
|
1022 | + EE_Error::add_success($message); |
|
1023 | 1023 | } |
1024 | 1024 | } |
1025 | 1025 | //if no error then return the generated message(s). |
1026 | - if ( ! $error && ! $send ) { |
|
1027 | - $generated_queue = $processor->generate_queue( false ); |
|
1026 | + if ( ! $error && ! $send) { |
|
1027 | + $generated_queue = $processor->generate_queue(false); |
|
1028 | 1028 | //get message and return. |
1029 | 1029 | $generated_queue->get_message_repository()->rewind(); |
1030 | 1030 | $messages = array(); |
1031 | - while ( $generated_queue->get_message_repository()->valid() ) { |
|
1031 | + while ($generated_queue->get_message_repository()->valid()) { |
|
1032 | 1032 | $message = $generated_queue->get_message_repository()->current(); |
1033 | - if ( $message instanceof EE_Message ) { |
|
1033 | + if ($message instanceof EE_Message) { |
|
1034 | 1034 | //set properties that might be expected by add-ons (backward compat) |
1035 | 1035 | $message->content = $message->content(); |
1036 | 1036 | $message->template_pack = $message->get_template_pack(); |
@@ -1055,10 +1055,10 @@ discard block |
||
1055 | 1055 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
1056 | 1056 | * @return string The body of the message. |
1057 | 1057 | */ |
1058 | - public function preview_message( $type, $context, $messenger, $send = false ) { |
|
1058 | + public function preview_message($type, $context, $messenger, $send = false) { |
|
1059 | 1059 | // EE_messages has been deprecated |
1060 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1061 | - return EED_Messages::preview_message( $type, $context, $messenger, $send ); |
|
1060 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1061 | + return EED_Messages::preview_message($type, $context, $messenger, $send); |
|
1062 | 1062 | } |
1063 | 1063 | |
1064 | 1064 | |
@@ -1072,14 +1072,14 @@ discard block |
||
1072 | 1072 | * |
1073 | 1073 | * @return bool success or fail. |
1074 | 1074 | */ |
1075 | - public function send_message_with_messenger_only( $messenger, $message_type, $message ) { |
|
1075 | + public function send_message_with_messenger_only($messenger, $message_type, $message) { |
|
1076 | 1076 | // EE_messages has been deprecated |
1077 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1077 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1078 | 1078 | //setup for sending to new method. |
1079 | 1079 | /** @type EE_Messages_Queue $queue */ |
1080 | - $queue = EE_Registry::instance()->load_lib( 'Messages_Queue' ); |
|
1080 | + $queue = EE_Registry::instance()->load_lib('Messages_Queue'); |
|
1081 | 1081 | //make sure we have a proper message object |
1082 | - if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) { |
|
1082 | + if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
1083 | 1083 | $msg = EE_Message_Factory::create( |
1084 | 1084 | array( |
1085 | 1085 | 'MSG_messenger' => $messenger, |
@@ -1091,15 +1091,15 @@ discard block |
||
1091 | 1091 | } else { |
1092 | 1092 | $msg = $message; |
1093 | 1093 | } |
1094 | - if ( ! $msg instanceof EE_Message ) { |
|
1094 | + if ( ! $msg instanceof EE_Message) { |
|
1095 | 1095 | return false; |
1096 | 1096 | } |
1097 | 1097 | //make sure any content in a content property (if not empty) is set on the MSG_content. |
1098 | - if ( ! empty( $msg->content ) ) { |
|
1099 | - $msg->set( 'MSG_content', $msg->content ); |
|
1098 | + if ( ! empty($msg->content)) { |
|
1099 | + $msg->set('MSG_content', $msg->content); |
|
1100 | 1100 | } |
1101 | - $queue->add( $msg ); |
|
1102 | - return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue ); |
|
1101 | + $queue->add($msg); |
|
1102 | + return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue); |
|
1103 | 1103 | } |
1104 | 1104 | |
1105 | 1105 | |
@@ -1113,11 +1113,11 @@ discard block |
||
1113 | 1113 | * @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned. |
1114 | 1114 | * @throws \EE_Error |
1115 | 1115 | */ |
1116 | - public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) { |
|
1116 | + public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) { |
|
1117 | 1117 | // EE_messages has been deprecated |
1118 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1119 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1120 | - return EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $is_global ); |
|
1118 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1119 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1120 | + return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global); |
|
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | |
@@ -1128,11 +1128,11 @@ discard block |
||
1128 | 1128 | * @param string $message_type_name name of EE_message_type |
1129 | 1129 | * @return array |
1130 | 1130 | */ |
1131 | - public function get_fields( $messenger_name, $message_type_name ) { |
|
1131 | + public function get_fields($messenger_name, $message_type_name) { |
|
1132 | 1132 | // EE_messages has been deprecated |
1133 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1134 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1135 | - return EEH_MSG_Template::get_fields( $messenger_name, $message_type_name ); |
|
1133 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1134 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1135 | + return EEH_MSG_Template::get_fields($messenger_name, $message_type_name); |
|
1136 | 1136 | } |
1137 | 1137 | |
1138 | 1138 | |
@@ -1146,13 +1146,13 @@ discard block |
||
1146 | 1146 | * @return array multidimensional array of messenger and message_type objects |
1147 | 1147 | * (messengers index, and message_type index); |
1148 | 1148 | */ |
1149 | - public function get_installed( $type = 'all', $skip_cache = false ) { |
|
1149 | + public function get_installed($type = 'all', $skip_cache = false) { |
|
1150 | 1150 | // EE_messages has been deprecated |
1151 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1152 | - if ( $skip_cache ) { |
|
1151 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1152 | + if ($skip_cache) { |
|
1153 | 1153 | $this->_message_resource_manager->reset_active_messengers_and_message_types(); |
1154 | 1154 | } |
1155 | - switch ( $type ) { |
|
1155 | + switch ($type) { |
|
1156 | 1156 | case 'messengers' : |
1157 | 1157 | return array( |
1158 | 1158 | 'messenger' => $this->_message_resource_manager->installed_messengers(), |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | */ |
1182 | 1182 | public function get_active_messengers() { |
1183 | 1183 | // EE_messages has been deprecated |
1184 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1184 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1185 | 1185 | return $this->_message_resource_manager->active_messengers(); |
1186 | 1186 | } |
1187 | 1187 | |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | */ |
1194 | 1194 | public function get_active_message_types() { |
1195 | 1195 | // EE_messages has been deprecated |
1196 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1196 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1197 | 1197 | return $this->_message_resource_manager->list_of_active_message_types(); |
1198 | 1198 | } |
1199 | 1199 | |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | */ |
1206 | 1206 | public function get_active_message_type_objects() { |
1207 | 1207 | // EE_messages has been deprecated |
1208 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1208 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1209 | 1209 | return $this->_message_resource_manager->get_active_message_type_objects(); |
1210 | 1210 | } |
1211 | 1211 | |
@@ -1217,10 +1217,10 @@ discard block |
||
1217 | 1217 | * @param string $messenger The messenger being checked |
1218 | 1218 | * @return EE_message_type[] (or empty array if none present) |
1219 | 1219 | */ |
1220 | - public function get_active_message_types_per_messenger( $messenger ) { |
|
1220 | + public function get_active_message_types_per_messenger($messenger) { |
|
1221 | 1221 | // EE_messages has been deprecated |
1222 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1223 | - return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger ); |
|
1222 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1223 | + return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger); |
|
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | |
@@ -1231,10 +1231,10 @@ discard block |
||
1231 | 1231 | * @param string $message_type The string should correspond to a message type. |
1232 | 1232 | * @return EE_message_type|null |
1233 | 1233 | */ |
1234 | - public function get_active_message_type( $messenger, $message_type ) { |
|
1234 | + public function get_active_message_type($messenger, $message_type) { |
|
1235 | 1235 | // EE_messages has been deprecated |
1236 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1237 | - return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type ); |
|
1236 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1237 | + return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type); |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 | |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | */ |
1246 | 1246 | public function get_installed_message_types() { |
1247 | 1247 | // EE_messages has been deprecated |
1248 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1248 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1249 | 1249 | return $this->_message_resource_manager->installed_message_types(); |
1250 | 1250 | } |
1251 | 1251 | |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | */ |
1258 | 1258 | public function get_installed_messengers() { |
1259 | 1259 | // EE_messages has been deprecated |
1260 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1260 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1261 | 1261 | return $this->_message_resource_manager->installed_messengers(); |
1262 | 1262 | } |
1263 | 1263 | |
@@ -1268,10 +1268,10 @@ discard block |
||
1268 | 1268 | * @param bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type. |
1269 | 1269 | * @return array |
1270 | 1270 | */ |
1271 | - public function get_all_contexts( $slugs_only = true ) { |
|
1271 | + public function get_all_contexts($slugs_only = true) { |
|
1272 | 1272 | // EE_messages has been deprecated |
1273 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
1274 | - return $this->_message_resource_manager->get_all_contexts( $slugs_only ); |
|
1273 | + $this->_class_is_deprecated(__FUNCTION__); |
|
1274 | + return $this->_message_resource_manager->get_all_contexts($slugs_only); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * EE_Front_Controller |
4 | 4 | * |
@@ -75,37 +75,37 @@ discard block |
||
75 | 75 | $this->Request_Handler = $Request_Handler; |
76 | 76 | $this->Module_Request_Router = $Module_Request_Router; |
77 | 77 | // make sure template tags are loaded immediately so that themes don't break |
78 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 ); |
|
78 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10); |
|
79 | 79 | // determine how to integrate WP_Query with the EE models |
80 | - add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' )); |
|
80 | + add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy')); |
|
81 | 81 | // load other resources and begin to actually run shortcodes and modules |
82 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 ); |
|
82 | + add_action('wp_loaded', array($this, 'wp_loaded'), 5); |
|
83 | 83 | // analyse the incoming WP request |
84 | - add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 ); |
|
84 | + add_action('parse_request', array($this, 'get_request'), 1, 1); |
|
85 | 85 | // process any content shortcodes |
86 | - add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 ); |
|
86 | + add_action('parse_request', array($this, '_initialize_shortcodes'), 5); |
|
87 | 87 | // process request with module factory |
88 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 ); |
|
88 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1); |
|
89 | 89 | // before headers sent |
90 | - add_action( 'wp', array( $this, 'wp' ), 5 ); |
|
90 | + add_action('wp', array($this, 'wp'), 5); |
|
91 | 91 | // load css and js |
92 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 ); |
|
92 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1); |
|
93 | 93 | // header |
94 | - add_action('wp_head', array( $this, 'header_meta_tag' ), 5 ); |
|
95 | - add_filter( 'template_include', array( $this, 'template_include' ), 1 ); |
|
94 | + add_action('wp_head', array($this, 'header_meta_tag'), 5); |
|
95 | + add_filter('template_include', array($this, 'template_include'), 1); |
|
96 | 96 | // display errors |
97 | - add_action('loop_start', array( $this, 'display_errors' ), 2 ); |
|
97 | + add_action('loop_start', array($this, 'display_errors'), 2); |
|
98 | 98 | // the content |
99 | 99 | // add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 ); |
100 | 100 | //exclude our private cpt comments |
101 | - add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 ); |
|
101 | + add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1); |
|
102 | 102 | //make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://) |
103 | - add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 ); |
|
103 | + add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1); |
|
104 | 104 | // action hook EE |
105 | - do_action( 'AHEE__EE_Front_Controller__construct__done',$this ); |
|
105 | + do_action('AHEE__EE_Front_Controller__construct__done', $this); |
|
106 | 106 | // for checking that browser cookies are enabled |
107 | - if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) { |
|
108 | - setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' ); |
|
107 | + if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) { |
|
108 | + setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/'); |
|
109 | 109 | // add the following to your site's filters to turn off the test cookie: |
110 | 110 | // add_filter( 'FHEE__EE_Front_Controller____construct__set_test_cookie', '__return_false' ); |
111 | 111 | } |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function load_espresso_template_tags() { |
146 | - if ( is_readable( EE_PUBLIC . 'template_tags.php' )) { |
|
147 | - require_once( EE_PUBLIC . 'template_tags.php' ); |
|
146 | + if (is_readable(EE_PUBLIC.'template_tags.php')) { |
|
147 | + require_once(EE_PUBLIC.'template_tags.php'); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | * @param array $clauses array of comment clauses setup by WP_Comment_Query |
160 | 160 | * @return array array of comment clauses with modifications. |
161 | 161 | */ |
162 | - public function filter_wp_comments( $clauses ) { |
|
162 | + public function filter_wp_comments($clauses) { |
|
163 | 163 | global $wpdb; |
164 | - if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) { |
|
164 | + if (strpos($clauses['join'], $wpdb->posts) !== FALSE) { |
|
165 | 165 | $cpts = EE_Register_CPTs::get_private_CPTs(); |
166 | - foreach ( $cpts as $cpt => $details ) { |
|
167 | - $clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt ); |
|
166 | + foreach ($cpts as $cpt => $details) { |
|
167 | + $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | return $clauses; |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | * @return void |
182 | 182 | */ |
183 | 183 | public function employ_CPT_Strategy() { |
184 | - if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){ |
|
185 | - $this->Registry->load_core( 'CPT_Strategy' ); |
|
184 | + if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) { |
|
185 | + $this->Registry->load_core('CPT_Strategy'); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | * @param string $url incoming url |
195 | 195 | * @return string final assembled url |
196 | 196 | */ |
197 | - public function maybe_force_admin_ajax_ssl( $url ) { |
|
198 | - if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) { |
|
199 | - $url = str_replace( 'http://', 'https://', $url ); |
|
197 | + public function maybe_force_admin_ajax_ssl($url) { |
|
198 | + if (is_ssl() && preg_match('/admin-ajax.php/', $url)) { |
|
199 | + $url = str_replace('http://', 'https://', $url); |
|
200 | 200 | } |
201 | 201 | return $url; |
202 | 202 | } |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | * @param WP $WP |
234 | 234 | * @return void |
235 | 235 | */ |
236 | - public function get_request( WP $WP ) { |
|
237 | - do_action( 'AHEE__EE_Front_Controller__get_request__start' ); |
|
238 | - $this->Request_Handler->parse_request( $WP ); |
|
239 | - do_action( 'AHEE__EE_Front_Controller__get_request__complete' ); |
|
236 | + public function get_request(WP $WP) { |
|
237 | + do_action('AHEE__EE_Front_Controller__get_request__start'); |
|
238 | + $this->Request_Handler->parse_request($WP); |
|
239 | + do_action('AHEE__EE_Front_Controller__get_request__complete'); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | |
@@ -248,21 +248,21 @@ discard block |
||
248 | 248 | * @param WP $WP |
249 | 249 | * @return void |
250 | 250 | */ |
251 | - public function _initialize_shortcodes( WP $WP ) { |
|
252 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this ); |
|
253 | - $this->Request_Handler->set_request_vars( $WP ); |
|
251 | + public function _initialize_shortcodes(WP $WP) { |
|
252 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this); |
|
253 | + $this->Request_Handler->set_request_vars($WP); |
|
254 | 254 | // grab post_name from request |
255 | - $current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', $this->Request_Handler->get( 'post_name' )); |
|
256 | - $show_on_front = get_option( 'show_on_front' ); |
|
255 | + $current_post = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', $this->Request_Handler->get('post_name')); |
|
256 | + $show_on_front = get_option('show_on_front'); |
|
257 | 257 | // if it's not set, then check if frontpage is blog |
258 | - if ( empty( $current_post ) ) { |
|
258 | + if (empty($current_post)) { |
|
259 | 259 | // yup.. this is the posts page, prepare to load all shortcode modules |
260 | 260 | $current_post = 'posts'; |
261 | 261 | // unless.. |
262 | - if ( $show_on_front === 'page' ) { |
|
262 | + if ($show_on_front === 'page') { |
|
263 | 263 | // some other page is set as the homepage |
264 | - $page_on_front = get_option( 'page_on_front' ); |
|
265 | - if ( $page_on_front ) { |
|
264 | + $page_on_front = get_option('page_on_front'); |
|
265 | + if ($page_on_front) { |
|
266 | 266 | // k now we need to find the post_name for this page |
267 | 267 | global $wpdb; |
268 | 268 | $page_on_front = $wpdb->get_var( |
@@ -279,22 +279,22 @@ discard block |
||
279 | 279 | // where are posts being displayed ? |
280 | 280 | $page_for_posts = EE_Config::get_page_for_posts(); |
281 | 281 | // in case $current_post is hierarchical like: /parent-page/current-page |
282 | - $current_post = basename( $current_post ); |
|
282 | + $current_post = basename($current_post); |
|
283 | 283 | // are we on a category page? |
284 | - $term_exists = is_array( term_exists( $current_post, 'category' )) || array_key_exists( 'category_name', $WP->query_vars ); |
|
284 | + $term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name', $WP->query_vars); |
|
285 | 285 | // make sure shortcodes are set |
286 | - if ( isset( $this->Registry->CFG->core->post_shortcodes )) { |
|
287 | - if ( ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
288 | - $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
286 | + if (isset($this->Registry->CFG->core->post_shortcodes)) { |
|
287 | + if ( ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])) { |
|
288 | + $this->Registry->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
289 | 289 | } |
290 | 290 | // cycle thru all posts with shortcodes set |
291 | - foreach ( $this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) { |
|
291 | + foreach ($this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes) { |
|
292 | 292 | // filter shortcodes so |
293 | - $post_shortcodes = apply_filters( 'FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes ); |
|
293 | + $post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes); |
|
294 | 294 | // now cycle thru shortcodes |
295 | - foreach ( $post_shortcodes as $shortcode_class => $post_id ) { |
|
295 | + foreach ($post_shortcodes as $shortcode_class => $post_id) { |
|
296 | 296 | // are we on this page, or on the blog page, or an EE CPT category page ? |
297 | - if ( $current_post === $post_name || $term_exists ) { |
|
297 | + if ($current_post === $post_name || $term_exists) { |
|
298 | 298 | // maybe init the shortcode |
299 | 299 | $this->initialize_shortcode_if_active_on_page( |
300 | 300 | $shortcode_class, |
@@ -309,16 +309,16 @@ discard block |
||
309 | 309 | // but the shortcode is not being tracked for this page |
310 | 310 | } else if ( |
311 | 311 | $post_name !== $page_for_posts |
312 | - && isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) |
|
313 | - && ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ) |
|
312 | + && isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts]) |
|
313 | + && ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class]) |
|
314 | 314 | ) { |
315 | 315 | // then remove the "fallback" shortcode processor |
316 | - remove_shortcode( $shortcode_class ); |
|
316 | + remove_shortcode($shortcode_class); |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | } |
320 | 320 | } |
321 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this ); |
|
321 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | $WP |
341 | 341 | ) { |
342 | 342 | // verify shortcode is in list of registered shortcodes |
343 | - if ( ! isset( $this->Registry->shortcodes->{$shortcode_class} ) ) { |
|
344 | - if ( $current_post !== $page_for_posts && current_user_can( 'edit_post', $post_id ) ) { |
|
343 | + if ( ! isset($this->Registry->shortcodes->{$shortcode_class} )) { |
|
344 | + if ($current_post !== $page_for_posts && current_user_can('edit_post', $post_id)) { |
|
345 | 345 | EE_Error::add_error( |
346 | 346 | sprintf( |
347 | 347 | __( |
@@ -354,24 +354,24 @@ discard block |
||
354 | 354 | __FUNCTION__, |
355 | 355 | __LINE__ |
356 | 356 | ); |
357 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
357 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
358 | 358 | } |
359 | - add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' ) ); |
|
359 | + add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor')); |
|
360 | 360 | return; |
361 | 361 | } |
362 | 362 | // is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ? |
363 | 363 | if ( |
364 | 364 | $term_exists |
365 | 365 | || $current_post === $page_for_posts |
366 | - || isset( $this->Registry->CFG->core->post_shortcodes[ $current_post ] ) |
|
366 | + || isset($this->Registry->CFG->core->post_shortcodes[$current_post]) |
|
367 | 367 | ) { |
368 | 368 | // let's pause to reflect on this... |
369 | - $sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class ); |
|
369 | + $sc_reflector = new ReflectionClass('EES_'.$shortcode_class); |
|
370 | 370 | // ensure that class is actually a shortcode |
371 | 371 | if ( |
372 | - defined( 'WP_DEBUG' ) |
|
372 | + defined('WP_DEBUG') |
|
373 | 373 | && WP_DEBUG === true |
374 | - && ! $sc_reflector->isSubclassOf( 'EES_Shortcode' ) |
|
374 | + && ! $sc_reflector->isSubclassOf('EES_Shortcode') |
|
375 | 375 | ) { |
376 | 376 | EE_Error::add_error( |
377 | 377 | sprintf( |
@@ -385,13 +385,13 @@ discard block |
||
385 | 385 | __FUNCTION__, |
386 | 386 | __LINE__ |
387 | 387 | ); |
388 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
388 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
389 | 389 | return; |
390 | 390 | } |
391 | 391 | // and pass the request object to the run method |
392 | 392 | $this->Registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance(); |
393 | 393 | // fire the shortcode class's run method, so that it can activate resources |
394 | - $this->Registry->shortcodes->{$shortcode_class}->run( $WP ); |
|
394 | + $this->Registry->shortcodes->{$shortcode_class}->run($WP); |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | |
@@ -404,19 +404,19 @@ discard block |
||
404 | 404 | * @param WP_Query $WP_Query |
405 | 405 | * @return void |
406 | 406 | */ |
407 | - public function pre_get_posts( $WP_Query ) { |
|
407 | + public function pre_get_posts($WP_Query) { |
|
408 | 408 | // only load Module_Request_Router if this is the main query |
409 | 409 | if ( |
410 | 410 | $this->Module_Request_Router instanceof EE_Module_Request_Router |
411 | 411 | && $WP_Query->is_main_query() |
412 | 412 | ) { |
413 | 413 | // cycle thru module routes |
414 | - while ( $route = $this->Module_Request_Router->get_route( $WP_Query )) { |
|
414 | + while ($route = $this->Module_Request_Router->get_route($WP_Query)) { |
|
415 | 415 | // determine module and method for route |
416 | - $module = $this->Module_Request_Router->resolve_route( $route[0], $route[1] ); |
|
417 | - if( $module instanceof EED_Module ) { |
|
416 | + $module = $this->Module_Request_Router->resolve_route($route[0], $route[1]); |
|
417 | + if ($module instanceof EED_Module) { |
|
418 | 418 | // get registered view for route |
419 | - $this->_template_path = $this->Module_Request_Router->get_view( $route ); |
|
419 | + $this->_template_path = $this->Module_Request_Router->get_view($route); |
|
420 | 420 | // grab module name |
421 | 421 | $module_name = $module->module_name(); |
422 | 422 | // map the module to the module objects |
@@ -458,29 +458,29 @@ discard block |
||
458 | 458 | public function wp_enqueue_scripts() { |
459 | 459 | |
460 | 460 | // 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' ); |
461 | - if ( apply_filters( 'FHEE_load_css', TRUE ) ) { |
|
461 | + if (apply_filters('FHEE_load_css', TRUE)) { |
|
462 | 462 | |
463 | 463 | $this->Registry->CFG->template_settings->enable_default_style = TRUE; |
464 | 464 | //Load the ThemeRoller styles if enabled |
465 | - if ( isset( $this->Registry->CFG->template_settings->enable_default_style ) && $this->Registry->CFG->template_settings->enable_default_style ) { |
|
465 | + if (isset($this->Registry->CFG->template_settings->enable_default_style) && $this->Registry->CFG->template_settings->enable_default_style) { |
|
466 | 466 | |
467 | 467 | //Load custom style sheet if available |
468 | - if ( isset( $this->Registry->CFG->template_settings->custom_style_sheet )) { |
|
469 | - wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION ); |
|
468 | + if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) { |
|
469 | + wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION); |
|
470 | 470 | wp_enqueue_style('espresso_custom_css'); |
471 | 471 | } |
472 | 472 | |
473 | - if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) { |
|
474 | - wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
473 | + if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) { |
|
474 | + wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
475 | 475 | } else { |
476 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
476 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
477 | 477 | } |
478 | 478 | wp_enqueue_style('espresso_default'); |
479 | 479 | |
480 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) { |
|
481 | - wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
480 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) { |
|
481 | + wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
482 | 482 | } else { |
483 | - wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
483 | + wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | } |
@@ -488,38 +488,38 @@ discard block |
||
488 | 488 | } |
489 | 489 | |
490 | 490 | // 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' ); |
491 | - if ( apply_filters( 'FHEE_load_js', TRUE ) ) { |
|
491 | + if (apply_filters('FHEE_load_js', TRUE)) { |
|
492 | 492 | |
493 | - wp_enqueue_script( 'jquery' ); |
|
493 | + wp_enqueue_script('jquery'); |
|
494 | 494 | //let's make sure that all required scripts have been setup |
495 | - if ( function_exists( 'wp_script_is' ) && ! wp_script_is( 'jquery' )) { |
|
495 | + if (function_exists('wp_script_is') && ! wp_script_is('jquery')) { |
|
496 | 496 | $msg = sprintf( |
497 | - __( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ), |
|
497 | + __('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'), |
|
498 | 498 | '<em><br />', |
499 | 499 | '</em>' |
500 | 500 | ); |
501 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
501 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
502 | 502 | } |
503 | 503 | // load core js |
504 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
505 | - wp_enqueue_script( 'espresso_core' ); |
|
506 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
504 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
505 | + wp_enqueue_script('espresso_core'); |
|
506 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
507 | 507 | |
508 | 508 | } |
509 | 509 | |
510 | 510 | //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' ); |
511 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
511 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
512 | 512 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
513 | 513 | } |
514 | 514 | |
515 | 515 | |
516 | 516 | //accounting.js library |
517 | 517 | // @link http://josscrowcroft.github.io/accounting.js/ |
518 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
519 | - $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js'; |
|
520 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
521 | - wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE ); |
|
522 | - wp_enqueue_script( 'ee-accounting' ); |
|
518 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
519 | + $acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js'; |
|
520 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
521 | + wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE); |
|
522 | + wp_enqueue_script('ee-accounting'); |
|
523 | 523 | |
524 | 524 | $currency_config = array( |
525 | 525 | 'currency' => array( |
@@ -542,21 +542,21 @@ discard block |
||
542 | 542 | wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config); |
543 | 543 | } |
544 | 544 | |
545 | - if ( ! function_exists( 'wp_head' )) { |
|
545 | + if ( ! function_exists('wp_head')) { |
|
546 | 546 | $msg = sprintf( |
547 | - __( '%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' ), |
|
547 | + __('%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'), |
|
548 | 548 | '<em><br />', |
549 | 549 | '</em>' |
550 | 550 | ); |
551 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
551 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
552 | 552 | } |
553 | - if ( ! function_exists( 'wp_footer' )) { |
|
553 | + if ( ! function_exists('wp_footer')) { |
|
554 | 554 | $msg = sprintf( |
555 | - __( '%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' ), |
|
555 | + __('%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'), |
|
556 | 556 | '<em><br />', |
557 | 557 | '</em>' |
558 | 558 | ); |
559 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
559 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @return void |
571 | 571 | */ |
572 | 572 | public function header_meta_tag() { |
573 | - print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />")); |
|
573 | + print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />")); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | |
@@ -611,10 +611,10 @@ discard block |
||
611 | 611 | */ |
612 | 612 | public function display_errors() { |
613 | 613 | static $shown_already = FALSE; |
614 | - do_action( 'AHEE__EE_Front_Controller__display_errors__begin' ); |
|
614 | + do_action('AHEE__EE_Front_Controller__display_errors__begin'); |
|
615 | 615 | if ( |
616 | 616 | ! $shown_already |
617 | - && apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE ) |
|
617 | + && apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE) |
|
618 | 618 | && is_main_query() |
619 | 619 | && ! is_feed() |
620 | 620 | && in_the_loop() |
@@ -622,9 +622,9 @@ discard block |
||
622 | 622 | ) { |
623 | 623 | echo EE_Error::get_notices(); |
624 | 624 | $shown_already = TRUE; |
625 | - EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' ); |
|
625 | + EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php'); |
|
626 | 626 | } |
627 | - do_action( 'AHEE__EE_Front_Controller__display_errors__end' ); |
|
627 | + do_action('AHEE__EE_Front_Controller__display_errors__end'); |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | |
@@ -639,12 +639,12 @@ discard block |
||
639 | 639 | * @param string $template_include_path |
640 | 640 | * @return string |
641 | 641 | */ |
642 | - public function template_include( $template_include_path = NULL ) { |
|
643 | - if ( $this->Request_Handler->is_espresso_page() ) { |
|
644 | - $this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path ); |
|
645 | - $template_path = EEH_Template::locate_template( $this->_template_path, array(), false ); |
|
646 | - $this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path; |
|
647 | - $this->_template = basename( $this->_template_path ); |
|
642 | + public function template_include($template_include_path = NULL) { |
|
643 | + if ($this->Request_Handler->is_espresso_page()) { |
|
644 | + $this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path); |
|
645 | + $template_path = EEH_Template::locate_template($this->_template_path, array(), false); |
|
646 | + $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path; |
|
647 | + $this->_template = basename($this->_template_path); |
|
648 | 648 | return $this->_template_path; |
649 | 649 | } |
650 | 650 | return $template_include_path; |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | * @param bool $with_path |
660 | 660 | * @return string |
661 | 661 | */ |
662 | - public function get_selected_template( $with_path = FALSE ) { |
|
662 | + public function get_selected_template($with_path = FALSE) { |
|
663 | 663 | return $with_path ? $this->_template_path : $this->_template; |
664 | 664 | } |
665 | 665 |
@@ -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 | |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | * @return \EE_Activation_Manager |
94 | 94 | * @throws \EE_Error |
95 | 95 | */ |
96 | - public static function instance( \EE_Maintenance_Mode $maintenanceMode = null ) { |
|
96 | + public static function instance(\EE_Maintenance_Mode $maintenanceMode = null) { |
|
97 | 97 | // check if class object is instantiated |
98 | - if ( ! self::$_instance instanceof EE_Activation_Manager ) { |
|
99 | - if ( ! $maintenanceMode instanceof \EE_Maintenance_Mode ) { |
|
98 | + if ( ! self::$_instance instanceof EE_Activation_Manager) { |
|
99 | + if ( ! $maintenanceMode instanceof \EE_Maintenance_Mode) { |
|
100 | 100 | throw new \EE_Error( |
101 | 101 | __( |
102 | 102 | 'A valid instance of the EE_Maintenance_Mode class is required to instantiate EE_Activation_Manager.', |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ) |
105 | 105 | ); |
106 | 106 | } |
107 | - self::$_instance = new self( $maintenanceMode ); |
|
107 | + self::$_instance = new self($maintenanceMode); |
|
108 | 108 | } |
109 | 109 | return self::$_instance; |
110 | 110 | } |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param \EE_Maintenance_Mode $maintenanceMode |
118 | 118 | */ |
119 | - private function __construct( \EE_Maintenance_Mode $maintenanceMode ) { |
|
119 | + private function __construct(\EE_Maintenance_Mode $maintenanceMode) { |
|
120 | 120 | $this->maintenanceMode = $maintenanceMode; |
121 | 121 | // detect whether install or upgrade |
122 | 122 | add_action( |
123 | 123 | 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', |
124 | - array( $this, 'detect_activations_or_upgrades' ), |
|
124 | + array($this, 'detect_activations_or_upgrades'), |
|
125 | 125 | 10 |
126 | 126 | ); |
127 | 127 | } |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | * @param EspressoCore $espressoCore |
133 | 133 | * @throws \EE_Error |
134 | 134 | */ |
135 | - public function setEspressoCore( $espressoCore ) { |
|
135 | + public function setEspressoCore($espressoCore) { |
|
136 | 136 | $this->espressoCore = $espressoCore; |
137 | - if ( ! $this->espressoCore->registry() instanceof \EE_Registry ) { |
|
137 | + if ( ! $this->espressoCore->registry() instanceof \EE_Registry) { |
|
138 | 138 | throw new \EE_Error( |
139 | 139 | __( |
140 | 140 | 'A valid instance of the EE_Registry class is required for EE_Activation_Manager to function properly.', |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | ) |
143 | 143 | ); |
144 | 144 | } |
145 | - if ( ! $this->espressoCore->registry()->request() instanceof \EE_Request ) { |
|
145 | + if ( ! $this->espressoCore->registry()->request() instanceof \EE_Request) { |
|
146 | 146 | throw new \EE_Error( |
147 | 147 | __( |
148 | 148 | 'A valid instance of the EE_Request class is required for EE_Activation_Manager to function properly.', |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | * @throws \EE_Error |
168 | 168 | */ |
169 | 169 | public function detect_activations_or_upgrades() { |
170 | - do_action( 'AHEE__EE_Activation_Manager__detect_activations_or_upgrades__begin', $this ); |
|
170 | + do_action('AHEE__EE_Activation_Manager__detect_activations_or_upgrades__begin', $this); |
|
171 | 171 | // check if db has been updated, or if its a brand-new installation |
172 | - $this->espressoCore->registry()->request()->set_activation_type( $this->detect_activation_type() ); |
|
172 | + $this->espressoCore->registry()->request()->set_activation_type($this->detect_activation_type()); |
|
173 | 173 | $this->process_activation_type(); |
174 | - foreach ( $this->espressoCore->registry()->addons as $addon ) { |
|
174 | + foreach ($this->espressoCore->registry()->addons as $addon) { |
|
175 | 175 | //detect the request type for that addon |
176 | 176 | $addon->detect_activation_or_upgrade(); |
177 | 177 | } |
178 | - do_action( 'AHEE__EE_Activation_Manager__detect_activations_or_upgrades__end', $this ); |
|
178 | + do_action('AHEE__EE_Activation_Manager__detect_activations_or_upgrades__end', $this); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function detect_activation_type() { |
190 | 190 | $activation_type = $this->espressoCore->registry()->request()->activation_type(); |
191 | - if ( is_int( $activation_type ) ) { |
|
191 | + if (is_int($activation_type)) { |
|
192 | 192 | return $activation_type; |
193 | 193 | } |
194 | 194 | $activation_type = EE_Activation_Manager::detect_activation_type_given_activation_history( |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | EE_Activation_Manager::activation_indicator_option_name, |
197 | 197 | EVENT_ESPRESSO_VERSION |
198 | 198 | ); |
199 | - $this->espressoCore->registry()->request()->set_activation_type( $activation_type ); |
|
199 | + $this->espressoCore->registry()->request()->set_activation_type($activation_type); |
|
200 | 200 | return $activation_type; |
201 | 201 | } |
202 | 202 | |
@@ -221,35 +221,35 @@ discard block |
||
221 | 221 | $activation_history_for_addon, |
222 | 222 | $version_to_upgrade_to |
223 | 223 | ); |
224 | - if ( $activation_history_for_addon ) { |
|
224 | + if ($activation_history_for_addon) { |
|
225 | 225 | //it exists, so this isn't a completely new install |
226 | 226 | //check if this version already in that list of previously installed versions |
227 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] ) ) { |
|
227 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
228 | 228 | //it a version we haven't seen before |
229 | - if ( $version_is_higher === 1 ) { |
|
229 | + if ($version_is_higher === 1) { |
|
230 | 230 | $activation_type = EE_Activation_Manager::activation_type_upgrade; |
231 | 231 | } else { |
232 | 232 | $activation_type = EE_Activation_Manager::activation_type_downgrade; |
233 | 233 | } |
234 | - delete_option( $activation_indicator_option_name ); |
|
234 | + delete_option($activation_indicator_option_name); |
|
235 | 235 | } else { |
236 | 236 | // its not an update. maybe a reactivation? |
237 | - if ( get_option( $activation_indicator_option_name, false ) ) { |
|
238 | - if ( $version_is_higher === -1 ) { |
|
237 | + if (get_option($activation_indicator_option_name, false)) { |
|
238 | + if ($version_is_higher === -1) { |
|
239 | 239 | $activation_type = EE_Activation_Manager::activation_type_downgrade; |
240 | - } elseif ( $version_is_higher === 0 ) { |
|
240 | + } elseif ($version_is_higher === 0) { |
|
241 | 241 | //we've seen this version before, but it's an activation. must be a reactivation |
242 | 242 | $activation_type = EE_Activation_Manager::activation_type_reactivation; |
243 | 243 | } else { |
244 | 244 | //$version_is_higher === 1 |
245 | 245 | $activation_type = EE_Activation_Manager::activation_type_upgrade; |
246 | 246 | } |
247 | - delete_option( $activation_indicator_option_name ); |
|
247 | + delete_option($activation_indicator_option_name); |
|
248 | 248 | } else { |
249 | 249 | //we've seen this version before and the activation indicate doesn't show it was just activated |
250 | - if ( $version_is_higher === -1 ) { |
|
250 | + if ($version_is_higher === -1) { |
|
251 | 251 | $activation_type = EE_Activation_Manager::activation_type_downgrade; |
252 | - } elseif ( $version_is_higher === 0 ) { |
|
252 | + } elseif ($version_is_higher === 0) { |
|
253 | 253 | //we've seen this version before and it's not an activation. its normal request |
254 | 254 | $activation_type = EE_Activation_Manager::activation_type_none; |
255 | 255 | } else { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | } else { |
262 | 262 | //brand new install |
263 | 263 | $activation_type = EE_Activation_Manager::activation_type_new; |
264 | - delete_option( $activation_indicator_option_name ); |
|
264 | + delete_option($activation_indicator_option_name); |
|
265 | 265 | } |
266 | 266 | return $activation_type; |
267 | 267 | } |
@@ -280,21 +280,21 @@ discard block |
||
280 | 280 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
281 | 281 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
282 | 282 | */ |
283 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ) { |
|
283 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
284 | 284 | //find the most recently-activated version |
285 | 285 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
286 | 286 | $most_recently_active_version = '0.0.0.dev.000'; |
287 | - if ( is_array( $activation_history_for_addon ) ) { |
|
288 | - foreach ( $activation_history_for_addon as $version => $times_activated ) { |
|
287 | + if (is_array($activation_history_for_addon)) { |
|
288 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
289 | 289 | //check there is a record of when this version was activated. Otherwise, |
290 | 290 | //mark it as unknown |
291 | - if ( ! $times_activated ) { |
|
292 | - $times_activated = array( 'unknown-date' ); |
|
291 | + if ( ! $times_activated) { |
|
292 | + $times_activated = array('unknown-date'); |
|
293 | 293 | } |
294 | - if ( is_string( $times_activated ) ) { |
|
295 | - $times_activated = array( $times_activated ); |
|
294 | + if (is_string($times_activated)) { |
|
295 | + $times_activated = array($times_activated); |
|
296 | 296 | } |
297 | - foreach ( $times_activated as $an_activation ) { |
|
297 | + foreach ($times_activated as $an_activation) { |
|
298 | 298 | if ( |
299 | 299 | $an_activation !== 'unknown-date' |
300 | 300 | && $an_activation > $most_recently_active_version_activation |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | } |
309 | 309 | } |
310 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
310 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -321,9 +321,9 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function get_db_version_history() { |
323 | 323 | $db_version_history = $this->espressoCore->db_version_history(); |
324 | - if ( empty( $db_version_history ) ) { |
|
325 | - $db_version_history = $this->fix_espresso_db_upgrade_option( $db_version_history ); |
|
326 | - $this->espressoCore->set_db_version_history( $db_version_history ); |
|
324 | + if (empty($db_version_history)) { |
|
325 | + $db_version_history = $this->fix_espresso_db_upgrade_option($db_version_history); |
|
326 | + $this->espressoCore->set_db_version_history($db_version_history); |
|
327 | 327 | } |
328 | 328 | return $db_version_history; |
329 | 329 | } |
@@ -339,42 +339,42 @@ discard block |
||
339 | 339 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
340 | 340 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
341 | 341 | */ |
342 | - private function fix_espresso_db_upgrade_option( $db_version_history = null ) { |
|
343 | - if ( empty( $db_version_history ) ) { |
|
344 | - $db_version_history = get_option( EE_Activation_Manager::db_version_option_name ); |
|
342 | + private function fix_espresso_db_upgrade_option($db_version_history = null) { |
|
343 | + if (empty($db_version_history)) { |
|
344 | + $db_version_history = get_option(EE_Activation_Manager::db_version_option_name); |
|
345 | 345 | } |
346 | - do_action( 'AHEE__EE_Activation_Manager__fix_espresso_db_upgrade_option__begin', $db_version_history ); |
|
346 | + do_action('AHEE__EE_Activation_Manager__fix_espresso_db_upgrade_option__begin', $db_version_history); |
|
347 | 347 | // check that option is an array |
348 | - if ( ! is_array( $db_version_history ) ) { |
|
348 | + if ( ! is_array($db_version_history)) { |
|
349 | 349 | // if option is FALSE, then it never existed |
350 | - if ( $db_version_history === false ) { |
|
350 | + if ($db_version_history === false) { |
|
351 | 351 | // make $espresso_db_update an array and save option with autoload OFF |
352 | 352 | $db_version_history = array(); |
353 | - add_option( EE_Activation_Manager::db_version_option_name, $db_version_history, '', 'no' ); |
|
353 | + add_option(EE_Activation_Manager::db_version_option_name, $db_version_history, '', 'no'); |
|
354 | 354 | } else { |
355 | 355 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
356 | - $db_version_history = array( $db_version_history => array() ); |
|
357 | - update_option( EE_Activation_Manager::db_version_option_name, $db_version_history ); |
|
356 | + $db_version_history = array($db_version_history => array()); |
|
357 | + update_option(EE_Activation_Manager::db_version_option_name, $db_version_history); |
|
358 | 358 | } |
359 | 359 | } else { |
360 | 360 | $corrected_db_update = array(); |
361 | 361 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
362 | - foreach ( $db_version_history as $should_be_version_string => $should_be_array ) { |
|
363 | - if ( is_int( $should_be_version_string ) && ! is_array( $should_be_array ) ) { |
|
362 | + foreach ($db_version_history as $should_be_version_string => $should_be_array) { |
|
363 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
364 | 364 | //the key is an int, and the value IS NOT an array |
365 | 365 | //so it must be numerically-indexed, where values are versions installed... |
366 | 366 | //fix it! |
367 | 367 | $version_string = $should_be_array; |
368 | - $corrected_db_update[ $version_string ] = array( 'unknown-date' ); |
|
368 | + $corrected_db_update[$version_string] = array('unknown-date'); |
|
369 | 369 | } else { |
370 | 370 | //ok it checks out |
371 | - $corrected_db_update[ $should_be_version_string ] = $should_be_array; |
|
371 | + $corrected_db_update[$should_be_version_string] = $should_be_array; |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | $db_version_history = $corrected_db_update; |
375 | - update_option( EE_Activation_Manager::db_version_option_name, $db_version_history ); |
|
375 | + update_option(EE_Activation_Manager::db_version_option_name, $db_version_history); |
|
376 | 376 | } |
377 | - do_action( 'AHEE__EE_Activation_Manager__fix_espresso_db_upgrade_option__complete', $db_version_history ); |
|
377 | + do_action('AHEE__EE_Activation_Manager__fix_espresso_db_upgrade_option__complete', $db_version_history); |
|
378 | 378 | return $db_version_history; |
379 | 379 | } |
380 | 380 | |
@@ -389,18 +389,18 @@ discard block |
||
389 | 389 | * @access public |
390 | 390 | */ |
391 | 391 | public function process_activation_type() { |
392 | - do_action( 'AHEE__EE_Activation_Manager__process_activation_type__begin' ); |
|
392 | + do_action('AHEE__EE_Activation_Manager__process_activation_type__begin'); |
|
393 | 393 | if ( |
394 | 394 | $this->espressoCore->registry()->request()->activation_type() !== EE_Activation_Manager::activation_type_none |
395 | 395 | ) { |
396 | 396 | // NOT a normal request so do NOT proceed with regular application execution |
397 | - add_filter( 'FHEE__EE_System__brew_espresso', '__return_false' ); |
|
397 | + add_filter('FHEE__EE_System__brew_espresso', '__return_false'); |
|
398 | 398 | // perform any necessary activations upgrades and migrations instead |
399 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
399 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
400 | 400 | // update the db version history |
401 | - $this->_handle_core_version_change( $this->espressoCore->db_version_history() ); |
|
401 | + $this->_handle_core_version_change($this->espressoCore->db_version_history()); |
|
402 | 402 | } |
403 | - do_action( 'AHEE__EE_Activation_Manager__process_activation_type__complete' ); |
|
403 | + do_action('AHEE__EE_Activation_Manager__process_activation_type__complete'); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -413,21 +413,21 @@ discard block |
||
413 | 413 | * @throws \EE_Error |
414 | 414 | */ |
415 | 415 | public function perform_activations_upgrades_and_migrations() { |
416 | - switch ( $this->espressoCore->registry()->request()->activation_type() ) { |
|
416 | + switch ($this->espressoCore->registry()->request()->activation_type()) { |
|
417 | 417 | case EE_Activation_Manager::activation_type_new: |
418 | - do_action( 'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__new_activation' ); |
|
418 | + do_action('AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__new_activation'); |
|
419 | 419 | |
420 | 420 | break; |
421 | 421 | case EE_Activation_Manager::activation_type_reactivation: |
422 | - do_action( 'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__reactivation' ); |
|
422 | + do_action('AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__reactivation'); |
|
423 | 423 | break; |
424 | 424 | case EE_Activation_Manager::activation_type_upgrade: |
425 | - do_action( 'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__upgrade' ); |
|
425 | + do_action('AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__upgrade'); |
|
426 | 426 | //migrations may be required now that we've upgraded |
427 | 427 | $this->maintenanceMode->set_maintenance_mode_if_db_old(); |
428 | 428 | break; |
429 | 429 | case EE_Activation_Manager::activation_type_downgrade: |
430 | - do_action( 'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__downgrade' ); |
|
430 | + do_action('AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations__downgrade'); |
|
431 | 431 | //its possible migrations are no longer required |
432 | 432 | $this->maintenanceMode->set_maintenance_mode_if_db_old(); |
433 | 433 | break; |
@@ -436,11 +436,11 @@ discard block |
||
436 | 436 | break; |
437 | 437 | } //first check if we had previously attempted to setup EE's directories but failed |
438 | 438 | // load activation helper if need be |
439 | - $this->espressoCore->registry()->load_helper( 'Activation' ); |
|
440 | - if ( EEH_Activation::upload_directories_incomplete() ) { |
|
439 | + $this->espressoCore->registry()->load_helper('Activation'); |
|
440 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
441 | 441 | EEH_Activation::create_upload_directories(); |
442 | 442 | } |
443 | - do_action( 'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations', $this ); |
|
443 | + do_action('AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations', $this); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | * |
452 | 452 | * @param array $db_version_history |
453 | 453 | */ |
454 | - protected function _handle_core_version_change( $db_version_history ) { |
|
455 | - $this->update_list_of_installed_versions( $db_version_history ); |
|
454 | + protected function _handle_core_version_change($db_version_history) { |
|
455 | + $this->update_list_of_installed_versions($db_version_history); |
|
456 | 456 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
457 | 457 | add_action( |
458 | 458 | 'AHEE__EE_Activation_Manager__perform_activations_upgrades_and_migrations', |
459 | - array( $this, 'initialize_db_if_no_migrations_required' ) |
|
459 | + array($this, 'initialize_db_if_no_migrations_required') |
|
460 | 460 | ); |
461 | 461 | } |
462 | 462 | |
@@ -469,18 +469,18 @@ discard block |
||
469 | 469 | * @param string $current_version_to_add version to be added to the version history |
470 | 470 | * @return boolean success as to whether or not this option was changed |
471 | 471 | */ |
472 | - protected function update_list_of_installed_versions( $db_version_history = null, $current_version_to_add = null ) { |
|
472 | + protected function update_list_of_installed_versions($db_version_history = null, $current_version_to_add = null) { |
|
473 | 473 | // check db version history is set |
474 | - $db_version_history = ! empty( $db_version_history ) |
|
474 | + $db_version_history = ! empty($db_version_history) |
|
475 | 475 | ? $db_version_history |
476 | 476 | : $this->get_db_version_history(); |
477 | 477 | // check current version is set |
478 | - $current_version_to_add = ! empty( $current_version_to_add ) |
|
478 | + $current_version_to_add = ! empty($current_version_to_add) |
|
479 | 479 | ? $current_version_to_add |
480 | 480 | : EVENT_ESPRESSO_VERSION; |
481 | 481 | // add this version and save |
482 | - $db_version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s', time() ); |
|
483 | - return update_option( EE_Activation_Manager::db_version_option_name, $db_version_history ); |
|
482 | + $db_version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
483 | + return update_option(EE_Activation_Manager::db_version_option_name, $db_version_history); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
@@ -505,19 +505,19 @@ discard block |
||
505 | 505 | ) { |
506 | 506 | $this->detect_activation_type(); |
507 | 507 | //only initialize system if we're not in maintenance mode. |
508 | - if ( $this->maintenanceMode->level() !== \EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
509 | - update_option( 'ee_flush_rewrite_rules', true ); |
|
510 | - if ( $verify_db_schema ) { |
|
508 | + if ($this->maintenanceMode->level() !== \EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
509 | + update_option('ee_flush_rewrite_rules', true); |
|
510 | + if ($verify_db_schema) { |
|
511 | 511 | \EEH_Activation::initialize_db_and_folders(); |
512 | 512 | } |
513 | 513 | \EEH_Activation::initialize_db_content(); |
514 | 514 | \EEH_Activation::system_initialization(); |
515 | - if ( $initialize_addons_too ) { |
|
515 | + if ($initialize_addons_too) { |
|
516 | 516 | $this->initialize_addons(); |
517 | 517 | } |
518 | 518 | } else { |
519 | 519 | $this->espressoCore->registry()->load_core('Data_Migration_Manager'); |
520 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
520 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
521 | 521 | } |
522 | 522 | $activation_type = $this->espressoCore->registry()->request()->activation_type(); |
523 | 523 | if ( |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | || $activation_type === EE_Activation_Manager::activation_type_upgrade |
526 | 526 | //|| $activation_type == EE_Activation_Manager::activation_type_reactivation |
527 | 527 | ) { |
528 | - add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
528 | + add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9); |
|
529 | 529 | } |
530 | 530 | } |
531 | 531 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | */ |
539 | 539 | public function initialize_addons() { |
540 | 540 | //foreach registered addon, make sure its db is up-to-date too |
541 | - foreach ( $this->espressoCore->registry()->addons as $addon ) { |
|
541 | + foreach ($this->espressoCore->registry()->addons as $addon) { |
|
542 | 542 | $addon->initialize_db_if_no_migrations_required(); |
543 | 543 | } |
544 | 544 | } |
@@ -551,20 +551,20 @@ discard block |
||
551 | 551 | * @return void |
552 | 552 | */ |
553 | 553 | public function redirect_to_about_ee() { |
554 | - $notices = \EE_Error::get_notices( false ); |
|
554 | + $notices = \EE_Error::get_notices(false); |
|
555 | 555 | //if current user is an admin and it's not an ajax request |
556 | - if ( ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
557 | - && ! isset( $notices['errors'] ) |
|
558 | - && $this->espressoCore->registry()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) |
|
556 | + if ( ! (defined('DOING_AJAX') && DOING_AJAX) |
|
557 | + && ! isset($notices['errors']) |
|
558 | + && $this->espressoCore->registry()->CAP->current_user_can('manage_options', 'espresso_about_default') |
|
559 | 559 | ) { |
560 | - $query_params = array( 'page' => 'espresso_about' ); |
|
561 | - if ( $this->detect_activation_type() === EE_Activation_Manager::activation_type_new ) { |
|
560 | + $query_params = array('page' => 'espresso_about'); |
|
561 | + if ($this->detect_activation_type() === EE_Activation_Manager::activation_type_new) { |
|
562 | 562 | $query_params['new_activation'] = true; |
563 | - } else if ( $this->detect_activation_type() === EE_Activation_Manager::activation_type_reactivation ) { |
|
563 | + } else if ($this->detect_activation_type() === EE_Activation_Manager::activation_type_reactivation) { |
|
564 | 564 | $query_params['reactivation'] = true; |
565 | 565 | } |
566 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
567 | - wp_safe_redirect( $url ); |
|
566 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
567 | + wp_safe_redirect($url); |
|
568 | 568 | exit(); |
569 | 569 | } |
570 | 570 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | use EventEspresso\core\libraries\rest_api\Calculated_Model_Fields; |
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 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function instance() { |
39 | 39 | self::$_field_calculator = new Calculated_Model_Fields(); |
40 | - return parent::get_instance( __CLASS__ ); |
|
40 | + return parent::get_instance(__CLASS__); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | * @throws \EE_Error |
75 | 75 | */ |
76 | 76 | public static function set_hooks_both() { |
77 | - add_action( 'AHEE__EE_System__after_brew_espresso', array( 'EED_Core_Rest_Api', 'maybe_load_basic_auth' ), 10 ); |
|
78 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'register_routes' ), 10 ); |
|
79 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'set_hooks_rest_api' ), 5 ); |
|
80 | - add_filter( 'rest_route_data', array( 'EED_Core_Rest_Api', 'hide_old_endpoints' ), 10, 2 ); |
|
81 | - add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) ); |
|
77 | + add_action('AHEE__EE_System__after_brew_espresso', array('EED_Core_Rest_Api', 'maybe_load_basic_auth'), 10); |
|
78 | + add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10); |
|
79 | + add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5); |
|
80 | + add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2); |
|
81 | + add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index')); |
|
82 | 82 | EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change(); |
83 | 83 | } |
84 | 84 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @throws \EE_Error |
106 | 106 | */ |
107 | - public static function set_hooks_for_changes(){ |
|
107 | + public static function set_hooks_for_changes() { |
|
108 | 108 | self::_set_hooks_for_changes(); |
109 | 109 | } |
110 | 110 | |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | * @throws \EE_Error |
118 | 118 | */ |
119 | 119 | protected static function _set_hooks_for_changes() { |
120 | - $folder_contents = EEH_File::get_contents_of_folders( array( EE_LIBRARIES . 'rest_api' . DS . 'changes' ), false ); |
|
121 | - foreach( $folder_contents as $classname_in_namespace => $filepath ) { |
|
120 | + $folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false); |
|
121 | + foreach ($folder_contents as $classname_in_namespace => $filepath) { |
|
122 | 122 | //ignore the base parent class |
123 | - if( $classname_in_namespace === 'Changes_In_Base' ) { |
|
123 | + if ($classname_in_namespace === 'Changes_In_Base') { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | - $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace; |
|
127 | - if ( class_exists( $full_classname )) { |
|
126 | + $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace; |
|
127 | + if (class_exists($full_classname)) { |
|
128 | 128 | $instance_of_class = new $full_classname; |
129 | - if ( $instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base ) { |
|
129 | + if ($instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base) { |
|
130 | 130 | $instance_of_class->set_hooks(); |
131 | 131 | } |
132 | 132 | } |
@@ -144,18 +144,18 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public static function maybe_load_basic_auth() { |
146 | 146 | if ( |
147 | - ! ( isset( $_GET['activate'] ) && $_GET['activate'] === 'true' ) |
|
148 | - && ! function_exists( 'json_basic_auth_handler' ) |
|
149 | - && ! function_exists( 'json_basic_auth_error' ) |
|
147 | + ! (isset($_GET['activate']) && $_GET['activate'] === 'true') |
|
148 | + && ! function_exists('json_basic_auth_handler') |
|
149 | + && ! function_exists('json_basic_auth_error') |
|
150 | 150 | && ! ( |
151 | - isset( $_GET['action'] ) |
|
152 | - && in_array( $_GET['action'], array( 'activate', 'activate-selected' ) ) |
|
151 | + isset($_GET['action']) |
|
152 | + && in_array($_GET['action'], array('activate', 'activate-selected')) |
|
153 | 153 | ) |
154 | 154 | ) { |
155 | 155 | try { |
156 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php'; |
|
157 | - } catch ( Exception $e ) { |
|
158 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
156 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php'; |
|
157 | + } catch (Exception $e) { |
|
158 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -169,16 +169,16 @@ discard block |
||
169 | 169 | * @throws \EE_Error |
170 | 170 | */ |
171 | 171 | public static function register_routes() { |
172 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
173 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
174 | - foreach( $routes as $route ) { |
|
172 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
173 | + foreach ($relative_urls as $endpoint => $routes) { |
|
174 | + foreach ($routes as $route) { |
|
175 | 175 | register_rest_route( |
176 | 176 | $namespace, |
177 | 177 | $endpoint, |
178 | 178 | array( |
179 | - 'callback' => $route[ 'callback' ], |
|
180 | - 'methods' => $route[ 'methods' ], |
|
181 | - 'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(), |
|
179 | + 'callback' => $route['callback'], |
|
180 | + 'methods' => $route['methods'], |
|
181 | + 'args' => isset($route['args']) ? $route['args'] : array(), |
|
182 | 182 | ) |
183 | 183 | ); |
184 | 184 | } |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | * @throws \EE_Error |
195 | 195 | */ |
196 | 196 | public static function invalidate_cached_route_data_on_version_change() { |
197 | - if( EE_Registry::instance()->request()->activation_type() !== EE_Activation_Manager::activation_type_none ) { |
|
197 | + if (EE_Registry::instance()->request()->activation_type() !== EE_Activation_Manager::activation_type_none) { |
|
198 | 198 | EED_Core_Rest_Api::invalidate_cached_route_data(); |
199 | 199 | } |
200 | - foreach( EE_Registry::instance()->addons as $addon ){ |
|
201 | - if( |
|
200 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
201 | + if ( |
|
202 | 202 | $addon instanceof EE_Addon |
203 | 203 | && $addon->detect_req_type() !== EE_Activation_Manager::activation_type_none |
204 | 204 | ) { |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public static function invalidate_cached_route_data() { |
214 | 214 | //delete the saved EE REST API routes |
215 | - delete_option( EED_Core_Rest_Api::saved_routes_option_names ); |
|
215 | + delete_option(EED_Core_Rest_Api::saved_routes_option_names); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public static function get_ee_route_data() { |
229 | 229 | $ee_routes = array(); |
230 | - foreach( self::versions_served() as $version => $hidden_endpoints ) { |
|
231 | - $ee_routes[ self::ee_api_namespace . $version ] = self::_get_ee_route_data_for_version( $version, $hidden_endpoints ); |
|
230 | + foreach (self::versions_served() as $version => $hidden_endpoints) { |
|
231 | + $ee_routes[self::ee_api_namespace.$version] = self::_get_ee_route_data_for_version($version, $hidden_endpoints); |
|
232 | 232 | } |
233 | 233 | return $ee_routes; |
234 | 234 | } |
@@ -240,10 +240,10 @@ discard block |
||
240 | 240 | * @param boolean $hidden_endpoints |
241 | 241 | * @return array |
242 | 242 | */ |
243 | - protected static function _get_ee_route_data_for_version( $version, $hidden_endpoints = false ) { |
|
244 | - $ee_routes = get_option( self::saved_routes_option_names . $version , null ); |
|
245 | - if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){ |
|
246 | - $ee_routes = self::_save_ee_route_data_for_version( $version, $hidden_endpoints ); |
|
243 | + protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false) { |
|
244 | + $ee_routes = get_option(self::saved_routes_option_names.$version, null); |
|
245 | + if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) { |
|
246 | + $ee_routes = self::_save_ee_route_data_for_version($version, $hidden_endpoints); |
|
247 | 247 | } |
248 | 248 | return $ee_routes; |
249 | 249 | } |
@@ -253,18 +253,18 @@ discard block |
||
253 | 253 | * @param string $version |
254 | 254 | * @param boolean $hidden_endpoints |
255 | 255 | */ |
256 | - protected static function _save_ee_route_data_for_version( $version, $hidden_endpoints = false ) { |
|
256 | + protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false) { |
|
257 | 257 | $instance = self::instance(); |
258 | 258 | $routes = apply_filters( |
259 | 259 | 'EED_Core_Rest_Api__save_ee_route_data_for_version__routes', |
260 | 260 | array_replace_recursive( |
261 | - $instance->_get_config_route_data_for_version( $version, $hidden_endpoints ), |
|
262 | - $instance->_get_meta_route_data_for_version( $version, $hidden_endpoints ), |
|
263 | - $instance->_get_model_route_data_for_version( $version, $hidden_endpoints ), |
|
264 | - $instance->_get_rpc_route_data_for_version( $version, $hidden_endpoints ) |
|
261 | + $instance->_get_config_route_data_for_version($version, $hidden_endpoints), |
|
262 | + $instance->_get_meta_route_data_for_version($version, $hidden_endpoints), |
|
263 | + $instance->_get_model_route_data_for_version($version, $hidden_endpoints), |
|
264 | + $instance->_get_rpc_route_data_for_version($version, $hidden_endpoints) |
|
265 | 265 | ) |
266 | 266 | ); |
267 | - update_option( self::saved_routes_option_names . $version, $routes, true ); |
|
267 | + update_option(self::saved_routes_option_names.$version, $routes, true); |
|
268 | 268 | return $routes; |
269 | 269 | } |
270 | 270 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @throws \EE_Error |
277 | 277 | */ |
278 | 278 | public static function save_ee_routes() { |
279 | - if( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
279 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
280 | 280 | $instance = self::instance(); |
281 | 281 | $routes = apply_filters( |
282 | 282 | 'EED_Core_Rest_Api__save_ee_routes__routes', |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $instance->_register_rpc_routes() |
288 | 288 | ) |
289 | 289 | ); |
290 | - update_option( self::saved_routes_option_names, $routes, true ); |
|
290 | + update_option(self::saved_routes_option_names, $routes, true); |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | */ |
301 | 301 | protected function _register_model_routes() { |
302 | 302 | $model_routes = array( ); |
303 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
304 | - $model_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version, $hidden_endpoint ); |
|
303 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
304 | + $model_routes[EED_Core_Rest_Api::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint); |
|
305 | 305 | } |
306 | 306 | return $model_routes; |
307 | 307 | } |
@@ -312,30 +312,30 @@ discard block |
||
312 | 312 | * @param boolean $hidden_endpoint |
313 | 313 | * @return array |
314 | 314 | */ |
315 | - protected function _get_model_route_data_for_version( $version, $hidden_endpoint = false ) { |
|
316 | - $model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info( $version ); |
|
315 | + protected function _get_model_route_data_for_version($version, $hidden_endpoint = false) { |
|
316 | + $model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info($version); |
|
317 | 317 | $models_to_register = apply_filters( |
318 | 318 | 'FHEE__EED_Core_REST_API___register_model_routes', |
319 | 319 | $model_version_info->models_for_requested_version() |
320 | 320 | ); |
321 | 321 | //let's not bother having endpoints for extra metas |
322 | - unset( $models_to_register['Extra_Meta'], $models_to_register['Extra_Join'] ); |
|
322 | + unset($models_to_register['Extra_Meta'], $models_to_register['Extra_Join']); |
|
323 | 323 | $model_routes = array(); |
324 | - foreach ( $models_to_register as $model_name => $model_classname ) { |
|
325 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
324 | + foreach ($models_to_register as $model_name => $model_classname) { |
|
325 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
326 | 326 | //yes we could just register one route for ALL models, but then they wouldn't show up in the index |
327 | - $plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name ); |
|
328 | - $singular_model_route = $plural_model_route . '/(?P<id>\d+)' ; |
|
329 | - $model_routes[ $plural_model_route ] = array( |
|
327 | + $plural_model_route = EEH_Inflector::pluralize_and_lower($model_name); |
|
328 | + $singular_model_route = $plural_model_route.'/(?P<id>\d+)'; |
|
329 | + $model_routes[$plural_model_route] = array( |
|
330 | 330 | array( |
331 | 331 | 'callback' => array( |
332 | 332 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
333 | 333 | 'handle_request_get_all' ), |
334 | 334 | 'methods' => WP_REST_Server::READABLE, |
335 | 335 | 'hidden_endpoint' => $hidden_endpoint, |
336 | - 'args' => $this->_get_read_query_params( $model, $version ), |
|
336 | + 'args' => $this->_get_read_query_params($model, $version), |
|
337 | 337 | '_links' => array( |
338 | - 'self' => rest_url( EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route ), |
|
338 | + 'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace.$version.$singular_model_route), |
|
339 | 339 | ) |
340 | 340 | ), |
341 | 341 | // array( |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | // 'hidden_endpoint' => $hidden_endpoint |
347 | 347 | // ) |
348 | 348 | ); |
349 | - $model_routes[ $singular_model_route ] = array( |
|
349 | + $model_routes[$singular_model_route] = array( |
|
350 | 350 | array( |
351 | 351 | 'callback' => array( |
352 | 352 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
353 | 353 | 'handle_request_get_one' ), |
354 | 354 | 'methods' => WP_REST_Server::READABLE, |
355 | 355 | 'hidden_endpoint' => $hidden_endpoint, |
356 | - 'args' => $this->_get_response_selection_query_params( $model, $version) |
|
356 | + 'args' => $this->_get_response_selection_query_params($model, $version) |
|
357 | 357 | ), |
358 | 358 | // array( |
359 | 359 | // 'callback' => array( |
@@ -364,19 +364,19 @@ discard block |
||
364 | 364 | // ), |
365 | 365 | ); |
366 | 366 | //@todo: also handle DELETE for a single item |
367 | - foreach ( $model->relation_settings() as $relation_name => $relation_obj ) { |
|
367 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
368 | 368 | $related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name( |
369 | 369 | $relation_name, |
370 | 370 | $relation_obj |
371 | 371 | ); |
372 | - $model_routes[ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array( |
|
372 | + $model_routes[$singular_model_route.'/'.$related_model_name_endpoint_part] = array( |
|
373 | 373 | array( |
374 | 374 | 'callback' => array( |
375 | 375 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
376 | 376 | 'handle_request_get_related' ), |
377 | 377 | 'methods' => WP_REST_Server::READABLE, |
378 | 378 | 'hidden_endpoint' => $hidden_endpoint, |
379 | - 'args' => $this->_get_read_query_params( $relation_obj->get_other_model(), $version ), |
|
379 | + 'args' => $this->_get_read_query_params($relation_obj->get_other_model(), $version), |
|
380 | 380 | ), |
381 | 381 | // array( |
382 | 382 | // 'callback' => array( |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | */ |
400 | 400 | protected function _register_rpc_routes() { |
401 | 401 | $routes = array(); |
402 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
403 | - $routes[ self::ee_api_namespace . $version ] = $this->_get_rpc_route_data_for_version( $version, $hidden_endpoint ); |
|
402 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
403 | + $routes[self::ee_api_namespace.$version] = $this->_get_rpc_route_data_for_version($version, $hidden_endpoint); |
|
404 | 404 | } |
405 | 405 | return $routes; |
406 | 406 | } |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | * @param boolean $hidden_endpoint |
412 | 412 | * @return array |
413 | 413 | */ |
414 | - protected function _get_rpc_route_data_for_version( $version, $hidden_endpoint = false ) { |
|
414 | + protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false) { |
|
415 | 415 | $this_versions_routes = array(); |
416 | 416 | //checkin endpoint |
417 | - $this_versions_routes[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] = array( |
|
417 | + $this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array( |
|
418 | 418 | array( |
419 | 419 | 'callback' => array( |
420 | 420 | 'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin', |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | 'force' => array( |
426 | 426 | 'required' => false, |
427 | 427 | 'default' => false, |
428 | - 'description' => __( 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso' ) |
|
428 | + 'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso') |
|
429 | 429 | ) |
430 | 430 | ) |
431 | 431 | ) |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * @param string $version |
445 | 445 | * @return array |
446 | 446 | */ |
447 | - protected function _get_response_selection_query_params( \EEM_Base $model, $version ) { |
|
447 | + protected function _get_response_selection_query_params(\EEM_Base $model, $version) { |
|
448 | 448 | return apply_filters( |
449 | 449 | 'FHEE__EED_Core_Rest_Api___get_response_selection_query_params', |
450 | 450 | array( |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | 'calculate' => array( |
456 | 456 | 'required' => false, |
457 | 457 | 'default' => '', |
458 | - 'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model( $model ) |
|
458 | + 'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model($model) |
|
459 | 459 | ) |
460 | 460 | ), |
461 | 461 | $model, |
@@ -473,13 +473,13 @@ discard block |
||
473 | 473 | * @return array describing the args acceptable when querying this model |
474 | 474 | * @throws \EE_Error |
475 | 475 | */ |
476 | - protected function _get_read_query_params( \EEM_Base $model, $version ) { |
|
476 | + protected function _get_read_query_params(\EEM_Base $model, $version) { |
|
477 | 477 | $default_orderby = array(); |
478 | - foreach( $model->get_combined_primary_key_fields() as $key_field ) { |
|
479 | - $default_orderby[ $key_field->get_name() ] = 'ASC'; |
|
478 | + foreach ($model->get_combined_primary_key_fields() as $key_field) { |
|
479 | + $default_orderby[$key_field->get_name()] = 'ASC'; |
|
480 | 480 | } |
481 | 481 | return array_merge( |
482 | - $this->_get_response_selection_query_params( $model, $version ), |
|
482 | + $this->_get_response_selection_query_params($model, $version), |
|
483 | 483 | array( |
484 | 484 | 'where' => array( |
485 | 485 | 'required' => false, |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | */ |
517 | 517 | protected function _register_config_routes() { |
518 | 518 | $config_routes = array(); |
519 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
520 | - $config_routes[ self::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version, $hidden_endpoint ); |
|
519 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
520 | + $config_routes[self::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint); |
|
521 | 521 | } |
522 | 522 | return $config_routes; |
523 | 523 | } |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | * @param boolean $hidden_endpoint |
529 | 529 | * @return array |
530 | 530 | */ |
531 | - protected function _get_config_route_data_for_version( $version, $hidden_endpoint ) { |
|
531 | + protected function _get_config_route_data_for_version($version, $hidden_endpoint) { |
|
532 | 532 | return array( |
533 | 533 | 'config' => array( |
534 | 534 | array( |
@@ -549,8 +549,8 @@ discard block |
||
549 | 549 | */ |
550 | 550 | protected function _register_meta_routes() { |
551 | 551 | $meta_routes = array(); |
552 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
553 | - $meta_routes[ self::ee_api_namespace . $version ] = $this->_get_meta_route_data_for_version( $version, $hidden_endpoint ); |
|
552 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
553 | + $meta_routes[self::ee_api_namespace.$version] = $this->_get_meta_route_data_for_version($version, $hidden_endpoint); |
|
554 | 554 | } |
555 | 555 | return $meta_routes; |
556 | 556 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | * @param boolean $hidden_endpoint |
562 | 562 | * @return array |
563 | 563 | */ |
564 | - protected function _get_meta_route_data_for_version( $version, $hidden_endpoint = false ) { |
|
564 | + protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false) { |
|
565 | 565 | return array( |
566 | 566 | 'resources' => array( |
567 | 567 | array( |
@@ -584,13 +584,13 @@ discard block |
||
584 | 584 | * @return array |
585 | 585 | * @throws \EE_Error |
586 | 586 | */ |
587 | - public static function hide_old_endpoints( $route_data ) { |
|
588 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
589 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
590 | - foreach( $routes as $route ) { |
|
591 | - if( $route[ 'hidden_endpoint' ] ) { |
|
592 | - $full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' ); |
|
593 | - unset( $route_data[ $full_route ] ); |
|
587 | + public static function hide_old_endpoints($route_data) { |
|
588 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
589 | + foreach ($relative_urls as $endpoint => $routes) { |
|
590 | + foreach ($routes as $route) { |
|
591 | + if ($route['hidden_endpoint']) { |
|
592 | + $full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/'); |
|
593 | + unset($route_data[$full_route]); |
|
594 | 594 | } |
595 | 595 | } |
596 | 596 | } |
@@ -629,8 +629,8 @@ discard block |
||
629 | 629 | */ |
630 | 630 | public static function latest_rest_api_version() { |
631 | 631 | $versions_served = \EED_Core_Rest_Api::versions_served(); |
632 | - $versions_served_keys = array_keys( $versions_served ); |
|
633 | - return end( $versions_served_keys ); |
|
632 | + $versions_served_keys = array_keys($versions_served); |
|
633 | + return end($versions_served_keys); |
|
634 | 634 | } |
635 | 635 | |
636 | 636 | /** |
@@ -644,32 +644,32 @@ discard block |
||
644 | 644 | public static function versions_served() { |
645 | 645 | $versions_served = array(); |
646 | 646 | $possibly_served_versions = EED_Core_Rest_Api::version_compatibilities(); |
647 | - $lowest_compatible_version = end( $possibly_served_versions); |
|
648 | - reset( $possibly_served_versions ); |
|
649 | - $versions_served_historically = array_keys( $possibly_served_versions ); |
|
650 | - $latest_version = end( $versions_served_historically ); |
|
651 | - reset( $versions_served_historically ); |
|
647 | + $lowest_compatible_version = end($possibly_served_versions); |
|
648 | + reset($possibly_served_versions); |
|
649 | + $versions_served_historically = array_keys($possibly_served_versions); |
|
650 | + $latest_version = end($versions_served_historically); |
|
651 | + reset($versions_served_historically); |
|
652 | 652 | //for each version of core we have ever served: |
653 | - foreach ( $versions_served_historically as $key_versioned_endpoint ) { |
|
653 | + foreach ($versions_served_historically as $key_versioned_endpoint) { |
|
654 | 654 | //if it's not above the current core version, and it's compatible with the current version of core |
655 | - if( $key_versioned_endpoint === $latest_version ) { |
|
655 | + if ($key_versioned_endpoint === $latest_version) { |
|
656 | 656 | //don't hide the latest version in the index |
657 | - $versions_served[ $key_versioned_endpoint ] = false; |
|
658 | - } else if( |
|
657 | + $versions_served[$key_versioned_endpoint] = false; |
|
658 | + } else if ( |
|
659 | 659 | $key_versioned_endpoint >= $lowest_compatible_version |
660 | 660 | && $key_versioned_endpoint < EED_Core_Rest_Api::core_version() |
661 | 661 | ) { |
662 | 662 | //include, but hide, previous versions which are still supported |
663 | - $versions_served[ $key_versioned_endpoint ] = true; |
|
664 | - } elseif( |
|
663 | + $versions_served[$key_versioned_endpoint] = true; |
|
664 | + } elseif ( |
|
665 | 665 | apply_filters( |
666 | 666 | 'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions', |
667 | 667 | false, |
668 | 668 | $possibly_served_versions |
669 | 669 | ) |
670 | - ){ |
|
670 | + ) { |
|
671 | 671 | //if a version is no longer supported, don't include it in index or list of versions served |
672 | - $versions_served[ $key_versioned_endpoint ] = true; |
|
672 | + $versions_served[$key_versioned_endpoint] = true; |
|
673 | 673 | } |
674 | 674 | } |
675 | 675 | return $versions_served; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | * @return string |
683 | 683 | */ |
684 | 684 | public static function core_version() { |
685 | - return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) ); |
|
685 | + return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3))); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | /** |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | * @param WP $WP |
708 | 708 | * @return void |
709 | 709 | */ |
710 | - public function run( $WP ) { |
|
710 | + public function run($WP) { |
|
711 | 711 | |
712 | 712 | } |
713 | 713 |
@@ -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 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @return EED_Single_Page_Checkout |
54 | 54 | */ |
55 | 55 | public static function instance() { |
56 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
57 | - return parent::get_instance( __CLASS__ ); |
|
56 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
57 | + return parent::get_instance(__CLASS__); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -99,21 +99,21 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public static function set_hooks_admin() { |
101 | 101 | EED_Single_Page_Checkout::set_definitions(); |
102 | - if ( defined( 'DOING_AJAX' )) { |
|
102 | + if (defined('DOING_AJAX')) { |
|
103 | 103 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
104 | 104 | ob_start(); |
105 | 105 | EED_Single_Page_Checkout::load_reg_steps(); |
106 | 106 | } else { |
107 | 107 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
108 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
108 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
109 | 109 | } |
110 | 110 | // set ajax hooks |
111 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
112 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
113 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
114 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
115 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
116 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
111 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
112 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
113 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
114 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
115 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
116 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | * @param string $ajax_action |
125 | 125 | * @throws EE_Error |
126 | 126 | */ |
127 | - public static function process_ajax_request( $ajax_action ) { |
|
128 | - EE_Registry::instance()->request()->set( 'action', $ajax_action ); |
|
127 | + public static function process_ajax_request($ajax_action) { |
|
128 | + EE_Registry::instance()->request()->set('action', $ajax_action); |
|
129 | 129 | EED_Single_Page_Checkout::instance()->_initialize(); |
130 | 130 | } |
131 | 131 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @throws EE_Error |
138 | 138 | */ |
139 | 139 | public static function display_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @throws EE_Error |
149 | 149 | */ |
150 | 150 | public static function process_reg_step() { |
151 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
151 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @throws EE_Error |
160 | 160 | */ |
161 | 161 | public static function update_reg_step() { |
162 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
162 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @throws EE_Error |
173 | 173 | */ |
174 | 174 | public static function update_checkout() { |
175 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
175 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -185,14 +185,14 @@ discard block |
||
185 | 185 | * @throws EE_Error |
186 | 186 | */ |
187 | 187 | public static function set_definitions() { |
188 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
189 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
190 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
191 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
192 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
193 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
194 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
195 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
188 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
189 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
190 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
191 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
192 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
193 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
194 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
195 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public static function load_reg_steps() { |
209 | 209 | static $reg_steps_loaded = FALSE; |
210 | - if ( $reg_steps_loaded ) { |
|
210 | + if ($reg_steps_loaded) { |
|
211 | 211 | return; |
212 | 212 | } |
213 | 213 | // filter list of reg_steps |
@@ -216,24 +216,24 @@ discard block |
||
216 | 216 | EED_Single_Page_Checkout::get_reg_steps() |
217 | 217 | ); |
218 | 218 | // sort by key (order) |
219 | - ksort( $reg_steps_to_load ); |
|
219 | + ksort($reg_steps_to_load); |
|
220 | 220 | // loop through folders |
221 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
221 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
222 | 222 | // we need a |
223 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
223 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
224 | 224 | // copy over to the reg_steps_array |
225 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
225 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
226 | 226 | // register custom key route for each reg step |
227 | 227 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
228 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
228 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
229 | 229 | // add AJAX or other hooks |
230 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
230 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
231 | 231 | // setup autoloaders if necessary |
232 | 232 | $reg_step_class_name = $reg_step['class_name']; |
233 | - if ( ! class_exists( $reg_step_class_name )) { |
|
234 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
233 | + if ( ! class_exists($reg_step_class_name)) { |
|
234 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
235 | 235 | } |
236 | - if ( is_subclass_of( $reg_step_class_name, 'EE_SPCO_Reg_Step' )) { |
|
236 | + if (is_subclass_of($reg_step_class_name, 'EE_SPCO_Reg_Step')) { |
|
237 | 237 | /** @var EE_SPCO_Reg_Step $reg_step_class_name */ |
238 | 238 | $reg_step_class_name::set_hooks(); |
239 | 239 | } |
@@ -254,28 +254,28 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public static function get_reg_steps() { |
256 | 256 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
257 | - if ( empty( $reg_steps )) { |
|
257 | + if (empty($reg_steps)) { |
|
258 | 258 | $reg_steps = array( |
259 | 259 | 10 => array( |
260 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
260 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
261 | 261 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
262 | 262 | 'slug' => 'attendee_information', |
263 | 263 | 'has_hooks' => FALSE |
264 | 264 | ), |
265 | 265 | 20 => array( |
266 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
266 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
267 | 267 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
268 | 268 | 'slug' => 'registration_confirmation', |
269 | 269 | 'has_hooks' => FALSE |
270 | 270 | ), |
271 | 271 | 30 => array( |
272 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
272 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
273 | 273 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
274 | 274 | 'slug' => 'payment_options', |
275 | 275 | 'has_hooks' => TRUE |
276 | 276 | ), |
277 | 277 | 999 => array( |
278 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
278 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
279 | 279 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
280 | 280 | 'slug' => 'finalize_registration', |
281 | 281 | 'has_hooks' => FALSE |
@@ -296,9 +296,9 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public static function registration_checkout_for_admin() { |
298 | 298 | EED_Single_Page_Checkout::load_reg_steps(); |
299 | - EE_Registry::instance()->request()->set( 'step', 'attendee_information' ); |
|
300 | - EE_Registry::instance()->request()->set( 'action', 'display_spco_reg_step' ); |
|
301 | - EE_Registry::instance()->request()->set( 'process_form_submission', false ); |
|
299 | + EE_Registry::instance()->request()->set('step', 'attendee_information'); |
|
300 | + EE_Registry::instance()->request()->set('action', 'display_spco_reg_step'); |
|
301 | + EE_Registry::instance()->request()->set('process_form_submission', false); |
|
302 | 302 | EED_Single_Page_Checkout::instance()->_initialize(); |
303 | 303 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
304 | 304 | return EE_Registry::instance()->REQ->get_output(); |
@@ -315,15 +315,15 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public static function process_registration_from_admin() { |
317 | 317 | EED_Single_Page_Checkout::load_reg_steps(); |
318 | - EE_Registry::instance()->request()->set( 'step', 'attendee_information' ); |
|
319 | - EE_Registry::instance()->request()->set( 'action', 'process_reg_step' ); |
|
320 | - EE_Registry::instance()->request()->set( 'process_form_submission', true ); |
|
318 | + EE_Registry::instance()->request()->set('step', 'attendee_information'); |
|
319 | + EE_Registry::instance()->request()->set('action', 'process_reg_step'); |
|
320 | + EE_Registry::instance()->request()->set('process_form_submission', true); |
|
321 | 321 | EED_Single_Page_Checkout::instance()->_initialize(); |
322 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
323 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
324 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
325 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
326 | - if ( $final_reg_step->process_reg_step() ) { |
|
322 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
323 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
324 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
325 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
326 | + if ($final_reg_step->process_reg_step()) { |
|
327 | 327 | $final_reg_step->set_completed(); |
328 | 328 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
329 | 329 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -343,11 +343,11 @@ discard block |
||
343 | 343 | * @return void |
344 | 344 | * @throws EE_Error |
345 | 345 | */ |
346 | - public function run( $WP_Query ) { |
|
346 | + public function run($WP_Query) { |
|
347 | 347 | if ( |
348 | 348 | $WP_Query instanceof WP_Query |
349 | 349 | && $WP_Query->is_main_query() |
350 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
350 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
351 | 351 | ) { |
352 | 352 | $this->_initialize(); |
353 | 353 | } |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | * @return void |
364 | 364 | * @throws EE_Error |
365 | 365 | */ |
366 | - public static function init( $WP_Query ) { |
|
367 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
366 | + public static function init($WP_Query) { |
|
367 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | |
@@ -378,34 +378,34 @@ discard block |
||
378 | 378 | */ |
379 | 379 | private function _initialize() { |
380 | 380 | // ensure SPCO doesn't run twice |
381 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
381 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
382 | 382 | return; |
383 | 383 | } |
384 | 384 | try { |
385 | 385 | // setup the EE_Checkout object |
386 | 386 | $this->checkout = $this->_initialize_checkout(); |
387 | 387 | // filter checkout |
388 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
388 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
389 | 389 | // get the $_GET |
390 | 390 | $this->_get_request_vars(); |
391 | 391 | // filter continue_reg |
392 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
392 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
393 | 393 | // load the reg steps array |
394 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
394 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
395 | 395 | EED_Single_Page_Checkout::$_initialized = true; |
396 | 396 | return; |
397 | 397 | } |
398 | 398 | // set the current step |
399 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
399 | + $this->checkout->set_current_step($this->checkout->step); |
|
400 | 400 | // and the next step |
401 | 401 | $this->checkout->set_next_step(); |
402 | 402 | // was there already a valid transaction in the checkout from the session ? |
403 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
403 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
404 | 404 | // get transaction from db or session |
405 | 405 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
406 | 406 | ? $this->_get_transaction_and_cart_for_previous_visit() |
407 | 407 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
408 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
408 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
409 | 409 | // add some style and make it dance |
410 | 410 | $this->checkout->transaction = EE_Transaction::new_instance(); |
411 | 411 | $this->add_styles_and_scripts(); |
@@ -413,10 +413,10 @@ discard block |
||
413 | 413 | return; |
414 | 414 | } |
415 | 415 | // and the registrations for the transaction |
416 | - $this->_get_registrations( $this->checkout->transaction ); |
|
416 | + $this->_get_registrations($this->checkout->transaction); |
|
417 | 417 | } |
418 | 418 | // verify that everything has been setup correctly |
419 | - if ( ! $this->_final_verifications() ) { |
|
419 | + if ( ! $this->_final_verifications()) { |
|
420 | 420 | EED_Single_Page_Checkout::$_initialized = true; |
421 | 421 | return; |
422 | 422 | } |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | // set no cache headers and constants |
442 | 442 | EE_System::do_not_cache(); |
443 | 443 | // add anchor |
444 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
445 | - } catch ( Exception $e ) { |
|
446 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
444 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
445 | + } catch (Exception $e) { |
|
446 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
447 | 447 | } |
448 | 448 | } |
449 | 449 | |
@@ -461,20 +461,20 @@ discard block |
||
461 | 461 | // look in session for existing checkout |
462 | 462 | $checkout = EE_Registry::instance()->SSN->checkout(); |
463 | 463 | // verify |
464 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
464 | + if ( ! $checkout instanceof EE_Checkout) { |
|
465 | 465 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
466 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
466 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
467 | 467 | } else { |
468 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
468 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
469 | 469 | $this->unlock_transaction(); |
470 | - wp_safe_redirect( $checkout->redirect_url ); |
|
470 | + wp_safe_redirect($checkout->redirect_url); |
|
471 | 471 | exit(); |
472 | 472 | } |
473 | 473 | } |
474 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
474 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
475 | 475 | // verify again |
476 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
477 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
476 | + if ( ! $checkout instanceof EE_Checkout) { |
|
477 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
478 | 478 | } |
479 | 479 | // reset anything that needs a clean slate for each request |
480 | 480 | $checkout->reset_for_current_request(); |
@@ -492,24 +492,24 @@ discard block |
||
492 | 492 | */ |
493 | 493 | private function _get_request_vars() { |
494 | 494 | //make sure this request is marked as belonging to EE |
495 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
495 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
496 | 496 | // which step is being requested ? |
497 | - $this->checkout->step = EE_Registry::instance()->request()->get( 'step', $this->_get_first_step() ); |
|
497 | + $this->checkout->step = EE_Registry::instance()->request()->get('step', $this->_get_first_step()); |
|
498 | 498 | // which step is being edited ? |
499 | - $this->checkout->edit_step = EE_Registry::instance()->request()->get( 'edit_step', '' ); |
|
499 | + $this->checkout->edit_step = EE_Registry::instance()->request()->get('edit_step', ''); |
|
500 | 500 | // and what we're doing on the current step |
501 | - $this->checkout->action = EE_Registry::instance()->request()->get( 'action', 'display_spco_reg_step' ); |
|
501 | + $this->checkout->action = EE_Registry::instance()->request()->get('action', 'display_spco_reg_step'); |
|
502 | 502 | // returning to edit ? |
503 | - $this->checkout->reg_url_link = EE_Registry::instance()->request()->get( 'e_reg_url_link', '' ); |
|
503 | + $this->checkout->reg_url_link = EE_Registry::instance()->request()->get('e_reg_url_link', ''); |
|
504 | 504 | // or some other kind of revisit ? |
505 | - $this->checkout->revisit = EE_Registry::instance()->request()->get( 'revisit', FALSE ); |
|
505 | + $this->checkout->revisit = EE_Registry::instance()->request()->get('revisit', FALSE); |
|
506 | 506 | // and whether or not to generate a reg form for this request |
507 | - $this->checkout->generate_reg_form = EE_Registry::instance()->request()->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
507 | + $this->checkout->generate_reg_form = EE_Registry::instance()->request()->get('generate_reg_form', TRUE); // TRUE FALSE |
|
508 | 508 | // and whether or not to process a reg form submission for this request |
509 | - $this->checkout->process_form_submission = EE_Registry::instance()->request()->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
509 | + $this->checkout->process_form_submission = EE_Registry::instance()->request()->get('process_form_submission', FALSE); // TRUE FALSE |
|
510 | 510 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
511 | 511 | ? $this->checkout->process_form_submission |
512 | - : false; // true false |
|
512 | + : false; // true false |
|
513 | 513 | //$this->_display_request_vars(); |
514 | 514 | } |
515 | 515 | |
@@ -522,17 +522,17 @@ discard block |
||
522 | 522 | * @return void |
523 | 523 | */ |
524 | 524 | protected function _display_request_vars() { |
525 | - if ( ! WP_DEBUG ) { |
|
525 | + if ( ! WP_DEBUG) { |
|
526 | 526 | return; |
527 | 527 | } |
528 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
529 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
530 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
531 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
532 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
533 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
534 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
535 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
528 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
529 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
530 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
531 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
532 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
533 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
534 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
535 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | |
@@ -546,8 +546,8 @@ discard block |
||
546 | 546 | * @throws EE_Error |
547 | 547 | */ |
548 | 548 | private function _get_first_step() { |
549 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
550 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
549 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
550 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | |
@@ -563,27 +563,27 @@ discard block |
||
563 | 563 | private function _load_and_instantiate_reg_steps() { |
564 | 564 | // have reg_steps already been instantiated ? |
565 | 565 | if ( |
566 | - empty( $this->checkout->reg_steps ) || |
|
567 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
566 | + empty($this->checkout->reg_steps) || |
|
567 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
568 | 568 | ) { |
569 | 569 | // if not, then loop through raw reg steps array |
570 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
571 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
570 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
571 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
572 | 572 | return false; |
573 | 573 | } |
574 | 574 | } |
575 | 575 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
576 | 576 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
577 | 577 | // skip the registration_confirmation page ? |
578 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
578 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
579 | 579 | // just remove it from the reg steps array |
580 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
580 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
581 | 581 | } else if ( |
582 | - isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
582 | + isset($this->checkout->reg_steps['registration_confirmation']) |
|
583 | 583 | && EE_Registry::instance()->CFG->registration->reg_confirmation_last |
584 | 584 | ) { |
585 | 585 | // set the order to something big like 100 |
586 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
586 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
587 | 587 | } |
588 | 588 | // filter the array for good luck |
589 | 589 | $this->checkout->reg_steps = apply_filters( |
@@ -593,13 +593,13 @@ discard block |
||
593 | 593 | // finally re-sort based on the reg step class order properties |
594 | 594 | $this->checkout->sort_reg_steps(); |
595 | 595 | } else { |
596 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
596 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
597 | 597 | // set all current step stati to FALSE |
598 | - $reg_step->set_is_current_step( FALSE ); |
|
598 | + $reg_step->set_is_current_step(FALSE); |
|
599 | 599 | } |
600 | 600 | } |
601 | - if ( empty( $this->checkout->reg_steps )) { |
|
602 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
601 | + if (empty($this->checkout->reg_steps)) { |
|
602 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
603 | 603 | return false; |
604 | 604 | } |
605 | 605 | // make reg step details available to JS |
@@ -618,10 +618,10 @@ discard block |
||
618 | 618 | * @return bool |
619 | 619 | * @throws EE_Error |
620 | 620 | */ |
621 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
621 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
622 | 622 | |
623 | 623 | // we need a file_path, class_name, and slug to add a reg step |
624 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
624 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
625 | 625 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
626 | 626 | if ( |
627 | 627 | $this->checkout->reg_url_link |
@@ -639,26 +639,26 @@ discard block |
||
639 | 639 | FALSE |
640 | 640 | ); |
641 | 641 | // did we gets the goods ? |
642 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
642 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
643 | 643 | // set reg step order based on config |
644 | - $reg_step_obj->set_order( $order ); |
|
644 | + $reg_step_obj->set_order($order); |
|
645 | 645 | // add instantiated reg step object to the master reg steps array |
646 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
646 | + $this->checkout->add_reg_step($reg_step_obj); |
|
647 | 647 | } else { |
648 | 648 | EE_Error::add_error( |
649 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
649 | + __('The current step could not be set.', 'event_espresso'), |
|
650 | 650 | __FILE__, __FUNCTION__, __LINE__ |
651 | 651 | ); |
652 | 652 | return false; |
653 | 653 | } |
654 | 654 | } else { |
655 | - if ( WP_DEBUG ) { |
|
655 | + if (WP_DEBUG) { |
|
656 | 656 | EE_Error::add_error( |
657 | 657 | sprintf( |
658 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
659 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
660 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
661 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
658 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
659 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
660 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
661 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
662 | 662 | '<ul>', |
663 | 663 | '<li>', |
664 | 664 | '</li>', |
@@ -683,16 +683,16 @@ discard block |
||
683 | 683 | */ |
684 | 684 | private function _get_transaction_and_cart_for_previous_visit() { |
685 | 685 | /** @var $TXN_model EEM_Transaction */ |
686 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
686 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
687 | 687 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
688 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
688 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
689 | 689 | // verify transaction |
690 | - if ( $transaction instanceof EE_Transaction ) { |
|
690 | + if ($transaction instanceof EE_Transaction) { |
|
691 | 691 | // and get the cart that was used for that transaction |
692 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
692 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
693 | 693 | return $transaction; |
694 | 694 | } else { |
695 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
695 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
696 | 696 | return NULL; |
697 | 697 | } |
698 | 698 | } |
@@ -707,8 +707,8 @@ discard block |
||
707 | 707 | * @return EE_Cart |
708 | 708 | * @throws EE_Error |
709 | 709 | */ |
710 | - private function _get_cart_for_transaction( $transaction ) { |
|
711 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
710 | + private function _get_cart_for_transaction($transaction) { |
|
711 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
712 | 712 | } |
713 | 713 | |
714 | 714 | |
@@ -720,8 +720,8 @@ discard block |
||
720 | 720 | * @param EE_Transaction $transaction |
721 | 721 | * @return EE_Cart |
722 | 722 | */ |
723 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
724 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
723 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
724 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | |
@@ -737,17 +737,17 @@ discard block |
||
737 | 737 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
738 | 738 | // if there's no transaction, then this is the FIRST visit to SPCO |
739 | 739 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
740 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
740 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
741 | 741 | // and then create a new transaction |
742 | 742 | $transaction = $this->_initialize_transaction(); |
743 | 743 | // verify transaction |
744 | - if ( $transaction instanceof EE_Transaction ) { |
|
744 | + if ($transaction instanceof EE_Transaction) { |
|
745 | 745 | // save it so that we have an ID for other objects to use |
746 | 746 | $transaction->save(); |
747 | 747 | // and save TXN data to the cart |
748 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
748 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
749 | 749 | } else { |
750 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
750 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
751 | 751 | } |
752 | 752 | return $transaction; |
753 | 753 | } |
@@ -767,15 +767,15 @@ discard block |
||
767 | 767 | // grab the cart grand total |
768 | 768 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
769 | 769 | // create new TXN |
770 | - return EE_Transaction::new_instance( array( |
|
770 | + return EE_Transaction::new_instance(array( |
|
771 | 771 | 'TXN_timestamp' => time(), |
772 | 772 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
773 | 773 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
774 | 774 | 'TXN_paid' => 0, |
775 | 775 | 'STS_ID' => EEM_Transaction::failed_status_code, |
776 | 776 | )); |
777 | - } catch( Exception $e ) { |
|
778 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
777 | + } catch (Exception $e) { |
|
778 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
779 | 779 | } |
780 | 780 | return NULL; |
781 | 781 | } |
@@ -790,25 +790,25 @@ discard block |
||
790 | 790 | * @return EE_Cart |
791 | 791 | * @throws EE_Error |
792 | 792 | */ |
793 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
793 | + private function _get_registrations(EE_Transaction $transaction) { |
|
794 | 794 | // first step: grab the registrants { : o |
795 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
795 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
796 | 796 | // verify registrations have been set |
797 | - if ( empty( $registrations )) { |
|
797 | + if (empty($registrations)) { |
|
798 | 798 | // if no cached registrations, then check the db |
799 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
799 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
800 | 800 | // still nothing ? well as long as this isn't a revisit |
801 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
801 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
802 | 802 | // generate new registrations from scratch |
803 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
803 | + $registrations = $this->_initialize_registrations($transaction); |
|
804 | 804 | } |
805 | 805 | } |
806 | 806 | // sort by their original registration order |
807 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
807 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
808 | 808 | // then loop thru the array |
809 | - foreach ( $registrations as $registration ) { |
|
809 | + foreach ($registrations as $registration) { |
|
810 | 810 | // verify each registration |
811 | - if ( $registration instanceof EE_Registration ) { |
|
811 | + if ($registration instanceof EE_Registration) { |
|
812 | 812 | // we display all attendee info for the primary registrant |
813 | 813 | if ( |
814 | 814 | $this->checkout->reg_url_link === $registration->reg_url_link() |
@@ -821,9 +821,9 @@ discard block |
||
821 | 821 | && $this->checkout->reg_url_link !== $registration->reg_url_link() |
822 | 822 | ) { |
823 | 823 | // but hide info if it doesn't belong to you |
824 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
824 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
825 | 825 | } |
826 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
826 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
827 | 827 | } |
828 | 828 | } |
829 | 829 | } |
@@ -838,17 +838,17 @@ discard block |
||
838 | 838 | * @return array |
839 | 839 | * @throws EE_Error |
840 | 840 | */ |
841 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
841 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
842 | 842 | $att_nmbr = 0; |
843 | 843 | $registrations = array(); |
844 | - if ( $transaction instanceof EE_Transaction ) { |
|
844 | + if ($transaction instanceof EE_Transaction) { |
|
845 | 845 | /** @type EE_Registration_Processor $registration_processor */ |
846 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
846 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
847 | 847 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
848 | 848 | // now let's add the cart items to the $transaction |
849 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
849 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
850 | 850 | //do the following for each ticket of this type they selected |
851 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
851 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
852 | 852 | $att_nmbr++; |
853 | 853 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
854 | 854 | $line_item, |
@@ -856,12 +856,12 @@ discard block |
||
856 | 856 | $att_nmbr, |
857 | 857 | $this->checkout->total_ticket_count |
858 | 858 | ); |
859 | - if ( $registration instanceof EE_Registration ) { |
|
860 | - $registrations[ $registration->ID() ] = $registration; |
|
859 | + if ($registration instanceof EE_Registration) { |
|
860 | + $registrations[$registration->ID()] = $registration; |
|
861 | 861 | } |
862 | 862 | } |
863 | 863 | } |
864 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
864 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
865 | 865 | } |
866 | 866 | return $registrations; |
867 | 867 | } |
@@ -876,12 +876,12 @@ discard block |
||
876 | 876 | * @param EE_Registration $reg_B |
877 | 877 | * @return array() |
878 | 878 | */ |
879 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
879 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
880 | 880 | // this shouldn't ever happen within the same TXN, but oh well |
881 | - if ( $reg_A->count() === $reg_B->count() ) { |
|
881 | + if ($reg_A->count() === $reg_B->count()) { |
|
882 | 882 | return 0; |
883 | 883 | } |
884 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
884 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | |
@@ -896,21 +896,21 @@ discard block |
||
896 | 896 | */ |
897 | 897 | private function _final_verifications() { |
898 | 898 | // filter checkout |
899 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
899 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
900 | 900 | //verify that current step is still set correctly |
901 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
902 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
901 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
902 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
903 | 903 | return false; |
904 | 904 | } |
905 | 905 | // if returning to SPCO, then verify that primary registrant is set |
906 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
906 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
907 | 907 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
908 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
909 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
908 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
909 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
910 | 910 | return false; |
911 | 911 | } |
912 | 912 | $valid_registrant = null; |
913 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
913 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
914 | 914 | if ( |
915 | 915 | $registration instanceof EE_Registration |
916 | 916 | && $registration->reg_url_link() === $this->checkout->reg_url_link |
@@ -918,9 +918,9 @@ discard block |
||
918 | 918 | $valid_registrant = $registration; |
919 | 919 | } |
920 | 920 | } |
921 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
921 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
922 | 922 | // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? |
923 | - if ( EED_Single_Page_Checkout::$_checkout_verified ) { |
|
923 | + if (EED_Single_Page_Checkout::$_checkout_verified) { |
|
924 | 924 | // clear the session, mark the checkout as unverified, and try again |
925 | 925 | EE_Registry::instance()->SSN->clear_session(); |
926 | 926 | EED_Single_Page_Checkout::$_initialized = false; |
@@ -929,13 +929,13 @@ discard block |
||
929 | 929 | EE_Error::reset_notices(); |
930 | 930 | return false; |
931 | 931 | } |
932 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
932 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
933 | 933 | return false; |
934 | 934 | } |
935 | 935 | } |
936 | 936 | // now that things have been kinda sufficiently verified, |
937 | 937 | // let's add the checkout to the session so that's available other systems |
938 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
938 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
939 | 939 | return true; |
940 | 940 | } |
941 | 941 | |
@@ -950,15 +950,15 @@ discard block |
||
950 | 950 | * @param bool $reinitializing |
951 | 951 | * @throws \EE_Error |
952 | 952 | */ |
953 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
954 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
953 | + private function _initialize_reg_steps($reinitializing = false) { |
|
954 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
955 | 955 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
956 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
957 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
956 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
957 | + if ( ! $reg_step->initialize_reg_step()) { |
|
958 | 958 | // if not initialized then maybe this step is being removed... |
959 | - if ( ! $reinitializing && $reg_step->is_current_step() ) { |
|
959 | + if ( ! $reinitializing && $reg_step->is_current_step()) { |
|
960 | 960 | // if it was the current step, then we need to start over here |
961 | - $this->_initialize_reg_steps( true ); |
|
961 | + $this->_initialize_reg_steps(true); |
|
962 | 962 | return; |
963 | 963 | } |
964 | 964 | continue; |
@@ -967,13 +967,13 @@ discard block |
||
967 | 967 | $reg_step->enqueue_styles_and_scripts(); |
968 | 968 | // i18n |
969 | 969 | $reg_step->translate_js_strings(); |
970 | - if ( $reg_step->is_current_step() ) { |
|
970 | + if ($reg_step->is_current_step()) { |
|
971 | 971 | // the text that appears on the reg step form submit button |
972 | 972 | $reg_step->set_submit_button_text(); |
973 | 973 | } |
974 | 974 | } |
975 | 975 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
976 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
976 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | |
@@ -986,43 +986,43 @@ discard block |
||
986 | 986 | */ |
987 | 987 | private function _check_form_submission() { |
988 | 988 | //does this request require the reg form to be generated ? |
989 | - if ( $this->checkout->generate_reg_form ) { |
|
989 | + if ($this->checkout->generate_reg_form) { |
|
990 | 990 | // ever heard that song by Blue Rodeo ? |
991 | 991 | try { |
992 | 992 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
993 | 993 | // if not displaying a form, then check for form submission |
994 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
994 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
995 | 995 | // clear out any old data in case this step is being run again |
996 | - $this->checkout->current_step->set_valid_data( array() ); |
|
996 | + $this->checkout->current_step->set_valid_data(array()); |
|
997 | 997 | // capture submitted form data |
998 | 998 | $this->checkout->current_step->reg_form->receive_form_submission( |
999 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->request()->params(), $this->checkout ) |
|
999 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->request()->params(), $this->checkout) |
|
1000 | 1000 | ); |
1001 | 1001 | // validate submitted form data |
1002 | - if ( ! $this->checkout->continue_reg || ! $this->checkout->current_step->reg_form->is_valid() ) { |
|
1002 | + if ( ! $this->checkout->continue_reg || ! $this->checkout->current_step->reg_form->is_valid()) { |
|
1003 | 1003 | // thou shall not pass !!! |
1004 | 1004 | $this->checkout->continue_reg = FALSE; |
1005 | 1005 | // any form validation errors? |
1006 | - if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) { |
|
1006 | + if ($this->checkout->current_step->reg_form->submission_error_message() !== '') { |
|
1007 | 1007 | $submission_error_messages = array(); |
1008 | 1008 | // bad, bad, bad registrant |
1009 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1010 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1009 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1010 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1011 | 1011 | $submission_error_messages[] = sprintf( |
1012 | - __( '%s : %s', 'event_espresso' ), |
|
1012 | + __('%s : %s', 'event_espresso'), |
|
1013 | 1013 | $validation_error->get_form_section()->html_label_text(), |
1014 | 1014 | $validation_error->getMessage() |
1015 | 1015 | ); |
1016 | 1016 | } |
1017 | 1017 | } |
1018 | - EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1018 | + EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1019 | 1019 | } |
1020 | 1020 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1021 | 1021 | $this->go_to_next_step(); |
1022 | 1022 | return; |
1023 | 1023 | } |
1024 | 1024 | } |
1025 | - } catch( EE_Error $e ) { |
|
1025 | + } catch (EE_Error $e) { |
|
1026 | 1026 | $e->get_error(); |
1027 | 1027 | } |
1028 | 1028 | } |
@@ -1039,28 +1039,28 @@ discard block |
||
1039 | 1039 | */ |
1040 | 1040 | private function _process_form_action() { |
1041 | 1041 | // what cha wanna do? |
1042 | - if( $this->checkout->action === 'display_spco_reg_step' ) { |
|
1042 | + if ($this->checkout->action === 'display_spco_reg_step') { |
|
1043 | 1043 | // AJAX next step reg form |
1044 | 1044 | $this->checkout->redirect = false; |
1045 | - if ( EE_Registry::instance()->request()->ajax ) { |
|
1046 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1045 | + if (EE_Registry::instance()->request()->ajax) { |
|
1046 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1047 | 1047 | } |
1048 | 1048 | } else { |
1049 | 1049 | // meh... do one of those other steps first |
1050 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1050 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1051 | 1051 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1052 | 1052 | do_action( |
1053 | 1053 | "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", |
1054 | 1054 | $this->checkout->current_step |
1055 | 1055 | ); |
1056 | 1056 | // call action on current step |
1057 | - if ( $this->checkout->current_step->{$this->checkout->action}() ) { |
|
1057 | + if ($this->checkout->current_step->{$this->checkout->action}()) { |
|
1058 | 1058 | // good registrant, you get to proceed |
1059 | 1059 | if ( |
1060 | 1060 | $this->checkout->current_step->success_message() !== '' |
1061 | - && apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) |
|
1061 | + && apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false) |
|
1062 | 1062 | ) { |
1063 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
1063 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
1064 | 1064 | } |
1065 | 1065 | // pack it up, pack it in... |
1066 | 1066 | $this->_setup_redirect(); |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | } else { |
1075 | 1075 | EE_Error::add_error( |
1076 | 1076 | sprintf( |
1077 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1077 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1078 | 1078 | $this->checkout->action, |
1079 | 1079 | $this->checkout->current_step->name() |
1080 | 1080 | ), |
@@ -1101,10 +1101,10 @@ discard block |
||
1101 | 1101 | public function add_styles_and_scripts() { |
1102 | 1102 | // i18n |
1103 | 1103 | $this->translate_js_strings(); |
1104 | - if ( $this->checkout->admin_request ) { |
|
1105 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1104 | + if ($this->checkout->admin_request) { |
|
1105 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1106 | 1106 | } else { |
1107 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1107 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1108 | 1108 | } |
1109 | 1109 | } |
1110 | 1110 | |
@@ -1121,42 +1121,42 @@ discard block |
||
1121 | 1121 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1122 | 1122 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1123 | 1123 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1124 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1125 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1126 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1124 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1125 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1126 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1127 | 1127 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1128 | 1128 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1129 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1130 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1129 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1130 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1131 | 1131 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1132 | 1132 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1133 | 1133 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1134 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1135 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1136 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1137 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1138 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1139 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1140 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1141 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1142 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1143 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1144 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1145 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1146 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1147 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1134 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1135 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1136 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1137 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1138 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1139 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1140 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1141 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1142 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1143 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1144 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1145 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1146 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1147 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1148 | 1148 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1149 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1149 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1150 | 1150 | '<h4 class="important-notice">', |
1151 | 1151 | '</h4>', |
1152 | 1152 | '<br />', |
1153 | 1153 | '<p>', |
1154 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1154 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1155 | 1155 | '">', |
1156 | 1156 | '</a>', |
1157 | 1157 | '</p>' |
1158 | 1158 | ); |
1159 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1159 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | |
@@ -1169,25 +1169,25 @@ discard block |
||
1169 | 1169 | */ |
1170 | 1170 | public function enqueue_styles_and_scripts() { |
1171 | 1171 | // load css |
1172 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1173 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1172 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1173 | + wp_enqueue_style('single_page_checkout'); |
|
1174 | 1174 | // load JS |
1175 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1176 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1177 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1178 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1175 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1176 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1177 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1178 | + wp_enqueue_script('single_page_checkout'); |
|
1179 | 1179 | |
1180 | 1180 | /** |
1181 | 1181 | * global action hook for enqueueing styles and scripts with |
1182 | 1182 | * spco calls. |
1183 | 1183 | */ |
1184 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1184 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1185 | 1185 | |
1186 | 1186 | /** |
1187 | 1187 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1188 | 1188 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1189 | 1189 | */ |
1190 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1190 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1191 | 1191 | |
1192 | 1192 | } |
1193 | 1193 | |
@@ -1202,19 +1202,19 @@ discard block |
||
1202 | 1202 | */ |
1203 | 1203 | private function _display_spco_reg_form() { |
1204 | 1204 | // if registering via the admin, just display the reg form for the current step |
1205 | - if ( $this->checkout->admin_request ) { |
|
1206 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1205 | + if ($this->checkout->admin_request) { |
|
1206 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1207 | 1207 | } else { |
1208 | 1208 | // add powered by EE msg |
1209 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1209 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1210 | 1210 | |
1211 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1211 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1212 | 1212 | $cookies_not_set_msg = ''; |
1213 | - if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1213 | + if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) { |
|
1214 | 1214 | $cookies_not_set_msg = apply_filters( |
1215 | 1215 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1216 | 1216 | sprintf( |
1217 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1217 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1218 | 1218 | '<div class="ee-attention">', |
1219 | 1219 | '</div>', |
1220 | 1220 | '<h6 class="important-notice">', |
@@ -1233,7 +1233,7 @@ discard block |
||
1233 | 1233 | 'html_id' => 'ee-single-page-checkout-dv', |
1234 | 1234 | 'layout_strategy' => new EE_Template_Layout( |
1235 | 1235 | array( |
1236 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1236 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1237 | 1237 | 'template_args' => array( |
1238 | 1238 | 'empty_cart' => $empty_cart, |
1239 | 1239 | 'revisit' => $this->checkout->revisit, |
@@ -1244,8 +1244,8 @@ discard block |
||
1244 | 1244 | 'empty_msg' => apply_filters( |
1245 | 1245 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1246 | 1246 | sprintf( |
1247 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1248 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1247 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1248 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1249 | 1249 | '">', |
1250 | 1250 | '</a>' |
1251 | 1251 | ) |
@@ -1254,7 +1254,7 @@ discard block |
||
1254 | 1254 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1255 | 1255 | 'session_expiration' => gmdate( |
1256 | 1256 | 'M d, Y H:i:s', |
1257 | - EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) |
|
1257 | + EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS) |
|
1258 | 1258 | ) |
1259 | 1259 | ) |
1260 | 1260 | ) |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | ) |
1263 | 1263 | ); |
1264 | 1264 | // load template and add to output sent that gets filtered into the_content() |
1265 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1265 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1266 | 1266 | } |
1267 | 1267 | } |
1268 | 1268 | |
@@ -1276,8 +1276,8 @@ discard block |
||
1276 | 1276 | * @internal param string $label |
1277 | 1277 | * @return string |
1278 | 1278 | */ |
1279 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1280 | - if ( $next_step === 'finalize_registration' ) { |
|
1279 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1280 | + if ($next_step === 'finalize_registration') { |
|
1281 | 1281 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1282 | 1282 | } |
1283 | 1283 | } |
@@ -1292,18 +1292,18 @@ discard block |
||
1292 | 1292 | * @throws EE_Error |
1293 | 1293 | */ |
1294 | 1294 | public static function display_registration_footer() { |
1295 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1296 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1297 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1298 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1295 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1296 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1297 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1298 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1299 | 1299 | echo apply_filters( |
1300 | 1300 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1301 | 1301 | sprintf( |
1302 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1303 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1302 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1303 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1304 | 1304 | '" target="_blank">', |
1305 | 1305 | '</a>', |
1306 | - '<a href="' . $url . '" title="', |
|
1306 | + '<a href="'.$url.'" title="', |
|
1307 | 1307 | '" target="_blank">', |
1308 | 1308 | '</a></div>' |
1309 | 1309 | ) |
@@ -1334,12 +1334,12 @@ discard block |
||
1334 | 1334 | * @return array |
1335 | 1335 | */ |
1336 | 1336 | private function _setup_redirect() { |
1337 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1337 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1338 | 1338 | $this->checkout->redirect = TRUE; |
1339 | - if ( empty( $this->checkout->redirect_url )) { |
|
1339 | + if (empty($this->checkout->redirect_url)) { |
|
1340 | 1340 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1341 | 1341 | } |
1342 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1342 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1343 | 1343 | } |
1344 | 1344 | } |
1345 | 1345 | |
@@ -1353,9 +1353,9 @@ discard block |
||
1353 | 1353 | * @throws EE_Error |
1354 | 1354 | */ |
1355 | 1355 | public function go_to_next_step() { |
1356 | - if ( EE_Registry::instance()->request()->ajax ) { |
|
1356 | + if (EE_Registry::instance()->request()->ajax) { |
|
1357 | 1357 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1358 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1358 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1359 | 1359 | } |
1360 | 1360 | $this->unlock_transaction(); |
1361 | 1361 | // just return for these conditions |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | */ |
1386 | 1386 | protected function _handle_json_response() { |
1387 | 1387 | // if this is an ajax request |
1388 | - if ( EE_Registry::instance()->request()->ajax ) { |
|
1388 | + if (EE_Registry::instance()->request()->ajax) { |
|
1389 | 1389 | // DEBUG LOG |
1390 | 1390 | //$this->checkout->log( |
1391 | 1391 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1398,7 +1398,7 @@ discard block |
||
1398 | 1398 | $this->checkout->json_response->set_registration_time_limit( |
1399 | 1399 | $this->checkout->get_registration_time_limit() |
1400 | 1400 | ); |
1401 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1401 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1402 | 1402 | // just send the ajax ( |
1403 | 1403 | $json_response = apply_filters( |
1404 | 1404 | 'FHEE__EE_Single_Page_Checkout__JSON_response', |
@@ -1419,9 +1419,9 @@ discard block |
||
1419 | 1419 | */ |
1420 | 1420 | protected function _handle_html_redirects() { |
1421 | 1421 | // going somewhere ? |
1422 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1422 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1423 | 1423 | // store notices in a transient |
1424 | - EE_Error::get_notices( false, true, true ); |
|
1424 | + EE_Error::get_notices(false, true, true); |
|
1425 | 1425 | // DEBUG LOG |
1426 | 1426 | //$this->checkout->log( |
1427 | 1427 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | // 'headers_list' => headers_list(), |
1432 | 1432 | // ) |
1433 | 1433 | //); |
1434 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1434 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1435 | 1435 | exit(); |
1436 | 1436 | } |
1437 | 1437 | } |
@@ -25,30 +25,30 @@ discard block |
||
25 | 25 | * ------------------------------------------------------------------------ |
26 | 26 | */ |
27 | 27 | // defined some new constants related to caffeinated folder |
28 | -define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); |
|
29 | -define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); |
|
30 | -define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS); |
|
31 | -define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS ); |
|
28 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
29 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
30 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
31 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
32 | 32 | class EE_Brewing_Regular extends EE_Base { |
33 | 33 | |
34 | 34 | public function __construct() { |
35 | - if ( defined( 'EE_CAFF_PATH' )) { |
|
35 | + if (defined('EE_CAFF_PATH')) { |
|
36 | 36 | // activation |
37 | - add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' )); |
|
37 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
38 | 38 | // load caff init |
39 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' )); |
|
39 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
40 | 40 | // make it so the PDF receipt doesn't show our shameless plug |
41 | - add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' ); |
|
41 | + add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false'); |
|
42 | 42 | // add caffeinated modules |
43 | - add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' )); |
|
43 | + add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register')); |
|
44 | 44 | // load caff scripts |
45 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 ); |
|
45 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
46 | 46 | |
47 | - add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 ); |
|
47 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
48 | 48 | |
49 | - add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) ); |
|
49 | + add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods')); |
|
50 | 50 | // caffeinated constructed |
51 | - do_action( 'AHEE__EE_Brewing_Regular__construct__complete' ); |
|
51 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * @param array $paths original helper paths array |
59 | 59 | * @return array new array of paths |
60 | 60 | */ |
61 | - public function caf_helper_paths( $paths ) { |
|
62 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
61 | + public function caf_helper_paths($paths) { |
|
62 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
63 | 63 | return $paths; |
64 | 64 | } |
65 | 65 | |
@@ -75,22 +75,22 @@ discard block |
||
75 | 75 | * Right now, we ASSUME the only price types in the system are default ones |
76 | 76 | * @global WPDB $wpdb |
77 | 77 | */ |
78 | - function initialize_caf_db_content(){ |
|
78 | + function initialize_caf_db_content() { |
|
79 | 79 | // echo "initialize caf db content!"; |
80 | 80 | global $wpdb; |
81 | 81 | |
82 | 82 | //use same method of getting creator id as the version introducing the change |
83 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id()); |
|
83 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
84 | 84 | |
85 | 85 | $price_type_table = $wpdb->prefix."esp_price_type"; |
86 | 86 | $price_table = $wpdb->prefix."esp_price"; |
87 | 87 | |
88 | - if ( EEH_Activation::table_exists( $price_type_table ) ) { |
|
88 | + if (EEH_Activation::table_exists($price_type_table)) { |
|
89 | 89 | |
90 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types |
|
91 | - $tax_price_type_count = $wpdb->get_var( $SQL ); |
|
90 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types |
|
91 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
92 | 92 | |
93 | - if ( $tax_price_type_count <= 1) { |
|
93 | + if ($tax_price_type_count <= 1) { |
|
94 | 94 | $wpdb->insert($price_type_table, |
95 | 95 | array( |
96 | 96 | 'PRT_name'=> __("Regional Tax", "event_espresso"), |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | 'PRT_wp_user' => $default_creator_id |
102 | 102 | ), |
103 | 103 | array( |
104 | - '%s',//PRT_name |
|
105 | - '%d',//PBT_id |
|
106 | - '%d',//PRT_is_percent |
|
107 | - '%d',//PRT_order |
|
108 | - '%d',//PRT_deleted |
|
104 | + '%s', //PRT_name |
|
105 | + '%d', //PBT_id |
|
106 | + '%d', //PRT_is_percent |
|
107 | + '%d', //PRT_order |
|
108 | + '%d', //PRT_deleted |
|
109 | 109 | '%d', //PRT_wp_user |
110 | 110 | ) |
111 | 111 | ); |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | 'PRT_wp_user' => $default_creator_id, |
121 | 121 | ), |
122 | 122 | array( |
123 | - '%s',//PRT_name |
|
124 | - '%d',//PBT_id |
|
125 | - '%d',//PRT_is_percent |
|
126 | - '%d',//PRT_order |
|
127 | - '%d',//PRT_deleted |
|
123 | + '%s', //PRT_name |
|
124 | + '%d', //PBT_id |
|
125 | + '%d', //PRT_is_percent |
|
126 | + '%d', //PRT_order |
|
127 | + '%d', //PRT_deleted |
|
128 | 128 | '%d' //PRT_wp_user |
129 | 129 | ) |
130 | 130 | ); |
131 | - if( $result){ |
|
131 | + if ($result) { |
|
132 | 132 | $wpdb->insert($price_table, |
133 | 133 | array( |
134 | 134 | 'PRT_ID'=>$wpdb->insert_id, |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | 'PRC_wp_user' => $default_creator_id |
144 | 144 | ), |
145 | 145 | array( |
146 | - '%d',//PRT_id |
|
147 | - '%f',//PRC_amount |
|
148 | - '%s',//PRC_name |
|
149 | - '%s',//PRC_desc |
|
150 | - '%d',//PRC_is_default |
|
151 | - '%d',//PRC_overrides |
|
152 | - '%d',//PRC_deleted |
|
153 | - '%d',//PRC_order |
|
154 | - '%d',//PRC_parent |
|
146 | + '%d', //PRT_id |
|
147 | + '%f', //PRC_amount |
|
148 | + '%s', //PRC_name |
|
149 | + '%s', //PRC_desc |
|
150 | + '%d', //PRC_is_default |
|
151 | + '%d', //PRC_overrides |
|
152 | + '%d', //PRC_deleted |
|
153 | + '%d', //PRC_order |
|
154 | + '%d', //PRC_parent |
|
155 | 155 | '%d' //PRC_wp_user |
156 | 156 | ) |
157 | 157 | ); |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | * @param array $modules_to_register |
173 | 173 | * @return array |
174 | 174 | */ |
175 | - public function caffeinated_modules_to_register( $modules_to_register = array() ){ |
|
176 | - if ( is_readable( EE_CAFF_PATH . 'modules' )) { |
|
177 | - $caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR ); |
|
178 | - if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) { |
|
179 | - $modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register ); |
|
175 | + public function caffeinated_modules_to_register($modules_to_register = array()) { |
|
176 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
177 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
178 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
179 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | return $modules_to_register; |
@@ -184,19 +184,19 @@ discard block |
||
184 | 184 | |
185 | 185 | |
186 | 186 | |
187 | - public function caffeinated_init(){ |
|
187 | + public function caffeinated_init() { |
|
188 | 188 | // EE_Register_CPTs hooks |
189 | - add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 ); |
|
190 | - add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 ); |
|
191 | - add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 ); |
|
192 | - EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE ); |
|
189 | + add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10); |
|
190 | + add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10); |
|
191 | + add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10); |
|
192 | + EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE); |
|
193 | 193 | // caffeinated_init__complete hook |
194 | - do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' ); |
|
194 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
198 | 198 | |
199 | - public function enqueue_caffeinated_scripts(){ |
|
199 | + public function enqueue_caffeinated_scripts() { |
|
200 | 200 | // sound of crickets... |
201 | 201 | } |
202 | 202 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @param array $taxonomy_array |
207 | 207 | * @return array |
208 | 208 | */ |
209 | - public function filter_taxonomies( $taxonomy_array ) { |
|
209 | + public function filter_taxonomies($taxonomy_array) { |
|
210 | 210 | $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE; |
211 | 211 | return $taxonomy_array; |
212 | 212 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @param array $cpt_array |
218 | 218 | * @return array |
219 | 219 | */ |
220 | - public function filter_cpts( $cpt_array ) { |
|
220 | + public function filter_cpts($cpt_array) { |
|
221 | 221 | $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE; |
222 | 222 | return $cpt_array; |
223 | 223 | } |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | * @param array $menu_items |
229 | 229 | * @return array |
230 | 230 | */ |
231 | - public function nav_metabox_items( $menu_items ) { |
|
231 | + public function nav_metabox_items($menu_items) { |
|
232 | 232 | $menu_items[] = array( |
233 | 233 | 'title' => __('Venue List', 'event_espresso'), |
234 | - 'url' => get_post_type_archive_link( 'espresso_venues' ), |
|
234 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
235 | 235 | 'description' => __('Archive page for all venues.', 'event_espresso') |
236 | 236 | ); |
237 | 237 | return $menu_items; |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | * @param array $payment_method_paths |
245 | 245 | * @return array values are folder paths to payment method folders |
246 | 246 | */ |
247 | - public function caf_payment_methods( $payment_method_paths ) { |
|
248 | - $caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
249 | - $payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths ); |
|
247 | + public function caf_payment_methods($payment_method_paths) { |
|
248 | + $caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
249 | + $payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths); |
|
250 | 250 | return $payment_method_paths; |
251 | 251 | } |
252 | 252 |