@@ -5,42 +5,42 @@ |
||
| 5 | 5 | <table class="admin-primary-mbox-tbl"> |
| 6 | 6 | <thead> |
| 7 | 7 | <tr> |
| 8 | - <th class="jst-left"><?php esc_html_e( 'Event Name', 'event_espresso' );?></th> |
|
| 9 | - <th class="jst-left"><?php esc_html_e( 'REG ID', 'event_espresso' );?></th> |
|
| 10 | - <th class="jst-left"><?php esc_html_e( 'TXN ID', 'event_espresso' );?></th> |
|
| 11 | - <th class="jst-left"><?php esc_html_e( 'Reg Code', 'event_espresso' );?></th> |
|
| 12 | - <th class="jst-rght"><?php esc_html_e( 'Ticket Price', 'event_espresso' );?></th> |
|
| 8 | + <th class="jst-left"><?php esc_html_e('Event Name', 'event_espresso'); ?></th> |
|
| 9 | + <th class="jst-left"><?php esc_html_e('REG ID', 'event_espresso'); ?></th> |
|
| 10 | + <th class="jst-left"><?php esc_html_e('TXN ID', 'event_espresso'); ?></th> |
|
| 11 | + <th class="jst-left"><?php esc_html_e('Reg Code', 'event_espresso'); ?></th> |
|
| 12 | + <th class="jst-rght"><?php esc_html_e('Ticket Price', 'event_espresso'); ?></th> |
|
| 13 | 13 | </tr> |
| 14 | 14 | </thead> |
| 15 | 15 | <tbody> |
| 16 | - <?php foreach( $registrations as $registration ) : ?> |
|
| 16 | + <?php foreach ($registrations as $registration) : ?> |
|
| 17 | 17 | <tr> |
| 18 | 18 | <td class="jst-left"> |
| 19 | 19 | <?php |
| 20 | - $event_url = add_query_arg( array( 'action' => 'edit', 'post' => $registration->event_ID() ), admin_url( 'admin.php?page=espresso_events' )); |
|
| 21 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $registration->event_ID() ) ? '<a href="'. $event_url .'" title="'. esc_attr__( 'Edit Event', 'event_espresso' ) .'">' . $registration->event_name() . '</a>' : $registration->event_name(); |
|
| 20 | + $event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events')); |
|
| 21 | + echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="'.$event_url.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.$registration->event_name().'</a>' : $registration->event_name(); |
|
| 22 | 22 | ?> |
| 23 | 23 | </td> |
| 24 | 24 | <td class="jst-left"> |
| 25 | 25 | <?php |
| 26 | - $reg_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
| 27 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? ' |
|
| 28 | - <a href="'.$reg_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . |
|
| 29 | - esc_html__( 'View Registration', 'event_espresso' ) . |
|
| 26 | + $reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
| 27 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' |
|
| 28 | + <a href="'.$reg_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'. |
|
| 29 | + esc_html__('View Registration', 'event_espresso'). |
|
| 30 | 30 | '</a>' : $registration->ID(); |
| 31 | 31 | ?> |
| 32 | 32 | </td> |
| 33 | 33 | <td class="jst-left"> |
| 34 | 34 | <?php |
| 35 | - $txn_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID() ), TXN_ADMIN_URL ); |
|
| 36 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
| 37 | - <a href="'.$txn_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' . |
|
| 38 | - sprintf( esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID() ) . |
|
| 35 | + $txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID()), TXN_ADMIN_URL); |
|
| 36 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
| 37 | + <a href="'.$txn_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'. |
|
| 38 | + sprintf(esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID()). |
|
| 39 | 39 | '</a>' : $registration->transaction_ID(); |
| 40 | 40 | ?> |
| 41 | 41 | </td> |
| 42 | - <td class="jst-left"><?php echo $registration->reg_code();?></td> |
|
| 43 | - <td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->final_price() );?></td> |
|
| 42 | + <td class="jst-left"><?php echo $registration->reg_code(); ?></td> |
|
| 43 | + <td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td> |
|
| 44 | 44 | </tr> |
| 45 | 45 | <?php endforeach; ?> |
| 46 | 46 | </tbody> |
@@ -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 | |
@@ -156,26 +156,26 @@ discard block |
||
| 156 | 156 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
| 157 | 157 | * @return mixed |
| 158 | 158 | */ |
| 159 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
| 159 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
| 160 | 160 | // first use WP locate_template to check for template in the current theme folder |
| 161 | - $template_path = locate_template( $templates ); |
|
| 161 | + $template_path = locate_template($templates); |
|
| 162 | 162 | |
| 163 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
| 163 | + if ($check_if_custom && ! empty($template_path)) |
|
| 164 | 164 | return TRUE; |
| 165 | 165 | |
| 166 | 166 | // not in the theme |
| 167 | - if ( empty( $template_path )) { |
|
| 167 | + if (empty($template_path)) { |
|
| 168 | 168 | // not even a template to look for ? |
| 169 | - if ( empty( $templates )) { |
|
| 169 | + if (empty($templates)) { |
|
| 170 | 170 | // get post_type |
| 171 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
| 171 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
| 172 | 172 | // get array of EE Custom Post Types |
| 173 | 173 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
| 174 | 174 | // build template name based on request |
| 175 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
| 176 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
| 177 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
| 178 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
| 175 | + if (isset($EE_CPTs[$post_type])) { |
|
| 176 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
| 177 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
| 178 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | // currently active EE template theme |
@@ -184,78 +184,78 @@ discard block |
||
| 184 | 184 | // array of paths to folders that may contain templates |
| 185 | 185 | $template_folder_paths = array( |
| 186 | 186 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
| 187 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
| 187 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
| 188 | 188 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
| 189 | 189 | EVENT_ESPRESSO_TEMPLATE_DIR |
| 190 | 190 | ); |
| 191 | 191 | |
| 192 | 192 | //add core plugin folders for checking only if we're not $check_if_custom |
| 193 | - if ( ! $check_if_custom ) { |
|
| 193 | + if ( ! $check_if_custom) { |
|
| 194 | 194 | $core_paths = array( |
| 195 | 195 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
| 196 | - EE_PUBLIC . $current_theme, |
|
| 196 | + EE_PUBLIC.$current_theme, |
|
| 197 | 197 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
| 198 | - EE_TEMPLATES . $current_theme, |
|
| 198 | + EE_TEMPLATES.$current_theme, |
|
| 199 | 199 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
| 200 | 200 | EE_PLUGIN_DIR_PATH |
| 201 | 201 | ); |
| 202 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
| 202 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // now filter that array |
| 206 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
| 207 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
| 208 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
| 206 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
| 207 | + $templates = is_array($templates) ? $templates : array($templates); |
|
| 208 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
| 209 | 209 | // array to hold all possible template paths |
| 210 | 210 | $full_template_paths = array(); |
| 211 | 211 | // loop through $templates |
| 212 | - foreach ( $templates as $template ) { |
|
| 212 | + foreach ($templates as $template) { |
|
| 213 | 213 | // normalize directory separators |
| 214 | - $template = str_replace( array( '\\', '/' ), DS, $template ); |
|
| 215 | - $file_name = basename( $template ); |
|
| 216 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
| 214 | + $template = str_replace(array('\\', '/'), DS, $template); |
|
| 215 | + $file_name = basename($template); |
|
| 216 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
| 217 | 217 | // while looping through all template folder paths |
| 218 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
| 218 | + foreach ($template_folder_paths as $template_folder_path) { |
|
| 219 | 219 | // normalize directory separators |
| 220 | - $template_folder_path = str_replace( array( '\\', '/' ), DS, $template_folder_path ); |
|
| 220 | + $template_folder_path = str_replace(array('\\', '/'), DS, $template_folder_path); |
|
| 221 | 221 | // determine if any common base path exists between the two paths |
| 222 | 222 | $common_base_path = EEH_Template::_find_common_base_path( |
| 223 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
| 223 | + array($template_folder_path, $template_path_minus_file_name) |
|
| 224 | 224 | ); |
| 225 | - if ( $common_base_path !== '' ) { |
|
| 225 | + if ($common_base_path !== '') { |
|
| 226 | 226 | // both paths have a common base, so just tack the filename onto our search path |
| 227 | - $resolved_path = rtrim( $template_folder_path, DS ) . DS . $file_name; |
|
| 227 | + $resolved_path = rtrim($template_folder_path, DS).DS.$file_name; |
|
| 228 | 228 | } else { |
| 229 | 229 | // no common base path, so let's just concatenate |
| 230 | - $resolved_path = rtrim( $template_folder_path, DS ) . DS . $template; |
|
| 230 | + $resolved_path = rtrim($template_folder_path, DS).DS.$template; |
|
| 231 | 231 | } |
| 232 | 232 | // build up our template locations array by adding our resolved paths |
| 233 | 233 | $full_template_paths[] = $resolved_path; |
| 234 | 234 | } |
| 235 | 235 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
| 236 | - array_unshift( $full_template_paths, $template ); |
|
| 236 | + array_unshift($full_template_paths, $template); |
|
| 237 | 237 | // absolute path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
| 238 | - array_unshift( $full_template_paths, get_template_directory() . DS . $file_name ); |
|
| 238 | + array_unshift($full_template_paths, get_template_directory().DS.$file_name); |
|
| 239 | 239 | } |
| 240 | 240 | // filter final array of full template paths |
| 241 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths ); |
|
| 241 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths); |
|
| 242 | 242 | // now loop through our final array of template location paths and check each location |
| 243 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
| 244 | - if ( is_readable( $full_template_path )) { |
|
| 245 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
| 243 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
| 244 | + if (is_readable($full_template_path)) { |
|
| 245 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
| 246 | 246 | break; |
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | // if we got it and you want to see it... |
| 251 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
| 252 | - if ( $return_string ) { |
|
| 253 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
| 251 | + if ($template_path && $load && ! $check_if_custom) { |
|
| 252 | + if ($return_string) { |
|
| 253 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
| 254 | 254 | } else { |
| 255 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
| 255 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
| 258 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | |
@@ -268,21 +268,21 @@ discard block |
||
| 268 | 268 | * @param array $paths |
| 269 | 269 | * @return string |
| 270 | 270 | */ |
| 271 | - protected static function _find_common_base_path( $paths ) { |
|
| 271 | + protected static function _find_common_base_path($paths) { |
|
| 272 | 272 | $last_offset = 0; |
| 273 | 273 | $common_base_path = ''; |
| 274 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
| 274 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
| 275 | 275 | $dir_length = $index - $last_offset + 1; |
| 276 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
| 277 | - foreach ( $paths as $path ) { |
|
| 278 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
| 276 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
| 277 | + foreach ($paths as $path) { |
|
| 278 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
| 279 | 279 | return $common_base_path; |
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | $common_base_path .= $directory; |
| 283 | 283 | $last_offset = $index + 1; |
| 284 | 284 | } |
| 285 | - return substr( $common_base_path, 0, -1 ); |
|
| 285 | + return substr($common_base_path, 0, -1); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
@@ -294,9 +294,9 @@ discard block |
||
| 294 | 294 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
| 295 | 295 | * @return mixed string |
| 296 | 296 | */ |
| 297 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
| 297 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
| 298 | 298 | //require the template validator for verifying variables are set according to how the template requires |
| 299 | - EE_Registry::instance()->load_helper( 'Template_Validator' ); |
|
| 299 | + EE_Registry::instance()->load_helper('Template_Validator'); |
|
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | 302 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -307,26 +307,26 @@ discard block |
||
| 307 | 307 | * |
| 308 | 308 | * @since 4.6.0 |
| 309 | 309 | */ |
| 310 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
| 311 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
| 310 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
| 311 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
| 312 | 312 | |
| 313 | 313 | // you gimme nuttin - YOU GET NUTTIN !! |
| 314 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
| 314 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
| 315 | 315 | return ''; |
| 316 | 316 | } |
| 317 | 317 | // if $template_args are not in an array, then make it so |
| 318 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
| 319 | - $template_args = array( $template_args ); |
|
| 318 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
| 319 | + $template_args = array($template_args); |
|
| 320 | 320 | } |
| 321 | - extract( (array) $template_args); |
|
| 321 | + extract((array) $template_args); |
|
| 322 | 322 | |
| 323 | - if ( $return_string ) { |
|
| 323 | + if ($return_string) { |
|
| 324 | 324 | // because we want to return a string, we are going to capture the output |
| 325 | 325 | ob_start(); |
| 326 | - include( $template_path ); |
|
| 326 | + include($template_path); |
|
| 327 | 327 | return ob_get_clean(); |
| 328 | 328 | } else { |
| 329 | - include( $template_path ); |
|
| 329 | + include($template_path); |
|
| 330 | 330 | } |
| 331 | 331 | return ''; |
| 332 | 332 | } |
@@ -344,27 +344,27 @@ discard block |
||
| 344 | 344 | * @param string $suffix added to the end of the generated class |
| 345 | 345 | * @return string |
| 346 | 346 | */ |
| 347 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
| 347 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
| 348 | 348 | // in the beginning... |
| 349 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
| 349 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
| 350 | 350 | // da muddle |
| 351 | 351 | $class = ''; |
| 352 | 352 | // the end |
| 353 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
| 353 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
| 354 | 354 | // is the passed object an EE object ? |
| 355 | - if ( $object instanceof EE_Base_Class ) { |
|
| 355 | + if ($object instanceof EE_Base_Class) { |
|
| 356 | 356 | // grab the exact type of object |
| 357 | - $obj_class = get_class( $object ); |
|
| 357 | + $obj_class = get_class($object); |
|
| 358 | 358 | // depending on the type of object... |
| 359 | - switch ( $obj_class ) { |
|
| 359 | + switch ($obj_class) { |
|
| 360 | 360 | // no specifics just yet... |
| 361 | 361 | default : |
| 362 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
| 363 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
| 362 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
| 363 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
| 364 | 364 | |
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | - return $prefix . $class . $suffix; |
|
| 367 | + return $prefix.$class.$suffix; |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | |
@@ -380,50 +380,50 @@ discard block |
||
| 380 | 380 | * @param string $cur_code_span_class |
| 381 | 381 | * @return string the html output for the formatted money value |
| 382 | 382 | */ |
| 383 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
| 383 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
| 384 | 384 | // ensure amount was received |
| 385 | - if ( is_null( $amount ) ) { |
|
| 386 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
| 387 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 385 | + if (is_null($amount)) { |
|
| 386 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
| 387 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 388 | 388 | return ''; |
| 389 | 389 | } |
| 390 | 390 | //ensure amount is float |
| 391 | 391 | $amount = (float) $amount; |
| 392 | 392 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
| 393 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
| 393 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
| 394 | 394 | // still a number or was amount converted to a string like "free" ? |
| 395 | - if ( is_float( $amount_formatted )) { |
|
| 395 | + if (is_float($amount_formatted)) { |
|
| 396 | 396 | // was a country ISO code passed ? if so generate currency config object for that country |
| 397 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
| 397 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
| 398 | 398 | // verify results |
| 399 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
| 399 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
| 400 | 400 | // set default config country currency settings |
| 401 | 401 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
| 402 | 402 | } |
| 403 | 403 | // format float |
| 404 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
| 404 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
| 405 | 405 | // add formatting ? |
| 406 | - if ( ! $return_raw ) { |
|
| 406 | + if ( ! $return_raw) { |
|
| 407 | 407 | // add currency sign |
| 408 | - if( $mny->sign_b4 ){ |
|
| 409 | - if( $amount >= 0 ){ |
|
| 410 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
| 411 | - }else{ |
|
| 412 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
| 408 | + if ($mny->sign_b4) { |
|
| 409 | + if ($amount >= 0) { |
|
| 410 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
| 411 | + } else { |
|
| 412 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - }else{ |
|
| 416 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
| 415 | + } else { |
|
| 416 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | // add currency code ? |
| 420 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
| 420 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
| 421 | 421 | } |
| 422 | 422 | // filter results |
| 423 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
| 423 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
| 424 | 424 | } |
| 425 | 425 | // clean up vars |
| 426 | - unset( $mny ); |
|
| 426 | + unset($mny); |
|
| 427 | 427 | // return formatted currency amount |
| 428 | 428 | return $amount_formatted; |
| 429 | 429 | } |
@@ -438,11 +438,11 @@ discard block |
||
| 438 | 438 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
| 439 | 439 | * @return string The localized label for the status id. |
| 440 | 440 | */ |
| 441 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
| 441 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
| 442 | 442 | /** @type EEM_Status $EEM_Status */ |
| 443 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
| 444 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
| 445 | - return $status[ $status_id ]; |
|
| 443 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
| 444 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
| 445 | + return $status[$status_id]; |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | |
@@ -455,9 +455,9 @@ discard block |
||
| 455 | 455 | * @param string $icon |
| 456 | 456 | * @return string the html output for the button |
| 457 | 457 | */ |
| 458 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
| 459 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
| 460 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
| 458 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
| 459 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
| 460 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
| 461 | 461 | return $button; |
| 462 | 462 | } |
| 463 | 463 | |
@@ -474,21 +474,21 @@ discard block |
||
| 474 | 474 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
| 475 | 475 | * @return string generated link |
| 476 | 476 | */ |
| 477 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
| 477 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
| 478 | 478 | |
| 479 | - if ( ! $page ) |
|
| 480 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
| 479 | + if ( ! $page) |
|
| 480 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
| 481 | 481 | |
| 482 | - if ( ! $action ) |
|
| 483 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
| 482 | + if ( ! $action) |
|
| 483 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
| 484 | 484 | |
| 485 | 485 | $action = empty($action) ? 'default' : $action; |
| 486 | 486 | |
| 487 | 487 | |
| 488 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
| 489 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
| 490 | - $help_text = !$help_text ? '' : $help_text; |
|
| 491 | - 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>'; |
|
| 488 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
| 489 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
| 490 | + $help_text = ! $help_text ? '' : $help_text; |
|
| 491 | + 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>'; |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | |
@@ -500,31 +500,31 @@ discard block |
||
| 500 | 500 | * @param EE_Help_Tour |
| 501 | 501 | * @return string html |
| 502 | 502 | */ |
| 503 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
| 503 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
| 504 | 504 | $id = $tour->get_slug(); |
| 505 | 505 | $stops = $tour->get_stops(); |
| 506 | 506 | |
| 507 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
| 507 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
| 508 | 508 | |
| 509 | - foreach ( $stops as $stop ) { |
|
| 510 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
| 511 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
| 509 | + foreach ($stops as $stop) { |
|
| 510 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
| 511 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
| 512 | 512 | |
| 513 | 513 | //if container is set to modal then let's make sure we set the options accordingly |
| 514 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
| 514 | + if (empty($data_id) && empty($data_class)) { |
|
| 515 | 515 | $stop['options']['modal'] = true; |
| 516 | 516 | $stop['options']['expose'] = true; |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
| 520 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
| 519 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
| 520 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
| 521 | 521 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
| 522 | 522 | |
| 523 | 523 | //options |
| 524 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
| 524 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
| 525 | 525 | $options = ' data-options="'; |
| 526 | - foreach ( $stop['options'] as $option => $value ) { |
|
| 527 | - $options .= $option . ':' . $value . ';'; |
|
| 526 | + foreach ($stop['options'] as $option => $value) { |
|
| 527 | + $options .= $option.':'.$value.';'; |
|
| 528 | 528 | } |
| 529 | 529 | $options .= '"'; |
| 530 | 530 | } else { |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | //let's put all together |
| 535 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
| 535 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | $content .= '</ol>'; |
@@ -553,31 +553,31 @@ discard block |
||
| 553 | 553 | * @throws EE_Error |
| 554 | 554 | * @return string html structure for status. |
| 555 | 555 | */ |
| 556 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
| 557 | - if ( !is_array( $status_array ) ) |
|
| 558 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
| 556 | + public static function status_legend($status_array, $active_status = '') { |
|
| 557 | + if ( ! is_array($status_array)) |
|
| 558 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
| 559 | 559 | |
| 560 | 560 | $setup_array = array(); |
| 561 | - foreach ( $status_array as $item => $status ) { |
|
| 561 | + foreach ($status_array as $item => $status) { |
|
| 562 | 562 | $setup_array[$item] = array( |
| 563 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
| 564 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
| 563 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
| 564 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
| 565 | 565 | 'status' => $status |
| 566 | 566 | ); |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
| 570 | - $content .= '<h4>' . __('Status Legend', 'event_espresso') . '</h4>' . "\n"; |
|
| 571 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
| 572 | - foreach ( $setup_array as $item => $details ) { |
|
| 569 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
| 570 | + $content .= '<h4>'.__('Status Legend', 'event_espresso').'</h4>'."\n"; |
|
| 571 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
| 572 | + foreach ($setup_array as $item => $details) { |
|
| 573 | 573 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
| 574 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
| 575 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
| 576 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
| 577 | - $content .= '</dt>' . "\n"; |
|
| 574 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
| 575 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
| 576 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
| 577 | + $content .= '</dt>'."\n"; |
|
| 578 | 578 | } |
| 579 | - $content .= '</dl>' . "\n"; |
|
| 580 | - $content .= '</div>' . "\n"; |
|
| 579 | + $content .= '</dl>'."\n"; |
|
| 580 | + $content .= '</div>'."\n"; |
|
| 581 | 581 | return $content; |
| 582 | 582 | } |
| 583 | 583 | |
@@ -590,8 +590,8 @@ discard block |
||
| 590 | 590 | * @return string |
| 591 | 591 | */ |
| 592 | 592 | public static function layout_array_as_table($data) { |
| 593 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
| 594 | - $data = (array)$data; |
|
| 593 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
| 594 | + $data = (array) $data; |
|
| 595 | 595 | } |
| 596 | 596 | EE_Registry::instance()->load_helper('Array'); |
| 597 | 597 | ob_start(); |
@@ -605,10 +605,10 @@ discard block |
||
| 605 | 605 | ?> |
| 606 | 606 | <tr> |
| 607 | 607 | <td> |
| 608 | - <?php echo $data_key;?> |
|
| 608 | + <?php echo $data_key; ?> |
|
| 609 | 609 | </td> |
| 610 | 610 | <td> |
| 611 | - <?php echo self::layout_array_as_table($data_values);?> |
|
| 611 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
| 612 | 612 | </td> |
| 613 | 613 | </tr> |
| 614 | 614 | <?php |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | <ul> |
| 623 | 623 | <?php |
| 624 | 624 | foreach ($data as $datum) { |
| 625 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
| 625 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
| 626 | 626 | }?> |
| 627 | 627 | </ul> |
| 628 | 628 | <?php |
@@ -652,8 +652,8 @@ discard block |
||
| 652 | 652 | * |
| 653 | 653 | * @return string |
| 654 | 654 | */ |
| 655 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
| 656 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
| 655 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
| 656 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | |
@@ -677,13 +677,13 @@ discard block |
||
| 677 | 677 | * ) |
| 678 | 678 | * @return string |
| 679 | 679 | */ |
| 680 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
| 680 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
| 681 | 681 | $page_links = array(); |
| 682 | 682 | $disable_first = $disable_last = ''; |
| 683 | 683 | $total_items = (int) $total_items; |
| 684 | 684 | $per_page = (int) $per_page; |
| 685 | 685 | $current = (int) $current; |
| 686 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
| 686 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
| 687 | 687 | |
| 688 | 688 | //filter items_label |
| 689 | 689 | $items_label = apply_filters( |
@@ -691,68 +691,68 @@ discard block |
||
| 691 | 691 | $items_label |
| 692 | 692 | ); |
| 693 | 693 | |
| 694 | - if ( empty( $items_label ) |
|
| 695 | - || ! is_array( $items_label ) |
|
| 696 | - || ! isset( $items_label['single'] ) |
|
| 697 | - || ! isset( $items_label['plural'] ) ) { |
|
| 694 | + if (empty($items_label) |
|
| 695 | + || ! is_array($items_label) |
|
| 696 | + || ! isset($items_label['single']) |
|
| 697 | + || ! isset($items_label['plural'])) { |
|
| 698 | 698 | $items_label = array( |
| 699 | - 'single' => __( '1 item', 'event_espresso' ), |
|
| 700 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
| 699 | + 'single' => __('1 item', 'event_espresso'), |
|
| 700 | + 'plural' => __('%s items', 'event_espresso') |
|
| 701 | 701 | ); |
| 702 | 702 | } else { |
| 703 | 703 | $items_label = array( |
| 704 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
| 705 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
| 704 | + 'single' => '1 '.esc_html($items_label['single']), |
|
| 705 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
| 706 | 706 | ); |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - $total_pages = ceil( $total_items / $per_page ); |
|
| 709 | + $total_pages = ceil($total_items / $per_page); |
|
| 710 | 710 | |
| 711 | - if ( $total_pages <= 1 ) |
|
| 711 | + if ($total_pages <= 1) |
|
| 712 | 712 | return ''; |
| 713 | 713 | |
| 714 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
| 714 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
| 715 | 715 | |
| 716 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
| 716 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
| 717 | 717 | |
| 718 | - if ( $current === 1 ) { |
|
| 718 | + if ($current === 1) { |
|
| 719 | 719 | $disable_first = ' disabled'; |
| 720 | 720 | } |
| 721 | - if ( $current == $total_pages ) { |
|
| 721 | + if ($current == $total_pages) { |
|
| 722 | 722 | $disable_last = ' disabled'; |
| 723 | 723 | } |
| 724 | 724 | |
| 725 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 726 | - 'first-page' . $disable_first, |
|
| 727 | - esc_attr__( 'Go to the first page' ), |
|
| 728 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
| 725 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 726 | + 'first-page'.$disable_first, |
|
| 727 | + esc_attr__('Go to the first page'), |
|
| 728 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
| 729 | 729 | '«' |
| 730 | 730 | ); |
| 731 | 731 | |
| 732 | 732 | $page_links[] = sprintf( |
| 733 | 733 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 734 | - 'prev-page' . $disable_first, |
|
| 735 | - esc_attr__( 'Go to the previous page' ), |
|
| 736 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
| 734 | + 'prev-page'.$disable_first, |
|
| 735 | + esc_attr__('Go to the previous page'), |
|
| 736 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
| 737 | 737 | '‹' |
| 738 | 738 | ); |
| 739 | 739 | |
| 740 | - if ( ! $show_num_field ) { |
|
| 740 | + if ( ! $show_num_field) { |
|
| 741 | 741 | $html_current_page = $current; |
| 742 | 742 | } else { |
| 743 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
| 744 | - esc_attr__( 'Current page' ), |
|
| 743 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
| 744 | + esc_attr__('Current page'), |
|
| 745 | 745 | $current, |
| 746 | - strlen( $total_pages ) |
|
| 746 | + strlen($total_pages) |
|
| 747 | 747 | ); |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | $html_total_pages = sprintf( |
| 751 | 751 | '<span class="total-pages">%s</span>', |
| 752 | - number_format_i18n( $total_pages ) |
|
| 752 | + number_format_i18n($total_pages) |
|
| 753 | 753 | ); |
| 754 | 754 | $page_links[] = sprintf( |
| 755 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
| 755 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
| 756 | 756 | $html_current_page, |
| 757 | 757 | $html_total_pages, |
| 758 | 758 | '<span class="paging-input">', |
@@ -761,29 +761,29 @@ discard block |
||
| 761 | 761 | |
| 762 | 762 | $page_links[] = sprintf( |
| 763 | 763 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 764 | - 'next-page' . $disable_last, |
|
| 765 | - esc_attr__( 'Go to the next page' ), |
|
| 766 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
| 764 | + 'next-page'.$disable_last, |
|
| 765 | + esc_attr__('Go to the next page'), |
|
| 766 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
| 767 | 767 | '›' |
| 768 | 768 | ); |
| 769 | 769 | |
| 770 | 770 | $page_links[] = sprintf( |
| 771 | 771 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 772 | - 'last-page' . $disable_last, |
|
| 773 | - esc_attr__( 'Go to the last page' ), |
|
| 774 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
| 772 | + 'last-page'.$disable_last, |
|
| 773 | + esc_attr__('Go to the last page'), |
|
| 774 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
| 775 | 775 | '»' |
| 776 | 776 | ); |
| 777 | 777 | |
| 778 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
| 778 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
| 779 | 779 | // set page class |
| 780 | - if ( $total_pages ) { |
|
| 780 | + if ($total_pages) { |
|
| 781 | 781 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
| 782 | 782 | } else { |
| 783 | 783 | $page_class = ' no-pages'; |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
| 786 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | |