@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -15,18 +15,18 @@ discard block |
||
15 | 15 | * @author Mike Nelson |
16 | 16 | * |
17 | 17 | */ |
18 | -class EE_Phone_Input extends EE_Text_Input{ |
|
18 | +class EE_Phone_Input extends EE_Text_Input { |
|
19 | 19 | /** |
20 | 20 | * @param array $options |
21 | 21 | */ |
22 | - function __construct($options = array()){ |
|
22 | + function __construct($options = array()) { |
|
23 | 23 | $this->_add_validation_strategy( |
24 | 24 | new EE_Text_Validation_Strategy( |
25 | - __( 'Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso' ), |
|
25 | + __('Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso'), |
|
26 | 26 | '~^([\d]{10})|([\d]{3}-[\d]{3}-[\d]{4})$~' |
27 | 27 | ) |
28 | 28 | ); |
29 | - parent::__construct( $options ); |
|
29 | + parent::__construct($options); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 |
@@ -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 | * Event Espresso |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | <li><?php printf( |
40 | 40 | __('To find the sandbox account\'s credit card, go to %1$s, then "Dashboard", then under Sandbox click "Accounts", then click your account and click "Profile", then in the popup that appears click on the "Funding" tab. Your testing card is listed there.', 'event_espresso'), |
41 | 41 | '<a href="http://developer.paypal.com">developer.paypal.com</a>'); ?></li> |
42 | - <li><?php printf(__('CVV2 should be 115 (see %s PayPal\'s documentation for other special codes %s)', 'event_espresso'),'<a href="https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions#id108HH0RJ0TS" target="_blank">','</a>'); ?></li> |
|
42 | + <li><?php printf(__('CVV2 should be 115 (see %s PayPal\'s documentation for other special codes %s)', 'event_espresso'), '<a href="https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions#id108HH0RJ0TS" target="_blank">', '</a>'); ?></li> |
|
43 | 43 | </ul> |
44 | 44 | |
45 | 45 | <p class="test-credit-cards-info-pg"> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | <p class="test-credit-cards-info-pg"> |
68 | 68 | <strong><?php _e('Testing Result Code Responses', 'event_espresso'); ?></strong><br/> |
69 | - <span class="small-text"><?php printf(__('You can use the amount of the transaction to generate a particular result code (see %s PayPal\'s documentation%s). The table below lists the general guidelines for specifying amounts. IMPORTANT: before you attempt any of these, ensure your sandbox PayPal account has %s "Negative Testing" set to on%s. Also be aware that you can generate AVS errors by using certain strings in your address field, and CVV errors using certain CVV values. See %s this PayPal doc %s', 'event_espresso'),"<a href='https://developer.paypal.com/docs/classic/api/errorcodes/#id09C3GA00GR1' target='_blank'>","</a>", "<a href='https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMNXNkZ2s5VUlHTUk/edit?usp=drivesdk' target='_blank'>","</a>","<a href='https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions' target='_blank'>","</a>"); ?></span> |
|
69 | + <span class="small-text"><?php printf(__('You can use the amount of the transaction to generate a particular result code (see %s PayPal\'s documentation%s). The table below lists the general guidelines for specifying amounts. IMPORTANT: before you attempt any of these, ensure your sandbox PayPal account has %s "Negative Testing" set to on%s. Also be aware that you can generate AVS errors by using certain strings in your address field, and CVV errors using certain CVV values. See %s this PayPal doc %s', 'event_espresso'), "<a href='https://developer.paypal.com/docs/classic/api/errorcodes/#id09C3GA00GR1' target='_blank'>", "</a>", "<a href='https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMNXNkZ2s5VUlHTUk/edit?usp=drivesdk' target='_blank'>", "</a>", "<a href='https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions' target='_blank'>", "</a>"); ?></span> |
|
70 | 70 | </p> |
71 | 71 | |
72 | 72 | <div class="tbl-wrap"> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,81 +210,81 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | // loop through $templates |
239 | - foreach ( $templates as $template ) { |
|
239 | + foreach ($templates as $template) { |
|
240 | 240 | // normalize directory separators |
241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
242 | - $file_name = basename( $template ); |
|
243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
241 | + $template = EEH_File::standardise_directory_separators($template); |
|
242 | + $file_name = basename($template); |
|
243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
244 | 244 | // while looping through all template folder paths |
245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
246 | 246 | // normalize directory separators |
247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
248 | 248 | // determine if any common base path exists between the two paths |
249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
250 | + array($template_folder_path, $template_path_minus_file_name) |
|
251 | 251 | ); |
252 | - if ( $common_base_path !== '' ) { |
|
252 | + if ($common_base_path !== '') { |
|
253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
255 | 255 | } else { |
256 | 256 | // no common base path, so let's just concatenate |
257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
258 | 258 | } |
259 | 259 | // build up our template locations array by adding our resolved paths |
260 | 260 | $full_template_paths[] = $resolved_path; |
261 | 261 | } |
262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
263 | - array_unshift( $full_template_paths, $template ); |
|
263 | + array_unshift($full_template_paths, $template); |
|
264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
266 | 266 | } |
267 | 267 | // filter final array of full template paths |
268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
269 | 269 | // now loop through our final array of template location paths and check each location |
270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
271 | - if ( is_readable( $full_template_path )) { |
|
272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
271 | + if (is_readable($full_template_path)) { |
|
272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
273 | 273 | // hook that can be used to display the full template path that will be used |
274 | - do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path ); |
|
274 | + do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
279 | 279 | // if we got it and you want to see it... |
280 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
281 | - if ( $return_string ) { |
|
282 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
280 | + if ($template_path && $load && ! $check_if_custom) { |
|
281 | + if ($return_string) { |
|
282 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
283 | 283 | } else { |
284 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
284 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
285 | 285 | } |
286 | 286 | } |
287 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
287 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -297,21 +297,21 @@ discard block |
||
297 | 297 | * @param array $paths |
298 | 298 | * @return string |
299 | 299 | */ |
300 | - protected static function _find_common_base_path( $paths ) { |
|
300 | + protected static function _find_common_base_path($paths) { |
|
301 | 301 | $last_offset = 0; |
302 | 302 | $common_base_path = ''; |
303 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
303 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
304 | 304 | $dir_length = $index - $last_offset + 1; |
305 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
306 | - foreach ( $paths as $path ) { |
|
307 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
305 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
306 | + foreach ($paths as $path) { |
|
307 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
308 | 308 | return $common_base_path; |
309 | 309 | } |
310 | 310 | } |
311 | 311 | $common_base_path .= $directory; |
312 | 312 | $last_offset = $index + 1; |
313 | 313 | } |
314 | - return substr( $common_base_path, 0, -1 ); |
|
314 | + return substr($common_base_path, 0, -1); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
324 | 324 | * @return mixed string |
325 | 325 | */ |
326 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
326 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -334,26 +334,26 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @since 4.6.0 |
336 | 336 | */ |
337 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
338 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
337 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
338 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
339 | 339 | |
340 | 340 | // you gimme nuttin - YOU GET NUTTIN !! |
341 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
341 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | // if $template_args are not in an array, then make it so |
345 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
346 | - $template_args = array( $template_args ); |
|
345 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
346 | + $template_args = array($template_args); |
|
347 | 347 | } |
348 | - extract( (array) $template_args); |
|
348 | + extract((array) $template_args); |
|
349 | 349 | |
350 | - if ( $return_string ) { |
|
350 | + if ($return_string) { |
|
351 | 351 | // because we want to return a string, we are going to capture the output |
352 | 352 | ob_start(); |
353 | - include( $template_path ); |
|
353 | + include($template_path); |
|
354 | 354 | return ob_get_clean(); |
355 | 355 | } else { |
356 | - include( $template_path ); |
|
356 | + include($template_path); |
|
357 | 357 | } |
358 | 358 | return ''; |
359 | 359 | } |
@@ -371,27 +371,27 @@ discard block |
||
371 | 371 | * @param string $suffix added to the end of the generated class |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
374 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
375 | 375 | // in the beginning... |
376 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
376 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
377 | 377 | // da muddle |
378 | 378 | $class = ''; |
379 | 379 | // the end |
380 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
380 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
381 | 381 | // is the passed object an EE object ? |
382 | - if ( $object instanceof EE_Base_Class ) { |
|
382 | + if ($object instanceof EE_Base_Class) { |
|
383 | 383 | // grab the exact type of object |
384 | - $obj_class = get_class( $object ); |
|
384 | + $obj_class = get_class($object); |
|
385 | 385 | // depending on the type of object... |
386 | - switch ( $obj_class ) { |
|
386 | + switch ($obj_class) { |
|
387 | 387 | // no specifics just yet... |
388 | 388 | default : |
389 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
390 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
389 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
390 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | } |
394 | - return $prefix . $class . $suffix; |
|
394 | + return $prefix.$class.$suffix; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -407,51 +407,51 @@ discard block |
||
407 | 407 | * @param string $cur_code_span_class |
408 | 408 | * @return string the html output for the formatted money value |
409 | 409 | */ |
410 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
410 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
411 | 411 | // ensure amount was received |
412 | - if ( is_null( $amount ) ) { |
|
413 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
414 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
412 | + if (is_null($amount)) { |
|
413 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
414 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
415 | 415 | return ''; |
416 | 416 | } |
417 | 417 | //ensure amount is float |
418 | - $amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount ); |
|
419 | - $CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount ); |
|
418 | + $amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount); |
|
419 | + $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount); |
|
420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
422 | 422 | // still a number or was amount converted to a string like "free" ? |
423 | - if ( is_float( $amount_formatted )) { |
|
423 | + if (is_float($amount_formatted)) { |
|
424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
426 | 426 | // verify results |
427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
428 | 428 | // set default config country currency settings |
429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
430 | 430 | } |
431 | 431 | // format float |
432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
433 | 433 | // add formatting ? |
434 | - if ( ! $return_raw ) { |
|
434 | + if ( ! $return_raw) { |
|
435 | 435 | // add currency sign |
436 | - if( $mny->sign_b4 ){ |
|
437 | - if( $amount >= 0 ){ |
|
438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
439 | - }else{ |
|
440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
436 | + if ($mny->sign_b4) { |
|
437 | + if ($amount >= 0) { |
|
438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
439 | + } else { |
|
440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
441 | 441 | } |
442 | 442 | |
443 | - }else{ |
|
444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
443 | + } else { |
|
444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | // add currency code ? |
448 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
448 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
449 | 449 | } |
450 | 450 | // filter results |
451 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
451 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
452 | 452 | } |
453 | 453 | // clean up vars |
454 | - unset( $mny ); |
|
454 | + unset($mny); |
|
455 | 455 | // return formatted currency amount |
456 | 456 | return $amount_formatted; |
457 | 457 | } |
@@ -466,11 +466,11 @@ discard block |
||
466 | 466 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
467 | 467 | * @return string The localized label for the status id. |
468 | 468 | */ |
469 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
469 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
470 | 470 | /** @type EEM_Status $EEM_Status */ |
471 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
472 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
473 | - return $status[ $status_id ]; |
|
471 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
472 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
473 | + return $status[$status_id]; |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | |
@@ -483,9 +483,9 @@ discard block |
||
483 | 483 | * @param string $icon |
484 | 484 | * @return string the html output for the button |
485 | 485 | */ |
486 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
487 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
488 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
486 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
487 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
488 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
489 | 489 | return $button; |
490 | 490 | } |
491 | 491 | |
@@ -502,21 +502,21 @@ discard block |
||
502 | 502 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
503 | 503 | * @return string generated link |
504 | 504 | */ |
505 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
505 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
506 | 506 | |
507 | - if ( ! $page ) |
|
508 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
507 | + if ( ! $page) |
|
508 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
509 | 509 | |
510 | - if ( ! $action ) |
|
511 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
510 | + if ( ! $action) |
|
511 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
512 | 512 | |
513 | 513 | $action = empty($action) ? 'default' : $action; |
514 | 514 | |
515 | 515 | |
516 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
517 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
518 | - $help_text = !$help_text ? '' : $help_text; |
|
519 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
516 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
517 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
518 | + $help_text = ! $help_text ? '' : $help_text; |
|
519 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -528,31 +528,31 @@ discard block |
||
528 | 528 | * @param EE_Help_Tour |
529 | 529 | * @return string html |
530 | 530 | */ |
531 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
531 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
532 | 532 | $id = $tour->get_slug(); |
533 | 533 | $stops = $tour->get_stops(); |
534 | 534 | |
535 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
535 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
536 | 536 | |
537 | - foreach ( $stops as $stop ) { |
|
538 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
539 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
537 | + foreach ($stops as $stop) { |
|
538 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
539 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
540 | 540 | |
541 | 541 | //if container is set to modal then let's make sure we set the options accordingly |
542 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
542 | + if (empty($data_id) && empty($data_class)) { |
|
543 | 543 | $stop['options']['modal'] = true; |
544 | 544 | $stop['options']['expose'] = true; |
545 | 545 | } |
546 | 546 | |
547 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
548 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
547 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
548 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
549 | 549 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
550 | 550 | |
551 | 551 | //options |
552 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
552 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
553 | 553 | $options = ' data-options="'; |
554 | - foreach ( $stop['options'] as $option => $value ) { |
|
555 | - $options .= $option . ':' . $value . ';'; |
|
554 | + foreach ($stop['options'] as $option => $value) { |
|
555 | + $options .= $option.':'.$value.';'; |
|
556 | 556 | } |
557 | 557 | $options .= '"'; |
558 | 558 | } else { |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | } |
561 | 561 | |
562 | 562 | //let's put all together |
563 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
563 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | $content .= '</ol>'; |
@@ -581,31 +581,31 @@ discard block |
||
581 | 581 | * @throws EE_Error |
582 | 582 | * @return string html structure for status. |
583 | 583 | */ |
584 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
585 | - if ( !is_array( $status_array ) ) |
|
586 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
584 | + public static function status_legend($status_array, $active_status = '') { |
|
585 | + if ( ! is_array($status_array)) |
|
586 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
587 | 587 | |
588 | 588 | $setup_array = array(); |
589 | - foreach ( $status_array as $item => $status ) { |
|
589 | + foreach ($status_array as $item => $status) { |
|
590 | 590 | $setup_array[$item] = array( |
591 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
592 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
591 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
592 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
593 | 593 | 'status' => $status |
594 | 594 | ); |
595 | 595 | } |
596 | 596 | |
597 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
598 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
599 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
600 | - foreach ( $setup_array as $item => $details ) { |
|
597 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
598 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
599 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
600 | + foreach ($setup_array as $item => $details) { |
|
601 | 601 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
602 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
603 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
604 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
605 | - $content .= '</dt>' . "\n"; |
|
602 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
603 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
604 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
605 | + $content .= '</dt>'."\n"; |
|
606 | 606 | } |
607 | - $content .= '</dl>' . "\n"; |
|
608 | - $content .= '</div>' . "\n"; |
|
607 | + $content .= '</dl>'."\n"; |
|
608 | + $content .= '</div>'."\n"; |
|
609 | 609 | return $content; |
610 | 610 | } |
611 | 611 | |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | * @return string |
619 | 619 | */ |
620 | 620 | public static function layout_array_as_table($data) { |
621 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
622 | - $data = (array)$data; |
|
621 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
622 | + $data = (array) $data; |
|
623 | 623 | } |
624 | 624 | ob_start(); |
625 | 625 | if (is_array($data)) { |
@@ -632,10 +632,10 @@ discard block |
||
632 | 632 | ?> |
633 | 633 | <tr> |
634 | 634 | <td> |
635 | - <?php echo $data_key;?> |
|
635 | + <?php echo $data_key; ?> |
|
636 | 636 | </td> |
637 | 637 | <td> |
638 | - <?php echo self::layout_array_as_table($data_values);?> |
|
638 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
639 | 639 | </td> |
640 | 640 | </tr> |
641 | 641 | <?php |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | <ul> |
650 | 650 | <?php |
651 | 651 | foreach ($data as $datum) { |
652 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
652 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
653 | 653 | }?> |
654 | 654 | </ul> |
655 | 655 | <?php |
@@ -679,8 +679,8 @@ discard block |
||
679 | 679 | * |
680 | 680 | * @return string |
681 | 681 | */ |
682 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
683 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
682 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
683 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | |
@@ -704,13 +704,13 @@ discard block |
||
704 | 704 | * ) |
705 | 705 | * @return string |
706 | 706 | */ |
707 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
707 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
708 | 708 | $page_links = array(); |
709 | 709 | $disable_first = $disable_last = ''; |
710 | 710 | $total_items = (int) $total_items; |
711 | 711 | $per_page = (int) $per_page; |
712 | 712 | $current = (int) $current; |
713 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
713 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
714 | 714 | |
715 | 715 | //filter items_label |
716 | 716 | $items_label = apply_filters( |
@@ -718,68 +718,68 @@ discard block |
||
718 | 718 | $items_label |
719 | 719 | ); |
720 | 720 | |
721 | - if ( empty( $items_label ) |
|
722 | - || ! is_array( $items_label ) |
|
723 | - || ! isset( $items_label['single'] ) |
|
724 | - || ! isset( $items_label['plural'] ) ) { |
|
721 | + if (empty($items_label) |
|
722 | + || ! is_array($items_label) |
|
723 | + || ! isset($items_label['single']) |
|
724 | + || ! isset($items_label['plural'])) { |
|
725 | 725 | $items_label = array( |
726 | - 'single' => __( '1 item', 'event_espresso' ), |
|
727 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
726 | + 'single' => __('1 item', 'event_espresso'), |
|
727 | + 'plural' => __('%s items', 'event_espresso') |
|
728 | 728 | ); |
729 | 729 | } else { |
730 | 730 | $items_label = array( |
731 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
732 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
731 | + 'single' => '1 '.esc_html($items_label['single']), |
|
732 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
733 | 733 | ); |
734 | 734 | } |
735 | 735 | |
736 | - $total_pages = ceil( $total_items / $per_page ); |
|
736 | + $total_pages = ceil($total_items / $per_page); |
|
737 | 737 | |
738 | - if ( $total_pages <= 1 ) |
|
738 | + if ($total_pages <= 1) |
|
739 | 739 | return ''; |
740 | 740 | |
741 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
741 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
742 | 742 | |
743 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
743 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
744 | 744 | |
745 | - if ( $current === 1 ) { |
|
745 | + if ($current === 1) { |
|
746 | 746 | $disable_first = ' disabled'; |
747 | 747 | } |
748 | - if ( $current == $total_pages ) { |
|
748 | + if ($current == $total_pages) { |
|
749 | 749 | $disable_last = ' disabled'; |
750 | 750 | } |
751 | 751 | |
752 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
753 | - 'first-page' . $disable_first, |
|
754 | - esc_attr__( 'Go to the first page' ), |
|
755 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
752 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
753 | + 'first-page'.$disable_first, |
|
754 | + esc_attr__('Go to the first page'), |
|
755 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
756 | 756 | '«' |
757 | 757 | ); |
758 | 758 | |
759 | 759 | $page_links[] = sprintf( |
760 | 760 | '<a class="%s" title="%s" href="%s">%s</a>', |
761 | - 'prev-page' . $disable_first, |
|
762 | - esc_attr__( 'Go to the previous page' ), |
|
763 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
761 | + 'prev-page'.$disable_first, |
|
762 | + esc_attr__('Go to the previous page'), |
|
763 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
764 | 764 | '‹' |
765 | 765 | ); |
766 | 766 | |
767 | - if ( ! $show_num_field ) { |
|
767 | + if ( ! $show_num_field) { |
|
768 | 768 | $html_current_page = $current; |
769 | 769 | } else { |
770 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
771 | - esc_attr__( 'Current page' ), |
|
770 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
771 | + esc_attr__('Current page'), |
|
772 | 772 | $current, |
773 | - strlen( $total_pages ) |
|
773 | + strlen($total_pages) |
|
774 | 774 | ); |
775 | 775 | } |
776 | 776 | |
777 | 777 | $html_total_pages = sprintf( |
778 | 778 | '<span class="total-pages">%s</span>', |
779 | - number_format_i18n( $total_pages ) |
|
779 | + number_format_i18n($total_pages) |
|
780 | 780 | ); |
781 | 781 | $page_links[] = sprintf( |
782 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
782 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
783 | 783 | $html_current_page, |
784 | 784 | $html_total_pages, |
785 | 785 | '<span class="paging-input">', |
@@ -788,29 +788,29 @@ discard block |
||
788 | 788 | |
789 | 789 | $page_links[] = sprintf( |
790 | 790 | '<a class="%s" title="%s" href="%s">%s</a>', |
791 | - 'next-page' . $disable_last, |
|
792 | - esc_attr__( 'Go to the next page' ), |
|
793 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
791 | + 'next-page'.$disable_last, |
|
792 | + esc_attr__('Go to the next page'), |
|
793 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
794 | 794 | '›' |
795 | 795 | ); |
796 | 796 | |
797 | 797 | $page_links[] = sprintf( |
798 | 798 | '<a class="%s" title="%s" href="%s">%s</a>', |
799 | - 'last-page' . $disable_last, |
|
800 | - esc_attr__( 'Go to the last page' ), |
|
801 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
799 | + 'last-page'.$disable_last, |
|
800 | + esc_attr__('Go to the last page'), |
|
801 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
802 | 802 | '»' |
803 | 803 | ); |
804 | 804 | |
805 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
805 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
806 | 806 | // set page class |
807 | - if ( $total_pages ) { |
|
807 | + if ($total_pages) { |
|
808 | 808 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
809 | 809 | } else { |
810 | 810 | $page_class = ' no-pages'; |
811 | 811 | } |
812 | 812 | |
813 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
813 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
814 | 814 | } |
815 | 815 | |
816 | 816 | |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
827 | 827 | |
828 | 828 | |
829 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
829 | +if ( ! function_exists('espresso_pagination')) { |
|
830 | 830 | /** |
831 | 831 | * espresso_pagination |
832 | 832 | * |
@@ -838,21 +838,21 @@ discard block |
||
838 | 838 | $big = 999999999; // need an unlikely integer |
839 | 839 | $pagination = paginate_links( |
840 | 840 | array( |
841 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
841 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
842 | 842 | 'format' => '?paged=%#%', |
843 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
843 | + 'current' => max(1, get_query_var('paged')), |
|
844 | 844 | 'total' => $wp_query->max_num_pages, |
845 | 845 | 'show_all' => true, |
846 | 846 | 'end_size' => 10, |
847 | 847 | 'mid_size' => 6, |
848 | 848 | 'prev_next' => true, |
849 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
850 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
849 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
850 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
851 | 851 | 'type' => 'plain', |
852 | 852 | 'add_args' => false, |
853 | 853 | 'add_fragment' => '' |
854 | 854 | ) |
855 | 855 | ); |
856 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
856 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
857 | 857 | } |
858 | 858 | } |
859 | 859 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | protected function _init_page_props() { |
65 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
65 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
66 | 66 | $this->page_slug = EE_VENUES_PG_SLUG; |
67 | 67 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
68 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
68 | + $this->_admin_base_path = EE_ADMIN_PAGES.'venues'; |
|
69 | 69 | $this->page_label = __('Event Venues', 'event_espresso'); |
70 | 70 | $this->_cpt_model_names = array( |
71 | 71 | 'create_new' => 'EEM_Venue', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'edit' => __('Update Venue', 'event_espresso'), |
109 | 109 | 'add_category' => __('Save New Category', 'event_espresso'), |
110 | 110 | 'edit_category' => __('Update Category', 'event_espresso'), |
111 | - 'google_map_settings' => __( 'Update Settings', 'event_espresso' ) |
|
111 | + 'google_map_settings' => __('Update Settings', 'event_espresso') |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | } |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | //load field generator helper |
124 | 124 | |
125 | 125 | //is there a vnu_id in the request? |
126 | - $vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0; |
|
127 | - $vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id; |
|
126 | + $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0; |
|
127 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
128 | 128 | |
129 | 129 | $this->_page_routes = array( |
130 | 130 | 'default' => array( |
@@ -142,27 +142,27 @@ discard block |
||
142 | 142 | ), |
143 | 143 | 'trash_venue' => array( |
144 | 144 | 'func' => '_trash_or_restore_venue', |
145 | - 'args' => array( 'venue_status' => 'trash' ), |
|
145 | + 'args' => array('venue_status' => 'trash'), |
|
146 | 146 | 'noheader' => TRUE, |
147 | 147 | 'capability' => 'ee_delete_venue', |
148 | 148 | 'obj_id' => $vnu_id |
149 | 149 | ), |
150 | 150 | 'trash_venues' => array( |
151 | 151 | 'func' => '_trash_or_restore_venues', |
152 | - 'args' => array( 'venue_status' => 'trash' ), |
|
152 | + 'args' => array('venue_status' => 'trash'), |
|
153 | 153 | 'noheader' => TRUE, |
154 | 154 | 'capability' => 'ee_delete_venues' |
155 | 155 | ), |
156 | 156 | 'restore_venue' => array( |
157 | 157 | 'func' => '_trash_or_restore_venue', |
158 | - 'args' => array( 'venue_status' => 'draft' ), |
|
158 | + 'args' => array('venue_status' => 'draft'), |
|
159 | 159 | 'noheader' => TRUE, |
160 | 160 | 'capability' => 'ee_delete_venue', |
161 | 161 | 'obj_id' => $vnu_id |
162 | 162 | ), |
163 | 163 | 'restore_venues' => array( |
164 | 164 | 'func' => '_trash_or_restore_venues', |
165 | - 'args' => array( 'venue_status' => 'draft' ), |
|
165 | + 'args' => array('venue_status' => 'draft'), |
|
166 | 166 | 'noheader' => TRUE, |
167 | 167 | 'capability' => 'ee_delete_venues' |
168 | 168 | ), |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | 'filename' => 'venues_overview_views_bulk_actions_search' |
265 | 265 | ) |
266 | 266 | ), |
267 | - 'help_tour' => array( 'Venues_Overview_Help_Tour' ), |
|
267 | + 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
268 | 268 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
269 | 269 | 'require_nonce' => FALSE |
270 | 270 | ), |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | 'filename' => 'venues_editor_other' |
301 | 301 | ) |
302 | 302 | ), |
303 | - 'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ), |
|
303 | + 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
304 | 304 | 'metaboxes' => array('_venue_editor_metaboxes'), |
305 | 305 | 'require_nonce' => FALSE |
306 | 306 | ), |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | 'label' => __('Edit Venue', 'event_espresso'), |
310 | 310 | 'order' => 5, |
311 | 311 | 'persistent' => FALSE, |
312 | - 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
312 | + 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url |
|
313 | 313 | ), |
314 | 314 | 'help_tabs' => array( |
315 | 315 | 'venues_editor_help_tab' => array( |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | 'label' => __('Google Maps'), |
347 | 347 | 'order' => 40 |
348 | 348 | ), |
349 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
349 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
350 | 350 | 'help_tabs' => array( |
351 | 351 | 'general_settings_google_maps_help_tab' => array( |
352 | 352 | 'title' => __('Google Maps', 'event_espresso'), |
353 | 353 | 'filename' => 'general_settings_google_maps' |
354 | 354 | ) |
355 | 355 | ), |
356 | - 'help_tour' => array( 'Google_Maps_Help_Tour' ), |
|
356 | + 'help_tour' => array('Google_Maps_Help_Tour'), |
|
357 | 357 | 'require_nonce' => FALSE |
358 | 358 | ), |
359 | 359 | //venue category stuff |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | 'filename' => 'venues_add_category' |
370 | 370 | ) |
371 | 371 | ), |
372 | - 'help_tour' => array( 'Venues_Add_Category_Help_Tour' ), |
|
372 | + 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
373 | 373 | 'require_nonce' => FALSE |
374 | 374 | ), |
375 | 375 | 'edit_category' => array( |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | 'label' => __('Edit Category', 'event_espresso'), |
378 | 378 | 'order' => 15, |
379 | 379 | 'persistent' => FALSE, |
380 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
380 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
381 | 381 | ), |
382 | 382 | 'metaboxes' => array('_publish_post_box'), |
383 | 383 | 'help_tabs' => array( |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | 'filename' => 'venues_categories_other' |
414 | 414 | ) |
415 | 415 | ), |
416 | - 'help_tour' => array( 'Venues_Categories_Help_Tour' ), |
|
416 | + 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
417 | 417 | 'metaboxes' => $this->_default_espresso_metaboxes, |
418 | 418 | 'require_nonce' => FALSE |
419 | 419 | ) |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | |
472 | 472 | public function load_scripts_styles() { |
473 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
473 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
474 | 474 | wp_enqueue_style('ee-cat-admin'); |
475 | 475 | } |
476 | 476 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | public function load_scripts_styles_edit() { |
494 | 494 | //styles |
495 | 495 | wp_enqueue_style('espresso-ui-theme'); |
496 | - wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
496 | + wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
497 | 497 | wp_enqueue_style('espresso_venues'); |
498 | 498 | } |
499 | 499 | |
@@ -512,13 +512,13 @@ discard block |
||
512 | 512 | ) |
513 | 513 | ); |
514 | 514 | |
515 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) { |
|
515 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
516 | 516 | $this->_views['all']['bulk_action'] = array( |
517 | 517 | 'trash_venues' => __('Move to Trash', 'event_espresso') |
518 | 518 | ); |
519 | 519 | $this->_views['trash'] = array( |
520 | 520 | 'slug' => 'trash', |
521 | - 'label' => __( 'Trash', 'event_espresso' ), |
|
521 | + 'label' => __('Trash', 'event_espresso'), |
|
522 | 522 | 'count' => 0, |
523 | 523 | 'bulk_action' => array( |
524 | 524 | 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
@@ -551,8 +551,8 @@ discard block |
||
551 | 551 | |
552 | 552 | |
553 | 553 | protected function _overview_list_table() { |
554 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
555 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' ); |
|
554 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
555 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button'); |
|
556 | 556 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
557 | 557 | $this->_search_btn_label = __('Venues', 'event_espresso'); |
558 | 558 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | 'vnu_url' => $this->_cpt_model_obj->venue_url(), |
567 | 567 | 'vnu_phone' => $this->_cpt_model_obj->phone() |
568 | 568 | ); |
569 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
570 | - EEH_Template::display_template( $template, $extra_rows ); |
|
569 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
570 | + EEH_Template::display_template($template, $extra_rows); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | |
@@ -583,31 +583,31 @@ discard block |
||
583 | 583 | $default_map_settings->use_google_maps = TRUE; |
584 | 584 | $default_map_settings->google_map_api_key = ''; |
585 | 585 | // for event details pages (reg page) |
586 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
587 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
588 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
589 | - $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
590 | - $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
591 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
592 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
586 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
587 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
588 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
589 | + $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
590 | + $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
591 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
592 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
593 | 593 | // for event list pages |
594 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
595 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
596 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
597 | - $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
598 | - $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
599 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
600 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
594 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
595 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
596 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
597 | + $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
598 | + $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
599 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
600 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
601 | 601 | |
602 | 602 | $this->_template_args['map_settings'] = |
603 | - isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings ) |
|
604 | - ? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings ) |
|
603 | + isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
604 | + ? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings) |
|
605 | 605 | : $default_map_settings; |
606 | 606 | |
607 | - $this->_set_add_edit_form_tags( 'update_google_map_settings' ); |
|
608 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
607 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
608 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
609 | 609 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
610 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
610 | + EE_VENUES_TEMPLATE_PATH.'google_map.template.php', |
|
611 | 611 | $this->_template_args, |
612 | 612 | true |
613 | 613 | ); |
@@ -617,83 +617,83 @@ discard block |
||
617 | 617 | protected function _update_google_map_settings() { |
618 | 618 | |
619 | 619 | EE_Registry::instance()->CFG->map_settings->use_google_maps = |
620 | - isset( $this->_req_data['use_google_maps'] ) |
|
621 | - ? absint( $this->_req_data['use_google_maps'] ) |
|
620 | + isset($this->_req_data['use_google_maps']) |
|
621 | + ? absint($this->_req_data['use_google_maps']) |
|
622 | 622 | : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
623 | 623 | |
624 | 624 | EE_Registry::instance()->CFG->map_settings->google_map_api_key = |
625 | - isset( $this->_req_data['google_map_api_key'] ) |
|
626 | - ? sanitize_text_field( $this->_req_data['google_map_api_key'] ) |
|
625 | + isset($this->_req_data['google_map_api_key']) |
|
626 | + ? sanitize_text_field($this->_req_data['google_map_api_key']) |
|
627 | 627 | : EE_Registry::instance()->CFG->map_settings->google_map_api_key; |
628 | 628 | |
629 | 629 | EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
630 | - isset( $this->_req_data['event_details_map_width'] ) |
|
631 | - ? absint( $this->_req_data['event_details_map_width'] ) |
|
630 | + isset($this->_req_data['event_details_map_width']) |
|
631 | + ? absint($this->_req_data['event_details_map_width']) |
|
632 | 632 | : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
633 | 633 | |
634 | 634 | EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
635 | - isset( $this->_req_data['event_details_map_height'] ) |
|
636 | - ? absint( $this->_req_data['event_details_map_height'] ) |
|
635 | + isset($this->_req_data['event_details_map_height']) |
|
636 | + ? absint($this->_req_data['event_details_map_height']) |
|
637 | 637 | : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
638 | 638 | |
639 | 639 | EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
640 | - isset( $this->_req_data['event_details_map_zoom'] ) |
|
641 | - ? absint( $this->_req_data['event_details_map_zoom'] ) |
|
640 | + isset($this->_req_data['event_details_map_zoom']) |
|
641 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
642 | 642 | : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
643 | 643 | |
644 | 644 | EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
645 | - isset( $this->_req_data['event_details_display_nav'] ) |
|
646 | - ? absint( $this->_req_data['event_details_display_nav'] ) |
|
645 | + isset($this->_req_data['event_details_display_nav']) |
|
646 | + ? absint($this->_req_data['event_details_display_nav']) |
|
647 | 647 | : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
648 | 648 | |
649 | 649 | EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
650 | - isset( $this->_req_data['event_details_nav_size'] ) |
|
651 | - ? absint( $this->_req_data['event_details_nav_size'] ) |
|
650 | + isset($this->_req_data['event_details_nav_size']) |
|
651 | + ? absint($this->_req_data['event_details_nav_size']) |
|
652 | 652 | : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
653 | 653 | |
654 | 654 | EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
655 | - isset( $this->_req_data['event_details_control_type'] ) |
|
656 | - ? sanitize_text_field( $this->_req_data['event_details_control_type'] ) |
|
655 | + isset($this->_req_data['event_details_control_type']) |
|
656 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
657 | 657 | : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
658 | 658 | |
659 | 659 | EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
660 | - isset( $this->_req_data['event_details_map_align'] ) |
|
661 | - ? sanitize_text_field( $this->_req_data['event_details_map_align'] ) |
|
660 | + isset($this->_req_data['event_details_map_align']) |
|
661 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
662 | 662 | : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
663 | 663 | |
664 | 664 | EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
665 | - isset( $this->_req_data['event_list_map_width'] ) |
|
666 | - ? absint( $this->_req_data['event_list_map_width'] ) |
|
665 | + isset($this->_req_data['event_list_map_width']) |
|
666 | + ? absint($this->_req_data['event_list_map_width']) |
|
667 | 667 | : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
668 | 668 | |
669 | 669 | EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
670 | - isset( $this->_req_data['event_list_map_height'] ) |
|
671 | - ? absint( $this->_req_data['event_list_map_height'] ) |
|
670 | + isset($this->_req_data['event_list_map_height']) |
|
671 | + ? absint($this->_req_data['event_list_map_height']) |
|
672 | 672 | : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
673 | 673 | |
674 | 674 | EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
675 | - isset( $this->_req_data['event_list_map_zoom'] ) |
|
676 | - ? absint( $this->_req_data['event_list_map_zoom'] ) |
|
675 | + isset($this->_req_data['event_list_map_zoom']) |
|
676 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
677 | 677 | : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
678 | 678 | |
679 | 679 | EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
680 | - isset( $this->_req_data['event_list_display_nav'] ) |
|
681 | - ? absint( $this->_req_data['event_list_display_nav'] ) |
|
680 | + isset($this->_req_data['event_list_display_nav']) |
|
681 | + ? absint($this->_req_data['event_list_display_nav']) |
|
682 | 682 | : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
683 | 683 | |
684 | 684 | EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
685 | - isset( $this->_req_data['event_list_nav_size'] ) |
|
686 | - ? absint( $this->_req_data['event_list_nav_size'] ) |
|
685 | + isset($this->_req_data['event_list_nav_size']) |
|
686 | + ? absint($this->_req_data['event_list_nav_size']) |
|
687 | 687 | : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
688 | 688 | |
689 | 689 | EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
690 | - isset( $this->_req_data['event_list_control_type'] ) |
|
691 | - ? sanitize_text_field( $this->_req_data['event_list_control_type'] ) |
|
690 | + isset($this->_req_data['event_list_control_type']) |
|
691 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
692 | 692 | : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
693 | 693 | |
694 | 694 | EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
695 | - isset( $this->_req_data['event_list_map_align'] ) |
|
696 | - ? sanitize_text_field( $this->_req_data['event_list_map_align'] ) |
|
695 | + isset($this->_req_data['event_list_map_align']) |
|
696 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
697 | 697 | : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
698 | 698 | |
699 | 699 | EE_Registry::instance()->CFG->map_settings = apply_filters( |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | EE_Registry::instance()->CFG->map_settings, |
708 | 708 | __FILE__, __FUNCTION__, __LINE__ |
709 | 709 | ); |
710 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) ); |
|
710 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
711 | 711 | |
712 | 712 | } |
713 | 713 | |
@@ -716,9 +716,9 @@ discard block |
||
716 | 716 | protected function _venue_editor_metaboxes() { |
717 | 717 | $this->verify_cpt_object(); |
718 | 718 | |
719 | - add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' ); |
|
720 | - add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' ); |
|
721 | - add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' ); |
|
719 | + add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default'); |
|
720 | + add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default'); |
|
721 | + add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default'); |
|
722 | 722 | |
723 | 723 | } |
724 | 724 | |
@@ -726,23 +726,23 @@ discard block |
||
726 | 726 | |
727 | 727 | public function venue_gmap_metabox() { |
728 | 728 | $template_args = array( |
729 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ), |
|
729 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()), |
|
730 | 730 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
731 | 731 | ); |
732 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
733 | - EEH_Template::display_template( $template, $template_args ); |
|
732 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
733 | + EEH_Template::display_template($template, $template_args); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | |
737 | 737 | |
738 | 738 | public function venue_address_metabox() { |
739 | 739 | |
740 | - $template_args['_venue'] =$this->_cpt_model_obj; |
|
740 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
741 | 741 | |
742 | 742 | $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
743 | 743 | $QFI = new EE_Question_Form_Input( |
744 | - EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )), |
|
745 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->state_ID() )), |
|
744 | + EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), |
|
745 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())), |
|
746 | 746 | array( |
747 | 747 | 'input_name' => 'sta_id', |
748 | 748 | 'input_id' => 'sta_id', |
@@ -754,8 +754,8 @@ discard block |
||
754 | 754 | ); |
755 | 755 | $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
756 | 756 | $QFI = new EE_Question_Form_Input( |
757 | - EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )), |
|
758 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->country_ID() )), |
|
757 | + EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), |
|
758 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())), |
|
759 | 759 | array( |
760 | 760 | 'input_name' => 'cnt_iso', |
761 | 761 | 'input_id' => 'cnt_iso', |
@@ -766,8 +766,8 @@ discard block |
||
766 | 766 | ) |
767 | 767 | ); |
768 | 768 | |
769 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
770 | - EEH_Template::display_template( $template, $template_args ); |
|
769 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
770 | + EEH_Template::display_template($template, $template_args); |
|
771 | 771 | } |
772 | 772 | |
773 | 773 | |
@@ -779,8 +779,8 @@ discard block |
||
779 | 779 | $template_args = array( |
780 | 780 | '_venue' => $this->_cpt_model_obj |
781 | 781 | ); |
782 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
783 | - EEH_Template::display_template( $template, $template_args ); |
|
782 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
783 | + EEH_Template::display_template($template, $template_args); |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | |
@@ -803,52 +803,52 @@ discard block |
||
803 | 803 | * @param object $post Post object (with "blessed" WP properties) |
804 | 804 | * @return void |
805 | 805 | */ |
806 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
806 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
807 | 807 | |
808 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) { |
|
809 | - return;// get out we're not processing the saving of venues. |
|
808 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
809 | + return; // get out we're not processing the saving of venues. |
|
810 | 810 | } |
811 | 811 | |
812 | - $wheres = array( $this->_venue_model->primary_key_name() => $post_id ); |
|
812 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
813 | 813 | |
814 | 814 | $venue_values = array( |
815 | - 'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL, |
|
816 | - 'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL, |
|
817 | - 'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL, |
|
818 | - 'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL, |
|
819 | - 'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL, |
|
820 | - 'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL, |
|
821 | - 'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL, |
|
822 | - 'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF, |
|
823 | - 'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL, |
|
824 | - 'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
825 | - 'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
826 | - 'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE, |
|
827 | - 'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
815 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL, |
|
816 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL, |
|
817 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL, |
|
818 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL, |
|
819 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL, |
|
820 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL, |
|
821 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL, |
|
822 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF, |
|
823 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL, |
|
824 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
825 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
826 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE, |
|
827 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
828 | 828 | ); |
829 | 829 | |
830 | 830 | //update venue |
831 | - $success = $this->_venue_model->update( $venue_values, array( $wheres ) ); |
|
831 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
832 | 832 | |
833 | 833 | //get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
834 | - $get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
835 | - $venue = $this->_venue_model->get_one( array( $get_one_where ) ); |
|
834 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
835 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
836 | 836 | |
837 | 837 | //notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
838 | - $venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() ); |
|
838 | + $venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array()); |
|
839 | 839 | |
840 | 840 | $att_success = TRUE; |
841 | 841 | |
842 | - foreach ( $venue_update_callbacks as $v_callback ) { |
|
843 | - $_succ = call_user_func_array( $v_callback, array( $venue, $this->_req_data ) ); |
|
844 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
842 | + foreach ($venue_update_callbacks as $v_callback) { |
|
843 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
844 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | //any errors? |
848 | - if ( $success && !$att_success ) { |
|
849 | - EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
850 | - } else if ( $success === FALSE ) { |
|
851 | - EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
848 | + if ($success && ! $att_success) { |
|
849 | + EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
850 | + } else if ($success === FALSE) { |
|
851 | + EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
852 | 852 | } |
853 | 853 | } |
854 | 854 | |
@@ -856,9 +856,9 @@ discard block |
||
856 | 856 | |
857 | 857 | |
858 | 858 | |
859 | - public function trash_cpt_item( $post_id ) { |
|
859 | + public function trash_cpt_item($post_id) { |
|
860 | 860 | $this->_req_data['VNU_ID'] = $post_id; |
861 | - $this->_trash_or_restore_venue( 'trash', FALSE ); |
|
861 | + $this->_trash_or_restore_venue('trash', FALSE); |
|
862 | 862 | } |
863 | 863 | |
864 | 864 | |
@@ -866,18 +866,18 @@ discard block |
||
866 | 866 | |
867 | 867 | |
868 | 868 | |
869 | - public function restore_cpt_item( $post_id ) { |
|
869 | + public function restore_cpt_item($post_id) { |
|
870 | 870 | $this->_req_data['VNU_ID'] = $post_id; |
871 | - $this->_trash_or_restore_venue( 'draft', FALSE ); |
|
871 | + $this->_trash_or_restore_venue('draft', FALSE); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | |
875 | 875 | |
876 | 876 | |
877 | 877 | |
878 | - public function delete_cpt_item( $post_id ) { |
|
878 | + public function delete_cpt_item($post_id) { |
|
879 | 879 | $this->_req_data['VNU_ID'] = $post_id; |
880 | - $this->_delete_venue( FALSE ); |
|
880 | + $this->_delete_venue(FALSE); |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | |
@@ -892,15 +892,15 @@ discard block |
||
892 | 892 | |
893 | 893 | |
894 | 894 | |
895 | - protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) { |
|
896 | - $VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE; |
|
895 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) { |
|
896 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE; |
|
897 | 897 | |
898 | 898 | //loop thru venues |
899 | - if ( $VNU_ID ) { |
|
899 | + if ($VNU_ID) { |
|
900 | 900 | //clean status |
901 | - $venue_status = sanitize_key( $venue_status ); |
|
901 | + $venue_status = sanitize_key($venue_status); |
|
902 | 902 | // grab status |
903 | - if (!empty($venue_status)) { |
|
903 | + if ( ! empty($venue_status)) { |
|
904 | 904 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
905 | 905 | } else { |
906 | 906 | $success = FALSE; |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | } |
915 | 915 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
916 | 916 | |
917 | - if ( $redirect_after ) |
|
917 | + if ($redirect_after) |
|
918 | 918 | $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
919 | 919 | |
920 | 920 | } |
@@ -923,11 +923,11 @@ discard block |
||
923 | 923 | |
924 | 924 | |
925 | 925 | |
926 | - protected function _trash_or_restore_venues( $venue_status = 'trash' ) { |
|
926 | + protected function _trash_or_restore_venues($venue_status = 'trash') { |
|
927 | 927 | // clean status |
928 | 928 | $venue_status = sanitize_key($venue_status); |
929 | 929 | // grab status |
930 | - if (!empty($venue_status)) { |
|
930 | + if ( ! empty($venue_status)) { |
|
931 | 931 | $success = TRUE; |
932 | 932 | //determine the event id and set to array. |
933 | 933 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
@@ -967,20 +967,20 @@ discard block |
||
967 | 967 | * @param string $venue_status |
968 | 968 | * @return void |
969 | 969 | */ |
970 | - private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) { |
|
970 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') { |
|
971 | 971 | // grab venue id |
972 | - if (! $VNU_ID) { |
|
972 | + if ( ! $VNU_ID) { |
|
973 | 973 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
974 | 974 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
975 | 975 | return FALSE; |
976 | 976 | } |
977 | 977 | |
978 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
978 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
979 | 979 | |
980 | 980 | // clean status |
981 | 981 | $venue_status = sanitize_key($venue_status); |
982 | 982 | // grab status |
983 | - if ( ! $venue_status ) { |
|
983 | + if ( ! $venue_status) { |
|
984 | 984 | $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
985 | 985 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
986 | 986 | return FALSE; |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | $hook = FALSE; |
1002 | 1002 | } |
1003 | 1003 | //use class to change status |
1004 | - $this->_cpt_model_obj->set_status( $venue_status ); |
|
1004 | + $this->_cpt_model_obj->set_status($venue_status); |
|
1005 | 1005 | $success = $this->_cpt_model_obj->save(); |
1006 | 1006 | |
1007 | 1007 | if ($success === FALSE) { |
@@ -1020,21 +1020,21 @@ discard block |
||
1020 | 1020 | * @param bool $redirect_after |
1021 | 1021 | * @return void |
1022 | 1022 | */ |
1023 | - protected function _delete_venue( $redirect_after = true ) { |
|
1023 | + protected function _delete_venue($redirect_after = true) { |
|
1024 | 1024 | //determine the venue id and set to array. |
1025 | 1025 | $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL; |
1026 | - $VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID; |
|
1026 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1027 | 1027 | |
1028 | 1028 | |
1029 | 1029 | // loop thru venues |
1030 | 1030 | if ($VNU_ID) { |
1031 | - $success = $this->_delete_or_trash_venue( $VNU_ID ); |
|
1031 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1032 | 1032 | } else { |
1033 | 1033 | $success = FALSE; |
1034 | 1034 | $msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso'); |
1035 | 1035 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1036 | 1036 | } |
1037 | - if ( $redirect_after ) |
|
1037 | + if ($redirect_after) |
|
1038 | 1038 | $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
1039 | 1039 | } |
1040 | 1040 | |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | //todo: put in parent |
1067 | 1067 | private function _delete_or_trash_venue($VNU_ID = FALSE) { |
1068 | 1068 | // grab event id |
1069 | - if (!$VNU_ID = absint($VNU_ID)) { |
|
1069 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
1070 | 1070 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1071 | 1071 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1072 | 1072 | return FALSE; |
@@ -1086,7 +1086,7 @@ discard block |
||
1086 | 1086 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1087 | 1087 | return FALSE; |
1088 | 1088 | } |
1089 | - do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' ); |
|
1089 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1090 | 1090 | return TRUE; |
1091 | 1091 | } |
1092 | 1092 | |
@@ -1097,11 +1097,11 @@ discard block |
||
1097 | 1097 | /* QUERIES */ |
1098 | 1098 | |
1099 | 1099 | |
1100 | - public function get_venues( $per_page = 10, $count = FALSE ) { |
|
1100 | + public function get_venues($per_page = 10, $count = FALSE) { |
|
1101 | 1101 | |
1102 | - $_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : ''; |
|
1102 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1103 | 1103 | |
1104 | - switch ( $_orderby ) { |
|
1104 | + switch ($_orderby) { |
|
1105 | 1105 | case 'id': |
1106 | 1106 | $orderby = 'VNU_ID'; |
1107 | 1107 | break; |
@@ -1119,43 +1119,43 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | |
1122 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
1122 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
1123 | 1123 | |
1124 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1125 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
1126 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1124 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1125 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1126 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1127 | 1127 | |
1128 | 1128 | |
1129 | - $offset = ($current_page-1)*$per_page; |
|
1129 | + $offset = ($current_page - 1) * $per_page; |
|
1130 | 1130 | $limit = array($offset, $per_page); |
1131 | 1131 | |
1132 | - $category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1132 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1133 | 1133 | $where = array(); |
1134 | 1134 | |
1135 | 1135 | //only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
1136 | - if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) { |
|
1136 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1137 | 1137 | $where['status'] = $this->_req_data['status']; |
1138 | 1138 | } |
1139 | 1139 | |
1140 | - if ( isset( $this->_req_data['venue_status'] ) ) { |
|
1140 | + if (isset($this->_req_data['venue_status'])) { |
|
1141 | 1141 | $where['status'] = $this->_req_data['venue_status']; |
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | |
1145 | - if ( $category ) { |
|
1145 | + if ($category) { |
|
1146 | 1146 | $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
1147 | 1147 | $where['Term_Taxonomy.term_id'] = $category; |
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | |
1151 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) { |
|
1152 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1151 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1152 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1153 | 1153 | } else { |
1154 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) { |
|
1154 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1155 | 1155 | $where['OR'] = array( |
1156 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1156 | + 'status*restrict_private' => array('!=', 'private'), |
|
1157 | 1157 | 'AND' => array( |
1158 | - 'status*inclusive' => array( '=', 'private' ), |
|
1158 | + 'status*inclusive' => array('=', 'private'), |
|
1159 | 1159 | 'VNU_wp_user' => get_current_user_id() |
1160 | 1160 | ) |
1161 | 1161 | ); |
@@ -1165,30 +1165,30 @@ discard block |
||
1165 | 1165 | |
1166 | 1166 | |
1167 | 1167 | |
1168 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1169 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1168 | + if (isset($this->_req_data['s'])) { |
|
1169 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1170 | 1170 | $where['OR'] = array( |
1171 | - 'VNU_name' => array('LIKE',$sstr ), |
|
1172 | - 'VNU_desc' => array('LIKE',$sstr ), |
|
1173 | - 'VNU_short_desc' => array( 'LIKE',$sstr ), |
|
1174 | - 'VNU_address' => array( 'LIKE', $sstr ), |
|
1175 | - 'VNU_address2' => array( 'LIKE', $sstr ), |
|
1176 | - 'VNU_city' => array( 'LIKE', $sstr ), |
|
1177 | - 'VNU_zip' => array( 'LIKE', $sstr ), |
|
1178 | - 'VNU_phone' => array( 'LIKE', $sstr ), |
|
1179 | - 'VNU_url' => array( 'LIKE', $sstr ), |
|
1180 | - 'VNU_virtual_phone' => array( 'LIKE', $sstr ), |
|
1181 | - 'VNU_virtual_url' => array( 'LIKE', $sstr ), |
|
1182 | - 'VNU_google_map_link' => array( 'LIKE', $sstr ), |
|
1183 | - 'Event.EVT_name' => array('LIKE', $sstr ), |
|
1184 | - 'Event.EVT_desc' => array('LIKE', $sstr ), |
|
1185 | - 'Event.EVT_phone' => array('LIKE', $sstr ), |
|
1186 | - 'Event.EVT_external_URL' => array('LIKE', $sstr ), |
|
1171 | + 'VNU_name' => array('LIKE', $sstr), |
|
1172 | + 'VNU_desc' => array('LIKE', $sstr), |
|
1173 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
1174 | + 'VNU_address' => array('LIKE', $sstr), |
|
1175 | + 'VNU_address2' => array('LIKE', $sstr), |
|
1176 | + 'VNU_city' => array('LIKE', $sstr), |
|
1177 | + 'VNU_zip' => array('LIKE', $sstr), |
|
1178 | + 'VNU_phone' => array('LIKE', $sstr), |
|
1179 | + 'VNU_url' => array('LIKE', $sstr), |
|
1180 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1181 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1182 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1183 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1184 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1185 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1186 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1187 | 1187 | ); |
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | |
1191 | - $venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) ); |
|
1191 | + $venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort)); |
|
1192 | 1192 | |
1193 | 1193 | return $venues; |
1194 | 1194 | |
@@ -1206,22 +1206,22 @@ discard block |
||
1206 | 1206 | * @return void |
1207 | 1207 | */ |
1208 | 1208 | private function _set_category_object() { |
1209 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
1209 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
1210 | 1210 | return; //already have the category object so get out. |
1211 | 1211 | |
1212 | 1212 | //set default category object |
1213 | 1213 | $this->_set_empty_category_object(); |
1214 | 1214 | |
1215 | 1215 | //only set if we've got an id |
1216 | - if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) { |
|
1216 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1217 | 1217 | return; |
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | $category_id = absint($this->_req_data['VEN_CAT_ID']); |
1221 | - $term = get_term( $category_id, 'espresso_venue_categories' ); |
|
1221 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
1222 | 1222 | |
1223 | 1223 | |
1224 | - if ( !empty( $term ) ) { |
|
1224 | + if ( ! empty($term)) { |
|
1225 | 1225 | $this->_category->category_name = $term->name; |
1226 | 1226 | $this->_category->category_identifier = $term->slug; |
1227 | 1227 | $this->_category->category_desc = $term->description; |
@@ -1235,14 +1235,14 @@ discard block |
||
1235 | 1235 | |
1236 | 1236 | private function _set_empty_category_object() { |
1237 | 1237 | $this->_category = new stdClass(); |
1238 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1238 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1239 | 1239 | $this->_category->id = $this->_category->parent = 0; |
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | |
1243 | 1243 | |
1244 | 1244 | protected function _category_list_table() { |
1245 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1245 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1246 | 1246 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
1247 | 1247 | $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
1248 | 1248 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -1258,13 +1258,13 @@ discard block |
||
1258 | 1258 | $this->_set_add_edit_form_tags($route); |
1259 | 1259 | |
1260 | 1260 | $this->_set_category_object(); |
1261 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
1261 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1262 | 1262 | |
1263 | 1263 | $delete_action = 'delete_category'; |
1264 | 1264 | |
1265 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url ); |
|
1265 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1266 | 1266 | |
1267 | - $this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect ); |
|
1267 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1268 | 1268 | |
1269 | 1269 | //take care of contents |
1270 | 1270 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -1278,25 +1278,25 @@ discard block |
||
1278 | 1278 | 'type' => 'wp_editor', |
1279 | 1279 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
1280 | 1280 | 'class' => 'my_editor_custom', |
1281 | - 'wpeditor_args' => array( 'media_buttons' => FALSE ) |
|
1281 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
1282 | 1282 | ); |
1283 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
1283 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1284 | 1284 | |
1285 | - $all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
1285 | + $all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
1286 | 1286 | |
1287 | 1287 | //setup category select for term parents. |
1288 | 1288 | $category_select_values[] = array( |
1289 | 1289 | 'text' => __('No Parent', 'event_espresso'), |
1290 | 1290 | 'id' => 0 |
1291 | 1291 | ); |
1292 | - foreach ( $all_terms as $term ) { |
|
1292 | + foreach ($all_terms as $term) { |
|
1293 | 1293 | $category_select_values[] = array( |
1294 | 1294 | 'text' => $term->name, |
1295 | 1295 | 'id' => $term->term_id |
1296 | 1296 | ); |
1297 | 1297 | } |
1298 | 1298 | |
1299 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
1299 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
1300 | 1300 | $template_args = array( |
1301 | 1301 | 'category' => $this->_category, |
1302 | 1302 | 'category_select' => $category_select, |
@@ -1305,15 +1305,15 @@ discard block |
||
1305 | 1305 | 'disable' => '', |
1306 | 1306 | 'disabled_message' =>FALSE |
1307 | 1307 | ); |
1308 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1309 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
1308 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
1309 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1310 | 1310 | } |
1311 | 1311 | |
1312 | 1312 | |
1313 | 1313 | protected function _delete_categories() { |
1314 | - $cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1314 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1315 | 1315 | |
1316 | - foreach ( $cat_ids as $cat_id ) { |
|
1316 | + foreach ($cat_ids as $cat_id) { |
|
1317 | 1317 | $this->_delete_category($cat_id); |
1318 | 1318 | } |
1319 | 1319 | |
@@ -1321,7 +1321,7 @@ discard block |
||
1321 | 1321 | $query_args = array( |
1322 | 1322 | 'action' => 'category_list' |
1323 | 1323 | ); |
1324 | - $this->_redirect_after_action(0,'','',$query_args); |
|
1324 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1325 | 1325 | |
1326 | 1326 | } |
1327 | 1327 | |
@@ -1330,58 +1330,58 @@ discard block |
||
1330 | 1330 | |
1331 | 1331 | |
1332 | 1332 | protected function _delete_category($cat_id) { |
1333 | - $cat_id = absint( $cat_id ); |
|
1334 | - wp_delete_term( $cat_id, 'espresso_venue_categories' ); |
|
1333 | + $cat_id = absint($cat_id); |
|
1334 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1335 | 1335 | } |
1336 | 1336 | |
1337 | 1337 | |
1338 | 1338 | |
1339 | 1339 | protected function _insert_or_update_category($new_category) { |
1340 | 1340 | |
1341 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
1341 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
1342 | 1342 | $success = 0; //we already have a success message so lets not send another. |
1343 | - if ( $cat_id ) { |
|
1343 | + if ($cat_id) { |
|
1344 | 1344 | $query_args = array( |
1345 | 1345 | 'action' => 'edit_category', |
1346 | 1346 | 'VEN_CAT_ID' => $cat_id |
1347 | 1347 | ); |
1348 | 1348 | } else { |
1349 | - $query_args = array( 'action' => 'add_category' ); |
|
1349 | + $query_args = array('action' => 'add_category'); |
|
1350 | 1350 | } |
1351 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
1351 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
1352 | 1352 | |
1353 | 1353 | } |
1354 | 1354 | |
1355 | 1355 | |
1356 | 1356 | |
1357 | - private function _insert_category( $update = FALSE ) { |
|
1357 | + private function _insert_category($update = FALSE) { |
|
1358 | 1358 | $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
1359 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
1360 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
1361 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
1359 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1360 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1361 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1362 | 1362 | |
1363 | - if ( empty( $category_name ) ) { |
|
1364 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
1365 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1363 | + if (empty($category_name)) { |
|
1364 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1365 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1366 | 1366 | return false; |
1367 | 1367 | } |
1368 | 1368 | |
1369 | 1369 | |
1370 | - $term_args=array( |
|
1370 | + $term_args = array( |
|
1371 | 1371 | 'name'=>$category_name, |
1372 | 1372 | 'description'=>$category_desc, |
1373 | 1373 | 'parent'=>$category_parent |
1374 | 1374 | ); |
1375 | 1375 | |
1376 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args ); |
|
1376 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args); |
|
1377 | 1377 | |
1378 | - if ( !is_array( $insert_ids ) ) { |
|
1379 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
1380 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1378 | + if ( ! is_array($insert_ids)) { |
|
1379 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1380 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1381 | 1381 | } else { |
1382 | 1382 | $cat_id = $insert_ids['term_id']; |
1383 | - $msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name ); |
|
1384 | - EE_Error::add_success( $msg ); |
|
1383 | + $msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name); |
|
1384 | + EE_Error::add_success($msg); |
|
1385 | 1385 | } |
1386 | 1386 | |
1387 | 1387 | return $cat_id; |
@@ -1401,11 +1401,11 @@ discard block |
||
1401 | 1401 | 'category_ids' => $this->_req_data['VEN_CAT_ID'] |
1402 | 1402 | ); |
1403 | 1403 | |
1404 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
1404 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1405 | 1405 | |
1406 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
1407 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
1408 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
1406 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
1407 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
1408 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
1409 | 1409 | $EE_Export->export(); |
1410 | 1410 | } |
1411 | 1411 | |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | |
1418 | 1418 | protected function _import_categories() { |
1419 | 1419 | |
1420 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1420 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
1421 | 1421 | EE_Import::instance()->import(); |
1422 | 1422 | |
1423 | 1423 | } |
@@ -1425,29 +1425,29 @@ discard block |
||
1425 | 1425 | |
1426 | 1426 | |
1427 | 1427 | |
1428 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
1428 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
1429 | 1429 | |
1430 | 1430 | //testing term stuff |
1431 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1432 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
1433 | - $limit = ($current_page-1)*$per_page; |
|
1434 | - $where = array( 'taxonomy' => 'espresso_venue_categories' ); |
|
1435 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1436 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1431 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1432 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1433 | + $limit = ($current_page - 1) * $per_page; |
|
1434 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1435 | + if (isset($this->_req_data['s'])) { |
|
1436 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1437 | 1437 | $where['OR'] = array( |
1438 | - 'Term.name' => array( 'LIKE', $sstr), |
|
1439 | - 'description' => array( 'LIKE', $sstr ) |
|
1438 | + 'Term.name' => array('LIKE', $sstr), |
|
1439 | + 'description' => array('LIKE', $sstr) |
|
1440 | 1440 | ); |
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | $query_params = array( |
1444 | 1444 | $where, |
1445 | - 'order_by' => array( $orderby => $order ), |
|
1446 | - 'limit' => $limit . ',' . $per_page, |
|
1445 | + 'order_by' => array($orderby => $order), |
|
1446 | + 'limit' => $limit.','.$per_page, |
|
1447 | 1447 | 'force_join' => array('Term') |
1448 | 1448 | ); |
1449 | 1449 | |
1450 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
1450 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1451 | 1451 | |
1452 | 1452 | return $categories; |
1453 | 1453 | } |
@@ -25,12 +25,12 @@ |
||
25 | 25 | required /> |
26 | 26 | <p class="description"> |
27 | 27 | <?php |
28 | - printf( |
|
29 | - __('An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', 'event_espresso'), |
|
30 | - '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">', |
|
31 | - '</a>' |
|
32 | - ); |
|
33 | - ?> |
|
28 | + printf( |
|
29 | + __('An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', 'event_espresso'), |
|
30 | + '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">', |
|
31 | + '</a>' |
|
32 | + ); |
|
33 | + ?> |
|
34 | 34 | </p> |
35 | 35 | </td> |
36 | 36 | </tr> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | </td> |
16 | 16 | </tr> |
17 | 17 | <?php |
18 | - if( apply_filters( 'FHEE__google_map__show_api_key_input', true ) ) { ?> |
|
18 | + if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?> |
|
19 | 19 | <tr> |
20 | 20 | <th> |
21 | 21 | <label for="ee-google-map-api-key"> |
@@ -110,19 +110,19 @@ discard block |
||
110 | 110 | <td> |
111 | 111 | <label for="event_details_control_type-default" class="ee-admin-radio-lbl"> |
112 | 112 | <?php $checked = $map_settings->event_details_control_type == 'default' ? 'checked="checked"' : ''; ?> |
113 | - <input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked;?>/> |
|
113 | + <input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked; ?>/> |
|
114 | 114 | <?php _e(' Default', 'event_espresso') ?> |
115 | 115 | </label> |
116 | 116 | |
117 | 117 | <label for="event_details_control_type-horizontal" class="ee-admin-radio-lbl"> |
118 | 118 | <?php $checked = $map_settings->event_details_control_type == 'horizontal' ? 'checked="checked"' : ''; ?> |
119 | - <input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked;?>/> |
|
119 | + <input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked; ?>/> |
|
120 | 120 | <?php _e(' Horizontal', 'event_espresso') ?> |
121 | 121 | </label> |
122 | 122 | |
123 | 123 | <label for="event_details_control_type-dropdown" class="ee-admin-radio-lbl"> |
124 | 124 | <?php $checked = $map_settings->event_details_control_type == 'dropdown' ? 'checked="checked"' : ''; ?> |
125 | - <input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked;?>/> |
|
125 | + <input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked; ?>/> |
|
126 | 126 | <?php _e(' Dropdown', 'event_espresso') ?> |
127 | 127 | </label> |
128 | 128 | </td> |
@@ -135,25 +135,25 @@ discard block |
||
135 | 135 | <td> |
136 | 136 | <label for="event_details_map_align-none" class="ee-admin-radio-lbl"> |
137 | 137 | <?php $checked = $map_settings->event_details_map_align == 'none' ? 'checked="checked"' : ''; ?> |
138 | - <input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked;?>/> |
|
138 | + <input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked; ?>/> |
|
139 | 139 | <?php _e(' None', 'event_espresso') ?> |
140 | 140 | </label> |
141 | 141 | |
142 | 142 | <label for="event_details_map_align-left" class="ee-admin-radio-lbl"> |
143 | 143 | <?php $checked = $map_settings->event_details_map_align == 'left' ? 'checked="checked"' : ''; ?> |
144 | - <input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked;?>/> |
|
144 | + <input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked; ?>/> |
|
145 | 145 | <?php _e(' Align Left', 'event_espresso') ?> |
146 | 146 | </label> |
147 | 147 | |
148 | 148 | <label for="event_details_map_align-center" class="ee-admin-radio-lbl"> |
149 | 149 | <?php $checked = $map_settings->event_details_map_align == 'center' ? 'checked="checked"' : ''; ?> |
150 | - <input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked;?>/> |
|
150 | + <input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked; ?>/> |
|
151 | 151 | <?php _e(' Align Center', 'event_espresso') ?> |
152 | 152 | </label> |
153 | 153 | |
154 | 154 | <label for="event_details_map_align-right" class="ee-admin-radio-lbl"> |
155 | 155 | <?php $checked = $map_settings->event_details_map_align == 'right' ? 'checked="checked"' : ''; ?> |
156 | - <input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked;?>/> |
|
156 | + <input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked; ?>/> |
|
157 | 157 | <?php _e(' Align Right', 'event_espresso') ?> |
158 | 158 | </label> |
159 | 159 | </td> |
@@ -228,19 +228,19 @@ discard block |
||
228 | 228 | <td> |
229 | 229 | <label for="event_list_control_type-default" class="ee-admin-radio-lbl"> |
230 | 230 | <?php $checked = $map_settings->event_list_control_type == 'default' ? 'checked="checked"' : ''; ?> |
231 | - <input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked;?>/> |
|
231 | + <input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked; ?>/> |
|
232 | 232 | <?php _e(' Default', 'event_espresso') ?> |
233 | 233 | </label> |
234 | 234 | |
235 | 235 | <label for="event_list_control_type-horizontal" class="ee-admin-radio-lbl"> |
236 | 236 | <?php $checked = $map_settings->event_list_control_type == 'horizontal' ? 'checked="checked"' : ''; ?> |
237 | - <input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked;?>/> |
|
237 | + <input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked; ?>/> |
|
238 | 238 | <?php _e(' Horizontal', 'event_espresso') ?> |
239 | 239 | </label> |
240 | 240 | |
241 | 241 | <label for="event_list_control_type-dropdown" class="ee-admin-radio-lbl"> |
242 | 242 | <?php $checked = $map_settings->event_list_control_type == 'dropdown' ? 'checked="checked"' : ''; ?> |
243 | - <input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked;?>/> |
|
243 | + <input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked; ?>/> |
|
244 | 244 | <?php _e(' Dropdown', 'event_espresso') ?> |
245 | 245 | </label> |
246 | 246 | |
@@ -254,25 +254,25 @@ discard block |
||
254 | 254 | <td> |
255 | 255 | <label for="event_list_map_align-none" class="ee-admin-radio-lbl"> |
256 | 256 | <?php $checked = $map_settings->event_list_map_align == 'none' ? 'checked="checked"' : ''; ?> |
257 | - <input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked;?>/> |
|
257 | + <input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked; ?>/> |
|
258 | 258 | <?php _e(' None', 'event_espresso') ?> |
259 | 259 | </label> |
260 | 260 | |
261 | 261 | <label for="event_list_map_align-left" class="ee-admin-radio-lbl"> |
262 | 262 | <?php $checked = $map_settings->event_list_map_align == 'left' ? 'checked="checked"' : ''; ?> |
263 | - <input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked;?>/> |
|
263 | + <input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked; ?>/> |
|
264 | 264 | <?php _e(' Align Left', 'event_espresso') ?> |
265 | 265 | </label> |
266 | 266 | |
267 | 267 | <label for="event_list_map_align-center" class="ee-admin-radio-lbl"> |
268 | 268 | <?php $checked = $map_settings->event_list_map_align == 'center' ? 'checked="checked"' : ''; ?> |
269 | - <input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked;?>/> |
|
269 | + <input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked; ?>/> |
|
270 | 270 | <?php _e(' Align Center', 'event_espresso') ?> |
271 | 271 | </label> |
272 | 272 | |
273 | 273 | <label for="event_list_map_align-right" class="ee-admin-radio-lbl"> |
274 | 274 | <?php $checked = $map_settings->event_list_map_align == 'right' ? 'checked="checked"' : ''; ?> |
275 | - <input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked;?>/> |
|
275 | + <input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked; ?>/> |
|
276 | 276 | <?php _e(' Align Right', 'event_espresso') ?> |
277 | 277 | </label> |
278 | 278 |
@@ -18,43 +18,43 @@ |
||
18 | 18 | * @throws EE_Error |
19 | 19 | * @return string of html to display the field |
20 | 20 | */ |
21 | - public function display(){ |
|
21 | + public function display() { |
|
22 | 22 | $input = $this->get_input(); |
23 | 23 | //d( $input ); |
24 | - $multi = count( $input->options() ) > 1 ? TRUE : FALSE; |
|
24 | + $multi = count($input->options()) > 1 ? TRUE : FALSE; |
|
25 | 25 | $input->set_label_sizes(); |
26 | 26 | $label_size_class = $input->get_label_size_class(); |
27 | 27 | $html = ''; |
28 | - if ( ! is_array( $input->raw_value() ) && $input->raw_value() !== NULL ) { |
|
28 | + if ( ! is_array($input->raw_value()) && $input->raw_value() !== NULL) { |
|
29 | 29 | EE_Error::doing_it_wrong( |
30 | 30 | 'EE_Checkbox_Display_Strategy::display()', |
31 | 31 | sprintf( |
32 | - __( 'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', 'event_espresso'), |
|
32 | + __('Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"', 'event_espresso'), |
|
33 | 33 | $input->html_id(), |
34 | - var_export( $input->raw_value(), true), |
|
35 | - $input->html_name() . '[]' |
|
34 | + var_export($input->raw_value(), true), |
|
35 | + $input->html_name().'[]' |
|
36 | 36 | ), |
37 | 37 | '4.8.1' |
38 | 38 | ); |
39 | 39 | } |
40 | - $input_raw_value = (array)$input->raw_value(); |
|
41 | - foreach( $input->options() as $value => $display_text ){ |
|
42 | - $value = $input->get_normalization_strategy()->unnormalize_one( $value ); |
|
43 | - $html_id = $this->get_sub_input_id( $value ); |
|
44 | - $html .= EEH_HTML::nl( 0, 'checkbox' ); |
|
45 | - $html .= '<label for="' . $html_id . '" id="' . $html_id . '-lbl" class="ee-checkbox-label-after' . $label_size_class . '">'; |
|
46 | - $html .= EEH_HTML::nl( 1, 'checkbox' ); |
|
40 | + $input_raw_value = (array) $input->raw_value(); |
|
41 | + foreach ($input->options() as $value => $display_text) { |
|
42 | + $value = $input->get_normalization_strategy()->unnormalize_one($value); |
|
43 | + $html_id = $this->get_sub_input_id($value); |
|
44 | + $html .= EEH_HTML::nl(0, 'checkbox'); |
|
45 | + $html .= '<label for="'.$html_id.'" id="'.$html_id.'-lbl" class="ee-checkbox-label-after'.$label_size_class.'">'; |
|
46 | + $html .= EEH_HTML::nl(1, 'checkbox'); |
|
47 | 47 | $html .= '<input type="checkbox"'; |
48 | - $html .= ' name="' . $input->html_name() . '[]"'; |
|
49 | - $html .= ' id="' . $html_id . '"'; |
|
50 | - $html .= ' class="' . $input->html_class() . '"'; |
|
51 | - $html .= ' style="' . $input->html_style() . '"'; |
|
52 | - $html .= ' value="' . esc_attr( $value ) . '"'; |
|
53 | - $html .= ! empty( $input_raw_value ) && in_array( $value, $input_raw_value ) ? ' checked="checked"' : ''; |
|
54 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
48 | + $html .= ' name="'.$input->html_name().'[]"'; |
|
49 | + $html .= ' id="'.$html_id.'"'; |
|
50 | + $html .= ' class="'.$input->html_class().'"'; |
|
51 | + $html .= ' style="'.$input->html_style().'"'; |
|
52 | + $html .= ' value="'.esc_attr($value).'"'; |
|
53 | + $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value) ? ' checked="checked"' : ''; |
|
54 | + $html .= ' '.$this->_input->other_html_attributes(); |
|
55 | 55 | $html .= '> '; |
56 | 56 | $html .= $display_text; |
57 | - $html .= EEH_HTML::nl( -1, 'checkbox' ) . '</label>'; |
|
57 | + $html .= EEH_HTML::nl( -1, 'checkbox' ).'</label>'; |
|
58 | 58 | } |
59 | 59 | return $html; |
60 | 60 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * Specialized form for payment methods, allowing for easy setting and retrieving of meta fields. |
5 | 5 | * Uses EEM_Payment_Method as the model |
6 | 6 | */ |
7 | -class EE_Payment_Method_Form extends EE_Model_Form_Section{ |
|
7 | +class EE_Payment_Method_Form extends EE_Model_Form_Section { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * All the subsection inputs that correspond ot extra meta rows |
@@ -39,37 +39,37 @@ discard block |
||
39 | 39 | * @see EE_Model_Form_Section::__construct() for more |
40 | 40 | * } |
41 | 41 | */ |
42 | - public function __construct($options_array = array()){ |
|
42 | + public function __construct($options_array = array()) { |
|
43 | 43 | $this->_model = EEM_Payment_Method::instance(); |
44 | 44 | $this->_options_array = $options_array; |
45 | - if(isset($options_array['payment_method_type'])){ |
|
45 | + if (isset($options_array['payment_method_type'])) { |
|
46 | 46 | $this->_payment_method_type = $options_array['payment_method_type']; |
47 | 47 | } |
48 | 48 | $options_array = $this->_options_array; |
49 | - if(isset($options_array['extra_meta_inputs'])){ |
|
50 | - $this->_extra_meta_inputs = array_merge($this->_extra_meta_inputs,$options_array['extra_meta_inputs']); |
|
49 | + if (isset($options_array['extra_meta_inputs'])) { |
|
50 | + $this->_extra_meta_inputs = array_merge($this->_extra_meta_inputs, $options_array['extra_meta_inputs']); |
|
51 | 51 | } |
52 | - if($this->_extra_meta_inputs){ |
|
53 | - $this->_subsections = array_merge($this->_subsections,$this->_extra_meta_inputs); |
|
52 | + if ($this->_extra_meta_inputs) { |
|
53 | + $this->_subsections = array_merge($this->_subsections, $this->_extra_meta_inputs); |
|
54 | 54 | } |
55 | 55 | $this->_subsections['PMD_button_url'] = new EE_Admin_File_Uploader_Input( |
56 | - array( 'html_label_text'=> __( 'Button URL', 'event_espresso' )) |
|
56 | + array('html_label_text'=> __('Button URL', 'event_espresso')) |
|
57 | 57 | ); |
58 | 58 | $this->_subsections['PMD_scope'] = new EE_Checkbox_Multi_Input( |
59 | 59 | EEM_Payment_Method::instance()->scopes(), |
60 | - array( 'html_label_text' => $this->_model->field_settings_for('PMD_scope')->get_nicename() . EEH_Template::get_help_tab_link( 'payment_methods_overview' )) |
|
60 | + array('html_label_text' => $this->_model->field_settings_for('PMD_scope')->get_nicename().EEH_Template::get_help_tab_link('payment_methods_overview')) |
|
61 | 61 | ); |
62 | 62 | //setup the currency options |
63 | 63 | $this->_subsections['Currency'] = new EE_Select_Multi_Model_Input( |
64 | - EEM_Currency::instance()->get_all_currencies_usable_by( $this->_payment_method_type ), |
|
64 | + EEM_Currency::instance()->get_all_currencies_usable_by($this->_payment_method_type), |
|
65 | 65 | array( |
66 | - 'html_label_text'=> __( 'Currencies Supported', 'event_espresso' ), |
|
66 | + 'html_label_text'=> __('Currencies Supported', 'event_espresso'), |
|
67 | 67 | 'required'=>TRUE |
68 | 68 | ) |
69 | 69 | ); |
70 | - $this->_subsections['PMD_order'] = new EE_Text_Input( array( |
|
71 | - 'html_label_text' => __( 'Order', 'event_espresso' ), |
|
72 | - 'html_help_text' => __( 'Lowest numbers will be shown first', 'event_espresso' ), |
|
70 | + $this->_subsections['PMD_order'] = new EE_Text_Input(array( |
|
71 | + 'html_label_text' => __('Order', 'event_espresso'), |
|
72 | + 'html_help_text' => __('Lowest numbers will be shown first', 'event_espresso'), |
|
73 | 73 | 'normalization_strategy' => new EE_Int_Normalization(), |
74 | 74 | 'validation_strategies' => array( |
75 | 75 | new EE_Int_Validation_Strategy() |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | )); |
79 | 79 | $this->_layout_strategy = new EE_Admin_Two_Column_Layout(); |
80 | 80 | parent::__construct($options_array); |
81 | - $debug_mode = isset( $this->_subsections[ 'PMD_debug_mode' ] ) ? $this->_subsections[ 'PMD_debug_mode' ] : null; |
|
82 | - if( $debug_mode instanceof EE_Form_Input_Base ) { |
|
83 | - $debug_mode->set_html_help_text( __( 'This payment method has a Sandbox Server (also known as Testing Server, Development Server, Quality Assurance Server, etc). While in debug mode and using this sandbox server, real payments will not be processed.', 'event_espresso' ) ); |
|
81 | + $debug_mode = isset($this->_subsections['PMD_debug_mode']) ? $this->_subsections['PMD_debug_mode'] : null; |
|
82 | + if ($debug_mode instanceof EE_Form_Input_Base) { |
|
83 | + $debug_mode->set_html_help_text(__('This payment method has a Sandbox Server (also known as Testing Server, Development Server, Quality Assurance Server, etc). While in debug mode and using this sandbox server, real payments will not be processed.', 'event_espresso')); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | * @param string $name |
93 | 93 | * @throws EE_Error |
94 | 94 | */ |
95 | - public function _construct_finalize( $parent_form_section, $name ) { |
|
96 | - if( ! $this->_payment_method_type instanceof EE_PMT_Base ){ |
|
97 | - throw new EE_Error( sprintf( __( 'Payment Method forms must have set their payment method type BEFORE calling _construct_finalize', 'event_espresso' ))); |
|
95 | + public function _construct_finalize($parent_form_section, $name) { |
|
96 | + if ( ! $this->_payment_method_type instanceof EE_PMT_Base) { |
|
97 | + throw new EE_Error(sprintf(__('Payment Method forms must have set their payment method type BEFORE calling _construct_finalize', 'event_espresso'))); |
|
98 | 98 | } |
99 | 99 | //set the name of this form based on the payment method type |
100 | - if( ! $this->_name && ! $name ){ |
|
101 | - $name = str_replace(" ","_",ucwords(str_replace("_"," ",($this->_payment_method_type->system_name()))))."_Settings_Form"; |
|
100 | + if ( ! $this->_name && ! $name) { |
|
101 | + $name = str_replace(" ", "_", ucwords(str_replace("_", " ", ($this->_payment_method_type->system_name()))))."_Settings_Form"; |
|
102 | 102 | } |
103 | - parent::_construct_finalize( $parent_form_section, $name ); |
|
103 | + parent::_construct_finalize($parent_form_section, $name); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @param $payment_method_type |
110 | 110 | * @throws EE_Error |
111 | 111 | */ |
112 | - public function set_payment_method_type( $payment_method_type ){ |
|
113 | - if( ! $payment_method_type instanceof EE_PMT_Base){ |
|
112 | + public function set_payment_method_type($payment_method_type) { |
|
113 | + if ( ! $payment_method_type instanceof EE_PMT_Base) { |
|
114 | 114 | throw new EE_Error(sprintf(__("Payment Method forms MUST set a payment method type by using _set_payment_method_type", "event_espresso"))); |
115 | 115 | } |
116 | 116 | $this->_payment_method_type = $payment_method_type; |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | * extends the model form section's save method to also save the extra meta field values |
123 | 123 | * @return int ID of the payment method inserted, or true on update |
124 | 124 | */ |
125 | - public function save(){ |
|
125 | + public function save() { |
|
126 | 126 | $parent_save_val = parent::save(); |
127 | - if( $this->_model_object && $this->_model_object->ID()){ |
|
128 | - foreach($this->_extra_meta_inputs as $input_name => $input){ |
|
127 | + if ($this->_model_object && $this->_model_object->ID()) { |
|
128 | + foreach ($this->_extra_meta_inputs as $input_name => $input) { |
|
129 | 129 | $this->_model_object->update_extra_meta($input_name, $input->normalized_value()); |
130 | 130 | } |
131 | 131 | } |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | $model_obj = $this->_model->ensure_is_obj($model_obj); |
143 | 143 | parent::populate_model_obj($model_obj); |
144 | 144 | $extra_meta = $model_obj->all_extra_meta_array(); |
145 | - foreach($this->_extra_meta_inputs as $input_name => $extra_meta_input){ |
|
146 | - if(isset($extra_meta[$input_name])){ |
|
145 | + foreach ($this->_extra_meta_inputs as $input_name => $extra_meta_input) { |
|
146 | + if (isset($extra_meta[$input_name])) { |
|
147 | 147 | $extra_meta_input->set_default($extra_meta[$input_name]); |
148 | 148 | } |
149 | 149 | } |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | * gets the default name of this form section if none is specified |
156 | 156 | * @return string |
157 | 157 | */ |
158 | - protected function _set_default_name_if_empty(){ |
|
159 | - if( ! $this->_name ){ |
|
160 | - $default_name = str_replace("EEM_", "", get_class($this->_model)) . "_Model_Form"; |
|
161 | - $this->_name = $default_name; |
|
158 | + protected function _set_default_name_if_empty() { |
|
159 | + if ( ! $this->_name) { |
|
160 | + $default_name = str_replace("EEM_", "", get_class($this->_model))."_Model_Form"; |
|
161 | + $this->_name = $default_name; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * Gets all the extra meta inputs in this form |
169 | 169 | * @return EE_Form_Input_Base[] |
170 | 170 | */ |
171 | - public function extra_meta_inputs(){ |
|
171 | + public function extra_meta_inputs() { |
|
172 | 172 | return $this->_extra_meta_inputs; |
173 | 173 | } |
174 | 174 | } |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | function __construct() { |
31 | 31 | parent::__construct( |
32 | 32 | 'ee-upcoming-events-widget', |
33 | - __( 'Event Espresso Upcoming Events', 'event_espresso' ), |
|
34 | - array( 'description' => __( 'A widget to display your upcoming events.', 'event_espresso' )), |
|
33 | + __('Event Espresso Upcoming Events', 'event_espresso'), |
|
34 | + array('description' => __('A widget to display your upcoming events.', 'event_espresso')), |
|
35 | 35 | array( |
36 | 36 | 'width' => 300, |
37 | 37 | 'height' => 350, |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @param array $instance Previously saved values from database. |
50 | 50 | * @return string|void |
51 | 51 | */ |
52 | - public function form( $instance ) { |
|
52 | + public function form($instance) { |
|
53 | 53 | |
54 | - EE_Registry::instance()->load_class( 'Question_Option', array(), FALSE, FALSE, TRUE ); |
|
54 | + EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE); |
|
55 | 55 | // Set up some default widget settings. |
56 | 56 | $defaults = array( |
57 | 57 | 'title' => __('Upcoming Events', 'event_espresso'), |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | 'image_size' => 'medium' |
67 | 67 | ); |
68 | 68 | |
69 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
69 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
70 | 70 | // don't add HTML labels for EE_Form_Fields generated inputs |
71 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
71 | + add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
72 | 72 | $yes_no_values = array( |
73 | - EE_Question_Option::new_instance( array( 'QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
74 | - EE_Question_Option::new_instance( array( 'QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
73 | + EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
74 | + EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | ?> |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | <label for="<?php echo $this->get_field_id('title'); ?>"> |
83 | 83 | <?php _e('Title:', 'event_espresso'); ?> |
84 | 84 | </label> |
85 | - <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type="text" /> |
|
85 | + <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" type="text" /> |
|
86 | 86 | </p> |
87 | 87 | <p> |
88 | 88 | <label for="<?php echo $this->get_field_id('category_name'); ?>"> |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | <?php |
92 | 92 | $event_categories = array(); |
93 | 93 | /** @type EEM_Term $EEM_Term */ |
94 | - $EEM_Term = EE_Registry::instance()->load_model( 'Term' ); |
|
95 | - $categories = $EEM_Term->get_all_ee_categories( TRUE ); |
|
96 | - if ( $categories ) { |
|
97 | - foreach ( $categories as $category ) { |
|
98 | - if ( $category instanceof EE_Term ) { |
|
99 | - $event_categories[] = EE_Question_Option::new_instance( array( 'QSO_value' => $category->get( 'slug' ), 'QSO_desc' => $category->get( 'name' ))); |
|
94 | + $EEM_Term = EE_Registry::instance()->load_model('Term'); |
|
95 | + $categories = $EEM_Term->get_all_ee_categories(TRUE); |
|
96 | + if ($categories) { |
|
97 | + foreach ($categories as $category) { |
|
98 | + if ($category instanceof EE_Term) { |
|
99 | + $event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name'))); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | - array_unshift( $event_categories, EE_Question_Option::new_instance( array( 'QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
103 | + array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
104 | 104 | echo EEH_Form_Fields::select( |
105 | 105 | __('Event Category:', 'event_espresso'), |
106 | 106 | $instance['category_name'], |
@@ -137,16 +137,16 @@ discard block |
||
137 | 137 | <?php |
138 | 138 | $image_sizes = array(); |
139 | 139 | $sizes = get_intermediate_image_sizes(); |
140 | - if ( $sizes ) { |
|
140 | + if ($sizes) { |
|
141 | 141 | // loop thru images and create option objects out of them |
142 | - foreach ( $sizes as $image_size ) { |
|
143 | - $image_size = trim( $image_size ); |
|
142 | + foreach ($sizes as $image_size) { |
|
143 | + $image_size = trim($image_size); |
|
144 | 144 | // no big images plz |
145 | - if ( ! in_array( $image_size, array( 'large', 'post-thumbnail' ))) { |
|
146 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => $image_size, 'QSO_desc' => $image_size )); |
|
145 | + if ( ! in_array($image_size, array('large', 'post-thumbnail'))) { |
|
146 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size)); |
|
147 | 147 | } |
148 | 148 | } |
149 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso') )); |
|
149 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso'))); |
|
150 | 150 | } |
151 | 151 | echo EEH_Form_Fields::select( |
152 | 152 | __('Image Size:', 'event_espresso'), |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | <label for="<?php echo $this->get_field_id('date_limit'); ?>"> |
205 | 205 | <?php _e('Number of Dates to Display:', 'event_espresso'); ?> |
206 | 206 | </label> |
207 | - <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr( $instance['date_limit'] ); ?>" size="3" type="text" /> |
|
207 | + <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr($instance['date_limit']); ?>" size="3" type="text" /> |
|
208 | 208 | </p> |
209 | 209 | <p> |
210 | 210 | <label for="<?php echo $this->get_field_id('date_range'); ?>"> |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return array Updated safe values to be saved. |
238 | 238 | */ |
239 | - public function update( $new_instance, $old_instance ) { |
|
239 | + public function update($new_instance, $old_instance) { |
|
240 | 240 | $instance = $old_instance; |
241 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
241 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
242 | 242 | $instance['category_name'] = $new_instance['category_name']; |
243 | 243 | $instance['show_expired'] = $new_instance['show_expired']; |
244 | 244 | $instance['limit'] = $new_instance['limit']; |
@@ -261,18 +261,18 @@ discard block |
||
261 | 261 | * @param array $args Widget arguments. |
262 | 262 | * @param array $instance Saved values from database. |
263 | 263 | */ |
264 | - public function widget( $args, $instance ) { |
|
264 | + public function widget($args, $instance) { |
|
265 | 265 | |
266 | 266 | global $post; |
267 | 267 | // make sure there is some kinda post object |
268 | - if ( $post instanceof WP_Post ) { |
|
268 | + if ($post instanceof WP_Post) { |
|
269 | 269 | $before_widget = ''; |
270 | 270 | $before_title = ''; |
271 | 271 | $after_title = ''; |
272 | 272 | $after_widget = ''; |
273 | 273 | // but NOT an events archives page, cuz that would be like two event lists on the same page |
274 | - $show_everywhere = isset( $instance['show_everywhere'] ) ? (bool) absint( $instance['show_everywhere'] ) : TRUE; |
|
275 | - if ( $show_everywhere || ! ( $post->post_type == 'espresso_events' && is_archive() )) { |
|
274 | + $show_everywhere = isset($instance['show_everywhere']) ? (bool) absint($instance['show_everywhere']) : TRUE; |
|
275 | + if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
276 | 276 | // let's use some of the event helper functions' |
277 | 277 | // make separate vars out of attributes |
278 | 278 | |
@@ -291,81 +291,81 @@ discard block |
||
291 | 291 | // Before widget (defined by themes). |
292 | 292 | echo $before_widget; |
293 | 293 | // Display the widget title if one was input (before and after defined by themes). |
294 | - if ( ! empty( $title )) { |
|
295 | - echo $before_title . $title . $after_title; |
|
294 | + if ( ! empty($title)) { |
|
295 | + echo $before_title.$title.$after_title; |
|
296 | 296 | } |
297 | 297 | // grab widget settings |
298 | - $category = isset( $instance['category_name'] ) && ! empty( $instance['category_name'] ) ? $instance['category_name'] : FALSE; |
|
299 | - $show_expired = isset( $instance['show_expired'] ) ? (bool) absint( $instance['show_expired'] ) : FALSE; |
|
300 | - $image_size = isset( $instance['image_size'] ) && ! empty( $instance['image_size'] ) ? $instance['image_size'] : 'medium'; |
|
301 | - $show_desc = isset( $instance['show_desc'] ) ? (bool) absint( $instance['show_desc'] ) : TRUE; |
|
302 | - $show_dates = isset( $instance['show_dates'] ) ? (bool) absint( $instance['show_dates'] ) : TRUE; |
|
303 | - $date_limit = isset( $instance['date_limit'] ) && ! empty( $instance['date_limit'] ) ? $instance['date_limit'] : NULL; |
|
304 | - $date_range = isset( $instance['date_range'] ) && ! empty( $instance['date_range'] ) ? $instance['date_range'] : FALSE; |
|
298 | + $category = isset($instance['category_name']) && ! empty($instance['category_name']) ? $instance['category_name'] : FALSE; |
|
299 | + $show_expired = isset($instance['show_expired']) ? (bool) absint($instance['show_expired']) : FALSE; |
|
300 | + $image_size = isset($instance['image_size']) && ! empty($instance['image_size']) ? $instance['image_size'] : 'medium'; |
|
301 | + $show_desc = isset($instance['show_desc']) ? (bool) absint($instance['show_desc']) : TRUE; |
|
302 | + $show_dates = isset($instance['show_dates']) ? (bool) absint($instance['show_dates']) : TRUE; |
|
303 | + $date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) ? $instance['date_limit'] : NULL; |
|
304 | + $date_range = isset($instance['date_range']) && ! empty($instance['date_range']) ? $instance['date_range'] : FALSE; |
|
305 | 305 | // start to build our where clause |
306 | 306 | $where = array( |
307 | 307 | // 'Datetime.DTT_is_primary' => 1, |
308 | 308 | 'status' => 'publish' |
309 | 309 | ); |
310 | 310 | // add category |
311 | - if ( $category ) { |
|
311 | + if ($category) { |
|
312 | 312 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
313 | 313 | $where['Term_Taxonomy.Term.slug'] = $category; |
314 | 314 | } |
315 | 315 | // if NOT expired then we want events that start today or in the future |
316 | - if ( ! $show_expired ) { |
|
317 | - $where['Datetime.DTT_EVT_end'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
316 | + if ( ! $show_expired) { |
|
317 | + $where['Datetime.DTT_EVT_end'] = array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
318 | 318 | } |
319 | 319 | // run the query |
320 | - $events = EE_Registry::instance()->load_model( 'Event' )->get_all( array( |
|
320 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array( |
|
321 | 321 | $where, |
322 | - 'limit' => $instance['limit'] > 0 ? '0,' . $instance['limit'] : '0,10', |
|
322 | + 'limit' => $instance['limit'] > 0 ? '0,'.$instance['limit'] : '0,10', |
|
323 | 323 | 'order_by' => 'Datetime.DTT_EVT_start', |
324 | 324 | 'order' => 'ASC', |
325 | 325 | 'group_by' => 'EVT_ID' |
326 | 326 | )); |
327 | 327 | |
328 | - if ( ! empty( $events )) { |
|
328 | + if ( ! empty($events)) { |
|
329 | 329 | echo '<ul class="ee-upcoming-events-widget-ul">'; |
330 | - foreach ( $events as $event ) { |
|
331 | - if ( $event instanceof EE_Event && ( !is_single() || $post->ID != $event->ID() ) ) { |
|
330 | + foreach ($events as $event) { |
|
331 | + if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) { |
|
332 | 332 | //printr( $event, '$event <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
333 | - echo '<li id="ee-upcoming-events-widget-li-' . $event->ID() . '" class="ee-upcoming-events-widget-li">'; |
|
333 | + echo '<li id="ee-upcoming-events-widget-li-'.$event->ID().'" class="ee-upcoming-events-widget-li">'; |
|
334 | 334 | // how big is the event name ? |
335 | - $name_length = strlen( $event->name() ); |
|
336 | - switch( $name_length ) { |
|
335 | + $name_length = strlen($event->name()); |
|
336 | + switch ($name_length) { |
|
337 | 337 | case $name_length > 70 : |
338 | - $len_class = ' three-line'; |
|
338 | + $len_class = ' three-line'; |
|
339 | 339 | break; |
340 | 340 | case $name_length > 35 : |
341 | - $len_class = ' two-line'; |
|
341 | + $len_class = ' two-line'; |
|
342 | 342 | break; |
343 | 343 | default : |
344 | - $len_class = ' one-line'; |
|
344 | + $len_class = ' one-line'; |
|
345 | 345 | } |
346 | - $event_url = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event ); |
|
347 | - echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a' . $len_class . '" href="' . $event_url . '">' . $event->name() . '</a></h5>'; |
|
348 | - if ( post_password_required( $event->ID() ) ) { |
|
349 | - $pswd_form = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form( $event->ID() ), $event ); |
|
346 | + $event_url = apply_filters('FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event); |
|
347 | + echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a'.$len_class.'" href="'.$event_url.'">'.$event->name().'</a></h5>'; |
|
348 | + if (post_password_required($event->ID())) { |
|
349 | + $pswd_form = apply_filters('FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form($event->ID()), $event); |
|
350 | 350 | echo $pswd_form; |
351 | 351 | } else { |
352 | - if ( has_post_thumbnail( $event->ID() ) && $image_size != 'none' ) { |
|
353 | - echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="' . $event_url . '">' . get_the_post_thumbnail( $event->ID(), $image_size ) . '</a></div>'; |
|
352 | + if (has_post_thumbnail($event->ID()) && $image_size != 'none') { |
|
353 | + echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="'.$event_url.'">'.get_the_post_thumbnail($event->ID(), $image_size).'</a></div>'; |
|
354 | 354 | } |
355 | - $desc = $event->short_description( 25 ); |
|
356 | - if ( $show_dates ) { |
|
357 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', get_option( 'date_format' )); |
|
358 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', get_option( 'time_format' )); |
|
359 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', get_option( 'date_format' )); |
|
360 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
|
361 | - if ( $date_range == TRUE ) { |
|
362 | - echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
|
363 | - }else{ |
|
364 | - echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
|
355 | + $desc = $event->short_description(25); |
|
356 | + if ($show_dates) { |
|
357 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', get_option('date_format')); |
|
358 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', get_option('time_format')); |
|
359 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', get_option('date_format')); |
|
360 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', get_option('time_format')); |
|
361 | + if ($date_range == TRUE) { |
|
362 | + echo espresso_event_date_range($date_format, $time_format, $single_date_format, $single_time_format, $event->ID()); |
|
363 | + } else { |
|
364 | + echo espresso_list_of_event_dates($event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit); |
|
365 | 365 | } |
366 | 366 | } |
367 | - if ( $show_desc && $desc ) { |
|
368 | - echo '<p style="margin-top: .5em">' . $desc . '</p>'; |
|
367 | + if ($show_desc && $desc) { |
|
368 | + echo '<p style="margin-top: .5em">'.$desc.'</p>'; |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | echo '</li>'; |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @return string |
390 | 390 | */ |
391 | 391 | public function make_the_title_a_link($title) { |
392 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
392 | + return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>'; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -360,7 +362,7 @@ discard block |
||
360 | 362 | $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
361 | 363 | if ( $date_range == TRUE ) { |
362 | 364 | echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
363 | - }else{ |
|
365 | + } else{ |
|
364 | 366 | echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
365 | 367 | } |
366 | 368 | } |
@@ -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 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Paypal_Pro extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Paypal_Pro extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @param EE_Payment_Method $pm_instance |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | require_once($this->file_folder().'EEG_Paypal_Pro.gateway.php'); |
36 | 36 | $this->_gateway = new EEG_Paypal_Pro(); |
37 | 37 | $this->_pretty_name = __("Paypal Pro", 'event_espresso'); |
38 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
38 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
39 | 39 | $this->_requires_https = true; |
40 | 40 | parent::__construct($pm_instance); |
41 | 41 | } |
@@ -51,21 +51,21 @@ discard block |
||
51 | 51 | 'extra_meta_inputs'=>array( |
52 | 52 | // 'paypal_email'=>new EE_Email_Input(), not actually used |
53 | 53 | 'username'=>new EE_Text_Input(array( |
54 | - 'html_label_text'=> sprintf(__("Paypal API Username %s", "event_espresso"),$this->get_help_tab_link()), |
|
54 | + 'html_label_text'=> sprintf(__("Paypal API Username %s", "event_espresso"), $this->get_help_tab_link()), |
|
55 | 55 | 'required' => true |
56 | 56 | )), |
57 | 57 | 'password'=>new EE_Text_Input(array( |
58 | - 'html_label_text'=> sprintf(__("Paypal API Password %s", "event_espresso"),$this->get_help_tab_link()), |
|
58 | + 'html_label_text'=> sprintf(__("Paypal API Password %s", "event_espresso"), $this->get_help_tab_link()), |
|
59 | 59 | 'required' => true |
60 | 60 | )), |
61 | 61 | 'signature'=>new EE_Text_Input(array( |
62 | - 'html_label_text'=> sprintf(__("Paypal API Signature %s", "event_espresso"),$this->get_help_tab_link()), |
|
62 | + 'html_label_text'=> sprintf(__("Paypal API Signature %s", "event_espresso"), $this->get_help_tab_link()), |
|
63 | 63 | 'required' => true |
64 | 64 | )), |
65 | 65 | 'credit_card_types'=>new EE_Checkbox_Multi_Input( |
66 | 66 | $this->card_types_supported(), |
67 | 67 | array( |
68 | - 'html_label_text' => __( 'Card Types Supported', 'event_espresso' ), |
|
68 | + 'html_label_text' => __('Card Types Supported', 'event_espresso'), |
|
69 | 69 | 'required' => true )), |
70 | 70 | ) |
71 | 71 | ) |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | * @throws \EE_Error |
80 | 80 | * @return EE_Billing_Info_Form |
81 | 81 | */ |
82 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
83 | - $allowed_types = $this->_pm_instance->get_extra_meta( 'credit_card_types', TRUE ); |
|
82 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
83 | + $allowed_types = $this->_pm_instance->get_extra_meta('credit_card_types', TRUE); |
|
84 | 84 | //if allowed types is a string or empty array or null... |
85 | - if( empty( $allowed_types )) { |
|
85 | + if (empty($allowed_types)) { |
|
86 | 86 | $allowed_types = array(); |
87 | 87 | } |
88 | 88 | |
@@ -93,26 +93,26 @@ discard block |
||
93 | 93 | // 'html_id'=> 'ee-Paypal_Pro-billing-form', |
94 | 94 | 'subsections'=>array( |
95 | 95 | 'credit_card'=>new EE_Credit_Card_Input( |
96 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Number', 'event_espresso' )) |
|
96 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Number', 'event_espresso')) |
|
97 | 97 | ), |
98 | 98 | 'credit_card_type'=>new EE_Select_Input( |
99 | 99 | //the options are set dynamically |
100 | - array_intersect_key( EE_PMT_Paypal_Pro::card_types_supported(), array_flip( $allowed_types )), |
|
101 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Type', 'event_espresso' )) |
|
100 | + array_intersect_key(EE_PMT_Paypal_Pro::card_types_supported(), array_flip($allowed_types)), |
|
101 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Type', 'event_espresso')) |
|
102 | 102 | ), |
103 | 103 | 'exp_month'=>new EE_Credit_Card_Month_Input( |
104 | - TRUE, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) ) |
|
104 | + TRUE, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Expiry Month', 'event_espresso')) |
|
105 | 105 | ), |
106 | 106 | 'exp_year'=>new EE_Credit_Card_Year_Input( |
107 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) ) |
|
107 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Expiry Year', 'event_espresso')) |
|
108 | 108 | ), |
109 | 109 | 'cvv'=>new EE_CVV_Input( |
110 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'CVV', 'event_espresso' ) ) |
|
110 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('CVV', 'event_espresso')) |
|
111 | 111 | ), |
112 | 112 | ) |
113 | 113 | ) |
114 | 114 | ); |
115 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
115 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | * @param \EE_Billing_Info_Form $billing_form |
125 | 125 | * @return \EE_Billing_Info_Form |
126 | 126 | */ |
127 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
128 | - if ( $this->_pm_instance->debug_mode() ) { |
|
127 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
128 | + if ($this->_pm_instance->debug_mode()) { |
|
129 | 129 | $billing_form->add_subsections( |
130 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
130 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
131 | 131 | 'credit_card' |
132 | 132 | ); |
133 | 133 | $billing_form->add_subsections( |
134 | - array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php' )), |
|
134 | + array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php')), |
|
135 | 135 | 'first_name' |
136 | 136 | ); |
137 | - $billing_form->get_input( 'credit_card_type' )->set_default( 'Visa' ); |
|
138 | - $billing_form->get_input( 'exp_year' )->set_default( 2018); |
|
139 | - $billing_form->get_input( 'cvv' )->set_default( '115' ); |
|
137 | + $billing_form->get_input('credit_card_type')->set_default('Visa'); |
|
138 | + $billing_form->get_input('exp_year')->set_default(2018); |
|
139 | + $billing_form->get_input('cvv')->set_default('115'); |
|
140 | 140 | } |
141 | 141 | return $billing_form; |
142 | 142 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * Keys are their values, values are their pretty names. |
149 | 149 | * @return array |
150 | 150 | */ |
151 | - public static function card_types_supported(){ |
|
151 | + public static function card_types_supported() { |
|
152 | 152 | return array( |
153 | 153 | 'Visa'=> __("Visa", 'event_espresso'), |
154 | 154 | 'MasterCard'=> __("MasterCard", 'event_espresso'), |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @see EE_PMT_Base::help_tabs_config() |
165 | 165 | * @return array |
166 | 166 | */ |
167 | - public function help_tabs_config(){ |
|
167 | + public function help_tabs_config() { |
|
168 | 168 | return array( |
169 | 169 | $this->get_help_tab_name() => array( |
170 | 170 | 'title' => __('PayPal Pro Settings', 'event_espresso'), |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | * @param EE_Billing_Info_Form $billing_form |
180 | 180 | * @return array |
181 | 181 | */ |
182 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
183 | - $billing_values = parent::_get_billing_values_from_form( $billing_form ); |
|
184 | - $billing_values[ 'country' ] = $billing_form->get_input_value( 'country' ); |
|
185 | - $billing_values[ 'credit_card_type' ] = $billing_form->get_input_value( 'credit_card_type' ); |
|
182 | + protected function _get_billing_values_from_form($billing_form) { |
|
183 | + $billing_values = parent::_get_billing_values_from_form($billing_form); |
|
184 | + $billing_values['country'] = $billing_form->get_input_value('country'); |
|
185 | + $billing_values['credit_card_type'] = $billing_form->get_input_value('credit_card_type'); |
|
186 | 186 | return $billing_values; |
187 | 187 | } |
188 | 188 |