@@ -5,17 +5,17 @@ |
||
5 | 5 | exit( 'No direct script access allowed' ); |
6 | 6 | } |
7 | 7 | /** |
8 | - * Class EE_Template_Part_PriorityQueue |
|
9 | - * |
|
10 | - * SplPriorityQueue class configured to only accept instances of EE_Template_Part |
|
11 | - * sorts list in ascending order based on priority set when adding template parts |
|
12 | - * |
|
13 | - * @package Event Espresso |
|
14 | - * @subpackage core |
|
15 | - * @author Brent Christensen |
|
16 | - * @since $VID:$ |
|
17 | - * |
|
18 | - */ |
|
8 | + * Class EE_Template_Part_PriorityQueue |
|
9 | + * |
|
10 | + * SplPriorityQueue class configured to only accept instances of EE_Template_Part |
|
11 | + * sorts list in ascending order based on priority set when adding template parts |
|
12 | + * |
|
13 | + * @package Event Espresso |
|
14 | + * @subpackage core |
|
15 | + * @author Brent Christensen |
|
16 | + * @since $VID:$ |
|
17 | + * |
|
18 | + */ |
|
19 | 19 | class EE_Template_Part_PriorityQueue extends \SplPriorityQueue { |
20 | 20 | |
21 | 21 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
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 | * Class EE_Template_Part_PriorityQueue |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | * @param int $priority |
32 | 32 | * @return bool |
33 | 33 | */ |
34 | - public function insert( $object, $priority = 100 ) { |
|
35 | - if ( $object instanceof EE_Template_Part ) { |
|
36 | - parent::insert( $object, $priority ); |
|
34 | + public function insert($object, $priority = 100) { |
|
35 | + if ($object instanceof EE_Template_Part) { |
|
36 | + parent::insert($object, $priority); |
|
37 | 37 | return true; |
38 | 38 | } else { |
39 | 39 | return false; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param int $priority2 |
53 | 53 | * @return bool |
54 | 54 | */ |
55 | - public function compare( $priority1, $priority2 ) { |
|
56 | - if ( $priority1 === $priority2 ) { |
|
55 | + public function compare($priority1, $priority2) { |
|
56 | + if ($priority1 === $priority2) { |
|
57 | 57 | return 0; |
58 | 58 | } |
59 | 59 | return $priority1 > $priority2 ? -1 : 1; |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | * @param EE_Response $response |
22 | 22 | * @return EE_Response |
23 | 23 | */ |
24 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
24 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
25 | 25 | $this->_request = $request; |
26 | 26 | $this->_response = $response; |
27 | 27 | $this->display_alpha_banner_warning(); |
28 | - $this->_response = $this->process_request_stack( $this->_request, $this->_response ); |
|
28 | + $this->_response = $this->process_request_stack($this->_request, $this->_response); |
|
29 | 29 | return $this->_response; |
30 | 30 | } |
31 | 31 | |
@@ -41,22 +41,22 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function display_alpha_banner_warning() { |
43 | 43 | // skip AJAX requests |
44 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
44 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | // skip stable releases |
48 | - if ( strpos( EVENT_ESPRESSO_VERSION, '.alpha' ) === false ) { |
|
48 | + if (strpos(EVENT_ESPRESSO_VERSION, '.alpha') === false) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | // post release candidate warning |
52 | - if ( is_admin() ) { |
|
53 | - add_action( 'admin_notices', array( $this, 'alpha_banner_admin_notice' ), -999 ); |
|
52 | + if (is_admin()) { |
|
53 | + add_action('admin_notices', array($this, 'alpha_banner_admin_notice'), -999); |
|
54 | 54 | } else { |
55 | 55 | // site admin has authorized use of non-stable release candidate for production |
56 | - if ( defined( 'ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE' ) && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE ) { |
|
56 | + if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) { |
|
57 | 57 | return; |
58 | 58 | } |
59 | - add_action( 'shutdown', array( $this, 'alpha_banner_warning_notice' ), 10 ); |
|
59 | + add_action('shutdown', array($this, 'alpha_banner_warning_notice'), 10); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function alpha_banner_admin_notice() { |
73 | 73 | EE_Error::add_attention( |
74 | 74 | sprintf( |
75 | - __( 'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso' ), |
|
75 | + __('This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso'), |
|
76 | 76 | '<strong>', |
77 | 77 | '</strong>' |
78 | 78 | ), |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function alpha_banner_warning_notice() { |
93 | 93 | global $pagenow; |
94 | - if ( in_array( $pagenow, array( 'wp-login.php', 'wp-register.php' ) ) ) { |
|
94 | + if (in_array($pagenow, array('wp-login.php', 'wp-register.php'))) { |
|
95 | 95 | return; |
96 | 96 | } |
97 | 97 | printf( |
98 | - __( '%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso' ), |
|
98 | + __('%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso'), |
|
99 | 99 | '<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>', |
100 | 100 | '<strong>', |
101 | 101 | '</strong>', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @access public |
44 | 44 | * @param \EEI_Request_Decorator $request_stack |
45 | 45 | */ |
46 | - public function __construct( EEI_Request_Decorator $request_stack ) { |
|
46 | + public function __construct(EEI_Request_Decorator $request_stack) { |
|
47 | 47 | $this->request_stack = $request_stack; |
48 | 48 | } |
49 | 49 | |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | * @param EE_Response $response |
58 | 58 | * @return EE_Response |
59 | 59 | */ |
60 | - protected function process_request_stack( EE_Request $request, EE_Response $response ) { |
|
60 | + protected function process_request_stack(EE_Request $request, EE_Response $response) { |
|
61 | 61 | $this->_request = $request; |
62 | 62 | $this->_response = $response; |
63 | - if ( ! $this->_response->request_terminated() ) { |
|
64 | - $this->_response = $this->request_stack->handle_request( $this->_request, $this->_response ); |
|
63 | + if ( ! $this->_response->request_terminated()) { |
|
64 | + $this->_response = $this->request_stack->handle_request($this->_request, $this->_response); |
|
65 | 65 | } else { |
66 | - espresso_deactivate_plugin( EE_PLUGIN_BASENAME ); |
|
66 | + espresso_deactivate_plugin(EE_PLUGIN_BASENAME); |
|
67 | 67 | } |
68 | 68 | return $this->_response; |
69 | 69 | } |
@@ -22,34 +22,34 @@ 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 | } |
37 | 37 | // check required PHP version |
38 | - if ( ! $this->_minimum_php_version_required() ) { |
|
39 | - $this->_request->un_set( 'activate', true ); |
|
40 | - add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 ); |
|
38 | + if ( ! $this->_minimum_php_version_required()) { |
|
39 | + $this->_request->un_set('activate', true); |
|
40 | + add_action('admin_notices', array($this, 'minimum_php_version_error'), 1); |
|
41 | 41 | //$this->_response->add_output( "\n<br />" . 'minimum_php_version_error' ); |
42 | 42 | $this->_response->terminate_request(); |
43 | 43 | } |
44 | 44 | // check recommended WP version |
45 | - if ( ! $this->_minimum_wp_version_recommended() ) { |
|
45 | + if ( ! $this->_minimum_wp_version_recommended()) { |
|
46 | 46 | $this->_display_minimum_recommended_wp_version_notice(); |
47 | 47 | } |
48 | 48 | // check recommended PHP version |
49 | - if ( ! $this->_minimum_php_version_recommended() ) { |
|
49 | + if ( ! $this->_minimum_php_version_recommended()) { |
|
50 | 50 | $this->_display_minimum_recommended_php_version_notice(); |
51 | 51 | } |
52 | - $this->_response = $this->process_request_stack( $this->_request, $this->_response ); |
|
52 | + $this->_response = $this->process_request_stack($this->_request, $this->_response); |
|
53 | 53 | //$this->_response->add_output( "\n\t OUT << " . __CLASS__ ); |
54 | 54 | return $this->_response; |
55 | 55 | } |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param string $min_version |
64 | 64 | * @return boolean |
65 | 65 | */ |
66 | - private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) { |
|
66 | + private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) { |
|
67 | 67 | global $wp_version; |
68 | - return version_compare( $wp_version, $min_version, '>=' ) ? true : false; |
|
68 | + return version_compare($wp_version, $min_version, '>=') ? true : false; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return boolean |
78 | 78 | */ |
79 | 79 | private function _minimum_wp_version_required() { |
80 | - return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED ); |
|
80 | + return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return boolean |
90 | 90 | */ |
91 | 91 | private function _minimum_wp_version_recommended() { |
92 | - return $this->_check_wp_version( EE_MIN_WP_VER_RECOMMENDED ); |
|
92 | + return $this->_check_wp_version(EE_MIN_WP_VER_RECOMMENDED); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * @param string $min_version |
102 | 102 | * @return boolean |
103 | 103 | */ |
104 | - private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) { |
|
105 | - return version_compare( PHP_VERSION, $min_version, '>=' ) ? true : false; |
|
104 | + private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) { |
|
105 | + return version_compare(PHP_VERSION, $min_version, '>=') ? true : false; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @return boolean |
115 | 115 | */ |
116 | 116 | private function _minimum_php_version_required() { |
117 | - return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED ); |
|
117 | + return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @return boolean |
127 | 127 | */ |
128 | 128 | private function _minimum_php_version_recommended() { |
129 | - return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED ); |
|
129 | + return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | <p> |
144 | 144 | <?php |
145 | 145 | printf( |
146 | - __( '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' ), |
|
146 | + __('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'), |
|
147 | 147 | EE_MIN_WP_VER_REQUIRED, |
148 | 148 | $wp_version, |
149 | 149 | '<br/>', |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | <p> |
169 | 169 | <?php |
170 | 170 | printf( |
171 | - __( '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' ), |
|
171 | + __('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'), |
|
172 | 172 | EE_MIN_PHP_VER_REQUIRED, |
173 | 173 | PHP_VERSION, |
174 | 174 | '<br/>', |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | private function _display_minimum_recommended_wp_version_notice() { |
192 | 192 | global $wp_version; |
193 | 193 | EE_Error::add_persistent_admin_notice( |
194 | - 'wp_version_' . str_replace( '.', '-', EE_MIN_WP_VER_RECOMMENDED ) . '_recommended', |
|
194 | + 'wp_version_'.str_replace('.', '-', EE_MIN_WP_VER_RECOMMENDED).'_recommended', |
|
195 | 195 | sprintf( |
196 | - __( 'Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. 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' ), |
|
196 | + __('Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. 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'), |
|
197 | 197 | EE_MIN_WP_VER_RECOMMENDED, |
198 | 198 | $wp_version, |
199 | 199 | '<br/>', |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | */ |
213 | 213 | private function _display_minimum_recommended_php_version_notice() { |
214 | 214 | EE_Error::add_persistent_admin_notice( |
215 | - 'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended', |
|
215 | + 'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended', |
|
216 | 216 | sprintf( |
217 | - __( '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' ), |
|
217 | + __('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'), |
|
218 | 218 | EE_MIN_PHP_VER_RECOMMENDED, |
219 | 219 | PHP_VERSION, |
220 | 220 | '<br/>', |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | * @access public |
39 | 39 | * @param array $request |
40 | 40 | */ |
41 | - public function __construct( $request ) { |
|
41 | + public function __construct($request) { |
|
42 | 42 | // grab request vars |
43 | 43 | $this->_params = $request; |
44 | 44 | // AJAX ??? |
45 | - $this->ajax = defined( 'DOING_AJAX' ) ? TRUE : FALSE; |
|
46 | - $this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? TRUE : FALSE; |
|
45 | + $this->ajax = defined('DOING_AJAX') ? TRUE : FALSE; |
|
46 | + $this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? TRUE : FALSE; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * @param bool $override_ee |
68 | 68 | * @return void |
69 | 69 | */ |
70 | - public function set( $key, $value, $override_ee = FALSE ) { |
|
70 | + public function set($key, $value, $override_ee = FALSE) { |
|
71 | 71 | // don't allow "ee" to be overwritten unless explicitly instructed to do so |
72 | - if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) { |
|
73 | - $this->_params[ $key ] = $value; |
|
72 | + if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) { |
|
73 | + $this->_params[$key] = $value; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | * @param null $default |
85 | 85 | * @return mixed |
86 | 86 | */ |
87 | - public function get( $key, $default = NULL ) { |
|
88 | - return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default; |
|
87 | + public function get($key, $default = NULL) { |
|
88 | + return isset($this->_params[$key]) ? $this->_params[$key] : $default; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @param $key |
98 | 98 | * @return boolean |
99 | 99 | */ |
100 | - public function is_set( $key ) { |
|
101 | - return isset( $this->_params[ $key ] ) ? TRUE : FALSE; |
|
100 | + public function is_set($key) { |
|
101 | + return isset($this->_params[$key]) ? TRUE : FALSE; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * @param $key |
111 | 111 | * @param bool $unset_from_global_too |
112 | 112 | */ |
113 | - public function un_set( $key, $unset_from_global_too = false ) { |
|
114 | - unset( $this->_params[ $key ] ); |
|
115 | - if ( $unset_from_global_too ) { |
|
116 | - unset( $_REQUEST[ $key ] ); |
|
113 | + public function un_set($key, $unset_from_global_too = false) { |
|
114 | + unset($this->_params[$key]); |
|
115 | + if ($unset_from_global_too) { |
|
116 | + unset($_REQUEST[$key]); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param EEI_Request_Decorator $application |
44 | 44 | * @param array $middlewares |
45 | 45 | */ |
46 | - public function __construct( EEI_Request_Decorator $application, $middlewares = array() ) { |
|
46 | + public function __construct(EEI_Request_Decorator $application, $middlewares = array()) { |
|
47 | 47 | $this->_application = $application; |
48 | 48 | $this->_middlewares = $middlewares; |
49 | 49 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * @param EE_Response $response |
56 | 56 | * @return EE_Response |
57 | 57 | */ |
58 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
58 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
59 | 59 | $this->_request = $request; |
60 | 60 | $this->_response = $response; |
61 | - return $this->_application->handle_request( $request, $response ); |
|
61 | + return $this->_application->handle_request($request, $response); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function handle_response() { |
72 | 72 | $prev_middleware = null; |
73 | - foreach ( $this->_middlewares as $middleware ) { |
|
74 | - if ( ! $prev_middleware instanceof EEI_Request_Stack_Core_App && $middleware instanceof EEI_Request_Stack_Core_App ) { |
|
75 | - $middleware->handle_response( $this->_request, $this->_response ); |
|
73 | + foreach ($this->_middlewares as $middleware) { |
|
74 | + if ( ! $prev_middleware instanceof EEI_Request_Stack_Core_App && $middleware instanceof EEI_Request_Stack_Core_App) { |
|
75 | + $middleware->handle_response($this->_request, $this->_response); |
|
76 | 76 | } |
77 | 77 | $prev_middleware = $middleware; |
78 | 78 | } |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | * @return EE_Request_Stack_Builder |
45 | 45 | */ |
46 | 46 | public function unshift( /*$class_name, $args*/ ) { |
47 | - if ( func_num_args() === 0 ) { |
|
48 | - throw new InvalidArgumentException( "Missing argument(s) when calling unshift" ); |
|
47 | + if (func_num_args() === 0) { |
|
48 | + throw new InvalidArgumentException("Missing argument(s) when calling unshift"); |
|
49 | 49 | } |
50 | 50 | $middleware = func_get_args(); |
51 | 51 | //$this->middleware_stack->unshift( $middleware ); |
52 | - array_unshift( $this->_middleware_stack, $middleware ); |
|
52 | + array_unshift($this->_middleware_stack, $middleware); |
|
53 | 53 | return $this; |
54 | 54 | } |
55 | 55 | |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * @return EE_Request_Stack_Builder |
67 | 67 | */ |
68 | 68 | public function push( /*$class_name, $args...*/ ) { |
69 | - if ( func_num_args() === 0 ) { |
|
70 | - throw new InvalidArgumentException( "Missing argument(s) when calling push" ); |
|
69 | + if (func_num_args() === 0) { |
|
70 | + throw new InvalidArgumentException("Missing argument(s) when calling push"); |
|
71 | 71 | } |
72 | 72 | $middleware = func_get_args(); |
73 | 73 | //$this->middleware_stack->push( $middleware ); |
74 | - array_push( $this->_middleware_stack, $middleware ); |
|
74 | + array_push($this->_middleware_stack, $middleware); |
|
75 | 75 | return $this; |
76 | 76 | } |
77 | 77 | |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | * @param EEI_Request_Decorator $application |
85 | 85 | * @return EE_Request_Stack |
86 | 86 | */ |
87 | - public function resolve( EEI_Request_Decorator $application ) { |
|
88 | - $middlewares = array( $application ); |
|
89 | - foreach ( $this->_middleware_stack as $middleware_args ) { |
|
90 | - $class_name = array_shift( $middleware_args ); |
|
91 | - if ( is_callable( $class_name ) ) { |
|
92 | - $application = $class_name( $application ); |
|
87 | + public function resolve(EEI_Request_Decorator $application) { |
|
88 | + $middlewares = array($application); |
|
89 | + foreach ($this->_middleware_stack as $middleware_args) { |
|
90 | + $class_name = array_shift($middleware_args); |
|
91 | + if (is_callable($class_name)) { |
|
92 | + $application = $class_name($application); |
|
93 | 93 | } else { |
94 | - array_unshift( $middleware_args, $application ); |
|
95 | - $reflection = new ReflectionClass( $class_name ); |
|
96 | - $application = $reflection->newInstanceArgs( $middleware_args ); |
|
94 | + array_unshift($middleware_args, $application); |
|
95 | + $reflection = new ReflectionClass($class_name); |
|
96 | + $application = $reflection->newInstanceArgs($middleware_args); |
|
97 | 97 | } |
98 | - array_unshift( $middlewares, $application ); |
|
98 | + array_unshift($middlewares, $application); |
|
99 | 99 | } |
100 | - return new EE_Request_Stack( $application, $middlewares ); |
|
100 | + return new EE_Request_Stack($application, $middlewares); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return \EE_Response |
41 | 41 | */ |
42 | 42 | public function __construct() { |
43 | - $this->terminate_request( false ); |
|
43 | + $this->terminate_request(false); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @param $value |
54 | 54 | * @return void |
55 | 55 | */ |
56 | - public function set_notice( $key, $value ) { |
|
57 | - $this->_notice[ $key ] = $value; |
|
56 | + public function set_notice($key, $value) { |
|
57 | + $this->_notice[$key] = $value; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @param $key |
67 | 67 | * @return mixed |
68 | 68 | */ |
69 | - public function get_notice( $key ) { |
|
70 | - return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : NULL; |
|
69 | + public function get_notice($key) { |
|
70 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : NULL; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | * @param $string |
92 | 92 | * @param bool $append |
93 | 93 | */ |
94 | - public function add_output( $string, $append = true ) { |
|
95 | - $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
94 | + public function add_output($string, $append = true) { |
|
95 | + $this->_output = $append ? $this->_output.$string : $string.$this->_output; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | /** |
122 | 122 | * @param boolean $request_terminated |
123 | 123 | */ |
124 | - public function terminate_request( $request_terminated = true ) { |
|
125 | - $this->request_terminated = filter_var( $request_terminated, FILTER_VALIDATE_BOOLEAN ); |
|
124 | + public function terminate_request($request_terminated = true) { |
|
125 | + $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | |
204 | 204 | |
205 | 205 | /** |
206 | - * detect_if_activation_or_upgrade |
|
207 | - * |
|
208 | - * Takes care of detecting whether this is a brand new install or code upgrade, |
|
209 | - * and either setting up the DB or setting up maintenance mode etc. |
|
210 | - * |
|
211 | - * @access public |
|
212 | - * @return void |
|
213 | - */ |
|
206 | + * detect_if_activation_or_upgrade |
|
207 | + * |
|
208 | + * Takes care of detecting whether this is a brand new install or code upgrade, |
|
209 | + * and either setting up the DB or setting up maintenance mode etc. |
|
210 | + * |
|
211 | + * @access public |
|
212 | + * @return void |
|
213 | + */ |
|
214 | 214 | public function detect_if_activation_or_upgrade() { |
215 | 215 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
216 | 216 | |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | $query_params = array( 'page' => 'espresso_about' ); |
515 | 515 | |
516 | 516 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
517 | - $query_params['new_activation'] = TRUE; |
|
517 | + $query_params['new_activation'] = TRUE; |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
521 | - $query_params['reactivation'] = TRUE; |
|
521 | + $query_params['reactivation'] = TRUE; |
|
522 | 522 | } |
523 | 523 | $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
524 | 524 | wp_safe_redirect( $url ); |
@@ -621,11 +621,11 @@ discard block |
||
621 | 621 | |
622 | 622 | |
623 | 623 | /** |
624 | - * _incompatible_addon_error |
|
625 | - * |
|
626 | - * @access public |
|
627 | - * @return void |
|
628 | - */ |
|
624 | + * _incompatible_addon_error |
|
625 | + * |
|
626 | + * @access public |
|
627 | + * @return void |
|
628 | + */ |
|
629 | 629 | private function _incompatible_addon_error() { |
630 | 630 | // get array of classes hooking into here |
631 | 631 | $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
@@ -747,14 +747,14 @@ discard block |
||
747 | 747 | |
748 | 748 | |
749 | 749 | /** |
750 | - * load_controllers |
|
751 | - * |
|
752 | - * this is the best place to load any additional controllers that needs access to EE core. |
|
753 | - * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
754 | - * |
|
755 | - * @access public |
|
756 | - * @return void |
|
757 | - */ |
|
750 | + * load_controllers |
|
751 | + * |
|
752 | + * this is the best place to load any additional controllers that needs access to EE core. |
|
753 | + * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
754 | + * |
|
755 | + * @access public |
|
756 | + * @return void |
|
757 | + */ |
|
758 | 758 | public function load_controllers() { |
759 | 759 | do_action( 'AHEE__EE_System__load_controllers__start' ); |
760 | 760 | // let's get it started |
@@ -771,13 +771,13 @@ discard block |
||
771 | 771 | |
772 | 772 | |
773 | 773 | /** |
774 | - * core_loaded_and_ready |
|
775 | - * |
|
776 | - * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
777 | - * |
|
778 | - * @access public |
|
779 | - * @return void |
|
780 | - */ |
|
774 | + * core_loaded_and_ready |
|
775 | + * |
|
776 | + * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
777 | + * |
|
778 | + * @access public |
|
779 | + * @return void |
|
780 | + */ |
|
781 | 781 | public function core_loaded_and_ready() { |
782 | 782 | do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
783 | 783 | do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
@@ -788,13 +788,13 @@ discard block |
||
788 | 788 | |
789 | 789 | |
790 | 790 | /** |
791 | - * initialize |
|
792 | - * |
|
793 | - * this is the best place to begin initializing client code |
|
794 | - * |
|
795 | - * @access public |
|
796 | - * @return void |
|
797 | - */ |
|
791 | + * initialize |
|
792 | + * |
|
793 | + * this is the best place to begin initializing client code |
|
794 | + * |
|
795 | + * @access public |
|
796 | + * @return void |
|
797 | + */ |
|
798 | 798 | public function initialize() { |
799 | 799 | do_action( 'AHEE__EE_System__initialize' ); |
800 | 800 | } |
@@ -802,13 +802,13 @@ discard block |
||
802 | 802 | |
803 | 803 | |
804 | 804 | /** |
805 | - * initialize_last |
|
806 | - * |
|
807 | - * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
808 | - * |
|
809 | - * @access public |
|
810 | - * @return void |
|
811 | - */ |
|
805 | + * initialize_last |
|
806 | + * |
|
807 | + * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
808 | + * |
|
809 | + * @access public |
|
810 | + * @return void |
|
811 | + */ |
|
812 | 812 | public function initialize_last() { |
813 | 813 | do_action( 'AHEE__EE_System__initialize_last' ); |
814 | 814 | } |
@@ -817,14 +817,14 @@ discard block |
||
817 | 817 | |
818 | 818 | |
819 | 819 | /** |
820 | - * set_hooks_for_shortcodes_modules_and_addons |
|
821 | - * |
|
822 | - * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
823 | - * this happens at the very beginning of the wp_loaded hookpoint |
|
824 | - * |
|
825 | - * @access public |
|
826 | - * @return void |
|
827 | - */ |
|
820 | + * set_hooks_for_shortcodes_modules_and_addons |
|
821 | + * |
|
822 | + * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
823 | + * this happens at the very beginning of the wp_loaded hookpoint |
|
824 | + * |
|
825 | + * @access public |
|
826 | + * @return void |
|
827 | + */ |
|
828 | 828 | public function set_hooks_for_shortcodes_modules_and_addons() { |
829 | 829 | // do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
830 | 830 | } |
@@ -833,13 +833,13 @@ discard block |
||
833 | 833 | |
834 | 834 | |
835 | 835 | /** |
836 | - * do_not_cache |
|
837 | - * |
|
838 | - * sets no cache headers and defines no cache constants for WP plugins |
|
839 | - * |
|
840 | - * @access public |
|
841 | - * @return void |
|
842 | - */ |
|
836 | + * do_not_cache |
|
837 | + * |
|
838 | + * sets no cache headers and defines no cache constants for WP plugins |
|
839 | + * |
|
840 | + * @access public |
|
841 | + * @return void |
|
842 | + */ |
|
843 | 843 | public static function do_not_cache() { |
844 | 844 | // set no cache constants |
845 | 845 | if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | //Current post |
958 | 958 | global $post; |
959 | 959 | |
960 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
960 | + if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
961 | 961 | //Events Edit Current Event |
962 | 962 | $admin_bar->add_menu(array( |
963 | 963 | 'id' => 'espresso-toolbar-events-edit', |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public static function instance() { |
104 | 104 | // check if class object is instantiated |
105 | - if ( ! self::$_instance instanceof EE_System ) { |
|
105 | + if ( ! self::$_instance instanceof EE_System) { |
|
106 | 106 | self::$_instance = new self(); |
107 | 107 | } |
108 | 108 | return self::$_instance; |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | * resets the instance and returns it |
114 | 114 | * @return EE_System |
115 | 115 | */ |
116 | - public static function reset(){ |
|
116 | + public static function reset() { |
|
117 | 117 | self::$_instance->_req_type = NULL; |
118 | 118 | //we need to reset the migration manager in order for it to detect DMSs properly |
119 | 119 | EE_Data_Migration_Manager::reset(); |
120 | 120 | //make sure none of the old hooks are left hanging around |
121 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
121 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
122 | 122 | self::instance()->detect_activations_or_upgrades(); |
123 | 123 | self::instance()->perform_activations_upgrades_and_migrations(); |
124 | 124 | return self::instance(); |
@@ -134,26 +134,26 @@ discard block |
||
134 | 134 | * @access private |
135 | 135 | */ |
136 | 136 | private function __construct() { |
137 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
137 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
138 | 138 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
139 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
139 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
140 | 140 | // when an ee addon is activated, we want to call the core hook(s) again |
141 | 141 | // because the newly-activated addon didn't get a chance to run at all |
142 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
142 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
143 | 143 | // detect whether install or upgrade |
144 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
144 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
145 | 145 | // load EE_Config, EE_Textdomain, etc |
146 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
146 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
147 | 147 | // load EE_Config, EE_Textdomain, etc |
148 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
148 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
149 | 149 | // you wanna get going? I wanna get going... let's get going! |
150 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
150 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
151 | 151 | //other housekeeping |
152 | 152 | //exclude EE critical pages from wp_list_pages |
153 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
153 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
154 | 154 | // ALL EE Addons should use the following hook point to attach their initial setup too |
155 | 155 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
156 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
156 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | public function load_espresso_addons() { |
174 | 174 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
175 | 175 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
176 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
176 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
177 | 177 | //load and setup EE_Capabilities |
178 | - EE_Registry::instance()->load_core( 'Capabilities' ); |
|
179 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
178 | + EE_Registry::instance()->load_core('Capabilities'); |
|
179 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | * @access public |
192 | 192 | * @return void |
193 | 193 | */ |
194 | - public function detect_activations_or_upgrades(){ |
|
194 | + public function detect_activations_or_upgrades() { |
|
195 | 195 | //first off: let's make sure to handle core |
196 | 196 | $this->detect_if_activation_or_upgrade(); |
197 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
197 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
198 | 198 | //detect teh request type for that addon |
199 | 199 | $addon->detect_activation_or_upgrade(); |
200 | 200 | } |
@@ -215,44 +215,44 @@ discard block |
||
215 | 215 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
216 | 216 | |
217 | 217 | // load M-Mode class |
218 | - EE_Registry::instance()->load_core( 'Maintenance_Mode' ); |
|
218 | + EE_Registry::instance()->load_core('Maintenance_Mode'); |
|
219 | 219 | // check if db has been updated, or if its a brand-new installation |
220 | 220 | |
221 | 221 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
222 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
222 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
223 | 223 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
224 | - if( $request_type != EE_System::req_type_normal){ |
|
224 | + if ($request_type != EE_System::req_type_normal) { |
|
225 | 225 | EE_Registry::instance()->load_helper('Activation'); |
226 | 226 | } |
227 | 227 | |
228 | - switch($request_type){ |
|
228 | + switch ($request_type) { |
|
229 | 229 | case EE_System::req_type_new_activation: |
230 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
231 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
230 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
231 | + $this->_handle_core_version_change($espresso_db_update); |
|
232 | 232 | break; |
233 | 233 | case EE_System::req_type_reactivation: |
234 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
235 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
234 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
235 | + $this->_handle_core_version_change($espresso_db_update); |
|
236 | 236 | break; |
237 | 237 | case EE_System::req_type_upgrade: |
238 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
238 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
239 | 239 | //migrations may be required now that we've upgraded |
240 | 240 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
241 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
241 | + $this->_handle_core_version_change($espresso_db_update); |
|
242 | 242 | // echo "done upgrade";die; |
243 | 243 | break; |
244 | 244 | case EE_System::req_type_downgrade: |
245 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
245 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
246 | 246 | //its possible migrations are no longer required |
247 | 247 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
248 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
248 | + $this->_handle_core_version_change($espresso_db_update); |
|
249 | 249 | break; |
250 | 250 | case EE_System::req_type_normal: |
251 | 251 | default: |
252 | 252 | // $this->_maybe_redirect_to_ee_about(); |
253 | 253 | break; |
254 | 254 | } |
255 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
255 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | * initializing the database later during the request |
261 | 261 | * @param array $espresso_db_update |
262 | 262 | */ |
263 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
264 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
263 | + protected function _handle_core_version_change($espresso_db_update) { |
|
264 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
265 | 265 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
266 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
266 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -278,44 +278,44 @@ discard block |
||
278 | 278 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
279 | 279 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
280 | 280 | */ |
281 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
282 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
283 | - if( ! $espresso_db_update){ |
|
284 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
281 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
282 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
283 | + if ( ! $espresso_db_update) { |
|
284 | + $espresso_db_update = get_option('espresso_db_update'); |
|
285 | 285 | } |
286 | 286 | // check that option is an array |
287 | - if( ! is_array( $espresso_db_update )) { |
|
287 | + if ( ! is_array($espresso_db_update)) { |
|
288 | 288 | // if option is FALSE, then it never existed |
289 | - if ( $espresso_db_update === FALSE ) { |
|
289 | + if ($espresso_db_update === FALSE) { |
|
290 | 290 | // make $espresso_db_update an array and save option with autoload OFF |
291 | - $espresso_db_update = array(); |
|
292 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
291 | + $espresso_db_update = array(); |
|
292 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
293 | 293 | } else { |
294 | 294 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
295 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
296 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
295 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
296 | + update_option('espresso_db_update', $espresso_db_update); |
|
297 | 297 | } |
298 | - }else{ |
|
298 | + } else { |
|
299 | 299 | $corrected_db_update = array(); |
300 | 300 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
301 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
302 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
301 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
302 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
303 | 303 | //the key is an int, and the value IS NOT an array |
304 | 304 | //so it must be numerically-indexed, where values are versions installed... |
305 | 305 | //fix it! |
306 | 306 | $version_string = $should_be_array; |
307 | 307 | $corrected_db_update[$version_string] = array('unknown-date'); |
308 | - }else{ |
|
308 | + } else { |
|
309 | 309 | //ok it checks out |
310 | 310 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | $espresso_db_update = $corrected_db_update; |
314 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
314 | + update_option('espresso_db_update', $espresso_db_update); |
|
315 | 315 | |
316 | 316 | } |
317 | 317 | |
318 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
318 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
319 | 319 | return $espresso_db_update; |
320 | 320 | } |
321 | 321 | |
@@ -334,33 +334,33 @@ discard block |
||
334 | 334 | * so we prefer to only do it when necessary |
335 | 335 | * @return void |
336 | 336 | */ |
337 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
337 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
338 | 338 | $request_type = $this->detect_req_type(); |
339 | 339 | //only initialize system if we're not in maintenance mode. |
340 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
341 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
340 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
341 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
342 | 342 | EEH_Activation::system_initialization(); |
343 | - if( $verify_schema ) { |
|
343 | + if ($verify_schema) { |
|
344 | 344 | EEH_Activation::initialize_db_and_folders(); |
345 | 345 | } |
346 | 346 | EEH_Activation::initialize_db_content(); |
347 | - if( $initialize_addons_too ) { |
|
347 | + if ($initialize_addons_too) { |
|
348 | 348 | $this->initialize_addons(); |
349 | 349 | } |
350 | - }else{ |
|
351 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
350 | + } else { |
|
351 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
352 | 352 | } |
353 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
354 | - add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
353 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
354 | + add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9); |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
359 | 359 | * Initializes the db for all registered addons |
360 | 360 | */ |
361 | - public function initialize_addons(){ |
|
361 | + public function initialize_addons() { |
|
362 | 362 | //foreach registered addon, make sure its db is up-to-date too |
363 | - foreach(EE_Registry::instance()->addons as $addon){ |
|
363 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
364 | 364 | $addon->initialize_db_if_no_migrations_required(); |
365 | 365 | } |
366 | 366 | } |
@@ -372,16 +372,16 @@ discard block |
||
372 | 372 | * @param string $current_version_to_add version to be added to the version history |
373 | 373 | * @return boolean success as to whether or not this option was changed |
374 | 374 | */ |
375 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
376 | - if( ! $version_history ) { |
|
375 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
376 | + if ( ! $version_history) { |
|
377 | 377 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
378 | 378 | } |
379 | - if( $current_version_to_add == NULL){ |
|
379 | + if ($current_version_to_add == NULL) { |
|
380 | 380 | $current_version_to_add = espresso_version(); |
381 | 381 | } |
382 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
382 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
383 | 383 | // re-save |
384 | - return update_option( 'espresso_db_update', $version_history ); |
|
384 | + return update_option('espresso_db_update', $version_history); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -398,10 +398,10 @@ discard block |
||
398 | 398 | * but still know if this is a new install or not |
399 | 399 | * @return int one of the constants on EE_System::req_type_ |
400 | 400 | */ |
401 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
402 | - if ( $this->_req_type === NULL ){ |
|
403 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
404 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
401 | + public function detect_req_type($espresso_db_update = NULL) { |
|
402 | + if ($this->_req_type === NULL) { |
|
403 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
404 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
405 | 405 | } |
406 | 406 | return $this->_req_type; |
407 | 407 | } |
@@ -417,39 +417,39 @@ discard block |
||
417 | 417 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
418 | 418 | * @return int one of the constants on EE_System::req_type_* |
419 | 419 | */ |
420 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
421 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
422 | - if( $activation_history_for_addon ){ |
|
420 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
421 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
422 | + if ($activation_history_for_addon) { |
|
423 | 423 | //it exists, so this isn't a completely new install |
424 | 424 | //check if this version already in that list of previously installed versions |
425 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
425 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
426 | 426 | //it a version we haven't seen before |
427 | - if( $version_is_higher === 1 ){ |
|
427 | + if ($version_is_higher === 1) { |
|
428 | 428 | $req_type = EE_System::req_type_upgrade; |
429 | - }else{ |
|
429 | + } else { |
|
430 | 430 | $req_type = EE_System::req_type_downgrade; |
431 | 431 | } |
432 | - delete_option( $activation_indicator_option_name ); |
|
432 | + delete_option($activation_indicator_option_name); |
|
433 | 433 | } else { |
434 | 434 | // its not an update. maybe a reactivation? |
435 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
436 | - if ( $version_is_higher === -1 ){ |
|
435 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
436 | + if ($version_is_higher === -1) { |
|
437 | 437 | $req_type = EE_System::req_type_downgrade; |
438 | - }elseif( $version_is_higher === 0 ){ |
|
438 | + }elseif ($version_is_higher === 0) { |
|
439 | 439 | //we've seen this version before, but it's an activation. must be a reactivation |
440 | 440 | $req_type = EE_System::req_type_reactivation; |
441 | - }else{//$version_is_higher === 1 |
|
441 | + } else {//$version_is_higher === 1 |
|
442 | 442 | $req_type = EE_System::req_type_upgrade; |
443 | 443 | } |
444 | - delete_option( $activation_indicator_option_name ); |
|
444 | + delete_option($activation_indicator_option_name); |
|
445 | 445 | } else { |
446 | 446 | //we've seen this version before and the activation indicate doesn't show it was just activated |
447 | - if ( $version_is_higher === -1 ){ |
|
447 | + if ($version_is_higher === -1) { |
|
448 | 448 | $req_type = EE_System::req_type_downgrade; |
449 | - }elseif( $version_is_higher === 0 ){ |
|
449 | + }elseif ($version_is_higher === 0) { |
|
450 | 450 | //we've seen this version before and it's not an activation. its normal request |
451 | 451 | $req_type = EE_System::req_type_normal; |
452 | - }else{//$version_is_higher === 1 |
|
452 | + } else {//$version_is_higher === 1 |
|
453 | 453 | $req_type = EE_System::req_type_upgrade; |
454 | 454 | } |
455 | 455 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | } else { |
458 | 458 | //brand new install |
459 | 459 | $req_type = EE_System::req_type_new_activation; |
460 | - delete_option( $activation_indicator_option_name ); |
|
460 | + delete_option($activation_indicator_option_name); |
|
461 | 461 | } |
462 | 462 | return $req_type; |
463 | 463 | } |
@@ -475,30 +475,30 @@ discard block |
||
475 | 475 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
476 | 476 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
477 | 477 | */ |
478 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
478 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
479 | 479 | //find the most recently-activated version |
480 | 480 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
481 | 481 | $most_recently_active_version = '0.0.0.dev.000'; |
482 | - if( is_array( $activation_history_for_addon ) ){ |
|
483 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
482 | + if (is_array($activation_history_for_addon)) { |
|
483 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
484 | 484 | //check there is a record of when this version was activated. Otherwise, |
485 | 485 | //mark it as unknown |
486 | - if( ! $times_activated ){ |
|
487 | - $times_activated = array( 'unknown-date'); |
|
486 | + if ( ! $times_activated) { |
|
487 | + $times_activated = array('unknown-date'); |
|
488 | 488 | } |
489 | - if( is_string( $times_activated ) ){ |
|
490 | - $times_activated = array( $times_activated ); |
|
489 | + if (is_string($times_activated)) { |
|
490 | + $times_activated = array($times_activated); |
|
491 | 491 | } |
492 | - foreach( $times_activated as $an_activation ){ |
|
493 | - if( $an_activation != 'unknown-date' && |
|
494 | - $an_activation > $most_recently_active_version_activation ){ |
|
492 | + foreach ($times_activated as $an_activation) { |
|
493 | + if ($an_activation != 'unknown-date' && |
|
494 | + $an_activation > $most_recently_active_version_activation) { |
|
495 | 495 | $most_recently_active_version = $version; |
496 | 496 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
497 | 497 | } |
498 | 498 | } |
499 | 499 | } |
500 | 500 | } |
501 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
501 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | |
@@ -508,20 +508,20 @@ discard block |
||
508 | 508 | * @return void |
509 | 509 | */ |
510 | 510 | public function redirect_to_about_ee() { |
511 | - $notices = EE_Error::get_notices( FALSE ); |
|
511 | + $notices = EE_Error::get_notices(FALSE); |
|
512 | 512 | //if current user is an admin and it's not an ajax request |
513 | - if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) && ! isset( $notices[ 'errors' ] ) ){ |
|
514 | - $query_params = array( 'page' => 'espresso_about' ); |
|
513 | + if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) { |
|
514 | + $query_params = array('page' => 'espresso_about'); |
|
515 | 515 | |
516 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
516 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
517 | 517 | $query_params['new_activation'] = TRUE; |
518 | 518 | } |
519 | 519 | |
520 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
520 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
521 | 521 | $query_params['reactivation'] = TRUE; |
522 | 522 | } |
523 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
524 | - wp_safe_redirect( $url ); |
|
523 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
524 | + wp_safe_redirect($url); |
|
525 | 525 | exit(); |
526 | 526 | } |
527 | 527 | } |
@@ -535,31 +535,31 @@ discard block |
||
535 | 535 | * |
536 | 536 | * @return void |
537 | 537 | */ |
538 | - public function load_core_configuration(){ |
|
539 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
540 | - EE_Registry::instance()->load_core( 'EE_Load_Textdomain' ); |
|
538 | + public function load_core_configuration() { |
|
539 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
540 | + EE_Registry::instance()->load_core('EE_Load_Textdomain'); |
|
541 | 541 | //load textdomain |
542 | 542 | EE_Load_Textdomain::load_textdomain(); |
543 | 543 | // load and setup EE_Config and EE_Network_Config |
544 | - EE_Registry::instance()->load_core( 'Config' ); |
|
545 | - EE_Registry::instance()->load_core( 'Network_Config' ); |
|
544 | + EE_Registry::instance()->load_core('Config'); |
|
545 | + EE_Registry::instance()->load_core('Network_Config'); |
|
546 | 546 | // setup autoloaders |
547 | 547 | // enable logging? |
548 | - if ( EE_Registry::instance()->CFG->admin->use_full_logging ) { |
|
549 | - EE_Registry::instance()->load_core( 'Log' ); |
|
548 | + if (EE_Registry::instance()->CFG->admin->use_full_logging) { |
|
549 | + EE_Registry::instance()->load_core('Log'); |
|
550 | 550 | } |
551 | 551 | // check for activation errors |
552 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
553 | - if ( $activation_errors ) { |
|
554 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
555 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
552 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
553 | + if ($activation_errors) { |
|
554 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
555 | + update_option('ee_plugin_activation_errors', FALSE); |
|
556 | 556 | } |
557 | 557 | // get model names |
558 | 558 | $this->_parse_model_names(); |
559 | 559 | |
560 | 560 | //load caf stuff a chance to play during the activation process too. |
561 | 561 | $this->_maybe_brew_regular(); |
562 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
562 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | |
@@ -568,23 +568,23 @@ discard block |
||
568 | 568 | * |
569 | 569 | * @return void |
570 | 570 | */ |
571 | - private function _parse_model_names(){ |
|
571 | + private function _parse_model_names() { |
|
572 | 572 | //get all the files in the EE_MODELS folder that end in .model.php |
573 | - $models = glob( EE_MODELS.'*.model.php'); |
|
573 | + $models = glob(EE_MODELS.'*.model.php'); |
|
574 | 574 | $model_names = array(); |
575 | 575 | $non_abstract_db_models = array(); |
576 | - foreach( $models as $model ){ |
|
576 | + foreach ($models as $model) { |
|
577 | 577 | // get model classname |
578 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
579 | - $shortname = str_replace( 'EEM_', '', $classname ); |
|
578 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
579 | + $shortname = str_replace('EEM_', '', $classname); |
|
580 | 580 | $reflectionClass = new ReflectionClass($classname); |
581 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
581 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
582 | 582 | $non_abstract_db_models[$shortname] = $classname; |
583 | 583 | } |
584 | - $model_names[ $shortname ] = $classname; |
|
584 | + $model_names[$shortname] = $classname; |
|
585 | 585 | } |
586 | - EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
587 | - EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
586 | + EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
587 | + EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | * @return void |
595 | 595 | */ |
596 | 596 | private function _maybe_brew_regular() { |
597 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
598 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
597 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
598 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 | |
@@ -612,9 +612,9 @@ discard block |
||
612 | 612 | * @return void |
613 | 613 | */ |
614 | 614 | public function register_shortcodes_modules_and_widgets() { |
615 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
615 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
616 | 616 | // check for addons using old hookpoint |
617 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
617 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
618 | 618 | $this->_incompatible_addon_error(); |
619 | 619 | } |
620 | 620 | } |
@@ -628,19 +628,19 @@ discard block |
||
628 | 628 | */ |
629 | 629 | private function _incompatible_addon_error() { |
630 | 630 | // get array of classes hooking into here |
631 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
632 | - if ( ! empty( $class_names )) { |
|
633 | - $msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' ); |
|
631 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
632 | + if ( ! empty($class_names)) { |
|
633 | + $msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso'); |
|
634 | 634 | $msg .= '<ul>'; |
635 | - foreach ( $class_names as $class_name ) { |
|
636 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
635 | + foreach ($class_names as $class_name) { |
|
636 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
637 | 637 | } |
638 | 638 | $msg .= '</ul>'; |
639 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
639 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
640 | 640 | // save list of incompatible addons to wp-options for later use |
641 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
642 | - if ( is_admin() ) { |
|
643 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
641 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
642 | + if (is_admin()) { |
|
643 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
644 | 644 | } |
645 | 645 | } |
646 | 646 | } |
@@ -657,25 +657,25 @@ discard block |
||
657 | 657 | * |
658 | 658 | * @return void |
659 | 659 | */ |
660 | - public function brew_espresso(){ |
|
661 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
660 | + public function brew_espresso() { |
|
661 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
662 | 662 | // load some final core systems |
663 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
664 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
665 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
666 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
667 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
668 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
669 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
670 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
671 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
672 | - |
|
673 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
663 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
664 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
665 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
666 | + add_action('init', array($this, 'load_controllers'), 7); |
|
667 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
668 | + add_action('init', array($this, 'initialize'), 10); |
|
669 | + add_action('init', array($this, 'initialize_last'), 100); |
|
670 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
671 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
672 | + |
|
673 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
674 | 674 | // pew pew pew |
675 | - EE_Registry::instance()->load_core( 'PUE' ); |
|
676 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
675 | + EE_Registry::instance()->load_core('PUE'); |
|
676 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
677 | 677 | } |
678 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
678 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | */ |
690 | 690 | public function set_hooks_for_core() { |
691 | 691 | $this->_deactivate_incompatible_addons(); |
692 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
692 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | |
@@ -698,15 +698,15 @@ discard block |
||
698 | 698 | * Using the information gathered in EE_System::_incompatible_addon_error, |
699 | 699 | * deactivates any addons considered incompatible with the current version of EE |
700 | 700 | */ |
701 | - private function _deactivate_incompatible_addons(){ |
|
702 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
703 | - if ( ! empty( $incompatible_addons )) { |
|
704 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
705 | - foreach ( $active_plugins as $active_plugin ) { |
|
706 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
707 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
708 | - unset( $_GET['activate'] ); |
|
709 | - espresso_deactivate_plugin( $active_plugin ); |
|
701 | + private function _deactivate_incompatible_addons() { |
|
702 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
703 | + if ( ! empty($incompatible_addons)) { |
|
704 | + $active_plugins = get_option('active_plugins', array()); |
|
705 | + foreach ($active_plugins as $active_plugin) { |
|
706 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
707 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
708 | + unset($_GET['activate']); |
|
709 | + espresso_deactivate_plugin($active_plugin); |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | } |
@@ -723,10 +723,10 @@ discard block |
||
723 | 723 | */ |
724 | 724 | public function perform_activations_upgrades_and_migrations() { |
725 | 725 | //first check if we had previously attempted to setup EE's directories but failed |
726 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
726 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
727 | 727 | EEH_Activation::create_upload_directories(); |
728 | 728 | } |
729 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
729 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
730 | 730 | } |
731 | 731 | |
732 | 732 | |
@@ -738,10 +738,10 @@ discard block |
||
738 | 738 | * @return void |
739 | 739 | */ |
740 | 740 | public function load_CPTs_and_session() { |
741 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
741 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
742 | 742 | // register Custom Post Types |
743 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
744 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
743 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
744 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | |
@@ -756,16 +756,16 @@ discard block |
||
756 | 756 | * @return void |
757 | 757 | */ |
758 | 758 | public function load_controllers() { |
759 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
759 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
760 | 760 | // let's get it started |
761 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
762 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
763 | - EE_Registry::instance()->load_core( 'Front_Controller' ); |
|
764 | - } else if ( ! EE_FRONT_AJAX ) { |
|
765 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
766 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
761 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
762 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
763 | + EE_Registry::instance()->load_core('Front_Controller'); |
|
764 | + } else if ( ! EE_FRONT_AJAX) { |
|
765 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
766 | + EE_Registry::instance()->load_core('Admin'); |
|
767 | 767 | } |
768 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
768 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | |
@@ -779,10 +779,10 @@ discard block |
||
779 | 779 | * @return void |
780 | 780 | */ |
781 | 781 | public function core_loaded_and_ready() { |
782 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
783 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
782 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
783 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
784 | 784 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
785 | - EE_Registry::instance()->load_core( 'Session' ); |
|
785 | + EE_Registry::instance()->load_core('Session'); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @return void |
797 | 797 | */ |
798 | 798 | public function initialize() { |
799 | - do_action( 'AHEE__EE_System__initialize' ); |
|
799 | + do_action('AHEE__EE_System__initialize'); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | * @return void |
811 | 811 | */ |
812 | 812 | public function initialize_last() { |
813 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
813 | + do_action('AHEE__EE_System__initialize_last'); |
|
814 | 814 | } |
815 | 815 | |
816 | 816 | |
@@ -842,21 +842,21 @@ discard block |
||
842 | 842 | */ |
843 | 843 | public static function do_not_cache() { |
844 | 844 | // set no cache constants |
845 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
846 | - define( 'DONOTCACHEPAGE', true ); |
|
845 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
846 | + define('DONOTCACHEPAGE', true); |
|
847 | 847 | } |
848 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
849 | - define( 'DONOTCACHCEOBJECT', true ); |
|
848 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
849 | + define('DONOTCACHCEOBJECT', true); |
|
850 | 850 | } |
851 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
852 | - define( 'DONOTCACHEDB', true ); |
|
851 | + if ( ! defined('DONOTCACHEDB')) { |
|
852 | + define('DONOTCACHEDB', true); |
|
853 | 853 | } |
854 | 854 | // add no cache headers |
855 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
855 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
856 | 856 | // plus a little extra for nginx |
857 | - add_filter( 'nocache_headers', array( 'EE_System', 'nocache_headers_nginx' ), 10, 1 ); |
|
857 | + add_filter('nocache_headers', array('EE_System', 'nocache_headers_nginx'), 10, 1); |
|
858 | 858 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
859 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
859 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | * @param $headers |
869 | 869 | * @return array |
870 | 870 | */ |
871 | - public static function nocache_headers_nginx ( $headers ) { |
|
871 | + public static function nocache_headers_nginx($headers) { |
|
872 | 872 | $headers['X-Accel-Expires'] = 0; |
873 | 873 | return $headers; |
874 | 874 | } |
@@ -894,15 +894,15 @@ discard block |
||
894 | 894 | * @param $admin_bar |
895 | 895 | * @return void |
896 | 896 | */ |
897 | - public function espresso_toolbar_items( $admin_bar ) { |
|
897 | + public function espresso_toolbar_items($admin_bar) { |
|
898 | 898 | |
899 | 899 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
900 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
900 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
901 | 901 | return; |
902 | 902 | } |
903 | 903 | |
904 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
905 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
904 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
905 | + EE_Registry::instance()->load_helper('URL'); |
|
906 | 906 | $menu_class = 'espresso_menu_item_class'; |
907 | 907 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
908 | 908 | //because they're only defined in each of their respective constructors |
@@ -914,20 +914,20 @@ discard block |
||
914 | 914 | //Top Level |
915 | 915 | $admin_bar->add_menu(array( |
916 | 916 | 'id' => 'espresso-toolbar', |
917 | - 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>', |
|
917 | + 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>', |
|
918 | 918 | 'href' => $events_admin_url, |
919 | 919 | 'meta' => array( |
920 | 920 | 'title' => __('Event Espresso', 'event_espresso'), |
921 | - 'class' => $menu_class . 'first' |
|
921 | + 'class' => $menu_class.'first' |
|
922 | 922 | ), |
923 | 923 | )); |
924 | 924 | |
925 | 925 | //Events |
926 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
926 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
927 | 927 | $admin_bar->add_menu(array( |
928 | 928 | 'id' => 'espresso-toolbar-events', |
929 | 929 | 'parent' => 'espresso-toolbar', |
930 | - 'title' => __( 'Events', 'event_espresso' ), |
|
930 | + 'title' => __('Events', 'event_espresso'), |
|
931 | 931 | 'href' => $events_admin_url, |
932 | 932 | 'meta' => array( |
933 | 933 | 'title' => __('Events', 'event_espresso'), |
@@ -938,13 +938,13 @@ discard block |
||
938 | 938 | } |
939 | 939 | |
940 | 940 | |
941 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
941 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
942 | 942 | //Events Add New |
943 | 943 | $admin_bar->add_menu(array( |
944 | 944 | 'id' => 'espresso-toolbar-events-new', |
945 | 945 | 'parent' => 'espresso-toolbar-events', |
946 | 946 | 'title' => __('Add New', 'event_espresso'), |
947 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
947 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
948 | 948 | 'meta' => array( |
949 | 949 | 'title' => __('Add New', 'event_espresso'), |
950 | 950 | 'target' => '', |
@@ -953,18 +953,18 @@ discard block |
||
953 | 953 | )); |
954 | 954 | } |
955 | 955 | |
956 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
956 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
957 | 957 | |
958 | 958 | //Current post |
959 | 959 | global $post; |
960 | 960 | |
961 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
961 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
962 | 962 | //Events Edit Current Event |
963 | 963 | $admin_bar->add_menu(array( |
964 | 964 | 'id' => 'espresso-toolbar-events-edit', |
965 | 965 | 'parent' => 'espresso-toolbar-events', |
966 | 966 | 'title' => __('Edit Event', 'event_espresso'), |
967 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
967 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
968 | 968 | 'meta' => array( |
969 | 969 | 'title' => __('Edit Event', 'event_espresso'), |
970 | 970 | 'target' => '', |
@@ -976,11 +976,11 @@ discard block |
||
976 | 976 | } |
977 | 977 | |
978 | 978 | //Events View |
979 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
979 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
980 | 980 | $admin_bar->add_menu(array( |
981 | 981 | 'id' => 'espresso-toolbar-events-view', |
982 | 982 | 'parent' => 'espresso-toolbar-events', |
983 | - 'title' => __( 'View', 'event_espresso' ), |
|
983 | + 'title' => __('View', 'event_espresso'), |
|
984 | 984 | 'href' => $events_admin_url, |
985 | 985 | 'meta' => array( |
986 | 986 | 'title' => __('View', 'event_espresso'), |
@@ -990,12 +990,12 @@ discard block |
||
990 | 990 | )); |
991 | 991 | } |
992 | 992 | |
993 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
993 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
994 | 994 | //Events View All |
995 | 995 | $admin_bar->add_menu(array( |
996 | 996 | 'id' => 'espresso-toolbar-events-all', |
997 | 997 | 'parent' => 'espresso-toolbar-events-view', |
998 | - 'title' => __( 'All', 'event_espresso' ), |
|
998 | + 'title' => __('All', 'event_espresso'), |
|
999 | 999 | 'href' => $events_admin_url, |
1000 | 1000 | 'meta' => array( |
1001 | 1001 | 'title' => __('All', 'event_espresso'), |
@@ -1006,13 +1006,13 @@ discard block |
||
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | |
1009 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1009 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1010 | 1010 | //Events View Today |
1011 | 1011 | $admin_bar->add_menu(array( |
1012 | 1012 | 'id' => 'espresso-toolbar-events-today', |
1013 | 1013 | 'parent' => 'espresso-toolbar-events-view', |
1014 | 1014 | 'title' => __('Today', 'event_espresso'), |
1015 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1015 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1016 | 1016 | 'meta' => array( |
1017 | 1017 | 'title' => __('Today', 'event_espresso'), |
1018 | 1018 | 'target' => '', |
@@ -1022,13 +1022,13 @@ discard block |
||
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | |
1025 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1025 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1026 | 1026 | //Events View This Month |
1027 | 1027 | $admin_bar->add_menu(array( |
1028 | 1028 | 'id' => 'espresso-toolbar-events-month', |
1029 | 1029 | 'parent' => 'espresso-toolbar-events-view', |
1030 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1031 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1030 | + 'title' => __('This Month', 'event_espresso'), |
|
1031 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1032 | 1032 | 'meta' => array( |
1033 | 1033 | 'title' => __('This Month', 'event_espresso'), |
1034 | 1034 | 'target' => '', |
@@ -1038,11 +1038,11 @@ discard block |
||
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | //Registration Overview |
1041 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1041 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1042 | 1042 | $admin_bar->add_menu(array( |
1043 | 1043 | 'id' => 'espresso-toolbar-registrations', |
1044 | 1044 | 'parent' => 'espresso-toolbar', |
1045 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1045 | + 'title' => __('Registrations', 'event_espresso'), |
|
1046 | 1046 | 'href' => $reg_admin_url, |
1047 | 1047 | 'meta' => array( |
1048 | 1048 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1053,12 +1053,12 @@ discard block |
||
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | //Registration Overview Today |
1056 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1056 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1057 | 1057 | $admin_bar->add_menu(array( |
1058 | 1058 | 'id' => 'espresso-toolbar-registrations-today', |
1059 | 1059 | 'parent' => 'espresso-toolbar-registrations', |
1060 | - 'title' => __( 'Today', 'event_espresso'), |
|
1061 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1060 | + 'title' => __('Today', 'event_espresso'), |
|
1061 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1062 | 1062 | 'meta' => array( |
1063 | 1063 | 'title' => __('Today', 'event_espresso'), |
1064 | 1064 | 'target' => '', |
@@ -1068,14 +1068,14 @@ discard block |
||
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | //Registration Overview Today Completed |
1071 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1071 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1072 | 1072 | $admin_bar->add_menu(array( |
1073 | 1073 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1074 | 1074 | 'parent' => 'espresso-toolbar-registrations-today', |
1075 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1076 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1075 | + 'title' => __('Approved', 'event_espresso'), |
|
1076 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1077 | 1077 | 'meta' => array( |
1078 | - 'title' => __('Approved', 'event_espresso' ), |
|
1078 | + 'title' => __('Approved', 'event_espresso'), |
|
1079 | 1079 | 'target' => '', |
1080 | 1080 | 'class' => $menu_class |
1081 | 1081 | ), |
@@ -1083,14 +1083,14 @@ discard block |
||
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | //Registration Overview Today Pending\ |
1086 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1086 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1087 | 1087 | $admin_bar->add_menu(array( |
1088 | 1088 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1089 | 1089 | 'parent' => 'espresso-toolbar-registrations-today', |
1090 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1091 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1090 | + 'title' => __('Pending', 'event_espresso'), |
|
1091 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1092 | 1092 | 'meta' => array( |
1093 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1093 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1094 | 1094 | 'target' => '', |
1095 | 1095 | 'class' => $menu_class |
1096 | 1096 | ), |
@@ -1098,14 +1098,14 @@ discard block |
||
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | //Registration Overview Today Incomplete |
1101 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1101 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1102 | 1102 | $admin_bar->add_menu(array( |
1103 | 1103 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1104 | 1104 | 'parent' => 'espresso-toolbar-registrations-today', |
1105 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1106 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1105 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1106 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1107 | 1107 | 'meta' => array( |
1108 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1108 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1109 | 1109 | 'target' => '', |
1110 | 1110 | 'class' => $menu_class |
1111 | 1111 | ), |
@@ -1113,12 +1113,12 @@ discard block |
||
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | //Registration Overview Today Incomplete |
1116 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1116 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1117 | 1117 | $admin_bar->add_menu(array( |
1118 | 1118 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1119 | 1119 | 'parent' => 'espresso-toolbar-registrations-today', |
1120 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1121 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1120 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1121 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1122 | 1122 | 'meta' => array( |
1123 | 1123 | 'title' => __('Cancelled', 'event_espresso'), |
1124 | 1124 | 'target' => '', |
@@ -1128,12 +1128,12 @@ discard block |
||
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | //Registration Overview This Month |
1131 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1131 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1132 | 1132 | $admin_bar->add_menu(array( |
1133 | 1133 | 'id' => 'espresso-toolbar-registrations-month', |
1134 | 1134 | 'parent' => 'espresso-toolbar-registrations', |
1135 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1136 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1135 | + 'title' => __('This Month', 'event_espresso'), |
|
1136 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1137 | 1137 | 'meta' => array( |
1138 | 1138 | 'title' => __('This Month', 'event_espresso'), |
1139 | 1139 | 'target' => '', |
@@ -1143,12 +1143,12 @@ discard block |
||
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | //Registration Overview This Month Approved |
1146 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1146 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1147 | 1147 | $admin_bar->add_menu(array( |
1148 | 1148 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1149 | 1149 | 'parent' => 'espresso-toolbar-registrations-month', |
1150 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1151 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1150 | + 'title' => __('Approved', 'event_espresso'), |
|
1151 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1152 | 1152 | 'meta' => array( |
1153 | 1153 | 'title' => __('Approved', 'event_espresso'), |
1154 | 1154 | 'target' => '', |
@@ -1158,12 +1158,12 @@ discard block |
||
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | //Registration Overview This Month Pending |
1161 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1161 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1162 | 1162 | $admin_bar->add_menu(array( |
1163 | 1163 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1164 | 1164 | 'parent' => 'espresso-toolbar-registrations-month', |
1165 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1166 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1165 | + 'title' => __('Pending', 'event_espresso'), |
|
1166 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1167 | 1167 | 'meta' => array( |
1168 | 1168 | 'title' => __('Pending', 'event_espresso'), |
1169 | 1169 | 'target' => '', |
@@ -1173,14 +1173,14 @@ discard block |
||
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | //Registration Overview This Month Not Approved |
1176 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1176 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1177 | 1177 | $admin_bar->add_menu(array( |
1178 | 1178 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1179 | 1179 | 'parent' => 'espresso-toolbar-registrations-month', |
1180 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1181 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1180 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1181 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1182 | 1182 | 'meta' => array( |
1183 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1183 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1184 | 1184 | 'target' => '', |
1185 | 1185 | 'class' => $menu_class |
1186 | 1186 | ), |
@@ -1189,12 +1189,12 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | |
1191 | 1191 | //Registration Overview This Month Cancelled |
1192 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1192 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1193 | 1193 | $admin_bar->add_menu(array( |
1194 | 1194 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1195 | 1195 | 'parent' => 'espresso-toolbar-registrations-month', |
1196 | 1196 | 'title' => __('Cancelled', 'event_espresso'), |
1197 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1197 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1198 | 1198 | 'meta' => array( |
1199 | 1199 | 'title' => __('Cancelled', 'event_espresso'), |
1200 | 1200 | 'target' => '', |
@@ -1204,11 +1204,11 @@ discard block |
||
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | //Extensions & Services |
1207 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
1207 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
1208 | 1208 | $admin_bar->add_menu(array( |
1209 | 1209 | 'id' => 'espresso-toolbar-extensions-and-services', |
1210 | 1210 | 'parent' => 'espresso-toolbar', |
1211 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
1211 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
1212 | 1212 | 'href' => $extensions_admin_url, |
1213 | 1213 | 'meta' => array( |
1214 | 1214 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1230,8 +1230,8 @@ discard block |
||
1230 | 1230 | * @param array $exclude_array any existing pages being excluded are in this array. |
1231 | 1231 | * @return array |
1232 | 1232 | */ |
1233 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1234 | - return array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() ); |
|
1233 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1234 | + return array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array()); |
|
1235 | 1235 | } |
1236 | 1236 | |
1237 | 1237 | |
@@ -1251,11 +1251,11 @@ discard block |
||
1251 | 1251 | */ |
1252 | 1252 | public function wp_enqueue_scripts() { |
1253 | 1253 | // unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' ); |
1254 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1254 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1255 | 1255 | // jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
1256 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1256 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1257 | 1257 | // register jQuery Validate |
1258 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE ); |
|
1258 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
1259 | 1259 | } |
1260 | 1260 | } |
1261 | 1261 | } |