@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -55,38 +55,38 @@ discard block |
||
55 | 55 | '[EVENT_NAME]' => __("This also can be used for the name of the event", 'event_espresso'), |
56 | 56 | '[EVENT_PHONE]' => __('The phone number for the event (usually an info number)', 'event_espresso'), |
57 | 57 | '[EVENT_DESCRIPTION]' => __('The description of the event', 'event_espresso'), |
58 | - '[EVENT_EXCERPT]' => __( 'This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso' ), |
|
58 | + '[EVENT_EXCERPT]' => __('This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso'), |
|
59 | 59 | '[EVENT_LINK]' => __('A link associated with the event', 'event_espresso'), |
60 | 60 | '[EVENT_URL]' => __('A link to the event set up on the host site.', 'event_espresso'), |
61 | 61 | '[VIRTUAL_URL]' => __('What was used for the "URL of Event" field in the Venue settings', 'event_espresso'), |
62 | 62 | '[VIRTUAL_PHONE]' => __('An alternate phone number for the event. Typically used as a "call-in" number', 'event_espresso'), |
63 | 63 | '[EVENT_IMAGE]' => __('This will parse to the Feature image for the event.', 'event_espresso'), |
64 | 64 | '[EVENT_IMAGE_*]' => sprintf( |
65 | - __( 'This will parse to the Feature image for the event, %1$ssize%2$s can be set to determine the size of the image loaded by the shortcode. The %1$swidth%2$s and/or %1$sheight%2$s can also be set to determine the width and height of the image when output. By default the shortcode will load the %1$sthumbnail%2$s image size.', 'event_espresso' ), |
|
65 | + __('This will parse to the Feature image for the event, %1$ssize%2$s can be set to determine the size of the image loaded by the shortcode. The %1$swidth%2$s and/or %1$sheight%2$s can also be set to determine the width and height of the image when output. By default the shortcode will load the %1$sthumbnail%2$s image size.', 'event_espresso'), |
|
66 | 66 | '<code>', |
67 | 67 | '</code>' |
68 | 68 | ), |
69 | 69 | '[EVENT_TOTAL_AVAILABLE_SPACES_*]' => sprintf( |
70 | - __( 'This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event. There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode). %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso' ), |
|
70 | + __('This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event. There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode). %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso'), |
|
71 | 71 | '<code>', |
72 | 72 | '</code>' |
73 | 73 | ), |
74 | - '[EVENT_TOTAL_SPOTS_TAKEN]' => __( 'This shortcode will parse to the output the total approved registrations for this event', 'event_espresso' ), |
|
74 | + '[EVENT_TOTAL_SPOTS_TAKEN]' => __('This shortcode will parse to the output the total approved registrations for this event', 'event_espresso'), |
|
75 | 75 | '[EVENT_FACEBOOK_URL]' => __('This will return the Facebook URL for the event if you have it set via custom field in your event, otherwise it will use the Facebook URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_facebook</code> and the value as your facebook url.', 'event_espresso'), |
76 | 76 | '[EVENT_TWITTER_URL]' => __('This will return the Twitter URL for the event if you have it set via custom field in your event, otherwise it will use the Twitter URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_twitter</code> and the value as your facebook url', 'event_espresso'), |
77 | 77 | '[EVENT_META_*]' => __('This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the event then it will be output in place of this shortcode.', 'event_espresso'), |
78 | - '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __( 'This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso' ), |
|
78 | + '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __('This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso'), |
|
79 | 79 | ); |
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | - protected function _parser( $shortcode ) { |
|
83 | + protected function _parser($shortcode) { |
|
84 | 84 | |
85 | 85 | |
86 | 86 | $this->_event = $this->_data instanceof EE_Event ? $this->_data : null; |
87 | 87 | |
88 | 88 | //if no event, then let's see if there is a reg_obj. If there IS, then we'll try and grab the event from the reg_obj instead. |
89 | - if ( empty( $this->_event ) ) { |
|
89 | + if (empty($this->_event)) { |
|
90 | 90 | $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
91 | 91 | $aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee; |
92 | 92 | |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | |
96 | 96 | |
97 | 97 | //If there is no event objecdt by now then get out. |
98 | - if ( ! $this->_event instanceof EE_Event ) |
|
98 | + if ( ! $this->_event instanceof EE_Event) |
|
99 | 99 | return ''; |
100 | 100 | |
101 | - switch ( $shortcode ) { |
|
101 | + switch ($shortcode) { |
|
102 | 102 | |
103 | 103 | case '[EVENT_ID]' : |
104 | 104 | return $this->_event->ID(); |
@@ -131,41 +131,41 @@ discard block |
||
131 | 131 | |
132 | 132 | case '[VIRTUAL_URL]' : |
133 | 133 | $venue = $this->_event->get_first_related('Venue'); |
134 | - if ( empty( $venue ) ) |
|
134 | + if (empty($venue)) |
|
135 | 135 | return ''; |
136 | 136 | return $venue->get('VNU_virtual_url'); |
137 | 137 | |
138 | 138 | case '[VIRTUAL_PHONE]' : |
139 | 139 | $venue = $this->_event->get_first_related('Venue'); |
140 | - if ( empty( $venue ) ) |
|
140 | + if (empty($venue)) |
|
141 | 141 | return ''; |
142 | 142 | return $venue->get('VNU_virtual_phone'); |
143 | 143 | break; |
144 | 144 | |
145 | 145 | case '[EVENT_IMAGE]' : |
146 | - $image = $this->_event->feature_image_url(array(600,300) ); |
|
146 | + $image = $this->_event->feature_image_url(array(600, 300)); |
|
147 | 147 | // @todo: eventually we should make this an attribute shortcode so that em can send along what size they want returned. |
148 | - return ! empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '" />' : ''; |
|
148 | + return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'" />' : ''; |
|
149 | 149 | break; |
150 | 150 | |
151 | 151 | case '[EVENT_FACEBOOK_URL]' : |
152 | - $facebook_url = $this->_event->get_post_meta('event_facebook', true ); |
|
153 | - return empty( $facebook_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : $facebook_url; |
|
152 | + $facebook_url = $this->_event->get_post_meta('event_facebook', true); |
|
153 | + return empty($facebook_url) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : $facebook_url; |
|
154 | 154 | break; |
155 | 155 | |
156 | 156 | case '[EVENT_TWITTER_URL]' : |
157 | 157 | $twitter_url = $this->_event->get_post_meta('event_twitter', true); |
158 | - return empty( $twitter_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : $twitter_url; |
|
158 | + return empty($twitter_url) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : $twitter_url; |
|
159 | 159 | break; |
160 | 160 | |
161 | 161 | case '[EVENT_AUTHOR_EMAIL]' : |
162 | 162 | $author_id = $this->_event->get('EVT_wp_user'); |
163 | - $user_data = get_userdata( (int) $author_id ); |
|
163 | + $user_data = get_userdata((int) $author_id); |
|
164 | 164 | return $user_data->user_email; |
165 | 165 | break; |
166 | 166 | |
167 | 167 | case '[EVENT_TOTAL_SPOTS_TAKEN]' : |
168 | - return EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true ); |
|
168 | + return EEM_Registration::instance()->count(array(array('EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true); |
|
169 | 169 | break; |
170 | 170 | |
171 | 171 | case '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' : |
@@ -175,49 +175,49 @@ discard block |
||
175 | 175 | 'page' => 'espresso_registrations', |
176 | 176 | 'action' => 'default' |
177 | 177 | ), |
178 | - admin_url( 'admin.php' ), |
|
178 | + admin_url('admin.php'), |
|
179 | 179 | true |
180 | 180 | ); |
181 | 181 | break; |
182 | 182 | } |
183 | 183 | |
184 | - if ( strpos( $shortcode, '[EVENT_META_*' ) !== false ) { |
|
185 | - $shortcode = str_replace( '[EVENT_META_*', '', $shortcode ); |
|
186 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
184 | + if (strpos($shortcode, '[EVENT_META_*') !== false) { |
|
185 | + $shortcode = str_replace('[EVENT_META_*', '', $shortcode); |
|
186 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
187 | 187 | |
188 | 188 | //pull the meta value from the event post |
189 | - $event_meta = $this->_event->get_post_meta( $shortcode, true ); |
|
189 | + $event_meta = $this->_event->get_post_meta($shortcode, true); |
|
190 | 190 | |
191 | - return ! empty( $event_meta ) ? $this->_event->get_post_meta( $shortcode, true ) : ''; |
|
191 | + return ! empty($event_meta) ? $this->_event->get_post_meta($shortcode, true) : ''; |
|
192 | 192 | |
193 | 193 | } |
194 | 194 | |
195 | - if ( strpos( $shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*' ) !== false ) { |
|
196 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
197 | - $method = empty( $attrs['method'] ) ? 'current' : $attrs['method']; |
|
195 | + if (strpos($shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*') !== false) { |
|
196 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
197 | + $method = empty($attrs['method']) ? 'current' : $attrs['method']; |
|
198 | 198 | $method = $method === 'current'; |
199 | 199 | $available = $this->_event->total_available_spaces($method); |
200 | 200 | return $available === EE_INF ? '∞' : $available; |
201 | 201 | } |
202 | 202 | |
203 | - if ( strpos( $shortcode, '[EVENT_IMAGE_*' ) !== false ) { |
|
204 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
205 | - $width = empty( $attrs['width'] ) ? '' : ' width="' . $attrs['width'] . '"'; |
|
206 | - $height = empty( $attrs['height'] ) ? '' : ' height="'. $attrs['height'] .'"'; |
|
203 | + if (strpos($shortcode, '[EVENT_IMAGE_*') !== false) { |
|
204 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
205 | + $width = empty($attrs['width']) ? '' : ' width="'.$attrs['width'].'"'; |
|
206 | + $height = empty($attrs['height']) ? '' : ' height="'.$attrs['height'].'"'; |
|
207 | 207 | |
208 | 208 | //Size may be set to a string such as 'tumbnail' or "width, height" eg - '200,200' |
209 | - if ( ! empty( $attrs['size'] ) ) { |
|
210 | - $size = explode( ',', $attrs['size'] ); |
|
211 | - if ( count($size) === 1 ) { |
|
209 | + if ( ! empty($attrs['size'])) { |
|
210 | + $size = explode(',', $attrs['size']); |
|
211 | + if (count($size) === 1) { |
|
212 | 212 | $size = $size[0]; |
213 | 213 | } |
214 | 214 | } else { |
215 | 215 | $size = 'thumbnail'; |
216 | 216 | } |
217 | 217 | |
218 | - $image = $this->_event->feature_image_url( $size ); |
|
218 | + $image = $this->_event->feature_image_url($size); |
|
219 | 219 | |
220 | - return ! empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '"' . $width . $height . '/>' : ''; |
|
220 | + return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'"'.$width.$height.'/>' : ''; |
|
221 | 221 | break; |
222 | 222 | } |
223 | 223 | |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | * @param boolean $full_link if TRUE (default) we return the html for the name of the event linked to the event. Otherwise we just return the url of the event. |
232 | 232 | * @return string |
233 | 233 | */ |
234 | - private function _get_event_link( $event, $full_link = TRUE ) { |
|
234 | + private function _get_event_link($event, $full_link = TRUE) { |
|
235 | 235 | $url = get_permalink($event->ID()); |
236 | 236 | |
237 | - return $full_link ? '<a href="' . $url . '">' . $event->get('EVT_name') . '</a>' : $url; |
|
237 | + return $full_link ? '<a href="'.$url.'">'.$event->get('EVT_name').'</a>' : $url; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @param string $name |
462 | 462 | * @param string $config_class |
463 | 463 | * @param EE_Config_Base $config_obj |
464 | - * @param array $tests_to_run |
|
464 | + * @param integer[] $tests_to_run |
|
465 | 465 | * @param bool $display_errors |
466 | 466 | * @return bool TRUE on success, FALSE on fail |
467 | 467 | */ |
@@ -1759,7 +1759,7 @@ discard block |
||
1759 | 1759 | |
1760 | 1760 | |
1761 | 1761 | /** |
1762 | - * @return array |
|
1762 | + * @return integer[] |
|
1763 | 1763 | */ |
1764 | 1764 | public function get_critical_pages_array() { |
1765 | 1765 | return array( |
@@ -1773,7 +1773,7 @@ discard block |
||
1773 | 1773 | |
1774 | 1774 | |
1775 | 1775 | /** |
1776 | - * @return array |
|
1776 | + * @return string[] |
|
1777 | 1777 | */ |
1778 | 1778 | public function get_critical_pages_shortcodes_array() { |
1779 | 1779 | return array( |
@@ -2866,7 +2866,7 @@ discard block |
||
2866 | 2866 | * according to max_input_vars |
2867 | 2867 | * |
2868 | 2868 | * @param int $input_count the count of input vars. |
2869 | - * @return array { |
|
2869 | + * @return string { |
|
2870 | 2870 | * An array that represents whether available space and if no available space the error |
2871 | 2871 | * message. |
2872 | 2872 | * @type bool $has_space whether more inputs can be added. |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function instance() { |
123 | 123 | // check if class object is instantiated, and instantiated properly |
124 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
124 | + if ( ! self::$_instance instanceof EE_Config) { |
|
125 | 125 | self::$_instance = new self(); |
126 | 126 | } |
127 | 127 | return self::$_instance; |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | * site was put into maintenance mode) |
142 | 142 | * @return EE_Config |
143 | 143 | */ |
144 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
145 | - if ( $hard_reset ) { |
|
144 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
145 | + if ($hard_reset) { |
|
146 | 146 | self::$_instance->_addon_option_names = array(); |
147 | 147 | self::$_instance->_initialize_config(); |
148 | 148 | self::$_instance->update_espresso_config(); |
149 | 149 | } |
150 | - if ( self::$_instance instanceof EE_Config ) { |
|
150 | + if (self::$_instance instanceof EE_Config) { |
|
151 | 151 | self::$_instance->update_addon_option_names(); |
152 | 152 | } |
153 | 153 | self::$_instance = null; |
154 | 154 | //we don't need to reset the static properties imo because those should |
155 | 155 | //only change when a module is added or removed. Currently we don't |
156 | 156 | //support removing a module during a request when it previously existed |
157 | - if ( $reinstantiate ) { |
|
157 | + if ($reinstantiate) { |
|
158 | 158 | return self::instance(); |
159 | 159 | } else { |
160 | 160 | return null; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @access private |
170 | 170 | */ |
171 | 171 | private function __construct() { |
172 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
172 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
173 | 173 | // setup empty config classes |
174 | 174 | $this->_initialize_config(); |
175 | 175 | // load existing EE site settings |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | // register shortcodes and modules |
180 | 180 | add_action( |
181 | 181 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
182 | - array( $this, 'register_shortcodes_and_modules' ), |
|
182 | + array($this, 'register_shortcodes_and_modules'), |
|
183 | 183 | 999 |
184 | 184 | ); |
185 | 185 | // initialize shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
186 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
187 | 187 | // register widgets |
188 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
188 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
189 | 189 | // shutdown |
190 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
190 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
191 | 191 | // construct__end hook |
192 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
192 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
193 | 193 | // hardcoded hack |
194 | 194 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
195 | 195 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return string current theme set. |
203 | 203 | */ |
204 | 204 | public static function get_current_theme() { |
205 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
205 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
206 | 206 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
207 | 207 | } |
208 | 208 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | private function _initialize_config() { |
218 | 218 | EE_Config::trim_log(); |
219 | 219 | //set defaults |
220 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
220 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
221 | 221 | $this->addons = new stdClass(); |
222 | 222 | // set _module_route_map |
223 | 223 | EE_Config::$_module_route_map = array(); |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | */ |
238 | 238 | private function _load_core_config() { |
239 | 239 | // load_core_config__start hook |
240 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
240 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
241 | 241 | $espresso_config = $this->get_espresso_config(); |
242 | - foreach ( $espresso_config as $config => $settings ) { |
|
242 | + foreach ($espresso_config as $config => $settings) { |
|
243 | 243 | // load_core_config__start hook |
244 | 244 | $settings = apply_filters( |
245 | 245 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -247,22 +247,22 @@ discard block |
||
247 | 247 | $config, |
248 | 248 | $this |
249 | 249 | ); |
250 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
251 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
250 | + if (is_object($settings) && property_exists($this, $config)) { |
|
251 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
252 | 252 | //call configs populate method to ensure any defaults are set for empty values. |
253 | - if ( method_exists( $settings, 'populate' ) ) { |
|
253 | + if (method_exists($settings, 'populate')) { |
|
254 | 254 | $this->{$config}->populate(); |
255 | 255 | } |
256 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
256 | + if (method_exists($settings, 'do_hooks')) { |
|
257 | 257 | $this->{$config}->do_hooks(); |
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
261 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
261 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
262 | 262 | $this->update_espresso_config(); |
263 | 263 | } |
264 | 264 | // load_core_config__end hook |
265 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
265 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -277,23 +277,23 @@ discard block |
||
277 | 277 | $this->core = $this->core instanceof EE_Core_Config |
278 | 278 | ? $this->core |
279 | 279 | : new EE_Core_Config(); |
280 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
280 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
281 | 281 | $this->organization = $this->organization instanceof EE_Organization_Config |
282 | 282 | ? $this->organization |
283 | 283 | : new EE_Organization_Config(); |
284 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
284 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
285 | 285 | $this->currency = $this->currency instanceof EE_Currency_Config |
286 | 286 | ? $this->currency |
287 | 287 | : new EE_Currency_Config(); |
288 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
288 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
289 | 289 | $this->registration = $this->registration instanceof EE_Registration_Config |
290 | 290 | ? $this->registration |
291 | 291 | : new EE_Registration_Config(); |
292 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
292 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
293 | 293 | $this->admin = $this->admin instanceof EE_Admin_Config |
294 | 294 | ? $this->admin |
295 | 295 | : new EE_Admin_Config(); |
296 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
296 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
297 | 297 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
298 | 298 | ? $this->template_settings |
299 | 299 | : new EE_Template_Config(); |
@@ -304,15 +304,15 @@ discard block |
||
304 | 304 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
305 | 305 | ? $this->map_settings |
306 | 306 | : new EE_Map_Config(); |
307 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
307 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
308 | 308 | $this->environment = $this->environment instanceof EE_Environment_Config |
309 | 309 | ? $this->environment |
310 | 310 | : new EE_Environment_Config(); |
311 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
311 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
312 | 312 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
313 | 313 | ? $this->gateway |
314 | 314 | : new EE_Gateway_Config(); |
315 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
315 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | // grab espresso configuration |
328 | 328 | return apply_filters( |
329 | 329 | 'FHEE__EE_Config__get_espresso_config__CFG', |
330 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
330 | + get_option(EE_Config::OPTION_NAME, array()) |
|
331 | 331 | ); |
332 | 332 | } |
333 | 333 | |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | * @param $old_value |
342 | 342 | * @param $value |
343 | 343 | */ |
344 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
344 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
345 | 345 | // make sure we're checking the ee config |
346 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
346 | + if ($option === EE_Config::OPTION_NAME) { |
|
347 | 347 | // run a loose comparison of the old value against the new value for type and properties, |
348 | 348 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
349 | - if ( $value != $old_value ) { |
|
349 | + if ($value != $old_value) { |
|
350 | 350 | // if they are NOT the same, then remove the hook, |
351 | 351 | // which means the subsequent update results will be based solely on the update query results |
352 | 352 | // the reason we do this is because, as stated above, |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | // the string it sees in the db looks the same as the new one it has been passed!!! |
362 | 362 | // This results in the query returning an "affected rows" value of ZERO, |
363 | 363 | // which gets returned immediately by WP update_option and looks like an error. |
364 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
364 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | } |
@@ -375,11 +375,11 @@ discard block |
||
375 | 375 | */ |
376 | 376 | protected function _reset_espresso_addon_config() { |
377 | 377 | $this->_addon_option_names = array(); |
378 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
379 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
380 | - $config_class = get_class( $addon_config_obj ); |
|
381 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
382 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
378 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
379 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
380 | + $config_class = get_class($addon_config_obj); |
|
381 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
382 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
383 | 383 | } |
384 | 384 | $this->addons->{$addon_name} = null; |
385 | 385 | } |
@@ -395,22 +395,22 @@ discard block |
||
395 | 395 | * @param bool $add_error |
396 | 396 | * @return bool |
397 | 397 | */ |
398 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
398 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
399 | 399 | // don't allow config updates during WP heartbeats |
400 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
400 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
401 | 401 | return false; |
402 | 402 | } |
403 | 403 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
404 | 404 | //$clone = clone( self::$_instance ); |
405 | 405 | //self::$_instance = NULL; |
406 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
406 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
407 | 407 | $this->_reset_espresso_addon_config(); |
408 | 408 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
409 | 409 | // but BEFORE the actual update occurs |
410 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
410 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
411 | 411 | // now update "ee_config" |
412 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
413 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
412 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
413 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
414 | 414 | // if not saved... check if the hook we just added still exists; |
415 | 415 | // if it does, it means one of two things: |
416 | 416 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -421,17 +421,17 @@ discard block |
||
421 | 421 | // but just means no update occurred, so don't display an error to the user. |
422 | 422 | // BUT... if update_option returns FALSE, AND the hook is missing, |
423 | 423 | // then it means that something truly went wrong |
424 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
424 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
425 | 425 | // remove our action since we don't want it in the system anymore |
426 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
427 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
426 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
427 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
428 | 428 | //self::$_instance = $clone; |
429 | 429 | //unset( $clone ); |
430 | 430 | // if config remains the same or was updated successfully |
431 | - if ( $saved ) { |
|
432 | - if ( $add_success ) { |
|
431 | + if ($saved) { |
|
432 | + if ($add_success) { |
|
433 | 433 | EE_Error::add_success( |
434 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
434 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
435 | 435 | __FILE__, |
436 | 436 | __FUNCTION__, |
437 | 437 | __LINE__ |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | } |
440 | 440 | return true; |
441 | 441 | } else { |
442 | - if ( $add_error ) { |
|
442 | + if ($add_error) { |
|
443 | 443 | EE_Error::add_error( |
444 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
444 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
445 | 445 | __FILE__, |
446 | 446 | __FUNCTION__, |
447 | 447 | __LINE__ |
@@ -470,16 +470,16 @@ discard block |
||
470 | 470 | $name = '', |
471 | 471 | $config_class = '', |
472 | 472 | $config_obj = null, |
473 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
473 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
474 | 474 | $display_errors = true |
475 | 475 | ) { |
476 | 476 | try { |
477 | - foreach ( $tests_to_run as $test ) { |
|
478 | - switch ( $test ) { |
|
477 | + foreach ($tests_to_run as $test) { |
|
478 | + switch ($test) { |
|
479 | 479 | // TEST #1 : check that section was set |
480 | 480 | case 1 : |
481 | - if ( empty( $section ) ) { |
|
482 | - if ( $display_errors ) { |
|
481 | + if (empty($section)) { |
|
482 | + if ($display_errors) { |
|
483 | 483 | throw new EE_Error( |
484 | 484 | sprintf( |
485 | 485 | __( |
@@ -495,11 +495,11 @@ discard block |
||
495 | 495 | break; |
496 | 496 | // TEST #2 : check that settings section exists |
497 | 497 | case 2 : |
498 | - if ( ! isset( $this->{$section} ) ) { |
|
499 | - if ( $display_errors ) { |
|
498 | + if ( ! isset($this->{$section} )) { |
|
499 | + if ($display_errors) { |
|
500 | 500 | throw new EE_Error( |
501 | 501 | sprintf( |
502 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
502 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
503 | 503 | $section |
504 | 504 | ) |
505 | 505 | ); |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | // TEST #3 : check that section is the proper format |
511 | 511 | case 3 : |
512 | 512 | if ( |
513 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
513 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
514 | 514 | ) { |
515 | - if ( $display_errors ) { |
|
515 | + if ($display_errors) { |
|
516 | 516 | throw new EE_Error( |
517 | 517 | sprintf( |
518 | 518 | __( |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | break; |
529 | 529 | // TEST #4 : check that config section name has been set |
530 | 530 | case 4 : |
531 | - if ( empty( $name ) ) { |
|
532 | - if ( $display_errors ) { |
|
531 | + if (empty($name)) { |
|
532 | + if ($display_errors) { |
|
533 | 533 | throw new EE_Error( |
534 | 534 | __( |
535 | 535 | 'No name has been provided for the specific configuration section.', |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | break; |
543 | 543 | // TEST #5 : check that a config class name has been set |
544 | 544 | case 5 : |
545 | - if ( empty( $config_class ) ) { |
|
546 | - if ( $display_errors ) { |
|
545 | + if (empty($config_class)) { |
|
546 | + if ($display_errors) { |
|
547 | 547 | throw new EE_Error( |
548 | 548 | __( |
549 | 549 | 'No class name has been provided for the specific configuration section.', |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | break; |
557 | 557 | // TEST #6 : verify config class is accessible |
558 | 558 | case 6 : |
559 | - if ( ! class_exists( $config_class ) ) { |
|
560 | - if ( $display_errors ) { |
|
559 | + if ( ! class_exists($config_class)) { |
|
560 | + if ($display_errors) { |
|
561 | 561 | throw new EE_Error( |
562 | 562 | sprintf( |
563 | 563 | __( |
@@ -573,11 +573,11 @@ discard block |
||
573 | 573 | break; |
574 | 574 | // TEST #7 : check that config has even been set |
575 | 575 | case 7 : |
576 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
577 | - if ( $display_errors ) { |
|
576 | + if ( ! isset($this->{$section}->{$name} )) { |
|
577 | + if ($display_errors) { |
|
578 | 578 | throw new EE_Error( |
579 | 579 | sprintf( |
580 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
580 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
581 | 581 | $section, |
582 | 582 | $name |
583 | 583 | ) |
@@ -586,13 +586,13 @@ discard block |
||
586 | 586 | return false; |
587 | 587 | } else { |
588 | 588 | // and make sure it's not serialized |
589 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
589 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
590 | 590 | } |
591 | 591 | break; |
592 | 592 | // TEST #8 : check that config is the requested type |
593 | 593 | case 8 : |
594 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
595 | - if ( $display_errors ) { |
|
594 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
595 | + if ($display_errors) { |
|
596 | 596 | throw new EE_Error( |
597 | 597 | sprintf( |
598 | 598 | __( |
@@ -610,12 +610,12 @@ discard block |
||
610 | 610 | break; |
611 | 611 | // TEST #9 : verify config object |
612 | 612 | case 9 : |
613 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
614 | - if ( $display_errors ) { |
|
613 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
614 | + if ($display_errors) { |
|
615 | 615 | throw new EE_Error( |
616 | 616 | sprintf( |
617 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
618 | - print_r( $config_obj, true ) |
|
617 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
618 | + print_r($config_obj, true) |
|
619 | 619 | ) |
620 | 620 | ); |
621 | 621 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | break; |
625 | 625 | } |
626 | 626 | } |
627 | - } catch ( EE_Error $e ) { |
|
627 | + } catch (EE_Error $e) { |
|
628 | 628 | $e->get_error(); |
629 | 629 | } |
630 | 630 | // you have successfully run the gauntlet |
@@ -641,8 +641,8 @@ discard block |
||
641 | 641 | * @param string $name |
642 | 642 | * @return string |
643 | 643 | */ |
644 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
645 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
644 | + private function _generate_config_option_name($section = '', $name = '') { |
|
645 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | * @param string $name |
657 | 657 | * @return string |
658 | 658 | */ |
659 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
660 | - return ! empty( $config_class ) |
|
659 | + private function _set_config_class($config_class = '', $name = '') { |
|
660 | + return ! empty($config_class) |
|
661 | 661 | ? $config_class |
662 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
662 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | |
@@ -674,36 +674,36 @@ discard block |
||
674 | 674 | * @param EE_Config_Base $config_obj |
675 | 675 | * @return EE_Config_Base |
676 | 676 | */ |
677 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
677 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
678 | 678 | // ensure config class is set to something |
679 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
679 | + $config_class = $this->_set_config_class($config_class, $name); |
|
680 | 680 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
681 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
681 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
682 | 682 | return null; |
683 | 683 | } |
684 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
684 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
685 | 685 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
686 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
687 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
686 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
687 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
688 | 688 | $this->update_addon_option_names(); |
689 | 689 | } |
690 | 690 | // verify the incoming config object but suppress errors |
691 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
691 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
692 | 692 | $config_obj = new $config_class(); |
693 | 693 | } |
694 | - if ( get_option( $config_option_name ) ) { |
|
695 | - EE_Config::log( $config_option_name ); |
|
696 | - update_option( $config_option_name, $config_obj ); |
|
694 | + if (get_option($config_option_name)) { |
|
695 | + EE_Config::log($config_option_name); |
|
696 | + update_option($config_option_name, $config_obj); |
|
697 | 697 | $this->{$section}->{$name} = $config_obj; |
698 | 698 | return $this->{$section}->{$name}; |
699 | 699 | } else { |
700 | 700 | // create a wp-option for this config |
701 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
702 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
701 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
702 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
703 | 703 | return $this->{$section}->{$name}; |
704 | 704 | } else { |
705 | 705 | EE_Error::add_error( |
706 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
706 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
707 | 707 | __FILE__, |
708 | 708 | __FUNCTION__, |
709 | 709 | __LINE__ |
@@ -726,46 +726,46 @@ discard block |
||
726 | 726 | * @param bool $throw_errors |
727 | 727 | * @return bool |
728 | 728 | */ |
729 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
729 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
730 | 730 | // don't allow config updates during WP heartbeats |
731 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
731 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
732 | 732 | return false; |
733 | 733 | } |
734 | - $config_obj = maybe_unserialize( $config_obj ); |
|
734 | + $config_obj = maybe_unserialize($config_obj); |
|
735 | 735 | // get class name of the incoming object |
736 | - $config_class = get_class( $config_obj ); |
|
736 | + $config_class = get_class($config_obj); |
|
737 | 737 | // run tests 1-5 and 9 to verify config |
738 | 738 | if ( ! $this->_verify_config_params( |
739 | 739 | $section, |
740 | 740 | $name, |
741 | 741 | $config_class, |
742 | 742 | $config_obj, |
743 | - array( 1, 2, 3, 4, 7, 9 ) |
|
743 | + array(1, 2, 3, 4, 7, 9) |
|
744 | 744 | ) |
745 | 745 | ) { |
746 | 746 | return false; |
747 | 747 | } |
748 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
748 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
749 | 749 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
750 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
750 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
751 | 751 | // save new config to db |
752 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
752 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
753 | 753 | return true; |
754 | 754 | } |
755 | 755 | } else { |
756 | 756 | // first check if the record already exists |
757 | - $existing_config = get_option( $config_option_name ); |
|
758 | - $config_obj = serialize( $config_obj ); |
|
757 | + $existing_config = get_option($config_option_name); |
|
758 | + $config_obj = serialize($config_obj); |
|
759 | 759 | // just return if db record is already up to date (NOT type safe comparison) |
760 | - if ( $existing_config == $config_obj ) { |
|
760 | + if ($existing_config == $config_obj) { |
|
761 | 761 | $this->{$section}->{$name} = $config_obj; |
762 | 762 | return true; |
763 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
764 | - EE_Config::log( $config_option_name ); |
|
763 | + } else if (update_option($config_option_name, $config_obj)) { |
|
764 | + EE_Config::log($config_option_name); |
|
765 | 765 | // update wp-option for this config class |
766 | 766 | $this->{$section}->{$name} = $config_obj; |
767 | 767 | return true; |
768 | - } elseif ( $throw_errors ) { |
|
768 | + } elseif ($throw_errors) { |
|
769 | 769 | EE_Error::add_error( |
770 | 770 | sprintf( |
771 | 771 | __( |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | 'event_espresso' |
774 | 774 | ), |
775 | 775 | $config_class, |
776 | - 'EE_Config->' . $section . '->' . $name |
|
776 | + 'EE_Config->'.$section.'->'.$name |
|
777 | 777 | ), |
778 | 778 | __FILE__, |
779 | 779 | __FUNCTION__, |
@@ -795,34 +795,34 @@ discard block |
||
795 | 795 | * @param string $config_class |
796 | 796 | * @return mixed EE_Config_Base | NULL |
797 | 797 | */ |
798 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
798 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
799 | 799 | // ensure config class is set to something |
800 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
800 | + $config_class = $this->_set_config_class($config_class, $name); |
|
801 | 801 | // run tests 1-4, 6 and 7 to verify that all params have been set |
802 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
802 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
803 | 803 | return null; |
804 | 804 | } |
805 | 805 | // now test if the requested config object exists, but suppress errors |
806 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
806 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
807 | 807 | // config already exists, so pass it back |
808 | 808 | return $this->{$section}->{$name}; |
809 | 809 | } |
810 | 810 | // load config option from db if it exists |
811 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
811 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
812 | 812 | // verify the newly retrieved config object, but suppress errors |
813 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
813 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
814 | 814 | // config is good, so set it and pass it back |
815 | 815 | $this->{$section}->{$name} = $config_obj; |
816 | 816 | return $this->{$section}->{$name}; |
817 | 817 | } |
818 | 818 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
819 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
819 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
820 | 820 | // verify the newly created config object |
821 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
821 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
822 | 822 | return $this->{$section}->{$name}; |
823 | 823 | } else { |
824 | 824 | EE_Error::add_error( |
825 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
825 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
826 | 826 | __FILE__, |
827 | 827 | __FUNCTION__, |
828 | 828 | __LINE__ |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | * @param string $config_option_name |
841 | 841 | * @return mixed EE_Config_Base | FALSE |
842 | 842 | */ |
843 | - public function get_config_option( $config_option_name = '' ) { |
|
843 | + public function get_config_option($config_option_name = '') { |
|
844 | 844 | // retrieve the wp-option for this config class. |
845 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
846 | - if ( empty( $config_option ) ) { |
|
847 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
845 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
846 | + if (empty($config_option)) { |
|
847 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
848 | 848 | } |
849 | 849 | return $config_option; |
850 | 850 | } |
@@ -856,17 +856,17 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @param string $config_option_name |
858 | 858 | */ |
859 | - public static function log( $config_option_name = '' ) { |
|
860 | - if ( ! empty( $config_option_name ) ) { |
|
861 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
859 | + public static function log($config_option_name = '') { |
|
860 | + if ( ! empty($config_option_name)) { |
|
861 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
862 | 862 | //copy incoming $_REQUEST and sanitize it so we can save it |
863 | 863 | $_request = $_REQUEST; |
864 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
865 | - $config_log[ (string) microtime( true ) ] = array( |
|
864 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
865 | + $config_log[(string) microtime(true)] = array( |
|
866 | 866 | 'config_name' => $config_option_name, |
867 | 867 | 'request' => $_request, |
868 | 868 | ); |
869 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
869 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
878 | 878 | */ |
879 | 879 | public static function trim_log() { |
880 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
881 | - $log_length = count( $config_log ); |
|
882 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
883 | - ksort( $config_log ); |
|
884 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
885 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
881 | + $log_length = count($config_log); |
|
882 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
883 | + ksort($config_log); |
|
884 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
885 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
@@ -897,14 +897,14 @@ discard block |
||
897 | 897 | * @return string |
898 | 898 | */ |
899 | 899 | public static function get_page_for_posts() { |
900 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
901 | - if ( ! $page_for_posts ) { |
|
900 | + $page_for_posts = get_option('page_for_posts'); |
|
901 | + if ( ! $page_for_posts) { |
|
902 | 902 | return 'posts'; |
903 | 903 | } |
904 | 904 | /** @type WPDB $wpdb */ |
905 | 905 | global $wpdb; |
906 | 906 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
907 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
907 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | |
@@ -960,17 +960,17 @@ discard block |
||
960 | 960 | ) |
961 | 961 | ) { |
962 | 962 | // grab list of installed widgets |
963 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
963 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
964 | 964 | // filter list of modules to register |
965 | 965 | $widgets_to_register = apply_filters( |
966 | 966 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
967 | 967 | $widgets_to_register |
968 | 968 | ); |
969 | - if ( ! empty( $widgets_to_register ) ) { |
|
969 | + if ( ! empty($widgets_to_register)) { |
|
970 | 970 | // cycle thru widget folders |
971 | - foreach ( $widgets_to_register as $widget_path ) { |
|
971 | + foreach ($widgets_to_register as $widget_path) { |
|
972 | 972 | // add to list of installed widget modules |
973 | - EE_Config::register_ee_widget( $widget_path ); |
|
973 | + EE_Config::register_ee_widget($widget_path); |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | // filter list of installed modules |
@@ -990,57 +990,57 @@ discard block |
||
990 | 990 | * @param string $widget_path - full path up to and including widget folder |
991 | 991 | * @return void |
992 | 992 | */ |
993 | - public static function register_ee_widget( $widget_path = null ) { |
|
994 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
993 | + public static function register_ee_widget($widget_path = null) { |
|
994 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
995 | 995 | $widget_ext = '.widget.php'; |
996 | 996 | // make all separators match |
997 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
997 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
998 | 998 | // does the file path INCLUDE the actual file name as part of the path ? |
999 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
999 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1000 | 1000 | // grab and shortcode file name from directory name and break apart at dots |
1001 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1001 | + $file_name = explode('.', basename($widget_path)); |
|
1002 | 1002 | // take first segment from file name pieces and remove class prefix if it exists |
1003 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1003 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1004 | 1004 | // sanitize shortcode directory name |
1005 | - $widget = sanitize_key( $widget ); |
|
1005 | + $widget = sanitize_key($widget); |
|
1006 | 1006 | // now we need to rebuild the shortcode path |
1007 | - $widget_path = explode( DS, $widget_path ); |
|
1007 | + $widget_path = explode(DS, $widget_path); |
|
1008 | 1008 | // remove last segment |
1009 | - array_pop( $widget_path ); |
|
1009 | + array_pop($widget_path); |
|
1010 | 1010 | // glue it back together |
1011 | - $widget_path = implode( DS, $widget_path ); |
|
1011 | + $widget_path = implode(DS, $widget_path); |
|
1012 | 1012 | } else { |
1013 | 1013 | // grab and sanitize widget directory name |
1014 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1014 | + $widget = sanitize_key(basename($widget_path)); |
|
1015 | 1015 | } |
1016 | 1016 | // create classname from widget directory name |
1017 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1017 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1018 | 1018 | // add class prefix |
1019 | - $widget_class = 'EEW_' . $widget; |
|
1019 | + $widget_class = 'EEW_'.$widget; |
|
1020 | 1020 | // does the widget exist ? |
1021 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1021 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1022 | 1022 | $msg = sprintf( |
1023 | 1023 | __( |
1024 | 1024 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1025 | 1025 | 'event_espresso' |
1026 | 1026 | ), |
1027 | 1027 | $widget_class, |
1028 | - $widget_path . DS . $widget_class . $widget_ext |
|
1028 | + $widget_path.DS.$widget_class.$widget_ext |
|
1029 | 1029 | ); |
1030 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1030 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1031 | 1031 | return; |
1032 | 1032 | } |
1033 | 1033 | // load the widget class file |
1034 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1034 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1035 | 1035 | // verify that class exists |
1036 | - if ( ! class_exists( $widget_class ) ) { |
|
1037 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1038 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1036 | + if ( ! class_exists($widget_class)) { |
|
1037 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1038 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1039 | 1039 | return; |
1040 | 1040 | } |
1041 | - register_widget( $widget_class ); |
|
1041 | + register_widget($widget_class); |
|
1042 | 1042 | // add to array of registered widgets |
1043 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1043 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | |
@@ -1053,17 +1053,17 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | private function _register_shortcodes() { |
1055 | 1055 | // grab list of installed shortcodes |
1056 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1056 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1057 | 1057 | // filter list of modules to register |
1058 | 1058 | $shortcodes_to_register = apply_filters( |
1059 | 1059 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1060 | 1060 | $shortcodes_to_register |
1061 | 1061 | ); |
1062 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1062 | + if ( ! empty($shortcodes_to_register)) { |
|
1063 | 1063 | // cycle thru shortcode folders |
1064 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1064 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1065 | 1065 | // add to list of installed shortcode modules |
1066 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1066 | + EE_Config::register_shortcode($shortcode_path); |
|
1067 | 1067 | } |
1068 | 1068 | } |
1069 | 1069 | // filter list of installed modules |
@@ -1082,64 +1082,64 @@ discard block |
||
1082 | 1082 | * @param string $shortcode_path - full path up to and including shortcode folder |
1083 | 1083 | * @return bool |
1084 | 1084 | */ |
1085 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1086 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1085 | + public static function register_shortcode($shortcode_path = null) { |
|
1086 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1087 | 1087 | $shortcode_ext = '.shortcode.php'; |
1088 | 1088 | // make all separators match |
1089 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1089 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1090 | 1090 | // does the file path INCLUDE the actual file name as part of the path ? |
1091 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1091 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1092 | 1092 | // grab shortcode file name from directory name and break apart at dots |
1093 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1093 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1094 | 1094 | // take first segment from file name pieces and remove class prefix if it exists |
1095 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1096 | - ? substr( $shortcode_file[0], 4 ) |
|
1095 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1096 | + ? substr($shortcode_file[0], 4) |
|
1097 | 1097 | : $shortcode_file[0]; |
1098 | 1098 | // sanitize shortcode directory name |
1099 | - $shortcode = sanitize_key( $shortcode ); |
|
1099 | + $shortcode = sanitize_key($shortcode); |
|
1100 | 1100 | // now we need to rebuild the shortcode path |
1101 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1101 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1102 | 1102 | // remove last segment |
1103 | - array_pop( $shortcode_path ); |
|
1103 | + array_pop($shortcode_path); |
|
1104 | 1104 | // glue it back together |
1105 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1105 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1106 | 1106 | } else { |
1107 | 1107 | // we need to generate the filename based off of the folder name |
1108 | 1108 | // grab and sanitize shortcode directory name |
1109 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1110 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1109 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1110 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1111 | 1111 | } |
1112 | 1112 | // create classname from shortcode directory or file name |
1113 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1113 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1114 | 1114 | // add class prefix |
1115 | - $shortcode_class = 'EES_' . $shortcode; |
|
1115 | + $shortcode_class = 'EES_'.$shortcode; |
|
1116 | 1116 | // does the shortcode exist ? |
1117 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1117 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1118 | 1118 | $msg = sprintf( |
1119 | 1119 | __( |
1120 | 1120 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1121 | 1121 | 'event_espresso' |
1122 | 1122 | ), |
1123 | 1123 | $shortcode_class, |
1124 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1124 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1125 | 1125 | ); |
1126 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1126 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1127 | 1127 | return false; |
1128 | 1128 | } |
1129 | 1129 | // load the shortcode class file |
1130 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1130 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1131 | 1131 | // verify that class exists |
1132 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1132 | + if ( ! class_exists($shortcode_class)) { |
|
1133 | 1133 | $msg = sprintf( |
1134 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1134 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1135 | 1135 | $shortcode_class |
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | - $shortcode = strtoupper( $shortcode ); |
|
1140 | + $shortcode = strtoupper($shortcode); |
|
1141 | 1141 | // add to array of registered shortcodes |
1142 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1142 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1143 | 1143 | return true; |
1144 | 1144 | } |
1145 | 1145 | |
@@ -1153,22 +1153,22 @@ discard block |
||
1153 | 1153 | */ |
1154 | 1154 | private function _register_modules() { |
1155 | 1155 | // grab list of installed modules |
1156 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1156 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1157 | 1157 | // filter list of modules to register |
1158 | 1158 | $modules_to_register = apply_filters( |
1159 | 1159 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1160 | 1160 | $modules_to_register |
1161 | 1161 | ); |
1162 | - if ( ! empty( $modules_to_register ) ) { |
|
1162 | + if ( ! empty($modules_to_register)) { |
|
1163 | 1163 | // loop through folders |
1164 | - foreach ( $modules_to_register as $module_path ) { |
|
1164 | + foreach ($modules_to_register as $module_path) { |
|
1165 | 1165 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1166 | 1166 | if ( |
1167 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1168 | - && $module_path !== EE_MODULES . 'gateways' |
|
1167 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1168 | + && $module_path !== EE_MODULES.'gateways' |
|
1169 | 1169 | ) { |
1170 | 1170 | // add to list of installed modules |
1171 | - EE_Config::register_module( $module_path ); |
|
1171 | + EE_Config::register_module($module_path); |
|
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1188,39 +1188,39 @@ discard block |
||
1188 | 1188 | * @param string $module_path - full path up to and including module folder |
1189 | 1189 | * @return bool |
1190 | 1190 | */ |
1191 | - public static function register_module( $module_path = null ) { |
|
1192 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1191 | + public static function register_module($module_path = null) { |
|
1192 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1193 | 1193 | $module_ext = '.module.php'; |
1194 | 1194 | // make all separators match |
1195 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1195 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1196 | 1196 | // does the file path INCLUDE the actual file name as part of the path ? |
1197 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1197 | + if (strpos($module_path, $module_ext) !== false) { |
|
1198 | 1198 | // grab and shortcode file name from directory name and break apart at dots |
1199 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1199 | + $module_file = explode('.', basename($module_path)); |
|
1200 | 1200 | // now we need to rebuild the shortcode path |
1201 | - $module_path = explode( DS, $module_path ); |
|
1201 | + $module_path = explode(DS, $module_path); |
|
1202 | 1202 | // remove last segment |
1203 | - array_pop( $module_path ); |
|
1203 | + array_pop($module_path); |
|
1204 | 1204 | // glue it back together |
1205 | - $module_path = implode( DS, $module_path ) . DS; |
|
1205 | + $module_path = implode(DS, $module_path).DS; |
|
1206 | 1206 | // take first segment from file name pieces and sanitize it |
1207 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1207 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1208 | 1208 | // ensure class prefix is added |
1209 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1209 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1210 | 1210 | } else { |
1211 | 1211 | // we need to generate the filename based off of the folder name |
1212 | 1212 | // grab and sanitize module name |
1213 | - $module = strtolower( basename( $module_path ) ); |
|
1214 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1213 | + $module = strtolower(basename($module_path)); |
|
1214 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1215 | 1215 | // like trailingslashit() |
1216 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1216 | + $module_path = rtrim($module_path, DS).DS; |
|
1217 | 1217 | // create classname from module directory name |
1218 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1218 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1219 | 1219 | // add class prefix |
1220 | - $module_class = 'EED_' . $module; |
|
1220 | + $module_class = 'EED_'.$module; |
|
1221 | 1221 | } |
1222 | 1222 | // does the module exist ? |
1223 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1223 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1224 | 1224 | $msg = sprintf( |
1225 | 1225 | __( |
1226 | 1226 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1228,19 +1228,19 @@ discard block |
||
1228 | 1228 | ), |
1229 | 1229 | $module |
1230 | 1230 | ); |
1231 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1231 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1232 | 1232 | return false; |
1233 | 1233 | } |
1234 | 1234 | // load the module class file |
1235 | - require_once( $module_path . $module_class . $module_ext ); |
|
1235 | + require_once($module_path.$module_class.$module_ext); |
|
1236 | 1236 | // verify that class exists |
1237 | - if ( ! class_exists( $module_class ) ) { |
|
1238 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1239 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1237 | + if ( ! class_exists($module_class)) { |
|
1238 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1239 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1240 | 1240 | return false; |
1241 | 1241 | } |
1242 | 1242 | // add to array of registered modules |
1243 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1243 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1244 | 1244 | do_action( |
1245 | 1245 | 'AHEE__EE_Config__register_module__complete', |
1246 | 1246 | $module_class, |
@@ -1260,26 +1260,26 @@ discard block |
||
1260 | 1260 | */ |
1261 | 1261 | private function _initialize_shortcodes() { |
1262 | 1262 | // cycle thru shortcode folders |
1263 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1263 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1264 | 1264 | // add class prefix |
1265 | - $shortcode_class = 'EES_' . $shortcode; |
|
1265 | + $shortcode_class = 'EES_'.$shortcode; |
|
1266 | 1266 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1267 | 1267 | // which set hooks ? |
1268 | - if ( is_admin() ) { |
|
1268 | + if (is_admin()) { |
|
1269 | 1269 | // fire immediately |
1270 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1270 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1271 | 1271 | } else { |
1272 | 1272 | // delay until other systems are online |
1273 | 1273 | add_action( |
1274 | 1274 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1275 | - array( $shortcode_class, 'set_hooks' ) |
|
1275 | + array($shortcode_class, 'set_hooks') |
|
1276 | 1276 | ); |
1277 | 1277 | // convert classname to UPPERCASE and create WP shortcode. |
1278 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1278 | + $shortcode_tag = strtoupper($shortcode); |
|
1279 | 1279 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1280 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1280 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1281 | 1281 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1282 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1282 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1283 | 1283 | } |
1284 | 1284 | } |
1285 | 1285 | } |
@@ -1296,17 +1296,17 @@ discard block |
||
1296 | 1296 | */ |
1297 | 1297 | private function _initialize_modules() { |
1298 | 1298 | // cycle thru shortcode folders |
1299 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1299 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1300 | 1300 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1301 | 1301 | // which set hooks ? |
1302 | - if ( is_admin() ) { |
|
1302 | + if (is_admin()) { |
|
1303 | 1303 | // fire immediately |
1304 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1304 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1305 | 1305 | } else { |
1306 | 1306 | // delay until other systems are online |
1307 | 1307 | add_action( |
1308 | 1308 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1309 | - array( $module_class, 'set_hooks' ) |
|
1309 | + array($module_class, 'set_hooks') |
|
1310 | 1310 | ); |
1311 | 1311 | } |
1312 | 1312 | } |
@@ -1324,29 +1324,29 @@ discard block |
||
1324 | 1324 | * @param string $key - url param key indicating a route is being called |
1325 | 1325 | * @return bool |
1326 | 1326 | */ |
1327 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1328 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1329 | - $module = str_replace( 'EED_', '', $module ); |
|
1330 | - $module_class = 'EED_' . $module; |
|
1331 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1332 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1333 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1327 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1328 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1329 | + $module = str_replace('EED_', '', $module); |
|
1330 | + $module_class = 'EED_'.$module; |
|
1331 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1332 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1333 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1334 | 1334 | return false; |
1335 | 1335 | } |
1336 | - if ( empty( $route ) ) { |
|
1337 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1338 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1336 | + if (empty($route)) { |
|
1337 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1338 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1339 | 1339 | return false; |
1340 | 1340 | } |
1341 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1341 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1342 | 1342 | $msg = sprintf( |
1343 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1343 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1344 | 1344 | $route |
1345 | 1345 | ); |
1346 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1346 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1347 | 1347 | return false; |
1348 | 1348 | } |
1349 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1349 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1350 | 1350 | return true; |
1351 | 1351 | } |
1352 | 1352 | |
@@ -1360,11 +1360,11 @@ discard block |
||
1360 | 1360 | * @param string $key - url param key indicating a route is being called |
1361 | 1361 | * @return string |
1362 | 1362 | */ |
1363 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1364 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1365 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1366 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1367 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1363 | + public static function get_route($route = null, $key = 'ee') { |
|
1364 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1365 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1366 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1367 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1368 | 1368 | } |
1369 | 1369 | return null; |
1370 | 1370 | } |
@@ -1394,49 +1394,49 @@ discard block |
||
1394 | 1394 | * @param string $key - url param key indicating a route is being called |
1395 | 1395 | * @return bool |
1396 | 1396 | */ |
1397 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1398 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1399 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1397 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1398 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1399 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1400 | 1400 | $msg = sprintf( |
1401 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1401 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1402 | 1402 | $route |
1403 | 1403 | ); |
1404 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1404 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1405 | 1405 | return false; |
1406 | 1406 | } |
1407 | - if ( empty( $forward ) ) { |
|
1408 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1409 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1407 | + if (empty($forward)) { |
|
1408 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1409 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1410 | 1410 | return false; |
1411 | 1411 | } |
1412 | - if ( is_array( $forward ) ) { |
|
1413 | - if ( ! isset( $forward[1] ) ) { |
|
1412 | + if (is_array($forward)) { |
|
1413 | + if ( ! isset($forward[1])) { |
|
1414 | 1414 | $msg = sprintf( |
1415 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1415 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1416 | 1416 | $route |
1417 | 1417 | ); |
1418 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1419 | 1419 | return false; |
1420 | 1420 | } |
1421 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1421 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1422 | 1422 | $msg = sprintf( |
1423 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1423 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1424 | 1424 | $forward[1], |
1425 | 1425 | $route |
1426 | 1426 | ); |
1427 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1427 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1428 | 1428 | return false; |
1429 | 1429 | } |
1430 | - } else if ( ! function_exists( $forward ) ) { |
|
1430 | + } else if ( ! function_exists($forward)) { |
|
1431 | 1431 | $msg = sprintf( |
1432 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1432 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1433 | 1433 | $forward, |
1434 | 1434 | $route |
1435 | 1435 | ); |
1436 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1436 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1437 | 1437 | return false; |
1438 | 1438 | } |
1439 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1439 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1440 | 1440 | return true; |
1441 | 1441 | } |
1442 | 1442 | |
@@ -1452,12 +1452,12 @@ discard block |
||
1452 | 1452 | * @param string $key - url param key indicating a route is being called |
1453 | 1453 | * @return string |
1454 | 1454 | */ |
1455 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1456 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1457 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1455 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1456 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1457 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1458 | 1458 | return apply_filters( |
1459 | 1459 | 'FHEE__EE_Config__get_forward', |
1460 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1460 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1461 | 1461 | $route, |
1462 | 1462 | $status |
1463 | 1463 | ); |
@@ -1479,17 +1479,17 @@ discard block |
||
1479 | 1479 | * @param string $key - url param key indicating a route is being called |
1480 | 1480 | * @return bool |
1481 | 1481 | */ |
1482 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1483 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1484 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1482 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1483 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1484 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1485 | 1485 | $msg = sprintf( |
1486 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1486 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1487 | 1487 | $route |
1488 | 1488 | ); |
1489 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1489 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1490 | 1490 | return false; |
1491 | 1491 | } |
1492 | - if ( ! is_readable( $view ) ) { |
|
1492 | + if ( ! is_readable($view)) { |
|
1493 | 1493 | $msg = sprintf( |
1494 | 1494 | __( |
1495 | 1495 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1497,10 +1497,10 @@ discard block |
||
1497 | 1497 | ), |
1498 | 1498 | $view |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1503 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1504 | 1504 | return true; |
1505 | 1505 | } |
1506 | 1506 | |
@@ -1516,12 +1516,12 @@ discard block |
||
1516 | 1516 | * @param string $key - url param key indicating a route is being called |
1517 | 1517 | * @return string |
1518 | 1518 | */ |
1519 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1520 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1521 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1519 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1520 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1521 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1522 | 1522 | return apply_filters( |
1523 | 1523 | 'FHEE__EE_Config__get_view', |
1524 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1524 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1525 | 1525 | $route, |
1526 | 1526 | $status |
1527 | 1527 | ); |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | |
1534 | 1534 | public function update_addon_option_names() { |
1535 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1535 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | |
@@ -1560,22 +1560,22 @@ discard block |
||
1560 | 1560 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1561 | 1561 | * @throws \EE_Error |
1562 | 1562 | */ |
1563 | - public function get_pretty( $property ) { |
|
1564 | - if ( ! property_exists( $this, $property ) ) { |
|
1563 | + public function get_pretty($property) { |
|
1564 | + if ( ! property_exists($this, $property)) { |
|
1565 | 1565 | throw new EE_Error( |
1566 | 1566 | sprintf( |
1567 | 1567 | __( |
1568 | 1568 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1569 | 1569 | 'event_espresso' |
1570 | 1570 | ), |
1571 | - get_class( $this ), |
|
1571 | + get_class($this), |
|
1572 | 1572 | $property |
1573 | 1573 | ) |
1574 | 1574 | ); |
1575 | 1575 | } |
1576 | 1576 | //just handling escaping of strings for now. |
1577 | - if ( is_string( $this->{$property} ) ) { |
|
1578 | - return stripslashes( $this->{$property} ); |
|
1577 | + if (is_string($this->{$property} )) { |
|
1578 | + return stripslashes($this->{$property} ); |
|
1579 | 1579 | } |
1580 | 1580 | return $this->{$property}; |
1581 | 1581 | } |
@@ -1584,17 +1584,17 @@ discard block |
||
1584 | 1584 | |
1585 | 1585 | public function populate() { |
1586 | 1586 | //grab defaults via a new instance of this class. |
1587 | - $class_name = get_class( $this ); |
|
1587 | + $class_name = get_class($this); |
|
1588 | 1588 | $defaults = new $class_name; |
1589 | 1589 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1590 | 1590 | //default from our $defaults object. |
1591 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1592 | - if ( $this->{$property} === null ) { |
|
1591 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1592 | + if ($this->{$property} === null) { |
|
1593 | 1593 | $this->{$property} = $value; |
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | //cleanup |
1597 | - unset( $defaults ); |
|
1597 | + unset($defaults); |
|
1598 | 1598 | } |
1599 | 1599 | |
1600 | 1600 | |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | * @param $a |
1611 | 1611 | * @return bool |
1612 | 1612 | */ |
1613 | - public function __isset( $a ) { |
|
1613 | + public function __isset($a) { |
|
1614 | 1614 | return false; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | * @param $a |
1623 | 1623 | * @return bool |
1624 | 1624 | */ |
1625 | - public function __unset( $a ) { |
|
1625 | + public function __unset($a) { |
|
1626 | 1626 | return false; |
1627 | 1627 | } |
1628 | 1628 | |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | $this->current_blog_id = get_current_blog_id(); |
1733 | 1733 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1734 | 1734 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1735 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1735 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1736 | 1736 | $this->post_shortcodes = array(); |
1737 | 1737 | $this->module_route_map = array(); |
1738 | 1738 | $this->module_forward_map = array(); |
@@ -1748,9 +1748,9 @@ discard block |
||
1748 | 1748 | $this->thank_you_page_url = ''; |
1749 | 1749 | $this->cancel_page_url = ''; |
1750 | 1750 | //cpt slugs |
1751 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1751 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1752 | 1752 | //ueip constant check |
1753 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1753 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1754 | 1754 | $this->ee_ueip_optin = false; |
1755 | 1755 | $this->ee_ueip_has_notified = true; |
1756 | 1756 | } |
@@ -1793,11 +1793,11 @@ discard block |
||
1793 | 1793 | * @return string |
1794 | 1794 | */ |
1795 | 1795 | public function reg_page_url() { |
1796 | - if ( ! $this->reg_page_url ) { |
|
1796 | + if ( ! $this->reg_page_url) { |
|
1797 | 1797 | $this->reg_page_url = add_query_arg( |
1798 | - array( 'uts' => time() ), |
|
1799 | - get_permalink( $this->reg_page_id ) |
|
1800 | - ) . '#checkout'; |
|
1798 | + array('uts' => time()), |
|
1799 | + get_permalink($this->reg_page_id) |
|
1800 | + ).'#checkout'; |
|
1801 | 1801 | } |
1802 | 1802 | return $this->reg_page_url; |
1803 | 1803 | } |
@@ -1812,12 +1812,12 @@ discard block |
||
1812 | 1812 | * @access public |
1813 | 1813 | * @return string |
1814 | 1814 | */ |
1815 | - public function txn_page_url( $query_args = array() ) { |
|
1816 | - if ( ! $this->txn_page_url ) { |
|
1817 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1815 | + public function txn_page_url($query_args = array()) { |
|
1816 | + if ( ! $this->txn_page_url) { |
|
1817 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1818 | 1818 | } |
1819 | - if ( $query_args ) { |
|
1820 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1819 | + if ($query_args) { |
|
1820 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1821 | 1821 | } else { |
1822 | 1822 | return $this->txn_page_url; |
1823 | 1823 | } |
@@ -1833,12 +1833,12 @@ discard block |
||
1833 | 1833 | * @access public |
1834 | 1834 | * @return string |
1835 | 1835 | */ |
1836 | - public function thank_you_page_url( $query_args = array() ) { |
|
1837 | - if ( ! $this->thank_you_page_url ) { |
|
1838 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1836 | + public function thank_you_page_url($query_args = array()) { |
|
1837 | + if ( ! $this->thank_you_page_url) { |
|
1838 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1839 | 1839 | } |
1840 | - if ( $query_args ) { |
|
1841 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1840 | + if ($query_args) { |
|
1841 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1842 | 1842 | } else { |
1843 | 1843 | return $this->thank_you_page_url; |
1844 | 1844 | } |
@@ -1853,8 +1853,8 @@ discard block |
||
1853 | 1853 | * @return string |
1854 | 1854 | */ |
1855 | 1855 | public function cancel_page_url() { |
1856 | - if ( ! $this->cancel_page_url ) { |
|
1857 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1856 | + if ( ! $this->cancel_page_url) { |
|
1857 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1858 | 1858 | } |
1859 | 1859 | return $this->cancel_page_url; |
1860 | 1860 | } |
@@ -1883,22 +1883,22 @@ discard block |
||
1883 | 1883 | */ |
1884 | 1884 | protected function _get_main_ee_ueip_optin() { |
1885 | 1885 | //if this is the main site then we can just bypass our direct query. |
1886 | - if ( is_main_site() ) { |
|
1887 | - return get_option( 'ee_ueip_optin', false ); |
|
1886 | + if (is_main_site()) { |
|
1887 | + return get_option('ee_ueip_optin', false); |
|
1888 | 1888 | } |
1889 | 1889 | |
1890 | 1890 | //is this already cached for this request? If so use it. |
1891 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1891 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1892 | 1892 | return EE_Core_Config::$ee_ueip_option; |
1893 | 1893 | } |
1894 | 1894 | |
1895 | 1895 | global $wpdb; |
1896 | 1896 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1897 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1897 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1898 | 1898 | $option = 'ee_ueip_optin'; |
1899 | 1899 | |
1900 | 1900 | //set correct table for query |
1901 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1901 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1902 | 1902 | |
1903 | 1903 | |
1904 | 1904 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1906,20 +1906,20 @@ discard block |
||
1906 | 1906 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1907 | 1907 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1908 | 1908 | //for the purpose of caching. |
1909 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1910 | - if ( false !== $pre ) { |
|
1909 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1910 | + if (false !== $pre) { |
|
1911 | 1911 | EE_Core_Config::$ee_ueip_option = $pre; |
1912 | 1912 | return EE_Core_Config::$ee_ueip_option; |
1913 | 1913 | } |
1914 | 1914 | |
1915 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1916 | - if ( is_object( $row ) ) { |
|
1915 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1916 | + if (is_object($row)) { |
|
1917 | 1917 | $value = $row->option_value; |
1918 | 1918 | } else { //option does not exist so use default. |
1919 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1919 | + return apply_filters('default_option_'.$option, false, $option); |
|
1920 | 1920 | } |
1921 | 1921 | |
1922 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1922 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1923 | 1923 | return EE_Core_Config::$ee_ueip_option; |
1924 | 1924 | } |
1925 | 1925 | |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | //reset all url properties |
1936 | 1936 | $this->_reset_urls(); |
1937 | 1937 | //return what to save to db |
1938 | - return array_keys( get_object_vars( $this ) ); |
|
1938 | + return array_keys(get_object_vars($this)); |
|
1939 | 1939 | } |
1940 | 1940 | |
1941 | 1941 | } |
@@ -2082,14 +2082,14 @@ discard block |
||
2082 | 2082 | */ |
2083 | 2083 | public function __construct() { |
2084 | 2084 | // set default organization settings |
2085 | - $this->name = get_bloginfo( 'name' ); |
|
2085 | + $this->name = get_bloginfo('name'); |
|
2086 | 2086 | $this->address_1 = '123 Onna Road'; |
2087 | 2087 | $this->address_2 = 'PO Box 123'; |
2088 | 2088 | $this->city = 'Inna City'; |
2089 | 2089 | $this->STA_ID = 4; |
2090 | 2090 | $this->CNT_ISO = 'US'; |
2091 | 2091 | $this->zip = '12345'; |
2092 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2092 | + $this->email = get_bloginfo('admin_email'); |
|
2093 | 2093 | $this->phone = ''; |
2094 | 2094 | $this->vat = '123456789'; |
2095 | 2095 | $this->logo_url = ''; |
@@ -2176,44 +2176,44 @@ discard block |
||
2176 | 2176 | * @access public |
2177 | 2177 | * @param string $CNT_ISO |
2178 | 2178 | */ |
2179 | - public function __construct( $CNT_ISO = '' ) { |
|
2179 | + public function __construct($CNT_ISO = '') { |
|
2180 | 2180 | // get country code from organization settings or use default |
2181 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2181 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2182 | 2182 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2183 | 2183 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2184 | 2184 | : ''; |
2185 | 2185 | // but override if requested |
2186 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2186 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2187 | 2187 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
2188 | 2188 | if ( |
2189 | - ! empty( $CNT_ISO ) |
|
2189 | + ! empty($CNT_ISO) |
|
2190 | 2190 | && EE_Maintenance_Mode::instance()->models_can_query() |
2191 | - && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2191 | + && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table()) |
|
2192 | 2192 | ) { |
2193 | 2193 | // retrieve the country settings from the db, just in case they have been customized |
2194 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2195 | - if ( $country instanceof EE_Country ) { |
|
2196 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2197 | - $this->name = $country->currency_name_single(); // Dollar |
|
2198 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2199 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2200 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2201 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2202 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2203 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2194 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2195 | + if ($country instanceof EE_Country) { |
|
2196 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2197 | + $this->name = $country->currency_name_single(); // Dollar |
|
2198 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2199 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2200 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2201 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2202 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2203 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2204 | 2204 | } |
2205 | 2205 | } |
2206 | 2206 | // fallback to hardcoded defaults, in case the above failed |
2207 | - if ( empty( $this->code ) ) { |
|
2207 | + if (empty($this->code)) { |
|
2208 | 2208 | // set default currency settings |
2209 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2210 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2211 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2212 | - $this->sign = '$'; // currency sign: $ |
|
2213 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2214 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2215 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2216 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2209 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2210 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2211 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2212 | + $this->sign = '$'; // currency sign: $ |
|
2213 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2214 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2215 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2216 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2217 | 2217 | } |
2218 | 2218 | } |
2219 | 2219 | } |
@@ -2375,7 +2375,7 @@ discard block |
||
2375 | 2375 | * @since 4.8.8.rc.019 |
2376 | 2376 | */ |
2377 | 2377 | public function do_hooks() { |
2378 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2378 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2379 | 2379 | } |
2380 | 2380 | |
2381 | 2381 | |
@@ -2384,7 +2384,7 @@ discard block |
||
2384 | 2384 | * @return void |
2385 | 2385 | */ |
2386 | 2386 | public function set_default_reg_status_on_EEM_Event() { |
2387 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2387 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2388 | 2388 | } |
2389 | 2389 | |
2390 | 2390 | |
@@ -2488,10 +2488,10 @@ discard block |
||
2488 | 2488 | * @param bool $reset |
2489 | 2489 | * @return string |
2490 | 2490 | */ |
2491 | - public function log_file_name( $reset = false ) { |
|
2492 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2493 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2494 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2491 | + public function log_file_name($reset = false) { |
|
2492 | + if (empty($this->log_file_name) || $reset) { |
|
2493 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2494 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2495 | 2495 | } |
2496 | 2496 | return $this->log_file_name; |
2497 | 2497 | } |
@@ -2502,10 +2502,10 @@ discard block |
||
2502 | 2502 | * @param bool $reset |
2503 | 2503 | * @return string |
2504 | 2504 | */ |
2505 | - public function debug_file_name( $reset = false ) { |
|
2506 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2507 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2508 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2505 | + public function debug_file_name($reset = false) { |
|
2506 | + if (empty($this->debug_file_name) || $reset) { |
|
2507 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2508 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2509 | 2509 | } |
2510 | 2510 | return $this->debug_file_name; |
2511 | 2511 | } |
@@ -2687,21 +2687,21 @@ discard block |
||
2687 | 2687 | $this->use_google_maps = true; |
2688 | 2688 | $this->google_map_api_key = ''; |
2689 | 2689 | // for event details pages (reg page) |
2690 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2691 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2692 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2693 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2694 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2695 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2696 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2690 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2691 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2692 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2693 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2694 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2695 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2696 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2697 | 2697 | // for event list pages |
2698 | - $this->event_list_map_width = 300; // ee_map_width |
|
2699 | - $this->event_list_map_height = 185; // ee_map_height |
|
2700 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2701 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2702 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2703 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2704 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2698 | + $this->event_list_map_width = 300; // ee_map_width |
|
2699 | + $this->event_list_map_height = 185; // ee_map_height |
|
2700 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2701 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2702 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2703 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2704 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2705 | 2705 | } |
2706 | 2706 | |
2707 | 2707 | } |
@@ -2854,7 +2854,7 @@ discard block |
||
2854 | 2854 | * @return void |
2855 | 2855 | */ |
2856 | 2856 | protected function _set_php_values() { |
2857 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2857 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2858 | 2858 | $this->php->version = phpversion(); |
2859 | 2859 | } |
2860 | 2860 | |
@@ -2873,10 +2873,10 @@ discard block |
||
2873 | 2873 | * @type string $msg Any message to be displayed. |
2874 | 2874 | * } |
2875 | 2875 | */ |
2876 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2877 | - if ( ! empty( $this->php->max_input_vars ) |
|
2878 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2879 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2876 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2877 | + if ( ! empty($this->php->max_input_vars) |
|
2878 | + && ($input_count >= $this->php->max_input_vars) |
|
2879 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2880 | 2880 | ) { |
2881 | 2881 | return sprintf( |
2882 | 2882 | __( |
@@ -2942,7 +2942,7 @@ discard block |
||
2942 | 2942 | */ |
2943 | 2943 | public function __construct() { |
2944 | 2944 | $this->payment_settings = array(); |
2945 | - $this->active_gateways = array( 'Invoice' => false ); |
|
2945 | + $this->active_gateways = array('Invoice' => false); |
|
2946 | 2946 | } |
2947 | 2947 | } |
2948 | 2948 |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
159 | 159 | * @access public |
160 | 160 | */ |
161 | - public function __construct( $routing = TRUE ) { |
|
161 | + public function __construct($routing = TRUE) { |
|
162 | 162 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
163 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
164 | 164 | $this->_is_caf = TRUE; |
165 | 165 | |
166 | 166 | $this->_yes_no_values = array( |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | |
173 | 173 | //set the _req_data property. |
174 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
174 | + $this->_req_data = array_merge($_GET, $_POST); |
|
175 | 175 | |
176 | 176 | |
177 | 177 | //routing enabled? |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $this->_do_other_page_hooks(); |
193 | 193 | |
194 | 194 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
195 | + if (method_exists($this, '_before_page_setup')) |
|
196 | 196 | $this->_before_page_setup(); |
197 | 197 | |
198 | 198 | //set up page dependencies |
@@ -462,16 +462,16 @@ discard block |
||
462 | 462 | */ |
463 | 463 | protected function _global_ajax_hooks() { |
464 | 464 | //for lazy loading of metabox content |
465 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
465 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
469 | 469 | |
470 | 470 | public function ajax_metabox_content() { |
471 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
472 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
471 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
472 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
473 | 473 | |
474 | - self::cached_rss_display( $contentid, $url ); |
|
474 | + self::cached_rss_display($contentid, $url); |
|
475 | 475 | wp_die(); |
476 | 476 | } |
477 | 477 | |
@@ -490,87 +490,87 @@ discard block |
||
490 | 490 | //requires? |
491 | 491 | |
492 | 492 | //admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can. But keep in mind, not everything is available from the EE_Admin Page object at this point. |
493 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
493 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
494 | 494 | |
495 | 495 | |
496 | 496 | //next verify if we need to load anything... |
497 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : ''; |
|
498 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
497 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : ''; |
|
498 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
499 | 499 | |
500 | 500 | global $ee_menu_slugs; |
501 | 501 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 502 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
503 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
504 | 504 | |
505 | 505 | |
506 | 506 | // becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first |
507 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
508 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
507 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
508 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
509 | 509 | } |
510 | 510 | // then set blank or -1 action values to 'default' |
511 | - $this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default'; |
|
511 | + $this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default'; |
|
512 | 512 | |
513 | 513 | //if action is 'default' after the above BUT we have 'route' var set, then let's use the route as the action. This covers cases where we're coming in from a list table that isn't on the default route. |
514 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
514 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
515 | 515 | |
516 | 516 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
517 | 517 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
518 | 518 | |
519 | 519 | $this->_current_view = $this->_req_action; |
520 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
520 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
521 | 521 | $this->_define_page_props(); |
522 | 522 | |
523 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
523 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
524 | 524 | |
525 | 525 | //default things |
526 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
526 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
527 | 527 | |
528 | 528 | //set page configs |
529 | 529 | $this->_set_page_routes(); |
530 | 530 | $this->_set_page_config(); |
531 | 531 | |
532 | 532 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
533 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
533 | + if (isset($this->_req_data['wp_referer'])) { |
|
534 | 534 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
535 | 535 | } |
536 | 536 | |
537 | 537 | //for caffeinated and other extended functionality. If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
538 | + if (method_exists($this, '_extend_page_config')) |
|
539 | 539 | $this->_extend_page_config(); |
540 | 540 | |
541 | 541 | //for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
542 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
543 | 543 | $this->_extend_page_config_for_cpt(); |
544 | 544 | |
545 | 545 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
547 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
546 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
547 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | //if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action |
551 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
552 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
551 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
552 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
556 | 556 | //next route only if routing enabled |
557 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
557 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
558 | 558 | |
559 | 559 | $this->_verify_routes(); |
560 | 560 | |
561 | 561 | //next let's just check user_access and kill if no access |
562 | 562 | $this->check_user_access(); |
563 | 563 | |
564 | - if ( $this->_is_UI_request ) { |
|
564 | + if ($this->_is_UI_request) { |
|
565 | 565 | //admin_init stuff - global, all views for this page class, specific view |
566 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
567 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
568 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
566 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
567 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
568 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | } else { |
572 | 572 | //hijack regular WP loading and route admin request immediately |
573 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
573 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
574 | 574 | $this->route_admin_request(); |
575 | 575 | } |
576 | 576 | } |
@@ -587,18 +587,18 @@ discard block |
||
587 | 587 | * @return void |
588 | 588 | */ |
589 | 589 | private function _do_other_page_hooks() { |
590 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
590 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
591 | 591 | |
592 | - foreach ( $registered_pages as $page ) { |
|
592 | + foreach ($registered_pages as $page) { |
|
593 | 593 | |
594 | 594 | //now let's setup the file name and class that should be present |
595 | 595 | $classname = str_replace('.class.php', '', $page); |
596 | 596 | |
597 | 597 | //autoloaders should take care of loading file |
598 | - if ( !class_exists( $classname ) ) { |
|
599 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
600 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname ); |
|
601 | - throw new EE_Error( implode( '||', $error_msg )); |
|
598 | + if ( ! class_exists($classname)) { |
|
599 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
600 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname); |
|
601 | + throw new EE_Error(implode('||', $error_msg)); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | $a = new ReflectionClass($classname); |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | public function load_page_dependencies() { |
614 | 614 | try { |
615 | 615 | $this->_load_page_dependencies(); |
616 | - } catch ( EE_Error $e ) { |
|
616 | + } catch (EE_Error $e) { |
|
617 | 617 | $e->get_error(); |
618 | 618 | } |
619 | 619 | } |
@@ -631,16 +631,16 @@ discard block |
||
631 | 631 | $this->_current_screen = get_current_screen(); |
632 | 632 | |
633 | 633 | //load admin_notices - global, page class, and view specific |
634 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
635 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
636 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
637 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
634 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
635 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
636 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
637 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | //load network admin_notices - global, page class, and view specific |
641 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
642 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
643 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
641 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
642 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
643 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | //this will save any per_page screen options if they are present |
@@ -656,8 +656,8 @@ discard block |
||
656 | 656 | //add screen options - global, page child class, and view specific |
657 | 657 | $this->_add_global_screen_options(); |
658 | 658 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
659 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
660 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
661 | 661 | |
662 | 662 | |
663 | 663 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,33 +668,33 @@ discard block |
||
668 | 668 | //add feature_pointers - global, page child class, and view specific |
669 | 669 | $this->_add_feature_pointers(); |
670 | 670 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
671 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
672 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
673 | 673 | |
674 | 674 | //enqueue scripts/styles - global, page class, and view specific |
675 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
676 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
675 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
676 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
677 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
678 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
679 | 679 | |
680 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
680 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
681 | 681 | |
682 | 682 | //admin_print_footer_scripts - global, page child class, and view specific. NOTE, despite the name, whenever possible, scripts should NOT be loaded using this. In most cases that's doing_it_wrong(). But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these |
683 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
684 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
683 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
684 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
685 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
686 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
687 | 687 | |
688 | 688 | //admin footer scripts |
689 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
690 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
689 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
690 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
691 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
692 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
693 | 693 | |
694 | 694 | |
695 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
695 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
696 | 696 | //targeted hook |
697 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
697 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
698 | 698 | |
699 | 699 | } |
700 | 700 | |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | private function _set_defaults() { |
710 | 710 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
711 | 711 | |
712 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
712 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
713 | 713 | |
714 | 714 | $this->default_nav_tab_name = 'overview'; |
715 | 715 | |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | public function route_admin_request() { |
737 | 737 | try { |
738 | 738 | $this->_route_admin_request(); |
739 | - } catch ( EE_Error $e ) { |
|
739 | + } catch (EE_Error $e) { |
|
740 | 740 | $e->get_error(); |
741 | 741 | } |
742 | 742 | } |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $this->_wp_page_slug = $wp_page_slug; |
748 | 748 | |
749 | 749 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
750 | - if ( is_network_admin() ) { |
|
750 | + if (is_network_admin()) { |
|
751 | 751 | $this->_wp_page_slug .= '-network'; |
752 | 752 | } |
753 | 753 | } |
@@ -760,53 +760,53 @@ discard block |
||
760 | 760 | * @return void |
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
763 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
764 | 764 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
765 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
766 | 766 | |
767 | 767 | $this->_route = FALSE; |
768 | 768 | $func = FALSE; |
769 | 769 | $args = array(); |
770 | 770 | |
771 | 771 | // check that the page_routes array is not empty |
772 | - if ( empty( $this->_page_routes )) { |
|
772 | + if (empty($this->_page_routes)) { |
|
773 | 773 | // user error msg |
774 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
774 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
775 | 775 | // developer error msg |
776 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
777 | - throw new EE_Error( $error_msg ); |
|
776 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
777 | + throw new EE_Error($error_msg); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | // and that the requested page route exists |
781 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
782 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
781 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
782 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
783 | 783 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
784 | 784 | } else { |
785 | 785 | // user error msg |
786 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
786 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
787 | 787 | // developer error msg |
788 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action ); |
|
789 | - throw new EE_Error( $error_msg ); |
|
788 | + $error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action); |
|
789 | + throw new EE_Error($error_msg); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | // and that a default route exists |
793 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
793 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
794 | 794 | // user error msg |
795 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
795 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
796 | 796 | // developer error msg |
797 | - $error_msg .= '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' ); |
|
798 | - throw new EE_Error( $error_msg ); |
|
797 | + $error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso'); |
|
798 | + throw new EE_Error($error_msg); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | |
802 | 802 | //first lets' catch if the UI request has EVER been set. |
803 | - if ( $this->_is_UI_request === NULL ) { |
|
803 | + if ($this->_is_UI_request === NULL) { |
|
804 | 804 | //lets set if this is a UI request or not. |
805 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
805 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
806 | 806 | |
807 | 807 | |
808 | 808 | //wait a minute... we might have a noheader in the route array |
809 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
809 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | $this->_set_current_labels(); |
@@ -821,15 +821,15 @@ discard block |
||
821 | 821 | * @param string $route the route name we're verifying |
822 | 822 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
823 | 823 | */ |
824 | - protected function _verify_route( $route ) { |
|
825 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
824 | + protected function _verify_route($route) { |
|
825 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
826 | 826 | return true; |
827 | 827 | } else { |
828 | 828 | // user error msg |
829 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
829 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
830 | 830 | // developer error msg |
831 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route ); |
|
832 | - throw new EE_Error( $error_msg ); |
|
831 | + $error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route); |
|
832 | + throw new EE_Error($error_msg); |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
@@ -843,18 +843,18 @@ discard block |
||
843 | 843 | * @param string $nonce_ref The nonce reference string (name0) |
844 | 844 | * @return mixed (bool|die) |
845 | 845 | */ |
846 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
846 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
847 | 847 | // verify nonce against expected value |
848 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
848 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
849 | 849 | // these are not the droids you are looking for !!! |
850 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
851 | - if ( WP_DEBUG ) { |
|
852 | - $msg .= "\n " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__ ); |
|
850 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
851 | + if (WP_DEBUG) { |
|
852 | + $msg .= "\n ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__); |
|
853 | 853 | } |
854 | - if ( ! defined( 'DOING_AJAX' )) { |
|
855 | - wp_die( $msg ); |
|
854 | + if ( ! defined('DOING_AJAX')) { |
|
855 | + wp_die($msg); |
|
856 | 856 | } else { |
857 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
857 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
858 | 858 | $this->_return_json(); |
859 | 859 | } |
860 | 860 | } |
@@ -872,63 +872,63 @@ discard block |
||
872 | 872 | * @return void |
873 | 873 | */ |
874 | 874 | protected function _route_admin_request() { |
875 | - if ( ! $this->_is_UI_request ) |
|
875 | + if ( ! $this->_is_UI_request) |
|
876 | 876 | $this->_verify_routes(); |
877 | 877 | |
878 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
878 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
879 | 879 | |
880 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
880 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
881 | 881 | // set nonce from post data |
882 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
883 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
882 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
883 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
884 | 884 | } |
885 | 885 | //set the nav_tabs array but ONLY if this is UI_request |
886 | - if ( $this->_is_UI_request ) |
|
886 | + if ($this->_is_UI_request) |
|
887 | 887 | $this->_set_nav_tabs(); |
888 | 888 | |
889 | 889 | // grab callback function |
890 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
890 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
891 | 891 | |
892 | 892 | // check if callback has args |
893 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
893 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
894 | 894 | |
895 | 895 | $error_msg = ''; |
896 | 896 | |
897 | 897 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
898 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
898 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | //right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing). |
903 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
903 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
904 | 904 | |
905 | - if ( ! empty( $func )) { |
|
905 | + if ( ! empty($func)) { |
|
906 | 906 | $base_call = $addon_call = FALSE; |
907 | 907 | //try to access page route via this class |
908 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
908 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
909 | 909 | // user error msg |
910 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
910 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
911 | 911 | // developer error msg |
912 | - $error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func ); |
|
912 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func); |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | //for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method) |
916 | 916 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
917 | 917 | |
918 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
919 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
920 | - $error_msg .= '||' . sprintf( __('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func ); |
|
918 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
919 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
920 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
924 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
925 | - throw new EE_Error( $error_msg ); |
|
924 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
925 | + throw new EE_Error($error_msg); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | //if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route. |
929 | 929 | //now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent. |
930 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
931 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
930 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
931 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
932 | 932 | } |
933 | 933 | } |
934 | 934 | |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | * @param string $new_route New (non header) route to redirect to. |
945 | 945 | * @return void |
946 | 946 | */ |
947 | - protected function _reset_routing_properties( $new_route ) { |
|
947 | + protected function _reset_routing_properties($new_route) { |
|
948 | 948 | $this->_is_UI_request = TRUE; |
949 | 949 | //now we set the current route to whatever the headers_sent_route is set at |
950 | 950 | $this->_req_data['action'] = $new_route; |
@@ -990,23 +990,23 @@ discard block |
||
990 | 990 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
991 | 991 | * @return string |
992 | 992 | */ |
993 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
993 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
994 | 994 | |
995 | 995 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
996 | - if ( $sticky ) { |
|
996 | + if ($sticky) { |
|
997 | 997 | $request = $_REQUEST; |
998 | - unset( $request['_wp_http_referer'] ); |
|
999 | - unset( $request['wp_referer'] ); |
|
1000 | - foreach ( $request as $key => $value ) { |
|
998 | + unset($request['_wp_http_referer']); |
|
999 | + unset($request['wp_referer']); |
|
1000 | + foreach ($request as $key => $value) { |
|
1001 | 1001 | //do not add nonces |
1002 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
1002 | + if (strpos($key, 'nonce') !== false) { |
|
1003 | 1003 | continue; |
1004 | 1004 | } |
1005 | - $args['wp_referer[' . $key . ']'] = $value; |
|
1005 | + $args['wp_referer['.$key.']'] = $value; |
|
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | |
1009 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
1009 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | * @uses EEH_Template::get_help_tab_link() |
1023 | 1023 | * @return string generated link |
1024 | 1024 | */ |
1025 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1026 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1025 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1026 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | |
@@ -1040,30 +1040,30 @@ discard block |
||
1040 | 1040 | */ |
1041 | 1041 | protected function _add_help_tabs() { |
1042 | 1042 | $tour_buttons = ''; |
1043 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1043 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1044 | 1044 | $config = $this->_page_config[$this->_req_action]; |
1045 | 1045 | |
1046 | 1046 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1047 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1047 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1048 | 1048 | $tb = array(); |
1049 | 1049 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1050 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1050 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1051 | 1051 | //if this is the end tour then we don't need to setup a button |
1052 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1052 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1053 | 1053 | continue; |
1054 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1054 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1055 | 1055 | } |
1056 | 1056 | $tour_buttons .= implode('<br />', $tb); |
1057 | 1057 | $tour_buttons .= '</div></div>'; |
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1061 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1061 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1062 | 1062 | //check that the callback given is valid |
1063 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1064 | - throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) ); |
|
1063 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1064 | + throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this))); |
|
1065 | 1065 | |
1066 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1066 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1067 | 1067 | |
1068 | 1068 | $content .= $tour_buttons; //add help tour buttons. |
1069 | 1069 | |
@@ -1072,49 +1072,49 @@ discard block |
||
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1075 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1075 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1076 | 1076 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1080 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1080 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1081 | 1081 | $_ht['id'] = $this->page_slug; |
1082 | 1082 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1083 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1083 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1084 | 1084 | $this->_current_screen->add_help_tab($_ht); |
1085 | 1085 | }/**/ |
1086 | 1086 | |
1087 | 1087 | |
1088 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1088 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1089 | 1089 | |
1090 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1090 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1091 | 1091 | //we're here so there ARE help tabs! |
1092 | 1092 | |
1093 | 1093 | //make sure we've got what we need |
1094 | - if ( !isset( $cfg['title'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1094 | + if ( ! isset($cfg['title'])) |
|
1095 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1096 | 1096 | |
1097 | 1097 | |
1098 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1099 | - throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') ); |
|
1098 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1099 | + throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso')); |
|
1100 | 1100 | |
1101 | 1101 | |
1102 | 1102 | |
1103 | 1103 | //first priority goes to content. |
1104 | - if ( !empty($cfg['content'] ) ) { |
|
1105 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1104 | + if ( ! empty($cfg['content'])) { |
|
1105 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1106 | 1106 | |
1107 | 1107 | //second priority goes to filename |
1108 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1109 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1108 | + } else if ( ! empty($cfg['filename'])) { |
|
1109 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1110 | 1110 | |
1111 | 1111 | |
1112 | 1112 | //it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too) |
1113 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1113 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1114 | 1114 | |
1115 | 1115 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1116 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1117 | - EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1116 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1117 | + EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__); |
|
1118 | 1118 | return; |
1119 | 1119 | } |
1120 | 1120 | $template_args['admin_page_obj'] = $this; |
@@ -1125,21 +1125,21 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | |
1127 | 1127 | //check if callback is valid |
1128 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1129 | - EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1128 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1129 | + EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__); |
|
1130 | 1130 | return; |
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | //setup config array for help tab method |
1134 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1134 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1135 | 1135 | $_ht = array( |
1136 | 1136 | 'id' => $id, |
1137 | 1137 | 'title' => $cfg['title'], |
1138 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1138 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1139 | 1139 | 'content' => $content |
1140 | 1140 | ); |
1141 | 1141 | |
1142 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1142 | + $this->_current_screen->add_help_tab($_ht); |
|
1143 | 1143 | } |
1144 | 1144 | } |
1145 | 1145 | } |
@@ -1159,49 +1159,49 @@ discard block |
||
1159 | 1159 | $this->_help_tour = array(); |
1160 | 1160 | |
1161 | 1161 | //exit early if help tours are turned off globally |
1162 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1162 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1163 | 1163 | return; |
1164 | 1164 | |
1165 | 1165 | //loop through _page_config to find any help_tour defined |
1166 | - foreach ( $this->_page_config as $route => $config ) { |
|
1166 | + foreach ($this->_page_config as $route => $config) { |
|
1167 | 1167 | //we're only going to set things up for this route |
1168 | - if ( $route !== $this->_req_action ) |
|
1168 | + if ($route !== $this->_req_action) |
|
1169 | 1169 | continue; |
1170 | 1170 | |
1171 | - if ( isset( $config['help_tour'] ) ) { |
|
1171 | + if (isset($config['help_tour'])) { |
|
1172 | 1172 | |
1173 | - foreach( $config['help_tour'] as $tour ) { |
|
1174 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1173 | + foreach ($config['help_tour'] as $tour) { |
|
1174 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1175 | 1175 | //let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent |
1176 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1176 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1177 | 1177 | |
1178 | 1178 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1179 | - if ( !is_readable($file_path) ) { |
|
1180 | - EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1179 | + if ( ! is_readable($file_path)) { |
|
1180 | + EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__); |
|
1181 | 1181 | return; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | require_once $file_path; |
1185 | - if ( !class_exists( $tour ) ) { |
|
1186 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1187 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) ); |
|
1188 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1185 | + if ( ! class_exists($tour)) { |
|
1186 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1187 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this)); |
|
1188 | + throw new EE_Error(implode('||', $error_msg)); |
|
1189 | 1189 | } |
1190 | 1190 | $a = new ReflectionClass($tour); |
1191 | 1191 | $tour_obj = $a->newInstance($this->_is_caf); |
1192 | 1192 | |
1193 | 1193 | $tours[] = $tour_obj; |
1194 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1194 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1198 | 1198 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1199 | 1199 | $tours[] = $end_stop_tour; |
1200 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1200 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | |
1204 | - if ( !empty( $tours ) ) |
|
1204 | + if ( ! empty($tours)) |
|
1205 | 1205 | $this->_help_tour['tours'] = $tours; |
1206 | 1206 | |
1207 | 1207 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1217,12 +1217,12 @@ discard block |
||
1217 | 1217 | * @return void |
1218 | 1218 | */ |
1219 | 1219 | protected function _add_qtips() { |
1220 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1220 | + if (isset($this->_route_config['qtips'])) { |
|
1221 | 1221 | $qtips = (array) $this->_route_config['qtips']; |
1222 | 1222 | //load qtip loader |
1223 | 1223 | $path = array( |
1224 | - $this->_get_dir() . '/qtips/', |
|
1225 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1224 | + $this->_get_dir().'/qtips/', |
|
1225 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1226 | 1226 | ); |
1227 | 1227 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1228 | 1228 | } |
@@ -1239,41 +1239,41 @@ discard block |
||
1239 | 1239 | * @return void |
1240 | 1240 | */ |
1241 | 1241 | protected function _set_nav_tabs() { |
1242 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1242 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1243 | 1243 | $i = 0; |
1244 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1245 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1244 | + foreach ($this->_page_config as $slug => $config) { |
|
1245 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1246 | 1246 | continue; //no nav tab for this config |
1247 | 1247 | |
1248 | 1248 | //check for persistent flag |
1249 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1249 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1250 | 1250 | continue; //nav tab is only to appear when route requested. |
1251 | 1251 | |
1252 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1252 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1253 | 1253 | continue; //no nav tab becasue current user does not have access. |
1254 | 1254 | |
1255 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1255 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1256 | 1256 | $this->_nav_tabs[$slug] = array( |
1257 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1258 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1259 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1260 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1257 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1258 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1259 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1260 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1261 | 1261 | ); |
1262 | 1262 | $i++; |
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | //if $this->_nav_tabs is empty then lets set the default |
1266 | - if ( empty( $this->_nav_tabs ) ) { |
|
1266 | + if (empty($this->_nav_tabs)) { |
|
1267 | 1267 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1268 | 1268 | 'url' => $this->admin_base_url, |
1269 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1269 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1270 | 1270 | 'css_class' => 'nav-tab-active', |
1271 | 1271 | 'order' => 10 |
1272 | 1272 | ); |
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | //now let's sort the tabs according to order |
1276 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1276 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1289,10 +1289,10 @@ discard block |
||
1289 | 1289 | * @return void |
1290 | 1290 | */ |
1291 | 1291 | private function _set_current_labels() { |
1292 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1293 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1294 | - if ( is_array($text) ) { |
|
1295 | - foreach ( $text as $sublabel => $subtext ) { |
|
1292 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1293 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1294 | + if (is_array($text)) { |
|
1295 | + foreach ($text as $sublabel => $subtext) { |
|
1296 | 1296 | $this->_labels[$label][$sublabel] = $subtext; |
1297 | 1297 | } |
1298 | 1298 | } else { |
@@ -1313,24 +1313,24 @@ discard block |
||
1313 | 1313 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1314 | 1314 | * @return BOOL|wp_die() |
1315 | 1315 | */ |
1316 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1317 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1318 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1319 | - $capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1316 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1317 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1318 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1319 | + $capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1320 | 1320 | |
1321 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1322 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1321 | + if (empty($capability) && empty($route_to_check)) { |
|
1322 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1323 | 1323 | } else { |
1324 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1324 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1325 | 1325 | } |
1326 | 1326 | |
1327 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1327 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1328 | 1328 | |
1329 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1330 | - if ( $verify_only ) { |
|
1329 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1330 | + if ($verify_only) { |
|
1331 | 1331 | return FALSE; |
1332 | 1332 | } else { |
1333 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1333 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1334 | 1334 | } |
1335 | 1335 | } |
1336 | 1336 | return TRUE; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | $this->_add_admin_page_overlay(); |
1408 | 1408 | |
1409 | 1409 | //if metaboxes are present we need to add the nonce field |
1410 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1410 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1411 | 1411 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1412 | 1412 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1413 | 1413 | } |
@@ -1426,19 +1426,19 @@ discard block |
||
1426 | 1426 | */ |
1427 | 1427 | public function admin_footer_global() { |
1428 | 1428 | //dialog container for dialog helper |
1429 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1429 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1430 | 1430 | $d_cont .= '<div class="ee-notices"></div>'; |
1431 | 1431 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1432 | 1432 | $d_cont .= '</div>'; |
1433 | 1433 | echo $d_cont; |
1434 | 1434 | |
1435 | 1435 | //help tour stuff? |
1436 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1436 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1437 | 1437 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | //current set timezone for timezone js |
1441 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1441 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | |
@@ -1462,18 +1462,18 @@ discard block |
||
1462 | 1462 | * @access protected |
1463 | 1463 | * @return string content |
1464 | 1464 | */ |
1465 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1465 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1466 | 1466 | $content = ''; |
1467 | 1467 | |
1468 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1469 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1468 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1469 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1470 | 1470 | |
1471 | 1471 | |
1472 | 1472 | //loop through the array and setup content |
1473 | - foreach ( $help_array as $trigger => $help ) { |
|
1473 | + foreach ($help_array as $trigger => $help) { |
|
1474 | 1474 | //make sure the array is setup properly |
1475 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1476 | - throw new EE_Error( __('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') ); |
|
1475 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1476 | + throw new EE_Error(__('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso')); |
|
1477 | 1477 | } |
1478 | 1478 | |
1479 | 1479 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1483,10 +1483,10 @@ discard block |
||
1483 | 1483 | 'help_popup_content' => $help['content'] |
1484 | 1484 | ); |
1485 | 1485 | |
1486 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1486 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1487 | 1487 | } |
1488 | 1488 | |
1489 | - if ( $display ) |
|
1489 | + if ($display) |
|
1490 | 1490 | echo $content; |
1491 | 1491 | else |
1492 | 1492 | return $content; |
@@ -1503,18 +1503,18 @@ discard block |
||
1503 | 1503 | */ |
1504 | 1504 | private function _get_help_content() { |
1505 | 1505 | //what is the method we're looking for? |
1506 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1506 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1507 | 1507 | |
1508 | 1508 | //if method doesn't exist let's get out. |
1509 | - if ( !method_exists( $this, $method_name ) ) |
|
1509 | + if ( ! method_exists($this, $method_name)) |
|
1510 | 1510 | return array(); |
1511 | 1511 | |
1512 | 1512 | //k we're good to go let's retrieve the help array |
1513 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1513 | + $help_array = call_user_func(array($this, $method_name)); |
|
1514 | 1514 | |
1515 | 1515 | //make sure we've got an array! |
1516 | - if ( !is_array($help_array) ) { |
|
1517 | - throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) ); |
|
1516 | + if ( ! is_array($help_array)) { |
|
1517 | + throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso')); |
|
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | return $help_array; |
@@ -1536,27 +1536,27 @@ discard block |
||
1536 | 1536 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1537 | 1537 | * @return string |
1538 | 1538 | */ |
1539 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1539 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1540 | 1540 | |
1541 | - if ( defined('DOING_AJAX') ) return; |
|
1541 | + if (defined('DOING_AJAX')) return; |
|
1542 | 1542 | |
1543 | 1543 | //let's check and see if there is any content set for this popup. If there isn't then we'll include a default title and content so that developers know something needs to be corrected |
1544 | 1544 | $help_array = $this->_get_help_content(); |
1545 | 1545 | $help_content = ''; |
1546 | 1546 | |
1547 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1547 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1548 | 1548 | $help_array[$trigger_id] = array( |
1549 | 1549 | 'title' => __('Missing Content', 'event_espresso'), |
1550 | 1550 | 'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso') |
1551 | 1551 | ); |
1552 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1552 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1553 | 1553 | } |
1554 | 1554 | |
1555 | 1555 | //let's setup the trigger |
1556 | - $content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1557 | - $content = $content . $help_content; |
|
1556 | + $content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1557 | + $content = $content.$help_content; |
|
1558 | 1558 | |
1559 | - if ( $display ) |
|
1559 | + if ($display) |
|
1560 | 1560 | echo $content; |
1561 | 1561 | else |
1562 | 1562 | return $content; |
@@ -1613,15 +1613,15 @@ discard block |
||
1613 | 1613 | public function load_global_scripts_styles() { |
1614 | 1614 | /** STYLES **/ |
1615 | 1615 | // add debugging styles |
1616 | - if ( WP_DEBUG ) { |
|
1617 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1616 | + if (WP_DEBUG) { |
|
1617 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | //register all styles |
1621 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION ); |
|
1622 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1621 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION); |
|
1622 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1623 | 1623 | //helpers styles |
1624 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1624 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1625 | 1625 | //enqueue global styles |
1626 | 1626 | wp_enqueue_style('ee-admin-css'); |
1627 | 1627 | |
@@ -1629,66 +1629,66 @@ discard block |
||
1629 | 1629 | /** SCRIPTS **/ |
1630 | 1630 | |
1631 | 1631 | //register all scripts |
1632 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1633 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1634 | - wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true ); |
|
1632 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1633 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1634 | + wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
1635 | 1635 | |
1636 | - wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true ); |
|
1636 | + wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true); |
|
1637 | 1637 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1638 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1638 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1639 | 1639 | add_filter('FHEE_load_joyride', '__return_true'); |
1640 | 1640 | |
1641 | 1641 | //script for sorting tables |
1642 | - wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1642 | + wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1643 | 1643 | //script for parsing uri's |
1644 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1644 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1645 | 1645 | //and parsing associative serialized form elements |
1646 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1646 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1647 | 1647 | //helpers scripts |
1648 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1649 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1650 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1651 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1648 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1649 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1650 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1651 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1652 | 1652 | |
1653 | 1653 | //google charts |
1654 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1654 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1655 | 1655 | |
1656 | 1656 | //enqueue global scripts |
1657 | 1657 | |
1658 | 1658 | //taking care of metaboxes |
1659 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1659 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1660 | 1660 | wp_enqueue_script('dashboard'); |
1661 | 1661 | } |
1662 | 1662 | |
1663 | 1663 | //enqueue thickbox for ee help popups. default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups |
1664 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1664 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1665 | 1665 | wp_enqueue_script('ee_admin_js'); |
1666 | 1666 | wp_enqueue_style('ee-admin-css'); |
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | |
1670 | 1670 | //localize script for ajax lazy loading |
1671 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1672 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1671 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1672 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1673 | 1673 | |
1674 | 1674 | |
1675 | 1675 | /** |
1676 | 1676 | * help tour stuff |
1677 | 1677 | */ |
1678 | - if ( !empty( $this->_help_tour ) ) { |
|
1678 | + if ( ! empty($this->_help_tour)) { |
|
1679 | 1679 | |
1680 | 1680 | //register the js for kicking things off |
1681 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1681 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1682 | 1682 | |
1683 | 1683 | //setup tours for the js tour object |
1684 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1684 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1685 | 1685 | $tours[] = array( |
1686 | 1686 | 'id' => $tour->get_slug(), |
1687 | 1687 | 'options' => $tour->get_options() |
1688 | 1688 | ); |
1689 | 1689 | } |
1690 | 1690 | |
1691 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1691 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1692 | 1692 | |
1693 | 1693 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1694 | 1694 | } |
@@ -1706,52 +1706,52 @@ discard block |
||
1706 | 1706 | public function admin_footer_scripts_eei18n_js_strings() { |
1707 | 1707 | |
1708 | 1708 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1709 | - EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' ); |
|
1710 | - |
|
1711 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1724 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1725 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1731 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1732 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1735 | - |
|
1736 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1739 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1740 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1741 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1742 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1743 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1744 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1745 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1746 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1747 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1748 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1749 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1709 | + EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso'); |
|
1710 | + |
|
1711 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1724 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1725 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1731 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1732 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1735 | + |
|
1736 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1739 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1740 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1741 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1742 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1743 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1744 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1745 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1746 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1747 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1748 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1749 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1750 | 1750 | |
1751 | 1751 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1752 | 1752 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1753 | 1753 | //espresso_core is listed as a dependency of ee_admin_js. |
1754 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1754 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1755 | 1755 | |
1756 | 1756 | } |
1757 | 1757 | |
@@ -1785,23 +1785,23 @@ discard block |
||
1785 | 1785 | protected function _set_list_table() { |
1786 | 1786 | |
1787 | 1787 | //first is this a list_table view? |
1788 | - if ( !isset($this->_route_config['list_table']) ) |
|
1788 | + if ( ! isset($this->_route_config['list_table'])) |
|
1789 | 1789 | return; //not a list_table view so get out. |
1790 | 1790 | |
1791 | 1791 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1792 | 1792 | |
1793 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1793 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1794 | 1794 | //user error msg |
1795 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1795 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1796 | 1796 | //developer error msg |
1797 | - $error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action ); |
|
1798 | - throw new EE_Error( $error_msg ); |
|
1797 | + $error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action); |
|
1798 | + throw new EE_Error($error_msg); |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1802 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1803 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1804 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1802 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1803 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1804 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1805 | 1805 | |
1806 | 1806 | $this->_set_list_table_view(); |
1807 | 1807 | $this->_set_list_table_object(); |
@@ -1823,14 +1823,14 @@ discard block |
||
1823 | 1823 | * @return array |
1824 | 1824 | */ |
1825 | 1825 | protected function _set_list_table_view() { |
1826 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1826 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1827 | 1827 | |
1828 | 1828 | |
1829 | 1829 | // looking at active items or dumpster diving ? |
1830 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1831 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1830 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1831 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1832 | 1832 | } else { |
1833 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1833 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1834 | 1834 | } |
1835 | 1835 | } |
1836 | 1836 | |
@@ -1843,8 +1843,8 @@ discard block |
||
1843 | 1843 | * @throws \EE_Error |
1844 | 1844 | */ |
1845 | 1845 | protected function _set_list_table_object() { |
1846 | - if ( isset( $this->_route_config['list_table'] ) ) { |
|
1847 | - if ( ! class_exists( $this->_route_config['list_table'] ) ) { |
|
1846 | + if (isset($this->_route_config['list_table'])) { |
|
1847 | + if ( ! class_exists($this->_route_config['list_table'])) { |
|
1848 | 1848 | throw new EE_Error( |
1849 | 1849 | sprintf( |
1850 | 1850 | __( |
@@ -1852,12 +1852,12 @@ discard block |
||
1852 | 1852 | 'event_espresso' |
1853 | 1853 | ), |
1854 | 1854 | $this->_route_config['list_table'], |
1855 | - get_class( $this ) |
|
1855 | + get_class($this) |
|
1856 | 1856 | ) |
1857 | 1857 | ); |
1858 | 1858 | } |
1859 | 1859 | $list_table = $this->_route_config['list_table']; |
1860 | - $this->_list_table_object = new $list_table( $this ); |
|
1860 | + $this->_list_table_object = new $list_table($this); |
|
1861 | 1861 | } |
1862 | 1862 | } |
1863 | 1863 | |
@@ -1874,27 +1874,27 @@ discard block |
||
1874 | 1874 | * |
1875 | 1875 | * @return array |
1876 | 1876 | */ |
1877 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1877 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1878 | 1878 | |
1879 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1879 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1880 | 1880 | |
1881 | - if ( empty( $this->_views )) { |
|
1881 | + if (empty($this->_views)) { |
|
1882 | 1882 | $this->_views = array(); |
1883 | 1883 | } |
1884 | 1884 | |
1885 | 1885 | // cycle thru views |
1886 | - foreach ( $this->_views as $key => $view ) { |
|
1886 | + foreach ($this->_views as $key => $view) { |
|
1887 | 1887 | $query_args = array(); |
1888 | 1888 | // check for current view |
1889 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1889 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1890 | 1890 | $query_args['action'] = $this->_req_action; |
1891 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1891 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1892 | 1892 | $query_args['status'] = $view['slug']; |
1893 | 1893 | //merge any other arguments sent in. |
1894 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1895 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1894 | + if (isset($extra_query_args[$view['slug']])) { |
|
1895 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1896 | 1896 | } |
1897 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1897 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1898 | 1898 | } |
1899 | 1899 | |
1900 | 1900 | return $this->_views; |
@@ -1911,15 +1911,15 @@ discard block |
||
1911 | 1911 | * @param int $max_entries total number of rows in the table |
1912 | 1912 | * @return string |
1913 | 1913 | */ |
1914 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1914 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1915 | 1915 | |
1916 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1917 | - $values = array( 10, 25, 50, 100 ); |
|
1918 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1916 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1917 | + $values = array(10, 25, 50, 100); |
|
1918 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1919 | 1919 | |
1920 | - if ( $max_entries ) { |
|
1920 | + if ($max_entries) { |
|
1921 | 1921 | $values[] = $max_entries; |
1922 | - sort( $values ); |
|
1922 | + sort($values); |
|
1923 | 1923 | } |
1924 | 1924 | |
1925 | 1925 | $entries_per_page_dropdown = ' |
@@ -1928,15 +1928,15 @@ discard block |
||
1928 | 1928 | Show |
1929 | 1929 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1930 | 1930 | |
1931 | - foreach ( $values as $value ) { |
|
1932 | - if ( $value < $max_entries ) { |
|
1933 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1931 | + foreach ($values as $value) { |
|
1932 | + if ($value < $max_entries) { |
|
1933 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1934 | 1934 | $entries_per_page_dropdown .= ' |
1935 | 1935 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1936 | 1936 | } |
1937 | 1937 | } |
1938 | 1938 | |
1939 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1939 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1940 | 1940 | $entries_per_page_dropdown .= ' |
1941 | 1941 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1942 | 1942 | |
@@ -1959,8 +1959,8 @@ discard block |
||
1959 | 1959 | * @return void |
1960 | 1960 | */ |
1961 | 1961 | public function _set_search_attributes() { |
1962 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1963 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1962 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1963 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1964 | 1964 | } |
1965 | 1965 | |
1966 | 1966 | /*** END LIST TABLE METHODS **/ |
@@ -1979,10 +1979,10 @@ discard block |
||
1979 | 1979 | * @return void |
1980 | 1980 | */ |
1981 | 1981 | private function _add_registered_meta_boxes() { |
1982 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1982 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1983 | 1983 | |
1984 | 1984 | //we only add meta boxes if the page_route calls for it |
1985 | - if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] ) |
|
1985 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) |
|
1986 | 1986 | && is_array( |
1987 | 1987 | $this->_route_config['metaboxes'] |
1988 | 1988 | ) |
@@ -1990,27 +1990,27 @@ discard block |
||
1990 | 1990 | // this simply loops through the callbacks provided |
1991 | 1991 | // and checks if there is a corresponding callback registered by the child |
1992 | 1992 | // if there is then we go ahead and process the metabox loader. |
1993 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1993 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1994 | 1994 | // first check for Closures |
1995 | - if ( $metabox_callback instanceof Closure ) { |
|
1995 | + if ($metabox_callback instanceof Closure) { |
|
1996 | 1996 | $result = $metabox_callback(); |
1997 | - } else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) { |
|
1998 | - $result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) ); |
|
1997 | + } else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) { |
|
1998 | + $result = call_user_func(array($metabox_callback[0], $metabox_callback[1])); |
|
1999 | 1999 | } else { |
2000 | - $result = call_user_func( array( $this, &$metabox_callback ) ); |
|
2000 | + $result = call_user_func(array($this, &$metabox_callback)); |
|
2001 | 2001 | } |
2002 | - if ( $result === FALSE ) { |
|
2002 | + if ($result === FALSE) { |
|
2003 | 2003 | // user error msg |
2004 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
2004 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
2005 | 2005 | // developer error msg |
2006 | - $error_msg .= '||' . sprintf( |
|
2006 | + $error_msg .= '||'.sprintf( |
|
2007 | 2007 | __( |
2008 | 2008 | 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', |
2009 | 2009 | 'event_espresso' |
2010 | 2010 | ), |
2011 | 2011 | $metabox_callback |
2012 | 2012 | ); |
2013 | - throw new EE_Error( $error_msg ); |
|
2013 | + throw new EE_Error($error_msg); |
|
2014 | 2014 | } |
2015 | 2015 | } |
2016 | 2016 | } |
@@ -2027,17 +2027,17 @@ discard block |
||
2027 | 2027 | * @return void |
2028 | 2028 | */ |
2029 | 2029 | private function _add_screen_columns() { |
2030 | - if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) { |
|
2030 | + if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) { |
|
2031 | 2031 | |
2032 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2032 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
2033 | 2033 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2034 | 2034 | $screen_id = $this->_current_screen->id; |
2035 | 2035 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
2036 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2037 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
2036 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2037 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
2038 | 2038 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2039 | 2039 | $this->_template_args['screen'] = $this->_current_screen; |
2040 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2040 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2041 | 2041 | |
2042 | 2042 | //finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded. |
2043 | 2043 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2054,11 +2054,11 @@ discard block |
||
2054 | 2054 | */ |
2055 | 2055 | |
2056 | 2056 | private function _espresso_news_post_box() { |
2057 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2058 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2057 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2058 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2059 | 2059 | $this, |
2060 | 2060 | 'espresso_news_post_box' |
2061 | - ), $this->_wp_page_slug, 'side' ); |
|
2061 | + ), $this->_wp_page_slug, 'side'); |
|
2062 | 2062 | } |
2063 | 2063 | |
2064 | 2064 | |
@@ -2066,14 +2066,14 @@ discard block |
||
2066 | 2066 | * Code for setting up espresso ratings request metabox. |
2067 | 2067 | */ |
2068 | 2068 | protected function _espresso_ratings_request() { |
2069 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2069 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2070 | 2070 | return ''; |
2071 | 2071 | } |
2072 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2073 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2072 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2073 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2074 | 2074 | $this, |
2075 | 2075 | 'espresso_ratings_request' |
2076 | - ), $this->_wp_page_slug, 'side' ); |
|
2076 | + ), $this->_wp_page_slug, 'side'); |
|
2077 | 2077 | } |
2078 | 2078 | |
2079 | 2079 | |
@@ -2081,34 +2081,34 @@ discard block |
||
2081 | 2081 | * Code for setting up espresso ratings request metabox content. |
2082 | 2082 | */ |
2083 | 2083 | public function espresso_ratings_request() { |
2084 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2085 | - EEH_Template::display_template( $template_path, array() ); |
|
2084 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2085 | + EEH_Template::display_template($template_path, array()); |
|
2086 | 2086 | } |
2087 | 2087 | |
2088 | 2088 | |
2089 | 2089 | |
2090 | 2090 | |
2091 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2092 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2093 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2094 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2095 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2096 | - $post = '</div>' . "\n"; |
|
2091 | + public static function cached_rss_display($rss_id, $url) { |
|
2092 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2093 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2094 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2095 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2096 | + $post = '</div>'."\n"; |
|
2097 | 2097 | |
2098 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2099 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2100 | - echo $pre . $output . $post; |
|
2098 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2099 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2100 | + echo $pre.$output.$post; |
|
2101 | 2101 | return TRUE; |
2102 | 2102 | } |
2103 | 2103 | |
2104 | - if ( ! $doing_ajax ) { |
|
2105 | - echo $pre . $loading . $post; |
|
2104 | + if ( ! $doing_ajax) { |
|
2105 | + echo $pre.$loading.$post; |
|
2106 | 2106 | return FALSE; |
2107 | 2107 | } |
2108 | 2108 | |
2109 | 2109 | ob_start(); |
2110 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2111 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2110 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2111 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2112 | 2112 | return TRUE; |
2113 | 2113 | |
2114 | 2114 | } |
@@ -2120,13 +2120,13 @@ discard block |
||
2120 | 2120 | <div id="espresso_news_post_box_content" class="infolinks"> |
2121 | 2121 | <?php |
2122 | 2122 | // Get RSS Feed(s) |
2123 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2123 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2124 | 2124 | $url = urlencode($feed_url); |
2125 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2125 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2126 | 2126 | |
2127 | 2127 | ?> |
2128 | 2128 | </div> |
2129 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2129 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2130 | 2130 | </div> |
2131 | 2131 | <?php |
2132 | 2132 | } |
@@ -2147,32 +2147,32 @@ discard block |
||
2147 | 2147 | |
2148 | 2148 | protected function _espresso_sponsors_post_box() { |
2149 | 2149 | |
2150 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2151 | - if ( $show_sponsors ) |
|
2152 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2150 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2151 | + if ($show_sponsors) |
|
2152 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2153 | 2153 | } |
2154 | 2154 | |
2155 | 2155 | |
2156 | 2156 | public function espresso_sponsors_post_box() { |
2157 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2158 | - EEH_Template::display_template( $templatepath ); |
|
2157 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2158 | + EEH_Template::display_template($templatepath); |
|
2159 | 2159 | } |
2160 | 2160 | |
2161 | 2161 | |
2162 | 2162 | |
2163 | 2163 | private function _publish_post_box() { |
2164 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2164 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2165 | 2165 | |
2166 | 2166 | //if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label. Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes) |
2167 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2168 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2167 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2168 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2169 | 2169 | } else { |
2170 | 2170 | $box_label = __('Publish', 'event_espresso'); |
2171 | 2171 | } |
2172 | 2172 | |
2173 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2173 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2174 | 2174 | |
2175 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2175 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2176 | 2176 | |
2177 | 2177 | } |
2178 | 2178 | |
@@ -2180,9 +2180,9 @@ discard block |
||
2180 | 2180 | |
2181 | 2181 | public function editor_overview() { |
2182 | 2182 | //if we have extra content set let's add it in if not make sure its empty |
2183 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2184 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2185 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2183 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2184 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2185 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2186 | 2186 | } |
2187 | 2187 | |
2188 | 2188 | |
@@ -2198,8 +2198,8 @@ discard block |
||
2198 | 2198 | * @see $this->_set_publish_post_box_vars for param details |
2199 | 2199 | * @since 4.6.0 |
2200 | 2200 | */ |
2201 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2202 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2201 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2202 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2203 | 2203 | } |
2204 | 2204 | |
2205 | 2205 | |
@@ -2227,17 +2227,17 @@ discard block |
||
2227 | 2227 | $both_btns = true |
2228 | 2228 | ) { |
2229 | 2229 | // if Save & Close, use a custom redirect URL or default to the main page? |
2230 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2230 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2231 | 2231 | // create the Save & Close and Save buttons |
2232 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2232 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2233 | 2233 | //if we have extra content set let's add it in if not make sure its empty |
2234 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2234 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2235 | 2235 | |
2236 | 2236 | |
2237 | - if ( $delete && ! empty( $id ) ) { |
|
2237 | + if ($delete && ! empty($id)) { |
|
2238 | 2238 | //make sure we have a default if just true is sent. |
2239 | 2239 | $delete = ! empty($delete) ? $delete : 'delete'; |
2240 | - $delete_link_args = array( $name => $id ); |
|
2240 | + $delete_link_args = array($name => $id); |
|
2241 | 2241 | $delete = $this->get_action_link_or_button( |
2242 | 2242 | $delete, |
2243 | 2243 | $delete, |
@@ -2248,8 +2248,8 @@ discard block |
||
2248 | 2248 | ); |
2249 | 2249 | } |
2250 | 2250 | |
2251 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2252 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2251 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2252 | + if ( ! empty($name) && ! empty($id)) { |
|
2253 | 2253 | $hidden_field_arr[$name] = array( |
2254 | 2254 | 'type' => 'hidden', |
2255 | 2255 | 'value' => $id |
@@ -2259,7 +2259,7 @@ discard block |
||
2259 | 2259 | $hf = ''; |
2260 | 2260 | } |
2261 | 2261 | // add hidden field |
2262 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2262 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2263 | 2263 | |
2264 | 2264 | } |
2265 | 2265 | |
@@ -2276,8 +2276,8 @@ discard block |
||
2276 | 2276 | <noscript> |
2277 | 2277 | <div id="no-js-message" class="error"> |
2278 | 2278 | <p style="font-size:1.3em;"> |
2279 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2280 | - <?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?> |
|
2279 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2280 | + <?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?> |
|
2281 | 2281 | </p> |
2282 | 2282 | </div> |
2283 | 2283 | </noscript> |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | * @return string |
2298 | 2298 | */ |
2299 | 2299 | private function _display_espresso_notices() { |
2300 | - $notices = $this->_get_transient( TRUE ); |
|
2300 | + $notices = $this->_get_transient(TRUE); |
|
2301 | 2301 | echo stripslashes($notices); |
2302 | 2302 | } |
2303 | 2303 | |
@@ -2349,11 +2349,11 @@ discard block |
||
2349 | 2349 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2350 | 2350 | * @param boolean $create_func default is true. Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box. |
2351 | 2351 | */ |
2352 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2353 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2352 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2353 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2354 | 2354 | |
2355 | 2355 | //if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated. |
2356 | - if ( empty( $callback_args ) && $create_func ) { |
|
2356 | + if (empty($callback_args) && $create_func) { |
|
2357 | 2357 | $callback_args = array( |
2358 | 2358 | 'template_path' => $this->_template_path, |
2359 | 2359 | 'template_args' => $this->_template_args, |
@@ -2363,7 +2363,7 @@ discard block |
||
2363 | 2363 | //if $create_func is true (default) then we automatically create the function for displaying the actual meta box. If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish) |
2364 | 2364 | $call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback; |
2365 | 2365 | |
2366 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2366 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2367 | 2367 | } |
2368 | 2368 | |
2369 | 2369 | |
@@ -2376,7 +2376,7 @@ discard block |
||
2376 | 2376 | */ |
2377 | 2377 | public function display_admin_page_with_metabox_columns() { |
2378 | 2378 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2379 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2379 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2380 | 2380 | |
2381 | 2381 | //the final wrapper |
2382 | 2382 | $this->admin_page_wrapper(); |
@@ -2419,7 +2419,7 @@ discard block |
||
2419 | 2419 | * @return void |
2420 | 2420 | */ |
2421 | 2421 | public function display_about_admin_page() { |
2422 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2422 | + $this->_display_admin_page(FALSE, TRUE); |
|
2423 | 2423 | } |
2424 | 2424 | |
2425 | 2425 | |
@@ -2435,26 +2435,26 @@ discard block |
||
2435 | 2435 | * @return void |
2436 | 2436 | */ |
2437 | 2437 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2438 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2438 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2439 | 2439 | |
2440 | 2440 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2441 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2441 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2442 | 2442 | |
2443 | 2443 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2444 | 2444 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2445 | 2445 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2446 | 2446 | |
2447 | - $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2447 | + $template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2448 | 2448 | |
2449 | - if ( defined('DOING_AJAX' ) ) |
|
2450 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2449 | + if (defined('DOING_AJAX')) |
|
2450 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2451 | 2451 | |
2452 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2452 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2453 | 2453 | |
2454 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2454 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2455 | 2455 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2456 | 2456 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2457 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2457 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2458 | 2458 | |
2459 | 2459 | |
2460 | 2460 | // the final template wrapper |
@@ -2472,7 +2472,7 @@ discard block |
||
2472 | 2472 | * @return void |
2473 | 2473 | * @throws \EE_Error |
2474 | 2474 | */ |
2475 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2475 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2476 | 2476 | //let's generate a default preview action button if there isn't one already present. |
2477 | 2477 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2478 | 2478 | $buy_now_url = add_query_arg( |
@@ -2485,7 +2485,7 @@ discard block |
||
2485 | 2485 | ), |
2486 | 2486 | 'http://eventespresso.com/pricing/' |
2487 | 2487 | ); |
2488 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) |
|
2488 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) |
|
2489 | 2489 | ? $this->get_action_link_or_button( |
2490 | 2490 | '', |
2491 | 2491 | 'buy_now', |
@@ -2495,13 +2495,13 @@ discard block |
||
2495 | 2495 | true |
2496 | 2496 | ) |
2497 | 2497 | : $this->_template_args['preview_action_button']; |
2498 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2498 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2499 | 2499 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2500 | 2500 | $template_path, |
2501 | 2501 | $this->_template_args, |
2502 | 2502 | true |
2503 | 2503 | ); |
2504 | - $this->_display_admin_page( $display_sidebar ); |
|
2504 | + $this->_display_admin_page($display_sidebar); |
|
2505 | 2505 | } |
2506 | 2506 | |
2507 | 2507 | |
@@ -2535,49 +2535,49 @@ discard block |
||
2535 | 2535 | * @param boolean $sidebar whether to display with sidebar or not. |
2536 | 2536 | * @return void |
2537 | 2537 | */ |
2538 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2538 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2539 | 2539 | //setup search attributes |
2540 | 2540 | $this->_set_search_attributes(); |
2541 | 2541 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2542 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2542 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2543 | 2543 | |
2544 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') |
|
2545 | - ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) |
|
2546 | - : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2544 | + $this->_template_args['table_url'] = defined('DOING_AJAX') |
|
2545 | + ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) |
|
2546 | + : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2547 | 2547 | $this->_template_args['list_table'] = $this->_list_table_object; |
2548 | 2548 | $this->_template_args['current_route'] = $this->_req_action; |
2549 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2549 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2550 | 2550 | |
2551 | 2551 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2552 | - if( ! empty( $ajax_sorting_callback )) { |
|
2552 | + if ( ! empty($ajax_sorting_callback)) { |
|
2553 | 2553 | $sortable_list_table_form_fields = wp_nonce_field( |
2554 | - $ajax_sorting_callback . '_nonce', |
|
2555 | - $ajax_sorting_callback . '_nonce', |
|
2554 | + $ajax_sorting_callback.'_nonce', |
|
2555 | + $ajax_sorting_callback.'_nonce', |
|
2556 | 2556 | FALSE, |
2557 | 2557 | FALSE |
2558 | 2558 | ); |
2559 | 2559 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2560 | 2560 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2561 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2562 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2561 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2562 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2563 | 2563 | } else { |
2564 | 2564 | $sortable_list_table_form_fields = ''; |
2565 | 2565 | } |
2566 | 2566 | |
2567 | 2567 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2568 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2569 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2570 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2568 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2569 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2570 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2571 | 2571 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2572 | 2572 | |
2573 | 2573 | //display message about search results? |
2574 | 2574 | $this->_template_args['before_list_table'] .= apply_filters( |
2575 | 2575 | 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', |
2576 | - ! empty( $this->_req_data['s'] ) |
|
2577 | - ? '<p class="ee-search-results">' . sprintf( |
|
2578 | - __( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ), |
|
2579 | - trim( $this->_req_data['s'], '%' ) |
|
2580 | - ) . '</p>' |
|
2576 | + ! empty($this->_req_data['s']) |
|
2577 | + ? '<p class="ee-search-results">'.sprintf( |
|
2578 | + __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), |
|
2579 | + trim($this->_req_data['s'], '%') |
|
2580 | + ).'</p>' |
|
2581 | 2581 | : '', |
2582 | 2582 | $this->page_slug, |
2583 | 2583 | $this->_req_data, |
@@ -2589,7 +2589,7 @@ discard block |
||
2589 | 2589 | true |
2590 | 2590 | ); |
2591 | 2591 | // the final template wrapper |
2592 | - if ( $sidebar ) |
|
2592 | + if ($sidebar) |
|
2593 | 2593 | $this->display_admin_page_with_sidebar(); |
2594 | 2594 | else |
2595 | 2595 | $this->display_admin_page_with_no_sidebar(); |
@@ -2612,9 +2612,9 @@ discard block |
||
2612 | 2612 | * @param array $items see above for format of array |
2613 | 2613 | * @return string html string of legend |
2614 | 2614 | */ |
2615 | - protected function _display_legend( $items ) { |
|
2616 | - $this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2617 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2615 | + protected function _display_legend($items) { |
|
2616 | + $this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2617 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2618 | 2618 | return EEH_Template::display_template($legend_template, $this->_template_args, TRUE); |
2619 | 2619 | } |
2620 | 2620 | |
@@ -2639,33 +2639,33 @@ discard block |
||
2639 | 2639 | * |
2640 | 2640 | * @return void |
2641 | 2641 | */ |
2642 | - protected function _return_json( $sticky_notices = false ) { |
|
2642 | + protected function _return_json($sticky_notices = false) { |
|
2643 | 2643 | |
2644 | 2644 | //make sure any EE_Error notices have been handled. |
2645 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2645 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2646 | 2646 | |
2647 | 2647 | |
2648 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2648 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2649 | 2649 | unset($this->_template_args['data']); |
2650 | 2650 | $json = array( |
2651 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false, |
|
2652 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false, |
|
2653 | - 'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false, |
|
2654 | - 'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false, |
|
2651 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false, |
|
2652 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false, |
|
2653 | + 'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false, |
|
2654 | + 'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false, |
|
2655 | 2655 | 'notices' => EE_Error::get_notices(), |
2656 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2657 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2656 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2657 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2658 | 2658 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2659 | 2659 | ); |
2660 | 2660 | |
2661 | 2661 | |
2662 | 2662 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2663 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2663 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2664 | 2664 | header('Content-Type: application/json; charset=UTF-8'); |
2665 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2666 | - echo wp_json_encode( $json ); |
|
2665 | + if (function_exists('wp_json_encode')) { |
|
2666 | + echo wp_json_encode($json); |
|
2667 | 2667 | } else { |
2668 | - echo json_encode( $json ); |
|
2668 | + echo json_encode($json); |
|
2669 | 2669 | } |
2670 | 2670 | exit(); |
2671 | 2671 | } |
@@ -2679,11 +2679,11 @@ discard block |
||
2679 | 2679 | * @throws EE_Error |
2680 | 2680 | */ |
2681 | 2681 | public function return_json() { |
2682 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2682 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2683 | 2683 | $this->_return_json(); |
2684 | 2684 | |
2685 | 2685 | else { |
2686 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2686 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2687 | 2687 | } |
2688 | 2688 | } |
2689 | 2689 | |
@@ -2696,7 +2696,7 @@ discard block |
||
2696 | 2696 | * |
2697 | 2697 | * @access public |
2698 | 2698 | */ |
2699 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2699 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2700 | 2700 | $this->_hook_obj = $hook_obj; |
2701 | 2701 | } |
2702 | 2702 | |
@@ -2712,33 +2712,33 @@ discard block |
||
2712 | 2712 | */ |
2713 | 2713 | public function admin_page_wrapper($about = FALSE) { |
2714 | 2714 | |
2715 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2715 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2716 | 2716 | |
2717 | 2717 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2718 | 2718 | |
2719 | 2719 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2720 | 2720 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2721 | 2721 | |
2722 | - $this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2723 | - $this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2722 | + $this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2723 | + $this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2724 | 2724 | |
2725 | 2725 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2726 | 2726 | |
2727 | 2727 | |
2728 | 2728 | |
2729 | 2729 | // load settings page wrapper template |
2730 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2730 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2731 | 2731 | |
2732 | 2732 | //about page? |
2733 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2733 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2734 | 2734 | |
2735 | 2735 | |
2736 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2737 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2736 | + if (defined('DOING_AJAX')) { |
|
2737 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2738 | 2738 | |
2739 | 2739 | $this->_return_json(); |
2740 | 2740 | } else { |
2741 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2741 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2742 | 2742 | } |
2743 | 2743 | |
2744 | 2744 | } |
@@ -2764,7 +2764,7 @@ discard block |
||
2764 | 2764 | * @param $b |
2765 | 2765 | * @return int |
2766 | 2766 | */ |
2767 | - private function _sort_nav_tabs( $a, $b ) { |
|
2767 | + private function _sort_nav_tabs($a, $b) { |
|
2768 | 2768 | if ($a['order'] == $b['order']) { |
2769 | 2769 | return 0; |
2770 | 2770 | } |
@@ -2784,7 +2784,7 @@ discard block |
||
2784 | 2784 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2785 | 2785 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2786 | 2786 | */ |
2787 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2787 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2788 | 2788 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2789 | 2789 | return $content; |
2790 | 2790 | } |
@@ -2806,25 +2806,25 @@ discard block |
||
2806 | 2806 | * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button). We can also use this to just dump default actions by submitting some other value. |
2807 | 2807 | * @param bool|string|null $referrer if false then we just do the default action on save and close. Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling). |
2808 | 2808 | */ |
2809 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2809 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2810 | 2810 | //make sure $text and $actions are in an array |
2811 | 2811 | $text = (array) $text; |
2812 | 2812 | $actions = (array) $actions; |
2813 | 2813 | $referrer_url = empty($referrer) ? '' : $referrer; |
2814 | - $referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />'; |
|
2814 | + $referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />'; |
|
2815 | 2815 | |
2816 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2817 | - $default_names = array( 'save', 'save_and_close' ); |
|
2816 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2817 | + $default_names = array('save', 'save_and_close'); |
|
2818 | 2818 | |
2819 | 2819 | //add in a hidden index for the current page (so save and close redirects properly) |
2820 | 2820 | $this->_template_args['save_buttons'] = $referrer_url; |
2821 | 2821 | |
2822 | - foreach ( $button_text as $key => $button ) { |
|
2822 | + foreach ($button_text as $key => $button) { |
|
2823 | 2823 | $ref = $default_names[$key]; |
2824 | - $id = $this->_current_view . '_' . $ref; |
|
2825 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2826 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2827 | - if ( !$both ) break; |
|
2824 | + $id = $this->_current_view.'_'.$ref; |
|
2825 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2826 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2827 | + if ( ! $both) break; |
|
2828 | 2828 | } |
2829 | 2829 | |
2830 | 2830 | } |
@@ -2839,8 +2839,8 @@ discard block |
||
2839 | 2839 | * @param string $route |
2840 | 2840 | * @param array $additional_hidden_fields |
2841 | 2841 | */ |
2842 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2843 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2842 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2843 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2844 | 2844 | } |
2845 | 2845 | |
2846 | 2846 | |
@@ -2853,30 +2853,30 @@ discard block |
||
2853 | 2853 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2854 | 2854 | * @return void |
2855 | 2855 | */ |
2856 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2856 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2857 | 2857 | |
2858 | - if ( empty( $route )) { |
|
2858 | + if (empty($route)) { |
|
2859 | 2859 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2860 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2861 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2860 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2861 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2862 | 2862 | } |
2863 | 2863 | // open form |
2864 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2864 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2865 | 2865 | // add nonce |
2866 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2866 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2867 | 2867 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2868 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2868 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2869 | 2869 | // add REQUIRED form action |
2870 | 2870 | $hidden_fields = array( |
2871 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2871 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2872 | 2872 | ); |
2873 | 2873 | // merge arrays |
2874 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2874 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2875 | 2875 | // generate form fields |
2876 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2876 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2877 | 2877 | // add fields to form |
2878 | - foreach ( (array)$form_fields as $field_name => $form_field ) { |
|
2879 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2878 | + foreach ((array) $form_fields as $field_name => $form_field) { |
|
2879 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2880 | 2880 | } |
2881 | 2881 | |
2882 | 2882 | // close form |
@@ -2893,8 +2893,8 @@ discard block |
||
2893 | 2893 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2894 | 2894 | * @since 4.5.0 |
2895 | 2895 | */ |
2896 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2897 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2896 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2897 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2898 | 2898 | } |
2899 | 2899 | |
2900 | 2900 | |
@@ -2910,38 +2910,38 @@ discard block |
||
2910 | 2910 | * @access protected |
2911 | 2911 | * @return void |
2912 | 2912 | */ |
2913 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2913 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2914 | 2914 | |
2915 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2915 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2916 | 2916 | |
2917 | 2917 | //class name for actions/filters. |
2918 | 2918 | $classname = get_class($this); |
2919 | 2919 | |
2920 | 2920 | //set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url |
2921 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2922 | - $notices = EE_Error::get_notices( FALSE ); |
|
2921 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2922 | + $notices = EE_Error::get_notices(FALSE); |
|
2923 | 2923 | |
2924 | 2924 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2925 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2925 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2926 | 2926 | EE_Error::overwrite_success(); |
2927 | 2927 | } |
2928 | - if ( ! empty( $what ) && ! empty( $action_desc ) ) { |
|
2928 | + if ( ! empty($what) && ! empty($action_desc)) { |
|
2929 | 2929 | // how many records affected ? more than one record ? or just one ? |
2930 | - if ( $success > 1 && empty( $notices[ 'errors' ] ) ) { |
|
2930 | + if ($success > 1 && empty($notices['errors'])) { |
|
2931 | 2931 | // set plural msg |
2932 | 2932 | EE_Error::add_success( |
2933 | 2933 | sprintf( |
2934 | - __( 'The "%s" have been successfully %s.', 'event_espresso' ), |
|
2934 | + __('The "%s" have been successfully %s.', 'event_espresso'), |
|
2935 | 2935 | $what, |
2936 | 2936 | $action_desc |
2937 | 2937 | ), |
2938 | 2938 | __FILE__, __FUNCTION__, __LINE__ |
2939 | 2939 | ); |
2940 | - } else if ( $success == 1 && empty( $notices[ 'errors' ] ) ) { |
|
2940 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2941 | 2941 | // set singular msg |
2942 | 2942 | EE_Error::add_success( |
2943 | 2943 | sprintf( |
2944 | - __( 'The "%s" has been successfully %s.', 'event_espresso' ), |
|
2944 | + __('The "%s" has been successfully %s.', 'event_espresso'), |
|
2945 | 2945 | $what, |
2946 | 2946 | $action_desc |
2947 | 2947 | ), |
@@ -2950,7 +2950,7 @@ discard block |
||
2950 | 2950 | } |
2951 | 2951 | } |
2952 | 2952 | // check that $query_args isn't something crazy |
2953 | - if ( ! is_array( $query_args )) { |
|
2953 | + if ( ! is_array($query_args)) { |
|
2954 | 2954 | $query_args = array(); |
2955 | 2955 | } |
2956 | 2956 | |
@@ -2963,36 +2963,36 @@ discard block |
||
2963 | 2963 | * @param array $query_args The original query_args array coming into the |
2964 | 2964 | * method. |
2965 | 2965 | */ |
2966 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2966 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2967 | 2967 | |
2968 | 2968 | //calculate where we're going (if we have a "save and close" button pushed) |
2969 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2969 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2970 | 2970 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2971 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2971 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2972 | 2972 | // regenerate query args array from referrer URL |
2973 | - parse_str( $parsed_url['query'], $query_args ); |
|
2973 | + parse_str($parsed_url['query'], $query_args); |
|
2974 | 2974 | // correct page and action will be in the query args now |
2975 | - $redirect_url = admin_url( 'admin.php' ); |
|
2975 | + $redirect_url = admin_url('admin.php'); |
|
2976 | 2976 | } |
2977 | 2977 | |
2978 | 2978 | //merge any default query_args set in _default_route_query_args property |
2979 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2979 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2980 | 2980 | $args_to_merge = array(); |
2981 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2981 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2982 | 2982 | //is there a wp_referer array in our _default_route_query_args property? |
2983 | - if ( $query_param == 'wp_referer' ) { |
|
2983 | + if ($query_param == 'wp_referer') { |
|
2984 | 2984 | $query_value = (array) $query_value; |
2985 | - foreach ( $query_value as $reference => $value ) { |
|
2986 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2985 | + foreach ($query_value as $reference => $value) { |
|
2986 | + if (strpos($reference, 'nonce') !== false) { |
|
2987 | 2987 | continue; |
2988 | 2988 | } |
2989 | 2989 | |
2990 | 2990 | //finally we will override any arguments in the referer with |
2991 | 2991 | //what might be set on the _default_route_query_args array. |
2992 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
2993 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
2992 | + if (isset($this->_default_route_query_args[$reference])) { |
|
2993 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
2994 | 2994 | } else { |
2995 | - $args_to_merge[$reference] = urlencode( $value ); |
|
2995 | + $args_to_merge[$reference] = urlencode($value); |
|
2996 | 2996 | } |
2997 | 2997 | } |
2998 | 2998 | continue; |
@@ -3003,7 +3003,7 @@ discard block |
||
3003 | 3003 | |
3004 | 3004 | //now let's merge these arguments but override with what was specifically sent in to the |
3005 | 3005 | //redirect. |
3006 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
3006 | + $query_args = array_merge($args_to_merge, $query_args); |
|
3007 | 3007 | } |
3008 | 3008 | |
3009 | 3009 | $this->_process_notices($query_args); |
@@ -3012,19 +3012,19 @@ discard block |
||
3012 | 3012 | // generate redirect url |
3013 | 3013 | |
3014 | 3014 | // if redirecting to anything other than the main page, add a nonce |
3015 | - if ( isset( $query_args['action'] )) { |
|
3015 | + if (isset($query_args['action'])) { |
|
3016 | 3016 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
3017 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
3017 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
3018 | 3018 | } |
3019 | 3019 | |
3020 | 3020 | //we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that). |
3021 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
3021 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
3022 | 3022 | |
3023 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
3023 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
3024 | 3024 | |
3025 | 3025 | |
3026 | 3026 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
3027 | - if ( defined('DOING_AJAX' ) ) { |
|
3027 | + if (defined('DOING_AJAX')) { |
|
3028 | 3028 | $default_data = array( |
3029 | 3029 | 'close' => TRUE, |
3030 | 3030 | 'redirect_url' => $redirect_url, |
@@ -3033,11 +3033,11 @@ discard block |
||
3033 | 3033 | ); |
3034 | 3034 | |
3035 | 3035 | $this->_template_args['success'] = $success; |
3036 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
3036 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
3037 | 3037 | $this->_return_json(); |
3038 | 3038 | } |
3039 | 3039 | |
3040 | - wp_safe_redirect( $redirect_url ); |
|
3040 | + wp_safe_redirect($redirect_url); |
|
3041 | 3041 | exit(); |
3042 | 3042 | } |
3043 | 3043 | |
@@ -3053,30 +3053,30 @@ discard block |
||
3053 | 3053 | * @param bool $sticky_notices This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice. |
3054 | 3054 | * @return void |
3055 | 3055 | */ |
3056 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
3056 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
3057 | 3057 | |
3058 | 3058 | //first let's set individual error properties if doing_ajax and the properties aren't already set. |
3059 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
3060 | - $notices = EE_Error::get_notices( false ); |
|
3061 | - if ( empty( $this->_template_args['success'] ) ) { |
|
3062 | - $this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false; |
|
3059 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
3060 | + $notices = EE_Error::get_notices(false); |
|
3061 | + if (empty($this->_template_args['success'])) { |
|
3062 | + $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false; |
|
3063 | 3063 | } |
3064 | 3064 | |
3065 | - if ( empty( $this->_template_args['errors'] ) ) { |
|
3066 | - $this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false; |
|
3065 | + if (empty($this->_template_args['errors'])) { |
|
3066 | + $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false; |
|
3067 | 3067 | } |
3068 | 3068 | |
3069 | - if ( empty( $this->_template_args['attention'] ) ) { |
|
3070 | - $this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false; |
|
3069 | + if (empty($this->_template_args['attention'])) { |
|
3070 | + $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false; |
|
3071 | 3071 | } |
3072 | 3072 | } |
3073 | 3073 | |
3074 | 3074 | $this->_template_args['notices'] = EE_Error::get_notices(); |
3075 | 3075 | |
3076 | 3076 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
3077 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
3078 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
3079 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
3077 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
3078 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
3079 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
3080 | 3080 | } |
3081 | 3081 | } |
3082 | 3082 | |
@@ -3106,7 +3106,7 @@ discard block |
||
3106 | 3106 | $exclude_nonce = false |
3107 | 3107 | ) { |
3108 | 3108 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
3109 | - if ( empty( $base_url ) && ! isset( $this->_page_routes[ $action ] ) ) { |
|
3109 | + if (empty($base_url) && ! isset($this->_page_routes[$action])) { |
|
3110 | 3110 | throw new EE_Error( |
3111 | 3111 | sprintf( |
3112 | 3112 | __( |
@@ -3117,7 +3117,7 @@ discard block |
||
3117 | 3117 | ) |
3118 | 3118 | ); |
3119 | 3119 | } |
3120 | - if ( ! isset( $this->_labels['buttons'][ $type ] ) ) { |
|
3120 | + if ( ! isset($this->_labels['buttons'][$type])) { |
|
3121 | 3121 | throw new EE_Error( |
3122 | 3122 | sprintf( |
3123 | 3123 | __( |
@@ -3129,8 +3129,8 @@ discard block |
||
3129 | 3129 | ); |
3130 | 3130 | } |
3131 | 3131 | //finally check user access for this button. |
3132 | - $has_access = $this->check_user_access( $action, true ); |
|
3133 | - if ( ! $has_access ) { |
|
3132 | + $has_access = $this->check_user_access($action, true); |
|
3133 | + if ( ! $has_access) { |
|
3134 | 3134 | return ''; |
3135 | 3135 | } |
3136 | 3136 | $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
@@ -3138,11 +3138,11 @@ discard block |
||
3138 | 3138 | 'action' => $action |
3139 | 3139 | ); |
3140 | 3140 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3141 | - if ( ! empty( $extra_request ) ) { |
|
3142 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3141 | + if ( ! empty($extra_request)) { |
|
3142 | + $query_args = array_merge($extra_request, $query_args); |
|
3143 | 3143 | } |
3144 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3145 | - return EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][ $type ], $class ); |
|
3144 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3145 | + return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3146 | 3146 | } |
3147 | 3147 | |
3148 | 3148 | |
@@ -3157,11 +3157,11 @@ discard block |
||
3157 | 3157 | $args = array( |
3158 | 3158 | 'label' => $this->_admin_page_title, |
3159 | 3159 | 'default' => 10, |
3160 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3160 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3161 | 3161 | ); |
3162 | 3162 | //ONLY add the screen option if the user has access to it. |
3163 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3164 | - add_screen_option( $option, $args ); |
|
3163 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3164 | + add_screen_option($option, $args); |
|
3165 | 3165 | } |
3166 | 3166 | } |
3167 | 3167 | |
@@ -3177,36 +3177,36 @@ discard block |
||
3177 | 3177 | * @return void |
3178 | 3178 | */ |
3179 | 3179 | private function _set_per_page_screen_options() { |
3180 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3181 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3180 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3181 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3182 | 3182 | |
3183 | - if ( !$user = wp_get_current_user() ) |
|
3183 | + if ( ! $user = wp_get_current_user()) |
|
3184 | 3184 | return; |
3185 | 3185 | $option = $_POST['wp_screen_options']['option']; |
3186 | 3186 | $value = $_POST['wp_screen_options']['value']; |
3187 | 3187 | |
3188 | - if ( $option != sanitize_key( $option ) ) |
|
3188 | + if ($option != sanitize_key($option)) |
|
3189 | 3189 | return; |
3190 | 3190 | |
3191 | 3191 | $map_option = $option; |
3192 | 3192 | |
3193 | 3193 | $option = str_replace('-', '_', $option); |
3194 | 3194 | |
3195 | - switch ( $map_option ) { |
|
3196 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3195 | + switch ($map_option) { |
|
3196 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3197 | 3197 | $value = (int) $value; |
3198 | - if ( $value < 1 || $value > 999 ) |
|
3198 | + if ($value < 1 || $value > 999) |
|
3199 | 3199 | return; |
3200 | 3200 | break; |
3201 | 3201 | default: |
3202 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3203 | - if ( false === $value ) |
|
3202 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3203 | + if (false === $value) |
|
3204 | 3204 | return; |
3205 | 3205 | break; |
3206 | 3206 | } |
3207 | 3207 | |
3208 | 3208 | update_user_meta($user->ID, $option, $value); |
3209 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3209 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3210 | 3210 | exit; |
3211 | 3211 | } |
3212 | 3212 | } |
@@ -3217,8 +3217,8 @@ discard block |
||
3217 | 3217 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3218 | 3218 | * @param array $data array that will be assigned to template args. |
3219 | 3219 | */ |
3220 | - public function set_template_args( $data ) { |
|
3221 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3220 | + public function set_template_args($data) { |
|
3221 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3222 | 3222 | } |
3223 | 3223 | |
3224 | 3224 | |
@@ -3234,26 +3234,26 @@ discard block |
||
3234 | 3234 | * @param bool $skip_route_verify Used to indicate we want to skip route verification. This is usually ONLY used when we are adding a transient before page_routes have been defined. |
3235 | 3235 | * @return void |
3236 | 3236 | */ |
3237 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3237 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3238 | 3238 | $user_id = get_current_user_id(); |
3239 | 3239 | |
3240 | - if ( !$skip_route_verify ) |
|
3240 | + if ( ! $skip_route_verify) |
|
3241 | 3241 | $this->_verify_route($route); |
3242 | 3242 | |
3243 | 3243 | |
3244 | 3244 | //now let's set the string for what kind of transient we're setting |
3245 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3246 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3245 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3246 | + $data = $notices ? array('notices' => $data) : $data; |
|
3247 | 3247 | //is there already a transient for this route? If there is then let's ADD to that transient |
3248 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3249 | - if ( $existing ) { |
|
3250 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3248 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3249 | + if ($existing) { |
|
3250 | + $data = array_merge((array) $data, (array) $existing); |
|
3251 | 3251 | } |
3252 | 3252 | |
3253 | - if ( is_multisite() && is_network_admin() ) { |
|
3254 | - set_site_transient( $transient, $data, 8 ); |
|
3253 | + if (is_multisite() && is_network_admin()) { |
|
3254 | + set_site_transient($transient, $data, 8); |
|
3255 | 3255 | } else { |
3256 | - set_transient( $transient, $data, 8 ); |
|
3256 | + set_transient($transient, $data, 8); |
|
3257 | 3257 | } |
3258 | 3258 | } |
3259 | 3259 | |
@@ -3265,18 +3265,18 @@ discard block |
||
3265 | 3265 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3266 | 3266 | * @return mixed data |
3267 | 3267 | */ |
3268 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3268 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3269 | 3269 | $user_id = get_current_user_id(); |
3270 | - $route = !$route ? $this->_req_action : $route; |
|
3271 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3272 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3270 | + $route = ! $route ? $this->_req_action : $route; |
|
3271 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3272 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3273 | 3273 | //delete transient after retrieval (just in case it hasn't expired); |
3274 | - if ( is_multisite() && is_network_admin() ) { |
|
3275 | - delete_site_transient( $transient ); |
|
3274 | + if (is_multisite() && is_network_admin()) { |
|
3275 | + delete_site_transient($transient); |
|
3276 | 3276 | } else { |
3277 | - delete_transient( $transient ); |
|
3277 | + delete_transient($transient); |
|
3278 | 3278 | } |
3279 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3279 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3280 | 3280 | } |
3281 | 3281 | |
3282 | 3282 | |
@@ -3293,12 +3293,12 @@ discard block |
||
3293 | 3293 | |
3294 | 3294 | //retrieve all existing transients |
3295 | 3295 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3296 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3297 | - foreach ( $results as $result ) { |
|
3298 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3299 | - get_transient( $transient ); |
|
3300 | - if ( is_multisite() && is_network_admin() ) { |
|
3301 | - get_site_transient( $transient ); |
|
3296 | + if ($results = $wpdb->get_results($query)) { |
|
3297 | + foreach ($results as $result) { |
|
3298 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3299 | + get_transient($transient); |
|
3300 | + if (is_multisite() && is_network_admin()) { |
|
3301 | + get_site_transient($transient); |
|
3302 | 3302 | } |
3303 | 3303 | } |
3304 | 3304 | } |
@@ -3448,23 +3448,23 @@ discard block |
||
3448 | 3448 | * @param string $line line no where error occurred |
3449 | 3449 | * @return boolean |
3450 | 3450 | */ |
3451 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3451 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3452 | 3452 | |
3453 | 3453 | //remove any options that are NOT going to be saved with the config settings. |
3454 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3454 | + if (isset($config->core->ee_ueip_optin)) { |
|
3455 | 3455 | $config->core->ee_ueip_has_notified = TRUE; |
3456 | 3456 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3457 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3458 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3457 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3458 | + update_option('ee_ueip_has_notified', TRUE); |
|
3459 | 3459 | } |
3460 | 3460 | // and save it (note we're also doing the network save here) |
3461 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3462 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3463 | - if ( $config_saved && $net_saved ) { |
|
3464 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3461 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3462 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3463 | + if ($config_saved && $net_saved) { |
|
3464 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3465 | 3465 | return TRUE; |
3466 | 3466 | } else { |
3467 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3467 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3468 | 3468 | return FALSE; |
3469 | 3469 | } |
3470 | 3470 | } |
@@ -3477,7 +3477,7 @@ discard block |
||
3477 | 3477 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3478 | 3478 | * @return array |
3479 | 3479 | */ |
3480 | - public function get_yes_no_values(){ |
|
3480 | + public function get_yes_no_values() { |
|
3481 | 3481 | return $this->_yes_no_values; |
3482 | 3482 | } |
3483 | 3483 | |
@@ -3499,8 +3499,8 @@ discard block |
||
3499 | 3499 | * |
3500 | 3500 | * @return string |
3501 | 3501 | */ |
3502 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3503 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3502 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3503 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3504 | 3504 | } |
3505 | 3505 | |
3506 | 3506 | |
@@ -3514,8 +3514,8 @@ discard block |
||
3514 | 3514 | * |
3515 | 3515 | * @return string |
3516 | 3516 | */ |
3517 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3518 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3517 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3518 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3519 | 3519 | } |
3520 | 3520 | |
3521 | 3521 | |
@@ -3534,8 +3534,8 @@ discard block |
||
3534 | 3534 | * @return bool success/fail |
3535 | 3535 | */ |
3536 | 3536 | protected function _process_resend_registration() { |
3537 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3538 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3537 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3538 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3539 | 3539 | return $this->_template_args['success']; |
3540 | 3540 | } |
3541 | 3541 | |
@@ -3548,11 +3548,11 @@ discard block |
||
3548 | 3548 | * @param \EE_Payment $payment |
3549 | 3549 | * @return bool success/fail |
3550 | 3550 | */ |
3551 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3552 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3553 | - do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment ); |
|
3554 | - $this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment ); |
|
3555 | - return $this->_template_args[ 'success' ]; |
|
3551 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3552 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3553 | + do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment); |
|
3554 | + $this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment); |
|
3555 | + return $this->_template_args['success']; |
|
3556 | 3556 | } |
3557 | 3557 | |
3558 | 3558 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base{ |
|
9 | +class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base { |
|
10 | 10 | protected $_individual_item_normalization_strategy = array(); |
11 | 11 | /** |
12 | 12 | * |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | * @return array |
24 | 24 | */ |
25 | 25 | public function normalize($value_to_normalize) { |
26 | - if ( is_array( $value_to_normalize )){ |
|
26 | + if (is_array($value_to_normalize)) { |
|
27 | 27 | $items_to_normalize = $value_to_normalize; |
28 | - } else if( $value_to_normalize !== NULL ){ |
|
29 | - $items_to_normalize = array( $value_to_normalize ); |
|
28 | + } else if ($value_to_normalize !== NULL) { |
|
29 | + $items_to_normalize = array($value_to_normalize); |
|
30 | 30 | } else { |
31 | 31 | $items_to_normalize = array(); |
32 | 32 | } |
33 | 33 | $normalized_array_value = array(); |
34 | - foreach( $items_to_normalize as $key => $individual_item ){ |
|
35 | - $normalized_array_value[ $key ] = $this->normalize_one( $individual_item ); |
|
34 | + foreach ($items_to_normalize as $key => $individual_item) { |
|
35 | + $normalized_array_value[$key] = $this->normalize_one($individual_item); |
|
36 | 36 | } |
37 | 37 | return $normalized_array_value; |
38 | 38 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $individual_value_to_normalize but definitely NOT an array |
43 | 43 | * @return mixed |
44 | 44 | */ |
45 | - public function normalize_one( $individual_value_to_normalize ) { |
|
46 | - return $this->_individual_item_normalization_strategy->normalize( $individual_value_to_normalize ); |
|
45 | + public function normalize_one($individual_value_to_normalize) { |
|
46 | + return $this->_individual_item_normalization_strategy->normalize($individual_value_to_normalize); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -51,16 +51,16 @@ discard block |
||
51 | 51 | * @param array $normalized_values |
52 | 52 | * @return string[] |
53 | 53 | */ |
54 | - public function unnormalize( $normalized_values ) { |
|
55 | - if( $normalized_values === null ) { |
|
54 | + public function unnormalize($normalized_values) { |
|
55 | + if ($normalized_values === null) { |
|
56 | 56 | $normalized_values = array(); |
57 | 57 | } |
58 | - if( ! is_array( $normalized_values ) ){ |
|
59 | - $normalized_values = array( $normalized_values ); |
|
58 | + if ( ! is_array($normalized_values)) { |
|
59 | + $normalized_values = array($normalized_values); |
|
60 | 60 | } |
61 | 61 | $non_normal_values = array(); |
62 | - foreach( $normalized_values as $key => $value ) { |
|
63 | - $non_normal_values[ $key ] = $this->unnormalize_one( $value ); |
|
62 | + foreach ($normalized_values as $key => $value) { |
|
63 | + $non_normal_values[$key] = $this->unnormalize_one($value); |
|
64 | 64 | } |
65 | 65 | return $non_normal_values; |
66 | 66 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * @param mixed $individual_value_to_unnormalize but certainly NOT an array |
71 | 71 | * @return string |
72 | 72 | */ |
73 | - public function unnormalize_one( $individual_value_to_unnormalize ) { |
|
74 | - return $this->_individual_item_normalization_strategy->unnormalize( $individual_value_to_unnormalize ); |
|
73 | + public function unnormalize_one($individual_value_to_unnormalize) { |
|
74 | + return $this->_individual_item_normalization_strategy->unnormalize($individual_value_to_unnormalize); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | //(all other times it gets resurrected from a wordpress option) |
14 | 14 | $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | -foreach($stages as $filepath){ |
|
16 | +foreach ($stages as $filepath) { |
|
17 | 17 | $matches = array(); |
18 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
18 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | 19 | $class_to_filepath[$matches[1]] = $filepath; |
20 | 20 | } |
21 | 21 | //give addons a chance to autoload their stages too |
22 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath); |
|
22 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
|
23 | 23 | EEH_Autoloader::register_autoloader($class_to_filepath); |
24 | 24 | |
25 | 25 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @since 4.6.0 |
36 | 36 | * |
37 | 37 | */ |
38 | -class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{ |
|
38 | +class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base { |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * return EE_DMS_Core_4_8_0 |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function can_migrate_from_version($version_array) { |
64 | 64 | $version_string = $version_array['Core']; |
65 | - if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){ |
|
65 | + if ($version_string <= '4.8.0' && $version_string >= '4.7.0') { |
|
66 | 66 | // echo "$version_string can be migrated from"; |
67 | 67 | return true; |
68 | - }elseif( ! $version_string ){ |
|
68 | + }elseif ( ! $version_string) { |
|
69 | 69 | // echo "no version string provided: $version_string"; |
70 | 70 | //no version string provided... this must be pre 4.3 |
71 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | - }else{ |
|
71 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + } else { |
|
73 | 73 | // echo "$version_string doesnt apply"; |
74 | 74 | return false; |
75 | 75 | } |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | * @return bool |
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
94 | - $now_in_mysql = current_time( 'mysql', true ); |
|
93 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
94 | + $now_in_mysql = current_time('mysql', true); |
|
95 | 95 | |
96 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
97 | - $table_name='esp_answer'; |
|
98 | - $sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
96 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
97 | + $table_name = 'esp_answer'; |
|
98 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
99 | 99 | REG_ID int(10) unsigned NOT NULL, |
100 | 100 | QST_ID int(10) unsigned NOT NULL, |
101 | 101 | ANS_value text NOT NULL, |
102 | 102 | PRIMARY KEY (ANS_ID), |
103 | 103 | KEY REG_ID (REG_ID), |
104 | 104 | KEY QST_ID (QST_ID)"; |
105 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
105 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
106 | 106 | |
107 | 107 | $table_name = 'esp_attendee_meta'; |
108 | 108 | $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | CNT_is_EU tinyint(1) DEFAULT '0', |
143 | 143 | CNT_active tinyint(1) DEFAULT '0', |
144 | 144 | PRIMARY KEY (CNT_ISO)"; |
145 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
145 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
146 | 146 | |
147 | 147 | $table_name = 'esp_currency'; |
148 | 148 | $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
153 | 153 | CUR_active tinyint(1) DEFAULT '0', |
154 | 154 | PRIMARY KEY (CUR_code)"; |
155 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
155 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
156 | 156 | |
157 | 157 | |
158 | 158 | $table_name = 'esp_currency_payment_method'; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | KEY EVT_ID (EVT_ID), |
183 | 183 | KEY DTT_is_primary (DTT_is_primary)"; |
184 | 184 | |
185 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
185 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
186 | 186 | |
187 | 187 | $table_name = 'esp_event_meta'; |
188 | 188 | $sql = " |
@@ -201,41 +201,41 @@ discard block |
||
201 | 201 | EVT_donations tinyint(1) NULL, |
202 | 202 | PRIMARY KEY (EVTM_ID), |
203 | 203 | KEY EVT_ID (EVT_ID)"; |
204 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
204 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
205 | 205 | |
206 | 206 | |
207 | 207 | |
208 | - $table_name='esp_event_question_group'; |
|
209 | - $sql="EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
208 | + $table_name = 'esp_event_question_group'; |
|
209 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
210 | 210 | EVT_ID bigint(20) unsigned NOT NULL, |
211 | 211 | QSG_ID int(10) unsigned NOT NULL, |
212 | 212 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
213 | 213 | PRIMARY KEY (EQG_ID), |
214 | 214 | KEY EVT_ID (EVT_ID), |
215 | 215 | KEY QSG_ID (QSG_ID)"; |
216 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
216 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
217 | 217 | |
218 | 218 | |
219 | 219 | |
220 | - $table_name='esp_event_venue'; |
|
221 | - $sql="EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
220 | + $table_name = 'esp_event_venue'; |
|
221 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
222 | 222 | EVT_ID bigint(20) unsigned NOT NULL, |
223 | 223 | VNU_ID bigint(20) unsigned NOT NULL, |
224 | 224 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
225 | 225 | PRIMARY KEY (EVV_ID)"; |
226 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
226 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | 227 | |
228 | 228 | |
229 | 229 | |
230 | - $table_name='esp_extra_meta'; |
|
231 | - $sql="EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
230 | + $table_name = 'esp_extra_meta'; |
|
231 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
232 | 232 | OBJ_ID int(11) DEFAULT NULL, |
233 | 233 | EXM_type varchar(45) DEFAULT NULL, |
234 | 234 | EXM_key varchar(45) DEFAULT NULL, |
235 | 235 | EXM_value text, |
236 | 236 | PRIMARY KEY (EXM_ID), |
237 | 237 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
238 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
238 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
239 | 239 | |
240 | 240 | $table_name = 'esp_extra_join'; |
241 | 241 | $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
249 | 249 | $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
250 | 250 | |
251 | - $table_name='esp_line_item'; |
|
252 | - $sql="LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
251 | + $table_name = 'esp_line_item'; |
|
252 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
253 | 253 | LIN_code varchar(245) NOT NULL DEFAULT '', |
254 | 254 | TXN_ID int(11) DEFAULT NULL, |
255 | 255 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | PRIMARY KEY (LIN_ID), |
269 | 269 | KEY LIN_code (LIN_code(191)), |
270 | 270 | KEY TXN_ID (TXN_ID)"; |
271 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
271 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
272 | 272 | |
273 | 273 | $table_name = 'esp_log'; |
274 | 274 | $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
308 | 308 | PRIMARY KEY (GRP_ID), |
309 | 309 | KEY MTP_user_id (MTP_user_id)"; |
310 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
310 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
311 | 311 | |
312 | 312 | $table_name = 'esp_event_message_template'; |
313 | 313 | $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | PRIMARY KEY (EMT_ID), |
317 | 317 | KEY EVT_ID (EVT_ID), |
318 | 318 | KEY GRP_ID (GRP_ID)"; |
319 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
319 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
320 | 320 | |
321 | 321 | |
322 | 322 | $table_name = 'esp_payment'; |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | PRIMARY KEY (TTM_ID)"; |
390 | 390 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
391 | 391 | |
392 | - $table_name='esp_question'; |
|
393 | - $sql='QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
392 | + $table_name = 'esp_question'; |
|
393 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
394 | 394 | QST_display_text text NOT NULL, |
395 | 395 | QST_admin_label varchar(255) NOT NULL, |
396 | 396 | QST_system varchar(25) NOT NULL DEFAULT "", |
@@ -404,22 +404,22 @@ discard block |
||
404 | 404 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
405 | 405 | PRIMARY KEY (QST_ID), |
406 | 406 | KEY QST_order (QST_order)'; |
407 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
407 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
408 | 408 | |
409 | - $table_name='esp_question_group_question'; |
|
410 | - $sql="QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
409 | + $table_name = 'esp_question_group_question'; |
|
410 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
411 | 411 | QSG_ID int(10) unsigned NOT NULL, |
412 | 412 | QST_ID int(10) unsigned NOT NULL, |
413 | 413 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
414 | 414 | PRIMARY KEY (QGQ_ID), |
415 | 415 | KEY QST_ID (QST_ID), |
416 | 416 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
417 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
417 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
418 | 418 | |
419 | 419 | |
420 | 420 | |
421 | - $table_name='esp_question_option'; |
|
422 | - $sql="QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
421 | + $table_name = 'esp_question_option'; |
|
422 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
423 | 423 | QSO_value varchar(255) NOT NULL, |
424 | 424 | QSO_desc text NOT NULL, |
425 | 425 | QST_ID int(10) unsigned NOT NULL, |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | PRIMARY KEY (QSO_ID), |
430 | 430 | KEY QST_ID (QST_ID), |
431 | 431 | KEY QSO_order (QSO_order)"; |
432 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
432 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | 433 | |
434 | 434 | |
435 | 435 | |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | |
476 | 476 | |
477 | 477 | |
478 | - $table_name='esp_checkin'; |
|
479 | - $sql="CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
478 | + $table_name = 'esp_checkin'; |
|
479 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
480 | 480 | REG_ID int(10) unsigned NOT NULL, |
481 | 481 | DTT_ID int(10) unsigned NOT NULL, |
482 | 482 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | PRC_parent int(10) unsigned DEFAULT 0, |
572 | 572 | PRIMARY KEY (PRC_ID), |
573 | 573 | KEY PRT_ID (PRT_ID)"; |
574 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
574 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
575 | 575 | |
576 | 576 | $table_name = "esp_price_type"; |
577 | 577 | $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
610 | 610 | PRIMARY KEY (TKT_ID), |
611 | 611 | KEY TKT_start_date (TKT_start_date)"; |
612 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
612 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
613 | 613 | |
614 | 614 | $table_name = 'esp_question_group'; |
615 | - $sql='QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
615 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
616 | 616 | QSG_name varchar(255) NOT NULL, |
617 | 617 | QSG_identifier varchar(100) NOT NULL, |
618 | 618 | QSG_desc text NULL, |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | PRIMARY KEY (QSG_ID), |
626 | 626 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
627 | 627 | KEY QSG_order (QSG_order)'; |
628 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
628 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
629 | 629 | |
630 | 630 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
631 | 631 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | return $script_4_7_defaults->schema_changes_after_migration(); |
662 | 662 | } |
663 | 663 | |
664 | - public function migration_page_hooks(){ |
|
664 | + public function migration_page_hooks() { |
|
665 | 665 | |
666 | 666 | } |
667 | 667 | |
@@ -675,19 +675,19 @@ discard block |
||
675 | 675 | //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
676 | 676 | //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
677 | 677 | $newer_countries = array( |
678 | - array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ), |
|
679 | - array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
680 | - array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ), |
|
681 | - array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ), |
|
682 | - array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
683 | - array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
684 | - array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
685 | - array( 'ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0 ), |
|
686 | - array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ), |
|
687 | - array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ), |
|
688 | - array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ), |
|
689 | - array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ), |
|
690 | - array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ), |
|
678 | + array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
679 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
680 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
681 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
682 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
683 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
684 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
685 | + array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
686 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0), |
|
687 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
688 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
689 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0), |
|
690 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
691 | 691 | ); |
692 | 692 | global $wpdb; |
693 | 693 | $country_table = $wpdb->prefix."esp_country"; |
@@ -706,14 +706,14 @@ discard block |
||
706 | 706 | "CNT_is_EU" => '%d', |
707 | 707 | "CNT_active" => '%d', |
708 | 708 | ); |
709 | - if ( EEH_Activation::table_exists( $country_table ) ) { |
|
710 | - foreach( $newer_countries as $country ) { |
|
711 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ; |
|
709 | + if (EEH_Activation::table_exists($country_table)) { |
|
710 | + foreach ($newer_countries as $country) { |
|
711 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
712 | 712 | $countries = $wpdb->get_var($SQL); |
713 | - if ( ! $countries ) { |
|
713 | + if ( ! $countries) { |
|
714 | 714 | |
715 | - $wpdb->insert( $country_table, |
|
716 | - array_combine( array_keys( $country_format), $country ), |
|
715 | + $wpdb->insert($country_table, |
|
716 | + array_combine(array_keys($country_format), $country), |
|
717 | 717 | $country_format |
718 | 718 | ); |
719 | 719 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
732 | 732 | //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
733 | 733 | $newer_currencies = array( |
734 | - array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ), |
|
734 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
735 | 735 | ); |
736 | 736 | global $wpdb; |
737 | 737 | $currency_table = $wpdb->prefix."esp_currency"; |
@@ -743,14 +743,14 @@ discard block |
||
743 | 743 | "CUR_dec_plc" => '%d', |
744 | 744 | "CUR_active" => '%d', |
745 | 745 | ); |
746 | - if ( EEH_Activation::table_exists( $currency_table ) ) { |
|
747 | - foreach( $newer_currencies as $currency ) { |
|
748 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ; |
|
746 | + if (EEH_Activation::table_exists($currency_table)) { |
|
747 | + foreach ($newer_currencies as $currency) { |
|
748 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
749 | 749 | $countries = $wpdb->get_var($SQL); |
750 | - if ( ! $countries ) { |
|
750 | + if ( ! $countries) { |
|
751 | 751 | |
752 | - $wpdb->insert( $currency_table, |
|
753 | - array_combine( array_keys( $currency_format), $currency ), |
|
752 | + $wpdb->insert($currency_table, |
|
753 | + array_combine(array_keys($currency_format), $currency), |
|
754 | 754 | $currency_format |
755 | 755 | ); |
756 | 756 | } |
@@ -762,9 +762,9 @@ discard block |
||
762 | 762 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
763 | 763 | * we should be able to stop doing this in 4.9 |
764 | 764 | */ |
765 | - public function fix_non_default_taxes(){ |
|
765 | + public function fix_non_default_taxes() { |
|
766 | 766 | global $wpdb; |
767 | - $query = $wpdb->prepare( "UPDATE |
|
767 | + $query = $wpdb->prepare("UPDATE |
|
768 | 768 | {$wpdb->prefix}esp_price p INNER JOIN |
769 | 769 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
770 | 770 | SET |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | WHERE |
773 | 773 | p.PRC_is_default = 0 AND |
774 | 774 | pt.PBT_ID = %d |
775 | - ", EEM_Price_Type::base_type_tax ); |
|
776 | - $wpdb->query( $query ); |
|
775 | + ", EEM_Price_Type::base_type_tax); |
|
776 | + $wpdb->query($query); |
|
777 | 777 | } |
778 | 778 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | |
38 | 38 | |
39 | 39 | protected function _init_props() { |
40 | - $this->label = esc_html__( 'Recipient Details Shortcodes', 'event_espresso' ); |
|
41 | - $this->description = esc_html__( 'All shortcodes specific to recipient registration data', 'event_espresso' ); |
|
40 | + $this->label = esc_html__('Recipient Details Shortcodes', 'event_espresso'); |
|
41 | + $this->description = esc_html__('All shortcodes specific to recipient registration data', 'event_espresso'); |
|
42 | 42 | $this->_shortcodes = array( |
43 | - '[RECIPIENT_FNAME]' => esc_html__( 'Parses to the first name of the recipient for the message.', 'event_espresso' ), |
|
44 | - '[RECIPIENT_LNAME]' => esc_html__( 'Parses to the last name of the recipient for the message.', 'event_espresso' ), |
|
45 | - '[RECIPIENT_EMAIL]' => esc_html__( 'Parses to the email address of the recipient for the message.', 'event_espresso' ), |
|
46 | - '[RECIPIENT_REGISTRATION_ID]' => esc_html__( 'Parses to the registration ID of the recipient for the message.', 'event_espresso' ), |
|
47 | - '[RECIPIENT_REGISTRATION_CODE]' => esc_html__( 'Parses to the registration code of the recipient for the message.', 'event_espresso' ), |
|
48 | - '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__( 'Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso' ), |
|
49 | - '[RECIPIENT_PHONE_NUMBER]' => esc_html__( 'The Phone Number for the recipient of the message.', 'event_espresso' ), |
|
50 | - '[RECIPIENT_ADDRESS]' => esc_html__( 'The Address for the recipient of the message.', 'event_espresso' ), |
|
51 | - '[RECIPIENT_ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the recipient of the message.', 'event_espresso' ), |
|
52 | - '[RECIPIENT_CITY]' => esc_html__( 'The city for the recipient of the message.', 'event_espresso' ), |
|
53 | - '[RECIPIENT_ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso' ), |
|
54 | - '[RECIPIENT_ADDRESS_STATE]' => esc_html__( 'The state/province for the recipient of the message.', 'event_espresso' ), |
|
55 | - '[RECIPIENT_COUNTRY]' => esc_html__( 'The country for the recipient of the message.', 'event_espresso' ), |
|
56 | - '[RECIPIENT_ANSWER_*]' => esc_html__( 'This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso' ), |
|
57 | - '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__( 'If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', 'event_espresso' ) |
|
43 | + '[RECIPIENT_FNAME]' => esc_html__('Parses to the first name of the recipient for the message.', 'event_espresso'), |
|
44 | + '[RECIPIENT_LNAME]' => esc_html__('Parses to the last name of the recipient for the message.', 'event_espresso'), |
|
45 | + '[RECIPIENT_EMAIL]' => esc_html__('Parses to the email address of the recipient for the message.', 'event_espresso'), |
|
46 | + '[RECIPIENT_REGISTRATION_ID]' => esc_html__('Parses to the registration ID of the recipient for the message.', 'event_espresso'), |
|
47 | + '[RECIPIENT_REGISTRATION_CODE]' => esc_html__('Parses to the registration code of the recipient for the message.', 'event_espresso'), |
|
48 | + '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__('Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso'), |
|
49 | + '[RECIPIENT_PHONE_NUMBER]' => esc_html__('The Phone Number for the recipient of the message.', 'event_espresso'), |
|
50 | + '[RECIPIENT_ADDRESS]' => esc_html__('The Address for the recipient of the message.', 'event_espresso'), |
|
51 | + '[RECIPIENT_ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the recipient of the message.', 'event_espresso'), |
|
52 | + '[RECIPIENT_CITY]' => esc_html__('The city for the recipient of the message.', 'event_espresso'), |
|
53 | + '[RECIPIENT_ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso'), |
|
54 | + '[RECIPIENT_ADDRESS_STATE]' => esc_html__('The state/province for the recipient of the message.', 'event_espresso'), |
|
55 | + '[RECIPIENT_COUNTRY]' => esc_html__('The country for the recipient of the message.', 'event_espresso'), |
|
56 | + '[RECIPIENT_ANSWER_*]' => esc_html__('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso'), |
|
57 | + '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__('If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', 'event_espresso') |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 | |
@@ -65,36 +65,35 @@ discard block |
||
65 | 65 | * @param string $shortcode the shortcode to be parsed. |
66 | 66 | * @return string parsed shortcode |
67 | 67 | */ |
68 | - protected function _parser( $shortcode ) { |
|
68 | + protected function _parser($shortcode) { |
|
69 | 69 | |
70 | 70 | //make sure we end up with a copy of the EE_Messages_Addressee object |
71 | 71 | $this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
72 | 72 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
73 | - && is_array( $this->_data ) |
|
74 | - && isset( $this->_data['data'] ) |
|
73 | + && is_array($this->_data) |
|
74 | + && isset($this->_data['data']) |
|
75 | 75 | && $this->_data['data'] instanceof EE_Messages_Addressee |
76 | - ? $this->_data['data'] : |
|
77 | - $this->_recipient; |
|
76 | + ? $this->_data['data'] : $this->_recipient; |
|
78 | 77 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
79 | - && ! empty( $this->_extra_data['data'] ) |
|
78 | + && ! empty($this->_extra_data['data']) |
|
80 | 79 | && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
81 | 80 | ? $this->_extra_data['data'] |
82 | 81 | : $this->_recipient; |
83 | 82 | |
84 | - if ( ! $this->_recipient instanceof EE_Messages_Addressee ) { |
|
83 | + if ( ! $this->_recipient instanceof EE_Messages_Addressee) { |
|
85 | 84 | return ''; |
86 | 85 | } |
87 | 86 | |
88 | 87 | $attendee = $this->_recipient->att_obj; |
89 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
88 | + if ( ! $attendee instanceof EE_Attendee) { |
|
90 | 89 | return ''; |
91 | 90 | } |
92 | 91 | |
93 | - $this->_registrations_for_recipient = isset( $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] ) |
|
94 | - ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] |
|
92 | + $this->_registrations_for_recipient = isset($this->_recipient->attendees[$attendee->ID()]['reg_objs']) |
|
93 | + ? $this->_recipient->attendees[$attendee->ID()]['reg_objs'] |
|
95 | 94 | : array(); |
96 | 95 | |
97 | - switch ( $shortcode ) { |
|
96 | + switch ($shortcode) { |
|
98 | 97 | case '[RECIPIENT_FNAME]' : |
99 | 98 | return $attendee->fname(); |
100 | 99 | break; |
@@ -108,21 +107,21 @@ discard block |
||
108 | 107 | break; |
109 | 108 | |
110 | 109 | case '[RECIPIENT_REGISTRATION_ID]' : |
111 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
110 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
112 | 111 | return ''; |
113 | 112 | } |
114 | 113 | return $this->_get_reg_id(); |
115 | 114 | break; |
116 | 115 | |
117 | 116 | case '[RECIPIENT_REGISTRATION_CODE]' : |
118 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
117 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
119 | 118 | return ''; |
120 | 119 | } |
121 | 120 | return $this->_get_reg_code(); |
122 | 121 | break; |
123 | 122 | |
124 | 123 | case '[RECIPIENT_EDIT_REGISTRATION_LINK]' : |
125 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
124 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
126 | 125 | return ''; |
127 | 126 | } |
128 | 127 | return $this->_recipient->reg_obj->edit_attendee_information_url(); |
@@ -164,23 +163,23 @@ discard block |
||
164 | 163 | break; |
165 | 164 | } |
166 | 165 | |
167 | - if ( strpos( $shortcode, '[RECIPIENT_ANSWER_*' ) !== false ) { |
|
168 | - $shortcode = str_replace( '[RECIPIENT_ANSWER_*', '', $shortcode ); |
|
169 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
166 | + if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) { |
|
167 | + $shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode); |
|
168 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
170 | 169 | |
171 | 170 | |
172 | 171 | //now let's figure out what question has this text |
173 | - if ( empty( $this->_recipient->questions ) || ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
172 | + if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
174 | 173 | return ''; |
175 | 174 | } |
176 | 175 | |
177 | - foreach ( $this->_recipient->questions as $ansid => $question ) { |
|
176 | + foreach ($this->_recipient->questions as $ansid => $question) { |
|
178 | 177 | if ( |
179 | 178 | $question instanceof EE_Question |
180 | 179 | && $question->display_text() == $shortcode |
181 | - && isset( $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ] ) |
|
180 | + && isset($this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]) |
|
182 | 181 | ) { |
183 | - return $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]->get_pretty( 'ANS_value', 'no_wpautop' ); |
|
182 | + return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
184 | 183 | } |
185 | 184 | } |
186 | 185 | } |
@@ -211,53 +210,53 @@ discard block |
||
211 | 210 | protected function _get_reg_code() { |
212 | 211 | |
213 | 212 | //if only one related registration for the recipient then just return that reg code. |
214 | - if ( count( $this->_registrations_for_recipient ) <= 1 ) { |
|
213 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
215 | 214 | return $this->_recipient->reg_obj->reg_code(); |
216 | 215 | } |
217 | 216 | |
218 | 217 | //k more than one registration so let's see if we can get specific to context |
219 | 218 | //are we parsing event_list? |
220 | - if ( $this->_data instanceof EE_Event ) { |
|
219 | + if ($this->_data instanceof EE_Event) { |
|
221 | 220 | $reg_code = array(); |
222 | 221 | //loop through registrations for recipient and see if there is a match for this event |
223 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
224 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) { |
|
222 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
223 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
225 | 224 | $reg_code[] = $reg->reg_code(); |
226 | 225 | } |
227 | 226 | } |
228 | - return implode( ', ', $reg_code ); |
|
227 | + return implode(', ', $reg_code); |
|
229 | 228 | } |
230 | 229 | |
231 | 230 | //are we parsing ticket list? |
232 | - if ( $this->_data instanceof EE_Ticket ) { |
|
231 | + if ($this->_data instanceof EE_Ticket) { |
|
233 | 232 | $reg_code = array(); |
234 | 233 | //loop through each registration for recipient and see if there is a match for this ticket |
235 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
236 | - if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) { |
|
234 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
235 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
237 | 236 | $reg_code = $reg->reg_code(); |
238 | 237 | } |
239 | 238 | } |
240 | - return implode( ', ', $reg_code ); |
|
239 | + return implode(', ', $reg_code); |
|
241 | 240 | } |
242 | 241 | |
243 | 242 | //do we have a specific reg_obj? Let's use it |
244 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
243 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
245 | 244 | return $this->_data->reg_obj->reg_code(); |
246 | 245 | } |
247 | 246 | |
248 | 247 | //do we have a specific reg_obj? Let's use it |
249 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
248 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
250 | 249 | return $this->_data->reg_obj->reg_code(); |
251 | 250 | } |
252 | 251 | |
253 | 252 | //not able to determine the single reg code so let's return a comma delimited list of reg codes. |
254 | 253 | $reg_code = array(); |
255 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
256 | - if ( $reg instanceof EE_Registration ) { |
|
254 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
255 | + if ($reg instanceof EE_Registration) { |
|
257 | 256 | $reg_code[] = $reg->reg_code(); |
258 | 257 | } |
259 | 258 | } |
260 | - return implode( ', ', $reg_code ); |
|
259 | + return implode(', ', $reg_code); |
|
261 | 260 | } |
262 | 261 | |
263 | 262 | |
@@ -270,48 +269,48 @@ discard block |
||
270 | 269 | protected function _get_reg_id() { |
271 | 270 | |
272 | 271 | //if only one related registration for the recipient then just return that reg code. |
273 | - if ( count( $this->_registrations_for_recipient ) <= 1 ) { |
|
272 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
274 | 273 | return $this->_recipient->reg_obj->ID(); |
275 | 274 | } |
276 | 275 | |
277 | 276 | //k more than one registration so let's see if we can get specific to context |
278 | 277 | //are we parsing event_list? |
279 | - if ( $this->_data instanceof EE_Event ) { |
|
278 | + if ($this->_data instanceof EE_Event) { |
|
280 | 279 | $registration_ids = array(); |
281 | 280 | //loop through registrations for recipient and see if there is a match for this event |
282 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
283 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) { |
|
281 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
282 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
284 | 283 | $registration_ids[] = $reg->ID(); |
285 | 284 | } |
286 | 285 | } |
287 | - return implode( ', ', $registration_ids ); |
|
286 | + return implode(', ', $registration_ids); |
|
288 | 287 | } |
289 | 288 | |
290 | 289 | //are we parsing ticket list? |
291 | - if ( $this->_data instanceof EE_Ticket ) { |
|
290 | + if ($this->_data instanceof EE_Ticket) { |
|
292 | 291 | $registration_ids = array(); |
293 | 292 | //loop through each registration for recipient and see if there is a match for this ticket |
294 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
295 | - if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) { |
|
293 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
294 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
296 | 295 | $registration_ids = $reg->ID(); |
297 | 296 | } |
298 | 297 | } |
299 | - return implode( ', ', $registration_ids ); |
|
298 | + return implode(', ', $registration_ids); |
|
300 | 299 | } |
301 | 300 | |
302 | 301 | //do we have a specific reg_obj? Let's use it |
303 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
302 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
304 | 303 | return $this->_data->reg_obj->ID(); |
305 | 304 | } |
306 | 305 | |
307 | 306 | //not able to determine the single reg code so let's return a comma delimited list of reg codes. |
308 | 307 | $registration_ids = array(); |
309 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
310 | - if ( $reg instanceof EE_Registration ) { |
|
308 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
309 | + if ($reg instanceof EE_Registration) { |
|
311 | 310 | $registration_ids[] = $reg->ID(); |
312 | 311 | } |
313 | 312 | } |
314 | - return implode( ', ', $registration_ids ); |
|
313 | + return implode(', ', $registration_ids); |
|
315 | 314 | } |
316 | 315 | |
317 | 316 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -49,26 +49,26 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _init_props() { |
52 | - $this->label = esc_html__( 'Attendee Shortcodes', 'event_espresso' ); |
|
53 | - $this->description = esc_html__( 'All shortcodes specific to attendee related data', 'event_espresso' ); |
|
52 | + $this->label = esc_html__('Attendee Shortcodes', 'event_espresso'); |
|
53 | + $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso'); |
|
54 | 54 | $this->_shortcodes = array( |
55 | - '[FNAME]' => esc_html__( 'First Name of an attendee.', 'event_espresso' ), |
|
56 | - '[LNAME]' => esc_html__( 'Last Name of an attendee.', 'event_espresso' ), |
|
57 | - '[ATTENDEE_EMAIL]' => esc_html__( 'Email address for the attendee.', 'event_espresso' ), |
|
58 | - '[EDIT_ATTENDEE_LINK]' => esc_html__( 'Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso' ), |
|
59 | - '[REGISTRATION_ID]' => esc_html__( 'Unique Registration ID for the registration', 'event_espresso' ), |
|
60 | - '[REGISTRATION_CODE]' => esc_html__( 'Unique Registration Code for the registration', 'event_espresso' ), |
|
61 | - '[REGISTRATION_STATUS_ID]' => esc_html__( 'Parses to the registration status for the attendee', 'event_espresso' ), |
|
62 | - '[REGISTRATION_STATUS_LABEL]' => esc_html__( 'Parses to the status label for the registrant', 'event_espresso' ), |
|
63 | - '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__( 'Parses to the total amount paid for this registration.', 'event_espresso' ), |
|
64 | - '[FRONTEND_EDIT_REG_LINK]' => esc_html__( 'Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso' ), |
|
65 | - '[PHONE_NUMBER]' => esc_html__( 'The Phone Number for the Registration.', 'event_espresso' ), |
|
66 | - '[ADDRESS]' => esc_html__( 'The Address for the Registration', 'event_espresso' ), |
|
67 | - '[ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the registration.', 'event_espresso' ), |
|
68 | - '[CITY]' => esc_html__( 'The city for the registration.', 'event_espresso' ), |
|
69 | - '[ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the Registration.', 'event_espresso' ), |
|
70 | - '[ADDRESS_STATE]' => esc_html__( 'The state/province for the registration.', 'event_espresso' ), |
|
71 | - '[COUNTRY]' => esc_html__( 'The country for the registration.', 'event_espresso' ) |
|
55 | + '[FNAME]' => esc_html__('First Name of an attendee.', 'event_espresso'), |
|
56 | + '[LNAME]' => esc_html__('Last Name of an attendee.', 'event_espresso'), |
|
57 | + '[ATTENDEE_EMAIL]' => esc_html__('Email address for the attendee.', 'event_espresso'), |
|
58 | + '[EDIT_ATTENDEE_LINK]' => esc_html__('Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso'), |
|
59 | + '[REGISTRATION_ID]' => esc_html__('Unique Registration ID for the registration', 'event_espresso'), |
|
60 | + '[REGISTRATION_CODE]' => esc_html__('Unique Registration Code for the registration', 'event_espresso'), |
|
61 | + '[REGISTRATION_STATUS_ID]' => esc_html__('Parses to the registration status for the attendee', 'event_espresso'), |
|
62 | + '[REGISTRATION_STATUS_LABEL]' => esc_html__('Parses to the status label for the registrant', 'event_espresso'), |
|
63 | + '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__('Parses to the total amount paid for this registration.', 'event_espresso'), |
|
64 | + '[FRONTEND_EDIT_REG_LINK]' => esc_html__('Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso'), |
|
65 | + '[PHONE_NUMBER]' => esc_html__('The Phone Number for the Registration.', 'event_espresso'), |
|
66 | + '[ADDRESS]' => esc_html__('The Address for the Registration', 'event_espresso'), |
|
67 | + '[ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the registration.', 'event_espresso'), |
|
68 | + '[CITY]' => esc_html__('The city for the registration.', 'event_espresso'), |
|
69 | + '[ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the Registration.', 'event_espresso'), |
|
70 | + '[ADDRESS_STATE]' => esc_html__('The state/province for the registration.', 'event_espresso'), |
|
71 | + '[COUNTRY]' => esc_html__('The country for the registration.', 'event_espresso') |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | * @return string |
83 | 83 | * @throws \EE_Error |
84 | 84 | */ |
85 | - protected function _parser( $shortcode ) { |
|
85 | + protected function _parser($shortcode) { |
|
86 | 86 | |
87 | 87 | |
88 | - $this->_xtra = ! empty( $this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
88 | + $this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
89 | 89 | ? $this->_extra_data['data'] |
90 | 90 | : null; |
91 | 91 | |
@@ -94,34 +94,34 @@ discard block |
||
94 | 94 | ? null |
95 | 95 | : $this->_data; |
96 | 96 | |
97 | - if ( ! $registration instanceof EE_Registration ) { |
|
97 | + if ( ! $registration instanceof EE_Registration) { |
|
98 | 98 | //let's attempt to get the txn_id for the error message. |
99 | - $txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction |
|
99 | + $txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction |
|
100 | 100 | ? $this->_xtra->txn->ID() |
101 | - : esc_html__( 'Unknown', 'event_espresso' ); |
|
102 | - $msg = esc_html__( 'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso' ); |
|
101 | + : esc_html__('Unknown', 'event_espresso'); |
|
102 | + $msg = esc_html__('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso'); |
|
103 | 103 | $dev_msg = sprintf( |
104 | - esc_html__( 'The transaction ID for this request is: %s', 'event_espresso' ), |
|
104 | + esc_html__('The transaction ID for this request is: %s', 'event_espresso'), |
|
105 | 105 | $txn_id |
106 | 106 | ); |
107 | - throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
|
107 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | //attendee obj for this registration |
111 | - $attendee = isset( $this->_xtra->registrations[ $registration->ID() ]['att_obj'] ) |
|
112 | - ? $this->_xtra->registrations[ $registration->ID() ]['att_obj'] |
|
113 | - : null ; |
|
111 | + $attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj']) |
|
112 | + ? $this->_xtra->registrations[$registration->ID()]['att_obj'] |
|
113 | + : null; |
|
114 | 114 | |
115 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
116 | - $msg = esc_html__( 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso' ); |
|
115 | + if ( ! $attendee instanceof EE_Attendee) { |
|
116 | + $msg = esc_html__('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso'); |
|
117 | 117 | $dev_msg = sprintf( |
118 | - esc_html__( 'The registration ID for this request is: %s', 'event_espresso' ), |
|
118 | + esc_html__('The registration ID for this request is: %s', 'event_espresso'), |
|
119 | 119 | $registration->ID() |
120 | 120 | ); |
121 | - throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
|
121 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
122 | 122 | } |
123 | 123 | |
124 | - switch ( $shortcode ) { |
|
124 | + switch ($shortcode) { |
|
125 | 125 | |
126 | 126 | case '[FNAME]' : |
127 | 127 | return $attendee->fname(); |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\exceptions; |
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 | |
@@ -15,5 +15,5 @@ discard block |
||
15 | 15 | * @author Darren Ethier |
16 | 16 | * @since 4.9.11.rc.001 |
17 | 17 | */ |
18 | -class SendMessageException extends \RuntimeException {} |
|
18 | +class SendMessageException extends \RuntimeException {} |
|
19 | 19 | // End of file SendMessageException.php |
20 | 20 | \ No newline at end of file |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | use EventEspresso\core\domain\entities\RegUrlLink; |
4 | 4 | use EventEspresso\core\domain\services\registration\CreateRegistrationService; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
7 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
7 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Class EE_Registration_Processor |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public static function instance() { |
68 | 68 | // check if class object is instantiated |
69 | - if ( ! self::$_instance instanceof EE_Registration_Processor ) { |
|
69 | + if ( ! self::$_instance instanceof EE_Registration_Processor) { |
|
70 | 70 | self::$_instance = new self(); |
71 | 71 | } |
72 | 72 | return self::$_instance; |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * @param int $REG_ID |
87 | 87 | * @return string |
88 | 88 | */ |
89 | - public function old_reg_status( $REG_ID ) { |
|
90 | - return isset( $this->_old_reg_status[ $REG_ID ] ) ? $this->_old_reg_status[ $REG_ID ] : null; |
|
89 | + public function old_reg_status($REG_ID) { |
|
90 | + return isset($this->_old_reg_status[$REG_ID]) ? $this->_old_reg_status[$REG_ID] : null; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | * @param int $REG_ID |
97 | 97 | * @param string $old_reg_status |
98 | 98 | */ |
99 | - public function set_old_reg_status( $REG_ID, $old_reg_status ) { |
|
99 | + public function set_old_reg_status($REG_ID, $old_reg_status) { |
|
100 | 100 | // only set the first time |
101 | - if ( ! isset( $this->_old_reg_status[ $REG_ID ] ) ) { |
|
102 | - $this->_old_reg_status[ $REG_ID ] = $old_reg_status; |
|
101 | + if ( ! isset($this->_old_reg_status[$REG_ID])) { |
|
102 | + $this->_old_reg_status[$REG_ID] = $old_reg_status; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @param int $REG_ID |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - public function new_reg_status( $REG_ID ) { |
|
113 | - return isset( $this->_new_reg_status[ $REG_ID ] ) ? $this->_new_reg_status[ $REG_ID ] : null; |
|
112 | + public function new_reg_status($REG_ID) { |
|
113 | + return isset($this->_new_reg_status[$REG_ID]) ? $this->_new_reg_status[$REG_ID] : null; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param int $REG_ID |
120 | 120 | * @param string $new_reg_status |
121 | 121 | */ |
122 | - public function set_new_reg_status( $REG_ID, $new_reg_status ) { |
|
123 | - $this->_new_reg_status[ $REG_ID ] = $new_reg_status; |
|
122 | + public function set_new_reg_status($REG_ID, $new_reg_status) { |
|
123 | + $this->_new_reg_status[$REG_ID] = $new_reg_status; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param int $REG_ID |
132 | 132 | * @return bool |
133 | 133 | */ |
134 | - public function reg_status_updated( $REG_ID ) { |
|
135 | - return $this->new_reg_status( $REG_ID ) !== $this->old_reg_status( $REG_ID ) ? true : false; |
|
134 | + public function reg_status_updated($REG_ID) { |
|
135 | + return $this->new_reg_status($REG_ID) !== $this->old_reg_status($REG_ID) ? true : false; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | * @param \EE_Registration $registration |
142 | 142 | * @throws \EE_Error |
143 | 143 | */ |
144 | - public function update_registration_status_and_trigger_notifications( \EE_Registration $registration ) { |
|
145 | - $this->toggle_incomplete_registration_status_to_default( $registration, false ); |
|
146 | - $this->toggle_registration_status_for_default_approved_events( $registration, false ); |
|
147 | - $this->toggle_registration_status_if_no_monies_owing( $registration, false ); |
|
144 | + public function update_registration_status_and_trigger_notifications(\EE_Registration $registration) { |
|
145 | + $this->toggle_incomplete_registration_status_to_default($registration, false); |
|
146 | + $this->toggle_registration_status_for_default_approved_events($registration, false); |
|
147 | + $this->toggle_registration_status_if_no_monies_owing($registration, false); |
|
148 | 148 | $registration->save(); |
149 | 149 | // trigger notifications |
150 | - $this->trigger_registration_update_notifications( $registration ); |
|
150 | + $this->trigger_registration_update_notifications($registration); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -162,18 +162,18 @@ discard block |
||
162 | 162 | * @return boolean |
163 | 163 | * @throws \EE_Error |
164 | 164 | */ |
165 | - public function manually_update_registration_status( EE_Registration $registration, $new_reg_status = '', $save = true ) { |
|
165 | + public function manually_update_registration_status(EE_Registration $registration, $new_reg_status = '', $save = true) { |
|
166 | 166 | // set initial REG_Status |
167 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
167 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
168 | 168 | // set incoming REG_Status |
169 | - $this->set_new_reg_status( $registration->ID(), $new_reg_status ); |
|
169 | + $this->set_new_reg_status($registration->ID(), $new_reg_status); |
|
170 | 170 | // toggle reg status but only if it has changed and the user can do so |
171 | 171 | if ( |
172 | - $this->reg_status_updated( $registration->ID() ) && |
|
173 | - EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registration', 'toggle_registration_status', $registration->ID() ) |
|
172 | + $this->reg_status_updated($registration->ID()) && |
|
173 | + EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'toggle_registration_status', $registration->ID()) |
|
174 | 174 | ) { |
175 | 175 | // change status to new value |
176 | - if ( $registration->set_status( $this->new_reg_status( $registration->ID() ) ) && $save ) { |
|
176 | + if ($registration->set_status($this->new_reg_status($registration->ID())) && $save) { |
|
177 | 177 | $registration->save(); |
178 | 178 | } |
179 | 179 | return TRUE; |
@@ -193,30 +193,30 @@ discard block |
||
193 | 193 | * @return void |
194 | 194 | * @throws \EE_Error |
195 | 195 | */ |
196 | - public function toggle_incomplete_registration_status_to_default( EE_Registration $registration, $save = TRUE ) { |
|
196 | + public function toggle_incomplete_registration_status_to_default(EE_Registration $registration, $save = TRUE) { |
|
197 | 197 | $existing_reg_status = $registration->status_ID(); |
198 | 198 | // set initial REG_Status |
199 | - $this->set_old_reg_status( $registration->ID(), $existing_reg_status ); |
|
199 | + $this->set_old_reg_status($registration->ID(), $existing_reg_status); |
|
200 | 200 | // is the registration currently incomplete ? |
201 | - if ( $registration->status_ID() === EEM_Registration::status_id_incomplete ) { |
|
201 | + if ($registration->status_ID() === EEM_Registration::status_id_incomplete) { |
|
202 | 202 | // grab default reg status for the event, if set |
203 | 203 | $event_default_registration_status = $registration->event()->default_registration_status(); |
204 | 204 | // if no default reg status is set for the event, then use the global value |
205 | - $STS_ID = ! empty( $event_default_registration_status ) |
|
205 | + $STS_ID = ! empty($event_default_registration_status) |
|
206 | 206 | ? $event_default_registration_status |
207 | 207 | : EE_Registry::instance()->CFG->registration->default_STS_ID; |
208 | 208 | // if the event default reg status is approved, then downgrade temporarily to payment pending to ensure that payments are triggered |
209 | 209 | $STS_ID = $STS_ID === EEM_Registration::status_id_approved ? EEM_Registration::status_id_pending_payment : $STS_ID; |
210 | 210 | // set incoming REG_Status |
211 | - $this->set_new_reg_status( $registration->ID(), $STS_ID ); |
|
212 | - $registration->set_status( $STS_ID ); |
|
213 | - if ( $save ) { |
|
211 | + $this->set_new_reg_status($registration->ID(), $STS_ID); |
|
212 | + $registration->set_status($STS_ID); |
|
213 | + if ($save) { |
|
214 | 214 | $registration->save(); |
215 | 215 | } |
216 | 216 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
217 | - if ( ! EE_Processor_Base::$IPN ) { |
|
217 | + if ( ! EE_Processor_Base::$IPN) { |
|
218 | 218 | // otherwise, send out notifications |
219 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
219 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
220 | 220 | } |
221 | 221 | // DEBUG LOG |
222 | 222 | //$this->log( |
@@ -241,10 +241,10 @@ discard block |
||
241 | 241 | * @return boolean |
242 | 242 | * @throws \EE_Error |
243 | 243 | */ |
244 | - public function toggle_registration_status_for_default_approved_events( EE_Registration $registration, $save = TRUE ) { |
|
244 | + public function toggle_registration_status_for_default_approved_events(EE_Registration $registration, $save = TRUE) { |
|
245 | 245 | $reg_status = $registration->status_ID(); |
246 | 246 | // set initial REG_Status |
247 | - $this->set_old_reg_status( $registration->ID(), $reg_status ); |
|
247 | + $this->set_old_reg_status($registration->ID(), $reg_status); |
|
248 | 248 | // if not already, toggle reg status to approved IF the event default reg status is approved |
249 | 249 | // ( as long as the registration wasn't cancelled or declined at some point ) |
250 | 250 | if ( |
@@ -254,16 +254,16 @@ discard block |
||
254 | 254 | $registration->event()->default_registration_status() === EEM_Registration::status_id_approved |
255 | 255 | ) { |
256 | 256 | // set incoming REG_Status |
257 | - $this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved ); |
|
257 | + $this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved); |
|
258 | 258 | // toggle status to approved |
259 | - $registration->set_status( EEM_Registration::status_id_approved ); |
|
260 | - if ( $save ) { |
|
259 | + $registration->set_status(EEM_Registration::status_id_approved); |
|
260 | + if ($save) { |
|
261 | 261 | $registration->save(); |
262 | 262 | } |
263 | 263 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
264 | - if ( ! EE_Processor_Base::$IPN ) { |
|
264 | + if ( ! EE_Processor_Base::$IPN) { |
|
265 | 265 | // otherwise, send out notifications |
266 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
266 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
267 | 267 | } |
268 | 268 | // DEBUG LOG |
269 | 269 | //$this->log( |
@@ -291,19 +291,19 @@ discard block |
||
291 | 291 | * @return bool |
292 | 292 | * @throws \EE_Error |
293 | 293 | */ |
294 | - public function toggle_registration_status_if_no_monies_owing( EE_Registration $registration, $save = TRUE, $additional_details = array() ) { |
|
294 | + public function toggle_registration_status_if_no_monies_owing(EE_Registration $registration, $save = TRUE, $additional_details = array()) { |
|
295 | 295 | // set initial REG_Status |
296 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
296 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
297 | 297 | //EEH_Debug_Tools::printr( $additional_details, '$additional_details', __FILE__, __LINE__ ); |
298 | 298 | // was a payment just made ? |
299 | 299 | if ( |
300 | - isset( $additional_details[ 'payment_updates' ], $additional_details[ 'last_payment' ] ) && |
|
301 | - $additional_details[ 'payment_updates' ] && |
|
302 | - $additional_details[ 'last_payment' ] instanceof EE_Payment |
|
300 | + isset($additional_details['payment_updates'], $additional_details['last_payment']) && |
|
301 | + $additional_details['payment_updates'] && |
|
302 | + $additional_details['last_payment'] instanceof EE_Payment |
|
303 | 303 | ) { |
304 | - $payment = $additional_details[ 'last_payment' ]; |
|
304 | + $payment = $additional_details['last_payment']; |
|
305 | 305 | $total_paid = 0; |
306 | - foreach ( self::$_amount_paid as $reg => $amount_paid ) { |
|
306 | + foreach (self::$_amount_paid as $reg => $amount_paid) { |
|
307 | 307 | $total_paid += $amount_paid; |
308 | 308 | } |
309 | 309 | } else { |
@@ -327,30 +327,30 @@ discard block |
||
327 | 327 | $registration->transaction()->is_completed() || |
328 | 328 | $registration->transaction()->is_overpaid() || |
329 | 329 | $registration->transaction()->is_free() || |
330 | - apply_filters( 'FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration ) |
|
330 | + apply_filters('FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration) |
|
331 | 331 | ) || ( |
332 | 332 | $payment instanceof EE_Payment && |
333 | 333 | $payment->is_approved() && |
334 | 334 | // this specific registration has not yet been paid for |
335 | - ! isset( self::$_amount_paid[ $registration->ID() ] ) && |
|
335 | + ! isset(self::$_amount_paid[$registration->ID()]) && |
|
336 | 336 | // payment amount, less what we have already attributed to other registrations, is greater than this reg's final price |
337 | 337 | $payment->amount() - $total_paid >= $registration->final_price() |
338 | 338 | ) |
339 | 339 | ) |
340 | 340 | ) { |
341 | 341 | // mark as paid |
342 | - self::$_amount_paid[ $registration->ID() ] = $registration->final_price(); |
|
342 | + self::$_amount_paid[$registration->ID()] = $registration->final_price(); |
|
343 | 343 | // track new REG_Status |
344 | - $this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved ); |
|
344 | + $this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved); |
|
345 | 345 | // toggle status to approved |
346 | - $registration->set_status( EEM_Registration::status_id_approved ); |
|
347 | - if ( $save ) { |
|
346 | + $registration->set_status(EEM_Registration::status_id_approved); |
|
347 | + if ($save) { |
|
348 | 348 | $registration->save(); |
349 | 349 | } |
350 | 350 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
351 | - if ( ! EE_Processor_Base::$IPN ) { |
|
351 | + if ( ! EE_Processor_Base::$IPN) { |
|
352 | 352 | // otherwise, send out notifications |
353 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
353 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
354 | 354 | } |
355 | 355 | // DEBUG LOG |
356 | 356 | //$this->log( |
@@ -376,27 +376,27 @@ discard block |
||
376 | 376 | * @param array $additional_details |
377 | 377 | * @return void |
378 | 378 | */ |
379 | - public function trigger_registration_update_notifications( $registration, $additional_details = array() ) { |
|
379 | + public function trigger_registration_update_notifications($registration, $additional_details = array()) { |
|
380 | 380 | try { |
381 | - if ( ! $registration instanceof EE_Registration ) { |
|
382 | - throw new EE_Error( __( 'An invalid registration was received.', 'event_espresso' ) ); |
|
381 | + if ( ! $registration instanceof EE_Registration) { |
|
382 | + throw new EE_Error(__('An invalid registration was received.', 'event_espresso')); |
|
383 | 383 | } |
384 | - EE_Registry::instance()->load_helper( 'Debug_Tools' ); |
|
384 | + EE_Registry::instance()->load_helper('Debug_Tools'); |
|
385 | 385 | EEH_Debug_Tools::log( |
386 | 386 | __CLASS__, |
387 | 387 | __FUNCTION__, |
388 | 388 | __LINE__, |
389 | - array( $registration->transaction(), $additional_details ), |
|
389 | + array($registration->transaction(), $additional_details), |
|
390 | 390 | false, |
391 | - 'EE_Transaction: ' . $registration->transaction()->ID() |
|
391 | + 'EE_Transaction: '.$registration->transaction()->ID() |
|
392 | 392 | ); |
393 | 393 | do_action( |
394 | 394 | 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', |
395 | 395 | $registration, |
396 | 396 | $additional_details |
397 | 397 | ); |
398 | - } catch( Exception $e ) { |
|
399 | - EE_Error::add_error( $e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine() ); |
|
398 | + } catch (Exception $e) { |
|
399 | + EE_Error::add_error($e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine()); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
@@ -410,22 +410,22 @@ discard block |
||
410 | 410 | * @return bool |
411 | 411 | * @throws \EE_Error |
412 | 412 | */ |
413 | - public function update_registration_after_checkout_or_payment( EE_Registration $registration, $additional_details = array() ) { |
|
413 | + public function update_registration_after_checkout_or_payment(EE_Registration $registration, $additional_details = array()) { |
|
414 | 414 | // set initial REG_Status |
415 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
415 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
416 | 416 | |
417 | 417 | // if the registration status gets updated, then save the registration |
418 | 418 | if ( |
419 | - $this->toggle_registration_status_for_default_approved_events( $registration, false ) |
|
420 | - || $this->toggle_registration_status_if_no_monies_owing( $registration, false, $additional_details ) |
|
419 | + $this->toggle_registration_status_for_default_approved_events($registration, false) |
|
420 | + || $this->toggle_registration_status_if_no_monies_owing($registration, false, $additional_details) |
|
421 | 421 | ) { |
422 | 422 | $registration->save(); |
423 | 423 | } |
424 | 424 | |
425 | 425 | // set new REG_Status |
426 | - $this->set_new_reg_status( $registration->ID(), $registration->status_ID() ); |
|
427 | - return $this->reg_status_updated( $registration->ID() ) |
|
428 | - && $this->new_reg_status( $registration->ID() ) === EEM_Registration::status_id_approved |
|
426 | + $this->set_new_reg_status($registration->ID(), $registration->status_ID()); |
|
427 | + return $this->reg_status_updated($registration->ID()) |
|
428 | + && $this->new_reg_status($registration->ID()) === EEM_Registration::status_id_approved |
|
429 | 429 | ? true |
430 | 430 | : false; |
431 | 431 | } |
@@ -441,20 +441,20 @@ discard block |
||
441 | 441 | * @return void |
442 | 442 | * @throws \EE_Error |
443 | 443 | */ |
444 | - public function update_registration_final_prices( $transaction, $save_regs = true ) { |
|
445 | - $reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $transaction->total_line_item() ); |
|
446 | - foreach( $transaction->registrations() as $registration ) { |
|
444 | + public function update_registration_final_prices($transaction, $save_regs = true) { |
|
445 | + $reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item()); |
|
446 | + foreach ($transaction->registrations() as $registration) { |
|
447 | 447 | /** @var EE_Line_Item $line_item */ |
448 | - $line_item = EEM_Line_Item::instance()->get_line_item_for_registration( $registration ); |
|
449 | - if( isset( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] ) ) { |
|
450 | - $registration->set_final_price( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] ); |
|
451 | - if( $save_regs ) { |
|
448 | + $line_item = EEM_Line_Item::instance()->get_line_item_for_registration($registration); |
|
449 | + if (isset($reg_final_price_per_ticket_line_item[$line_item->ID()])) { |
|
450 | + $registration->set_final_price($reg_final_price_per_ticket_line_item[$line_item->ID()]); |
|
451 | + if ($save_regs) { |
|
452 | 452 | $registration->save(); |
453 | 453 | } |
454 | 454 | } |
455 | 455 | } |
456 | 456 | //and make sure there's no rounding problem |
457 | - $this->fix_reg_final_price_rounding_issue( $transaction ); |
|
457 | + $this->fix_reg_final_price_rounding_issue($transaction); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * @return boolean success verifying that there is NO difference after this method is done |
475 | 475 | * @throws \EE_Error |
476 | 476 | */ |
477 | - public function fix_reg_final_price_rounding_issue( $transaction ) { |
|
477 | + public function fix_reg_final_price_rounding_issue($transaction) { |
|
478 | 478 | $reg_final_price_sum = EEM_Registration::instance()->sum( |
479 | 479 | array( |
480 | 480 | array( |
@@ -483,9 +483,9 @@ discard block |
||
483 | 483 | ), |
484 | 484 | 'REG_final_price' |
485 | 485 | ); |
486 | - $diff = $transaction->total() - (float) $reg_final_price_sum; |
|
486 | + $diff = $transaction->total() - (float) $reg_final_price_sum; |
|
487 | 487 | //ok then, just grab one of the registrations |
488 | - if( $diff !== 0 ) { |
|
488 | + if ($diff !== 0) { |
|
489 | 489 | $a_reg = EEM_Registration::instance()->get_one( |
490 | 490 | array( |
491 | 491 | array( |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | )); |
495 | 495 | $success = $a_reg instanceof EE_Registration |
496 | 496 | ? $a_reg->save( |
497 | - array( 'REG_final_price' => $a_reg->final_price() + $diff ) |
|
497 | + array('REG_final_price' => $a_reg->final_price() + $diff) |
|
498 | 498 | ) |
499 | 499 | : false; |
500 | 500 | return $success ? true : false; |
@@ -519,13 +519,13 @@ discard block |
||
519 | 519 | $update_reg = true |
520 | 520 | ) { |
521 | 521 | // these reg statuses should not be considered in any calculations involving monies owing |
522 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses |
|
522 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
523 | 523 | : EEM_Registration::closed_reg_statuses(); |
524 | - if ( ! in_array( $registration->status_ID(), $closed_reg_statuses ) ) { |
|
524 | + if ( ! in_array($registration->status_ID(), $closed_reg_statuses)) { |
|
525 | 525 | return false; |
526 | 526 | } |
527 | 527 | $registration->set_final_price(0); |
528 | - if ( $update_reg ) { |
|
528 | + if ($update_reg) { |
|
529 | 529 | $registration->save(); |
530 | 530 | } |
531 | 531 | return true; |
@@ -548,23 +548,23 @@ discard block |
||
548 | 548 | $update_reg = true |
549 | 549 | ) { |
550 | 550 | // these reg statuses should not be considered in any calculations involving monies owing |
551 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses |
|
551 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
552 | 552 | : EEM_Registration::closed_reg_statuses(); |
553 | - if ( in_array( $registration->status_ID(), $closed_reg_statuses ) ) { |
|
553 | + if (in_array($registration->status_ID(), $closed_reg_statuses)) { |
|
554 | 554 | return false; |
555 | 555 | } |
556 | 556 | $ticket = $registration->ticket(); |
557 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
557 | + if ( ! $ticket instanceof EE_Ticket) { |
|
558 | 558 | throw new EE_Error( |
559 | 559 | sprintf( |
560 | - __( 'The Ticket for Registration %1$d was not found or is invalid.', |
|
561 | - 'event_espresso' ), |
|
560 | + __('The Ticket for Registration %1$d was not found or is invalid.', |
|
561 | + 'event_espresso'), |
|
562 | 562 | $registration->ticket_ID() |
563 | 563 | ) |
564 | 564 | ); |
565 | 565 | } |
566 | - $registration->set_final_price( $ticket->price() ); |
|
567 | - if ( $update_reg ) { |
|
566 | + $registration->set_final_price($ticket->price()); |
|
567 | + if ($update_reg) { |
|
568 | 568 | $registration->save(); |
569 | 569 | } |
570 | 570 | return true; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $total_ticket_count = 1 |
603 | 603 | ) { |
604 | 604 | EE_Error::doing_it_wrong( |
605 | - __CLASS__ . '::' . __FUNCTION__, |
|
605 | + __CLASS__.'::'.__FUNCTION__, |
|
606 | 606 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
607 | 607 | '\EventEspresso\core\domain\services\registration\CreateRegistrationService::create()'), |
608 | 608 | '4.9.1', |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | public function generate_reg_url_link($att_nmbr, $item) |
646 | 646 | { |
647 | 647 | EE_Error::doing_it_wrong( |
648 | - __CLASS__ . '::' . __FUNCTION__, |
|
648 | + __CLASS__.'::'.__FUNCTION__, |
|
649 | 649 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
650 | 650 | 'EventEspresso\core\domain\entities\RegUrlLink'), |
651 | 651 | '4.9.1', |
@@ -665,11 +665,11 @@ discard block |
||
665 | 665 | * @return string |
666 | 666 | * @throws \EE_Error |
667 | 667 | */ |
668 | - public function generate_reg_code( EE_Registration $registration ) { |
|
668 | + public function generate_reg_code(EE_Registration $registration) { |
|
669 | 669 | EE_Error::doing_it_wrong( |
670 | - __CLASS__ . '::' . __FUNCTION__, |
|
670 | + __CLASS__.'::'.__FUNCTION__, |
|
671 | 671 | sprintf( |
672 | - __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), |
|
672 | + __('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
|
673 | 673 | 'EventEspresso\core\domain\entities\RegCode' |
674 | 674 | ), |
675 | 675 | '4.9.1', |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | return apply_filters( |
679 | 679 | 'FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code', |
680 | 680 | new RegCode( |
681 | - RegUrlLink::fromRegistration( $registration ), |
|
681 | + RegUrlLink::fromRegistration($registration), |
|
682 | 682 | $registration->transaction(), |
683 | 683 | $registration->ticket() |
684 | 684 | ), |