From 1add35a47ffd4fa489a78a9fc5e0a643598f5f41 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Fri, 28 Mar 2014 16:53:15 +1100 Subject: [PATCH] Replace deprecated functions --- includes/admin/class-sp-admin-dashboard.php | 2 +- includes/admin/class-sp-admin-menus.php | 10 +- .../class-sp-admin-permalink-settings.php | 2 +- includes/admin/class-sp-admin-taxonomies.php | 4 +- .../importers/class-sp-event-importer.php | 14 +- .../class-sp-admin-cpt-calendar.php | 10 +- .../post-types/class-sp-admin-cpt-column.php | 6 +- .../post-types/class-sp-admin-cpt-event.php | 12 +- .../post-types/class-sp-admin-cpt-list.php | 10 +- .../class-sp-admin-cpt-performance.php | 2 +- .../post-types/class-sp-admin-cpt-player.php | 14 +- .../post-types/class-sp-admin-cpt-staff.php | 8 +- .../post-types/class-sp-admin-cpt-table.php | 10 +- .../post-types/class-sp-admin-cpt-team.php | 8 +- .../class-sp-meta-box-calendar-data.php | 9 +- .../class-sp-meta-box-calendar-details.php | 30 +- .../class-sp-meta-box-calendar-format.php | 2 +- .../class-sp-meta-box-column-details.php | 12 +- .../class-sp-meta-box-event-details.php | 26 +- .../class-sp-meta-box-event-format.php | 2 +- .../class-sp-meta-box-event-performance.php | 10 +- .../class-sp-meta-box-event-results.php | 8 +- .../class-sp-meta-box-event-teams.php | 10 +- .../class-sp-meta-box-event-video.php | 2 +- .../class-sp-meta-box-list-data.php | 8 +- .../class-sp-meta-box-list-details.php | 36 +- .../class-sp-meta-box-list-format.php | 2 +- .../class-sp-meta-box-outcome-details.php | 2 +- .../class-sp-meta-box-performance-details.php | 6 +- .../class-sp-meta-box-player-details.php | 20 +- .../class-sp-meta-box-player-metrics.php | 6 +- .../class-sp-meta-box-player-performance.php | 8 +- .../class-sp-meta-box-result-details.php | 2 +- .../class-sp-meta-box-table-data.php | 11 +- .../class-sp-meta-box-table-details.php | 22 +- .../class-sp-meta-box-team-columns.php | 9 +- .../settings/class-sp-settings-config.php | 8 +- includes/sp-core-functions.php | 334 ++++++------------ includes/sp-template-hooks.php | 18 +- .../widgets/class-sp-widget-countdown.php | 4 +- .../class-sp-widget-event-calendar.php | 4 +- .../widgets/class-sp-widget-event-list.php | 4 +- .../widgets/class-sp-widget-league-table.php | 4 +- .../class-sp-widget-player-gallery.php | 8 +- .../widgets/class-sp-widget-player-list.php | 8 +- templates/countdown.php | 2 +- templates/event-calendar.php | 2 +- templates/event-list.php | 8 +- templates/event-performance.php | 8 +- templates/event-results.php | 6 +- templates/event-venue.php | 6 +- templates/league-table.php | 6 +- templates/player-gallery.php | 4 +- templates/player-league-performance.php | 4 +- templates/player-list.php | 8 +- templates/player-metrics.php | 4 +- templates/player-roster.php | 10 +- templates/team-columns.php | 4 +- 58 files changed, 348 insertions(+), 471 deletions(-) diff --git a/includes/admin/class-sp-admin-dashboard.php b/includes/admin/class-sp-admin-dashboard.php index bd0b5ee4..4a5ec268 100644 --- a/includes/admin/class-sp-admin-dashboard.php +++ b/includes/admin/class-sp-admin-dashboard.php @@ -38,7 +38,7 @@ class SP_Admin_Dashboard { * Show status widget */ public function status_widget() { - $next_event = sportspress_get_next_event(); + $next_event = sp_get_next_event(); $now = new DateTime( current_time( 'mysql', 0 ) ); $date = new DateTime( $next_event->post_date ); $interval = date_diff( $now, $date ); diff --git a/includes/admin/class-sp-admin-menus.php b/includes/admin/class-sp-admin-menus.php index 43a28664..6f3fb3aa 100644 --- a/includes/admin/class-sp-admin-menus.php +++ b/includes/admin/class-sp-admin-menus.php @@ -42,15 +42,15 @@ class SP_Admin_Menus { public function menu_highlight() { global $typenow; if ( in_array( $typenow, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_performance', 'sp_metric' ) ) ) - sportspress_highlight_admin_menu(); + sp_highlight_admin_menu(); elseif ( $typenow == 'sp_calendar' ) - sportspress_highlight_admin_menu( 'edit.php?post_type=sp_event', 'edit.php?post_type=sp_calendar' ); + sp_highlight_admin_menu( 'edit.php?post_type=sp_event', 'edit.php?post_type=sp_calendar' ); elseif ( $typenow == 'sp_table' ) - sportspress_highlight_admin_menu( 'edit.php?post_type=sp_team', 'edit.php?post_type=sp_table' ); + sp_highlight_admin_menu( 'edit.php?post_type=sp_team', 'edit.php?post_type=sp_table' ); elseif ( $typenow == 'sp_list' ) - sportspress_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_list' ); + sp_highlight_admin_menu( 'edit.php?post_type=sp_player', 'edit.php?post_type=sp_list' ); elseif ( $typenow == 'sp_directory' ) - sportspress_highlight_admin_menu( 'edit.php?post_type=sp_staff', 'edit.php?post_type=sp_directory' ); + sp_highlight_admin_menu( 'edit.php?post_type=sp_staff', 'edit.php?post_type=sp_directory' ); } /** diff --git a/includes/admin/class-sp-admin-permalink-settings.php b/includes/admin/class-sp-admin-permalink-settings.php index c7d02026..0a3d29b7 100644 --- a/includes/admin/class-sp-admin-permalink-settings.php +++ b/includes/admin/class-sp-admin-permalink-settings.php @@ -93,7 +93,7 @@ class SP_Admin_Permalink_Settings { else update_option( $key, $value ); endforeach; - sportspress_flush_rewrite_rules(); + sp_flush_rewrite_rules(); endif; } } diff --git a/includes/admin/class-sp-admin-taxonomies.php b/includes/admin/class-sp-admin-taxonomies.php index 12ab22d5..a40924a8 100644 --- a/includes/admin/class-sp-admin-taxonomies.php +++ b/includes/admin/class-sp-admin-taxonomies.php @@ -50,8 +50,8 @@ class SP_Admin_Taxonomies { $term = reset( $terms ); $t_id = $term->term_id; $term_meta = get_option( "taxonomy_$t_id" ); - $latitude = sportspress_array_value( $term_meta, 'sp_latitude', '40.7324319' ); - $longitude = sportspress_array_value( $term_meta, 'sp_longitude', '-73.82480799999996' ); + $latitude = sp_array_value( $term_meta, 'sp_latitude', '40.7324319' ); + $longitude = sp_array_value( $term_meta, 'sp_longitude', '-73.82480799999996' ); else: $latitude = '40.7324319'; $longitude = '-73.82480799999996'; diff --git a/includes/admin/importers/class-sp-event-importer.php b/includes/admin/importers/class-sp-event-importer.php index f7821ee7..37a027c7 100644 --- a/includes/admin/importers/class-sp-event-importer.php +++ b/includes/admin/importers/class-sp-event-importer.php @@ -120,8 +120,8 @@ if ( class_exists( 'WP_Importer' ) ) { $season = ( empty( $_POST['sp_season'] ) ? false : $_POST['sp_season'] ); // Get labels from result and performance post types - $result_labels = sportspress_get_var_labels( 'sp_result' ); - $performance_labels = sportspress_get_var_labels( 'sp_performance' ); + $result_labels = sp_get_var_labels( 'sp_result' ); + $performance_labels = sp_get_var_labels( 'sp_performance' ); while ( ( $row = fgetcsv( $handle, 0, $this->delimiter ) ) !== FALSE ): @@ -311,7 +311,7 @@ if ( class_exists( 'WP_Importer' ) ) { // Add delimiter if event name is set if ( $title ): - $title .= ' ' . sportspress_array_value( $sportspress_options, 'event_teams_delimiter', 'vs' ) . ' '; + $title .= ' ' . sp_array_value( $sportspress_options, 'event_teams_delimiter', 'vs' ) . ' '; endif; // Append team name to event name @@ -575,9 +575,9 @@ if ( class_exists( 'WP_Importer' ) ) { 'values' => 'slug', 'show_option_none' => __( '-- Not set --', 'sportspress' ), ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): + if ( ! sp_dropdown_taxonomies( $args ) ): echo '

' . __( 'None', 'sportspress' ) . '

'; - sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); + sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?> @@ -590,9 +590,9 @@ if ( class_exists( 'WP_Importer' ) ) { 'values' => 'slug', 'show_option_none' => __( '-- Not set --', 'sportspress' ), ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): + if ( ! sp_dropdown_taxonomies( $args ) ): echo '

' . __( 'None', 'sportspress' ) . '

'; - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); + sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?> diff --git a/includes/admin/post-types/class-sp-admin-cpt-calendar.php b/includes/admin/post-types/class-sp-admin-cpt-calendar.php index bc359cb6..e1d258d9 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-calendar.php +++ b/includes/admin/post-types/class-sp-admin-cpt-calendar.php @@ -92,10 +92,10 @@ class SP_Admin_CPT_Calendar extends SP_Admin_CPT { endif; break; case 'sp_events': - echo sizeof( sportspress_get_calendar_data( $post_id ) ); + echo sizeof( sp_get_calendar_data( $post_id ) ); break; case 'sp_views': - echo sportspress_get_post_views( $post_id ); + echo sp_get_post_views( $post_id ); break; endswitch; } @@ -125,7 +125,7 @@ class SP_Admin_CPT_Calendar extends SP_Admin_CPT { if ( $typenow != 'sp_calendar' ) return; - sportspress_highlight_admin_menu(); + sp_highlight_admin_menu(); $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; $args = array( @@ -134,7 +134,7 @@ class SP_Admin_CPT_Calendar extends SP_Admin_CPT { 'name' => 'sp_league', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; $args = array( @@ -143,7 +143,7 @@ class SP_Admin_CPT_Calendar extends SP_Admin_CPT { 'name' => 'sp_season', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); $selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null; $args = array( diff --git a/includes/admin/post-types/class-sp-admin-cpt-column.php b/includes/admin/post-types/class-sp-admin-cpt-column.php index 1b50ff01..6c52929d 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-column.php +++ b/includes/admin/post-types/class-sp-admin-cpt-column.php @@ -60,13 +60,13 @@ class SP_Admin_CPT_Column extends SP_Admin_CPT { echo $post->post_name; break; case 'sp_equation': - echo sportspress_get_post_equation( $post_id ); + echo sp_get_post_equation( $post_id ); break; case 'sp_precision': - echo sportspress_get_post_precision( $post_id ); + echo sp_get_post_precision( $post_id ); break; case 'sp_order': - echo sportspress_get_post_order( $post_id ); + echo sp_get_post_order( $post_id ); break; endswitch; } diff --git a/includes/admin/post-types/class-sp-admin-cpt-event.php b/includes/admin/post-types/class-sp-admin-cpt-event.php index 28ed6232..3458cacb 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-event.php +++ b/includes/admin/post-types/class-sp-admin-cpt-event.php @@ -69,14 +69,14 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT { if ( $data['post_type'] == 'sp_event' && $data['post_title'] == '' ): - $teams = sportspress_array_value( $postarr, 'sp_team', array() ); + $teams = sp_array_value( $postarr, 'sp_team', array() ); $team_names = array(); foreach( $teams as $team ): $team_names[] = get_the_title( $team ); endforeach; - $data['post_title'] = implode( ' ' . sportspress_array_value( $sportspress_options, 'event_teams_delimiter', 'vs' ) . ' ', $team_names ); + $data['post_title'] = implode( ' ' . sp_array_value( $sportspress_options, 'event_teams_delimiter', 'vs' ) . ' ', $team_names ); endif; @@ -152,7 +152,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT { echo get_the_terms ( $post_id, 'sp_venue' ) ? the_terms( $post_id, 'sp_venue' ) : '—'; break; case 'sp_views': - echo sportspress_get_post_views( $post_id ); + echo sp_get_post_views( $post_id ); break; endswitch; } @@ -182,7 +182,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT { if ( $typenow != 'sp_event' ) return; - sportspress_highlight_admin_menu(); + sp_highlight_admin_menu(); $selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null; $args = array( @@ -201,7 +201,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT { 'name' => 'sp_league', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; $args = array( @@ -210,7 +210,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT { 'name' => 'sp_season', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); } /** diff --git a/includes/admin/post-types/class-sp-admin-cpt-list.php b/includes/admin/post-types/class-sp-admin-cpt-list.php index 4a5c6024..5ed52345 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-list.php +++ b/includes/admin/post-types/class-sp-admin-cpt-list.php @@ -62,7 +62,7 @@ class SP_Admin_CPT_List extends SP_Admin_CPT { public function custom_columns( $column, $post_id ) { switch ( $column ): case 'sp_player': - echo sportspress_posts( $post_id, 'sp_player' ); + echo sp_posts( $post_id, 'sp_player' ); break; case 'sp_league': echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—'; @@ -84,7 +84,7 @@ class SP_Admin_CPT_List extends SP_Admin_CPT { endif; break; case 'sp_views': - echo sportspress_get_post_views( $post_id ); + echo sp_get_post_views( $post_id ); break; endswitch; } @@ -114,7 +114,7 @@ class SP_Admin_CPT_List extends SP_Admin_CPT { if ( $typenow != 'sp_list' ) return; - sportspress_highlight_admin_menu(); + sp_highlight_admin_menu(); $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; $args = array( @@ -123,7 +123,7 @@ class SP_Admin_CPT_List extends SP_Admin_CPT { 'name' => 'sp_league', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; $args = array( @@ -132,7 +132,7 @@ class SP_Admin_CPT_List extends SP_Admin_CPT { 'name' => 'sp_season', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); $selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null; $args = array( diff --git a/includes/admin/post-types/class-sp-admin-cpt-performance.php b/includes/admin/post-types/class-sp-admin-cpt-performance.php index 5a43a9c1..5099b402 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-performance.php +++ b/includes/admin/post-types/class-sp-admin-cpt-performance.php @@ -62,7 +62,7 @@ class SP_Admin_CPT_Performance extends SP_Admin_CPT { echo get_the_terms( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—'; break; case 'sp_calculate': - echo sportspress_get_post_calculate( $post_id ); + echo sp_get_post_calculate( $post_id ); break; endswitch; } diff --git a/includes/admin/post-types/class-sp-admin-cpt-player.php b/includes/admin/post-types/class-sp-admin-cpt-player.php index 9749a91e..0e039ddf 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-player.php +++ b/includes/admin/post-types/class-sp-admin-cpt-player.php @@ -89,16 +89,16 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT { else: $results = get_post_meta( $post_id, 'sp_results', true ); global $sportspress_options; - $main_result = sportspress_array_value( $sportspress_options, 'main_result', null ); + $main_result = sp_array_value( $sportspress_options, 'main_result', null ); foreach( $teams as $team_id ): if ( ! $team_id ) continue; $team = get_post( $team_id ); if ( $team ): - $team_results = sportspress_array_value( $results, $team_id, null ); + $team_results = sp_array_value( $results, $team_id, null ); if ( $main_result ): - $team_result = sportspress_array_value( $team_results, $main_result, null ); + $team_result = sp_array_value( $team_results, $main_result, null ); else: if ( is_array( $team_results ) ): end( $team_results ); @@ -131,7 +131,7 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT { echo get_the_terms ( $post_id, 'sp_venue' ) ? the_terms( $post_id, 'sp_venue' ) : '—'; break; case 'sp_views': - echo sportspress_get_post_views( $post_id ); + echo sp_get_post_views( $post_id ); break; endswitch; } @@ -161,7 +161,7 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT { if ( $typenow != 'sp_player' ) return; - sportspress_highlight_admin_menu(); + sp_highlight_admin_menu(); $selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null; $args = array( @@ -180,7 +180,7 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT { 'name' => 'sp_league', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; $args = array( @@ -189,7 +189,7 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT { 'name' => 'sp_season', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); } /** diff --git a/includes/admin/post-types/class-sp-admin-cpt-staff.php b/includes/admin/post-types/class-sp-admin-cpt-staff.php index e21ef985..c44991b8 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-staff.php +++ b/includes/admin/post-types/class-sp-admin-cpt-staff.php @@ -108,7 +108,7 @@ class SP_Admin_CPT_Staff extends SP_Admin_CPT { echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—'; break; case 'sp_views': - echo sportspress_get_post_views( $post_id ); + echo sp_get_post_views( $post_id ); break; endswitch; } @@ -138,7 +138,7 @@ class SP_Admin_CPT_Staff extends SP_Admin_CPT { if ( $typenow != 'sp_staff' ) return; - sportspress_highlight_admin_menu(); + sp_highlight_admin_menu(); $selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null; $args = array( @@ -157,7 +157,7 @@ class SP_Admin_CPT_Staff extends SP_Admin_CPT { 'name' => 'sp_league', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; $args = array( @@ -166,7 +166,7 @@ class SP_Admin_CPT_Staff extends SP_Admin_CPT { 'name' => 'sp_season', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); } /** diff --git a/includes/admin/post-types/class-sp-admin-cpt-table.php b/includes/admin/post-types/class-sp-admin-cpt-table.php index 58183a5c..8502078d 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-table.php +++ b/includes/admin/post-types/class-sp-admin-cpt-table.php @@ -67,10 +67,10 @@ class SP_Admin_CPT_Table extends SP_Admin_CPT { echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—'; break; case 'sp_team': - echo sportspress_posts( $post_id, 'sp_team' ); + echo sp_posts( $post_id, 'sp_team' ); break; case 'sp_views': - echo sportspress_get_post_views( $post_id ); + echo sp_get_post_views( $post_id ); break; endswitch; } @@ -100,7 +100,7 @@ class SP_Admin_CPT_Table extends SP_Admin_CPT { if ( $typenow != 'sp_table' ) return; - sportspress_highlight_admin_menu(); + sp_highlight_admin_menu(); $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; $args = array( @@ -109,7 +109,7 @@ class SP_Admin_CPT_Table extends SP_Admin_CPT { 'name' => 'sp_league', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; $args = array( @@ -118,7 +118,7 @@ class SP_Admin_CPT_Table extends SP_Admin_CPT { 'name' => 'sp_season', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); $selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null; $args = array( diff --git a/includes/admin/post-types/class-sp-admin-cpt-team.php b/includes/admin/post-types/class-sp-admin-cpt-team.php index 15ab2811..3b887d73 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-team.php +++ b/includes/admin/post-types/class-sp-admin-cpt-team.php @@ -82,7 +82,7 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT { echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—'; break; case 'sp_views': - echo sportspress_get_post_views( $post_id ); + echo sp_get_post_views( $post_id ); break; endswitch; } @@ -112,7 +112,7 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT { if ( $typenow != 'sp_team' ) return; - sportspress_highlight_admin_menu(); + sp_highlight_admin_menu(); $selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null; $args = array( @@ -121,7 +121,7 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT { 'name' => 'sp_league', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); $selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null; $args = array( @@ -130,7 +130,7 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT { 'name' => 'sp_season', 'selected' => $selected ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); } } diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php index ff242dfc..300bfa01 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php @@ -19,17 +19,14 @@ class SP_Meta_Box_Calendar_Data { * Output the metabox */ public static function output( $post ) { - list( $data, $usecolumns ) = sportspress_get_calendar_data( $post->ID, true ); - - sportspress_edit_calendar_table( $data, $usecolumns ); - - sportspress_nonce(); + list( $data, $usecolumns ) = sp_get_calendar_data( $post->ID, true ); + sp_edit_calendar_table( $data, $usecolumns ); } /** * Save meta box data */ public static function save( $post_id, $post ) { - update_post_meta( $post_id, 'sp_columns', sportspress_array_value( $_POST, 'sp_columns', array() ) ); + update_post_meta( $post_id, 'sp_columns', sp_array_value( $_POST, 'sp_columns', array() ) ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-details.php index 2cc4cfb6..cf253318 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-details.php @@ -20,9 +20,9 @@ class SP_Meta_Box_Calendar_Details { */ public static function output( $post ) { global $sportspress_formats; - $league_id = sportspress_get_the_term_id( $post->ID, 'sp_league', 0 ); - $season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 ); - $venue_id = sportspress_get_the_term_id( $post->ID, 'sp_venue', 0 ); + $league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); + $season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 ); + $venue_id = sp_get_the_term_id( $post->ID, 'sp_venue', 0 ); $team_id = get_post_meta( $post->ID, 'sp_team', true ); $formats = get_post_meta( $post->ID, 'sp_format' ); ?> @@ -37,8 +37,8 @@ class SP_Meta_Box_Calendar_Details { 'selected' => $league_id, 'values' => 'term_id' ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_taxonomies( $args ) ): + sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -52,8 +52,8 @@ class SP_Meta_Box_Calendar_Details { 'selected' => $season_id, 'values' => 'term_id' ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_taxonomies( $args ) ): + sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -67,8 +67,8 @@ class SP_Meta_Box_Calendar_Details { 'selected' => $venue_id, 'values' => 'term_id' ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_taxonomies( $args ) ): + sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -82,8 +82,8 @@ class SP_Meta_Box_Calendar_Details { 'selected' => $team_id, 'values' => 'ID' ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_pages( $args ) ): + sp_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -95,9 +95,9 @@ class SP_Meta_Box_Calendar_Details { * Save meta box data */ public static function save( $post_id, $post ) { - wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_league', 0 ), 'sp_league' ); - wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_season', 0 ), 'sp_season' ); - wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_venue', 0 ), 'sp_venue' ); - update_post_meta( $post_id, 'sp_team', sportspress_array_value( $_POST, 'sp_team', 0 ) ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_league', 0 ), 'sp_league' ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_season', 0 ), 'sp_season' ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_venue', 0 ), 'sp_venue' ); + update_post_meta( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', 0 ) ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-format.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-format.php index 2a675090..25237657 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-format.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-format.php @@ -34,6 +34,6 @@ class SP_Meta_Box_Calendar_Format { * Save meta box data */ public static function save( $post_id, $post ) { - update_post_meta( $post_id, 'sp_format', sportspress_array_value( $_POST, 'sp_format', 'calendar' ) ); + update_post_meta( $post_id, 'sp_format', sp_array_value( $_POST, 'sp_format', 'calendar' ) ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-column-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-column-details.php index 7a37c5d3..37c058de 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-column-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-column-details.php @@ -36,7 +36,7 @@ class SP_Meta_Box_Column_Details {

ID, $piece, array( 'team_event', 'result', 'outcome' ) ); + sp_equation_selector( $post->ID, $piece, array( 'team_event', 'result', 'outcome' ) ); endforeach; ?>

@@ -74,10 +74,10 @@ class SP_Meta_Box_Column_Details { * Save meta box data */ public static function save( $post_id, $post ) { - sportspress_delete_duplicate_post( $_POST ); - update_post_meta( $post_id, 'sp_equation', implode( ' ', sportspress_array_value( $_POST, 'sp_equation', array() ) ) ); - update_post_meta( $post_id, 'sp_precision', (int) sportspress_array_value( $_POST, 'sp_precision', 1 ) ); - update_post_meta( $post_id, 'sp_priority', sportspress_array_value( $_POST, 'sp_priority', '0' ) ); - update_post_meta( $post_id, 'sp_order', sportspress_array_value( $_POST, 'sp_order', 'DESC' ) ); + sp_delete_duplicate_post( $_POST ); + update_post_meta( $post_id, 'sp_equation', implode( ' ', sp_array_value( $_POST, 'sp_equation', array() ) ) ); + update_post_meta( $post_id, 'sp_precision', (int) sp_array_value( $_POST, 'sp_precision', 1 ) ); + update_post_meta( $post_id, 'sp_priority', sp_array_value( $_POST, 'sp_priority', '0' ) ); + update_post_meta( $post_id, 'sp_order', sp_array_value( $_POST, 'sp_order', 'DESC' ) ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-details.php index 069a1d22..75b9c34f 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-details.php @@ -19,10 +19,10 @@ class SP_Meta_Box_Event_Details { * Output the metabox */ public static function output( $post ) { - $type = sportspress_get_the_term_id( $post->ID, 'sp_type', null ); - $league_id = sportspress_get_the_term_id( $post->ID, 'sp_league', 0 ); - $season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 ); - $venue_id = sportspress_get_the_term_id( $post->ID, 'sp_venue', 0 ); + $type = sp_get_the_term_id( $post->ID, 'sp_type', null ); + $league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); + $season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 ); + $venue_id = sp_get_the_term_id( $post->ID, 'sp_venue', 0 ); ?>
@@ -36,8 +36,8 @@ class SP_Meta_Box_Event_Details { 'values' => 'term_id', 'show_option_none' => __( '-- Not set --', 'sportspress' ), ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_taxonomies( $args ) ): + sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -51,8 +51,8 @@ class SP_Meta_Box_Event_Details { 'values' => 'term_id', 'show_option_none' => __( '-- Not set --', 'sportspress' ), ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_taxonomies( $args ) ): + sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -67,8 +67,8 @@ class SP_Meta_Box_Event_Details { 'values' => 'term_id', 'show_option_none' => __( '-- Not set --', 'sportspress' ), ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_venue', 'sp_event', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_taxonomies( $args ) ): + sp_taxonomy_adder( 'sp_venue', 'sp_event', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -80,8 +80,8 @@ class SP_Meta_Box_Event_Details { * Save meta box data */ public static function save( $post_id, $post ) { - wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_league', 0 ), 'sp_league' ); - wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_season', 0 ), 'sp_season' ); - wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_venue', 0 ), 'sp_venue' ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_league', 0 ), 'sp_league' ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_season', 0 ), 'sp_season' ); + wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_venue', 0 ), 'sp_venue' ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-format.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-format.php index 458b3a43..49709378 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-format.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-format.php @@ -34,6 +34,6 @@ class SP_Meta_Box_Event_Format { * Save meta box data */ public static function save( $post_id, $post ) { - update_post_meta( $post_id, 'sp_format', sportspress_array_value( $_POST, 'sp_format', 'league' ) ); + update_post_meta( $post_id, 'sp_format', sp_array_value( $_POST, 'sp_format', 'league' ) ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php index 04e6dc5a..b2549949 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php @@ -23,19 +23,19 @@ class SP_Meta_Box_Event_Performance { $stats = (array)get_post_meta( $post->ID, 'sp_players', true ); // Get columns from performance variables - $columns = sportspress_get_var_labels( 'sp_performance' ); + $columns = sp_get_var_labels( 'sp_performance' ); foreach ( $teams as $key => $team_id ): if ( ! $team_id ) continue; // Get results for players in the team - $players = sportspress_array_between( (array)get_post_meta( $post->ID, 'sp_player', false ), 0, $key ); - $data = sportspress_array_combine( $players, sportspress_array_value( $stats, $team_id, array() ) ); + $players = sp_array_between( (array)get_post_meta( $post->ID, 'sp_player', false ), 0, $key ); + $data = sp_array_combine( $players, sp_array_value( $stats, $team_id, array() ) ); ?>

- +
ID, 'sp_results', true ); // Get columns from result variables - $columns = sportspress_get_var_labels( 'sp_result' ); + $columns = sp_get_var_labels( 'sp_result' ); // Get results for all teams - $data = sportspress_array_combine( $teams, $results ); + $data = sp_array_combine( $teams, $results ); ?>
- +
ID, 'sp_player', 'block', 'sp_current_team', $key ); - sportspress_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_current_team', $key ); + sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_current_team', $key ); + sp_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_current_team', $key ); ?>
@@ -67,8 +67,8 @@ class SP_Meta_Box_Event_Teams { * Save meta box data */ public static function save( $post_id, $post ) { - sportspress_update_post_meta_recursive( $post_id, 'sp_team', sportspress_array_value( $_POST, 'sp_team', array() ) ); - sportspress_update_post_meta_recursive( $post_id, 'sp_player', sportspress_array_value( $_POST, 'sp_player', array() ) ); - sportspress_update_post_meta_recursive( $post_id, 'sp_staff', sportspress_array_value( $_POST, 'sp_staff', array() ) ); + sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) ); + sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) ); + sp_update_post_meta_recursive( $post_id, 'sp_staff', sp_array_value( $_POST, 'sp_staff', array() ) ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-video.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-video.php index 3248586c..1601e540 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-video.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-video.php @@ -42,6 +42,6 @@ class SP_Meta_Box_Event_Video { * Save meta box data */ public static function save( $post_id, $post ) { - update_post_meta( $post_id, 'sp_video', sportspress_array_value( $_POST, 'sp_video', null ) ); + update_post_meta( $post_id, 'sp_video', sp_array_value( $_POST, 'sp_video', null ) ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php index f09d653e..8db5f4ae 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php @@ -19,16 +19,16 @@ class SP_Meta_Box_List_Data { * Output the metabox */ public static function output( $post ) { - list( $columns, $usecolumns, $data, $placeholders, $merged ) = sportspress_get_player_list_data( $post->ID, true ); + list( $columns, $usecolumns, $data, $placeholders, $merged ) = sp_get_player_list_data( $post->ID, true ); - sportspress_edit_player_list_table( $columns, $usecolumns, $data, $placeholders ); + sp_edit_player_list_table( $columns, $usecolumns, $data, $placeholders ); } /** * Save meta box data */ public static function save( $post_id, $post ) { - update_post_meta( $post_id, 'sp_columns', sportspress_array_value( $_POST, 'sp_columns', array() ) ); - update_post_meta( $post_id, 'sp_players', sportspress_array_value( $_POST, 'sp_players', array() ) ); + update_post_meta( $post_id, 'sp_columns', sp_array_value( $_POST, 'sp_columns', array() ) ); + update_post_meta( $post_id, 'sp_players', sp_array_value( $_POST, 'sp_players', array() ) ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-details.php index 2401b7b9..184f501d 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-details.php @@ -19,8 +19,8 @@ class SP_Meta_Box_List_Details { * Output the metabox */ public static function output( $post ) { - $league_id = sportspress_get_the_term_id( $post->ID, 'sp_league', 0 ); - $season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 ); + $league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); + $season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 ); $team_id = get_post_meta( $post->ID, 'sp_team', true ); $orderby = get_post_meta( $post->ID, 'sp_orderby', true ); $order = get_post_meta( $post->ID, 'sp_order', true ); @@ -35,8 +35,8 @@ class SP_Meta_Box_List_Details { 'selected' => $league_id, 'values' => 'term_id', ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_taxonomies( $args ) ): + sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -49,8 +49,8 @@ class SP_Meta_Box_List_Details { 'selected' => $season_id, 'values' => 'term_id', ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_taxonomies( $args ) ): + sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -64,8 +64,8 @@ class SP_Meta_Box_List_Details { 'selected' => $team_id, 'values' => 'ID', ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_pages( $args ) ): + sp_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -83,8 +83,8 @@ class SP_Meta_Box_List_Details { 'selected' => $orderby, 'values' => 'slug', ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_pages( $args ) ): + sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -97,8 +97,8 @@ class SP_Meta_Box_List_Details {

ID, 'sp_player', 'block', 'sp_team' ); - sportspress_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) ); + sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_team' ); + sp_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) ); ?>

- ID, $calculate ); ?> + ID, $calculate ); ?>

'multiple', 'chosen' => true, ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); ?>

@@ -95,7 +95,7 @@ class SP_Meta_Box_Player_Details { 'class' => 'sp-current-team widefat', 'chosen' => true, ); - sportspress_dropdown_pages( $args ); + sp_dropdown_pages( $args ); ?>

@@ -110,7 +110,7 @@ class SP_Meta_Box_Player_Details { 'property' => 'multiple', 'chosen' => true, ); - sportspress_dropdown_pages( $args ); + sp_dropdown_pages( $args ); ?>

@@ -125,7 +125,7 @@ class SP_Meta_Box_Player_Details { 'property' => 'multiple', 'chosen' => true, ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); ?>

@@ -140,7 +140,7 @@ class SP_Meta_Box_Player_Details { 'property' => 'multiple', 'chosen' => true, ); - sportspress_dropdown_taxonomies( $args ); + sp_dropdown_taxonomies( $args ); ?>

post_title; ?>

-

+

ID, $league->term_id, true ); + list( $columns, $data, $placeholders, $merged, $seasons_teams ) = sp_get_player_performance_data( $post->ID, $league->term_id, true ); - sportspress_edit_player_performance_table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, ! current_user_can( 'edit_sp_teams' ) ); + sp_edit_player_performance_table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, ! current_user_can( 'edit_sp_teams' ) ); endforeach; } @@ -43,8 +43,8 @@ class SP_Meta_Box_Player_Performance { * Save meta box data */ public static function save( $post_id, $post ) { - update_post_meta( $post_id, 'sp_leagues', sportspress_array_value( $_POST, 'sp_leagues', array() ) ); + update_post_meta( $post_id, 'sp_leagues', sp_array_value( $_POST, 'sp_leagues', array() ) ); if ( current_user_can( 'edit_sp_teams' ) ) - update_post_meta( $post_id, 'sp_performance', sportspress_array_value( $_POST, 'sp_performance', array() ) ); + update_post_meta( $post_id, 'sp_performance', sp_array_value( $_POST, 'sp_performance', array() ) ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-result-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-result-details.php index aca464dc..94dab1c3 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-result-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-result-details.php @@ -32,6 +32,6 @@ class SP_Meta_Box_Result_Details { * Save meta box data */ public static function save( $post_id, $post ) { - sportspress_delete_duplicate_post( $_POST ); + sp_delete_duplicate_post( $_POST ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php index 84944ebf..183c6e89 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php @@ -19,18 +19,15 @@ class SP_Meta_Box_Table_Data { * Output the metabox */ public static function output( $post ) { - list( $columns, $usecolumns, $data, $placeholders, $merged ) = sportspress_get_league_table_data( $post->ID, true ); - - sportspress_edit_league_table( $columns, $usecolumns, $data, $placeholders ); - - sportspress_nonce(); + list( $columns, $usecolumns, $data, $placeholders, $merged ) = sp_get_league_table_data( $post->ID, true ); + sp_edit_league_table( $columns, $usecolumns, $data, $placeholders ); } /** * Save meta box data */ public static function save( $post_id, $post ) { - update_post_meta( $post_id, 'sp_columns', sportspress_array_value( $_POST, 'sp_columns', array() ) ); - update_post_meta( $post_id, 'sp_teams', sportspress_array_value( $_POST, 'sp_teams', array() ) ); + update_post_meta( $post_id, 'sp_columns', sp_array_value( $_POST, 'sp_columns', array() ) ); + update_post_meta( $post_id, 'sp_teams', sp_array_value( $_POST, 'sp_teams', array() ) ); } } \ No newline at end of file diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-details.php index 5ac9a46c..6d9d20d2 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-details.php @@ -20,8 +20,8 @@ class SP_Meta_Box_Table_Details { */ public static function output( $post ) { wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' ); - $league_id = sportspress_get_the_term_id( $post->ID, 'sp_league', 0 ); - $season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 ); + $league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 ); + $season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 ); ?>

@@ -33,8 +33,8 @@ class SP_Meta_Box_Table_Details { 'selected' => $league_id, 'values' => 'term_id' ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_taxonomies( $args ) ): + sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?>

@@ -47,15 +47,15 @@ class SP_Meta_Box_Table_Details { 'selected' => $season_id, 'values' => 'term_id' ); - if ( ! sportspress_dropdown_taxonomies( $args ) ): - sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_taxonomies( $args ) ): + sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; ?>

ID, 'sp_team', 'block', 'sp_season' ); - sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) ); + sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_season' ); + sp_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) ); ?>
ID, 'sp_league' ); $league_num = sizeof( $leagues ); @@ -34,9 +33,9 @@ class SP_Meta_Box_Team_Columns { ID, $league_id, true ); + list( $columns, $data, $placeholders, $merged, $leagues_seasons ) = sp_get_team_columns_data( $post->ID, $league_id, true ); - sportspress_edit_team_columns_table( $league_id, $columns, $data, $placeholders, $merged, $leagues_seasons, ! current_user_can( 'edit_sp_tables' ) ); + sp_edit_team_columns_table( $league_id, $columns, $data, $placeholders, $merged, $leagues_seasons, ! current_user_can( 'edit_sp_tables' ) ); endforeach; } @@ -45,8 +44,8 @@ class SP_Meta_Box_Team_Columns { * Save meta box data */ public static function save( $post_id, $post ) { - update_post_meta( $post_id, 'sp_leagues_seasons', sportspress_array_value( $_POST, 'sp_leagues_seasons', array() ) ); + update_post_meta( $post_id, 'sp_leagues_seasons', sp_array_value( $_POST, 'sp_leagues_seasons', array() ) ); if ( current_user_can( 'edit_sp_tables' ) ) - update_post_meta( $post_id, 'sp_columns', sportspress_array_value( $_POST, 'sp_columns', array() ) ); + update_post_meta( $post_id, 'sp_columns', sp_array_value( $_POST, 'sp_columns', array() ) ); } } \ No newline at end of file diff --git a/includes/admin/settings/class-sp-settings-config.php b/includes/admin/settings/class-sp-settings-config.php index 2ccf4641..0b12dab2 100644 --- a/includes/admin/settings/class-sp-settings-config.php +++ b/includes/admin/settings/class-sp-settings-config.php @@ -316,9 +316,9 @@ class SP_Settings_Config extends SP_Settings_Page { > post_title; ?> post_name; ?> - ID, $row->post_name ); ?> - ID ); ?> - ID ); ?> + ID, $row->post_name ); ?> + ID ); ?> + ID ); ?> @@ -417,7 +417,7 @@ class SP_Settings_Config extends SP_Settings_Page { > post_title; ?> ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?> - ID ); ?> + ID ); ?> diff --git a/includes/sp-core-functions.php b/includes/sp-core-functions.php index 1f6619b2..7d82f20d 100644 --- a/includes/sp-core-functions.php +++ b/includes/sp-core-functions.php @@ -191,7 +191,7 @@ if ( !function_exists( 'sp_flush_rewrite_rules' ) ) { if ( !function_exists( 'sp_nonce' ) ) { function sp_nonce() { - echo ''; + wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' ); } } @@ -341,18 +341,6 @@ if ( !function_exists( 'sp_get_post_order' ) ) { } } -if ( !function_exists( 'sp_get_config_formats' ) ) { - function sp_get_config_formats() { - $arr = array( - 'integer' => __( 'Integer', 'sportspress' ), - 'decimal' => __( 'Decimal', 'sportspress' ), - 'time' => __( 'Time', 'sportspress' ), - 'custom' => __( 'Custom Field', 'sportspress' ), - ); - return $arr; - } -} - if ( !function_exists( 'sp_dropdown_taxonomies' ) ) { function sp_dropdown_taxonomies( $args = array() ) { $defaults = array( @@ -589,7 +577,7 @@ if ( !function_exists( 'sp_post_checklist' ) ) {
  • $meta, 'number' => 0 ) ); if ( empty( $posts ) ): $query = array( 'post_type' => $meta, 'numberposts' => -1, 'post_per_page' => -1 ); @@ -715,19 +703,19 @@ if ( !function_exists( 'sp_equation_selector' ) ) { $options[ __( 'Events', 'sportspress' ) ] = array( '$eventsplayed' => __( 'Played', 'sportspress' ) ); break; case 'result': - $options[ __( 'Results', 'sportspress' ) ] = sportspress_get_equation_optgroup_array( $postid, 'sp_result', array( 'for' => '→', 'against' => '←' ), null, false ); + $options[ __( 'Results', 'sportspress' ) ] = sp_get_equation_optgroup_array( $postid, 'sp_result', array( 'for' => '→', 'against' => '←' ), null, false ); break; case 'outcome': - $options[ __( 'Outcomes', 'sportspress' ) ] = sportspress_get_equation_optgroup_array( $postid, 'sp_outcome', array() ); + $options[ __( 'Outcomes', 'sportspress' ) ] = sp_get_equation_optgroup_array( $postid, 'sp_outcome', array() ); $options[ __( 'Outcomes', 'sportspress' ) ]['$streak'] = __( 'Streak', 'sportspress' ); $options[ __( 'Outcomes', 'sportspress' ) ]['$last5'] = __( 'Last 5', 'sportspress' ); $options[ __( 'Outcomes', 'sportspress' ) ]['$last10'] = __( 'Last 10', 'sportspress' ); break; case 'column': - $options[ __( 'Columns', 'sportspress' ) ] = sportspress_get_equation_optgroup_array( $postid, 'sp_column' ); + $options[ __( 'Columns', 'sportspress' ) ] = sp_get_equation_optgroup_array( $postid, 'sp_column' ); break; case 'performance': - $options[ __( 'Performance', 'sportspress' ) ] = sportspress_get_equation_optgroup_array( $postid, 'sp_performance' ); + $options[ __( 'Performance', 'sportspress' ) ] = sp_get_equation_optgroup_array( $postid, 'sp_performance' ); break; endswitch; endforeach; @@ -772,22 +760,6 @@ if ( !function_exists( 'sp_equation_selector' ) ) { } } -if ( !function_exists( 'sp_get_term_names' ) ) { - function sp_get_term_names( $id = null, $post_type = null ) { - if ( ! $id || ! $post_type ) - return false; - - $terms = get_the_terms( $id, $post_type ); - - $output = array(); - foreach ( $terms as $term ): - $output[ $term->slug ] = $term->name; - endforeach; - - return $output; - } -} - if ( !function_exists( 'sp_get_var_labels' ) ) { function sp_get_var_labels( $post_type ) { $args = array( @@ -837,28 +809,6 @@ if ( !function_exists( 'sp_get_var_equations' ) ) { } } -if ( !function_exists( 'sp_get_var_calculates' ) ) { - function sp_get_var_calculates( $post_type ) { - $args = array( - 'post_type' => $post_type, - 'numberposts' => -1, - 'posts_per_page' => -1, - 'orderby' => 'menu_order', - 'order' => 'ASC' - ); - - $vars = get_posts( $args ); - - $output = array(); - foreach ( $vars as $var ): - $calculate = get_post_meta( $var->ID, 'sp_calculate', true ); - $output[ $var->post_name ] = $calculate; - endforeach; - - return $output; - } -} - if ( !function_exists( 'sp_edit_calendar_table' ) ) { function sp_edit_calendar_table( $data = array(), $usecolumns = null ) { if ( is_array( $usecolumns ) ) @@ -907,7 +857,7 @@ if ( !function_exists( 'sp_edit_calendar_table' ) ) { 0 ): global $sportspress_options; - $main_result = sportspress_array_value( $sportspress_options, 'main_result', null ); + $main_result = sp_array_value( $sportspress_options, 'main_result', null ); $i = 0; foreach ( $data as $event ): $teams = get_post_meta( $event->ID, 'sp_team' ); @@ -922,10 +872,10 @@ if ( !function_exists( 'sp_edit_calendar_table' ) ) { foreach ( $teams as $team ): $name = get_the_title( $team ); if ( $name ): - $team_results = sportspress_array_value( $results, $team, null ); + $team_results = sp_array_value( $results, $team, null ); if ( $main_result ): - $team_result = sportspress_array_value( $team_results, $main_result, null ); + $team_result = sp_array_value( $team_results, $main_result, null ); else: if ( is_array( $team_results ) ): end( $team_results ); @@ -992,7 +942,7 @@ if ( !function_exists( 'sp_edit_league_table' ) ) { if ( is_array( $usecolumns ) ) $usecolumns = array_filter( $usecolumns ); global $sportspress_options; - $show_team_logo = sportspress_array_value( $sportspress_options, 'league_table_show_team_logo', false ); + $show_team_logo = sp_array_value( $sportspress_options, 'league_table_show_team_logo', false ); ?>
    @@ -1016,7 +966,7 @@ if ( !function_exists( 'sp_edit_league_table' ) ) { continue; $div = get_term( $team_id, 'sp_season' ); - $default_name = sportspress_array_value( $team_stats, 'name', '' ); + $default_name = sp_array_value( $team_stats, 'name', '' ); if ( $default_name == null ) $default_name = get_the_title( $team_id ); ?> @@ -1028,14 +978,14 @@ if ( !function_exists( 'sp_edit_league_table' ) ) { $label ): - $value = sportspress_array_value( $team_stats, $column, '' ); - $placeholder = sportspress_array_value( sportspress_array_value( $placeholders, $team_id, array() ), $column, 0 ); + $value = sp_array_value( $team_stats, $column, '' ); + $placeholder = sp_array_value( sp_array_value( $placeholders, $team_id, array() ), $column, 0 ); ?> @@ -1094,8 +1044,8 @@ if ( !function_exists( 'sp_edit_player_list_table' ) ) { $label ): - $value = sportspress_array_value( $player_stats, $column, '' ); - $placeholder = sportspress_array_value( sportspress_array_value( $placeholders, $player_id, array() ), $column, 0 ); + $value = sp_array_value( $player_stats, $column, '' ); + $placeholder = sp_array_value( sp_array_value( $placeholders, $player_id, array() ), $column, 0 ); ?> @@ -1143,17 +1093,17 @@ if ( !function_exists( 'sp_edit_team_columns_table' ) ) { ?> $label ): - $value = sportspress_array_value( sportspress_array_value( $data, $div_id, array() ), $column, 0 ); + $value = sp_array_value( sp_array_value( $data, $div_id, array() ), $column, 0 ); ?> @@ -1200,7 +1150,7 @@ if ( !function_exists( 'sp_edit_player_performance_table' ) ) { @@ -1274,13 +1224,13 @@ if ( !function_exists( 'sp_edit_event_results_table' ) ) { $label ): - $value = sportspress_array_value( $team_results, $column, '' ); + $value = sp_array_value( $team_results, $column, '' ); ?> @@ -1384,15 +1334,15 @@ if ( !function_exists( 'sp_edit_event_players_table' ) ) { $label ): - $value = sportspress_array_value( $player_performance, $column, '' ); + $value = sp_array_value( $player_performance, $column, '' ); ?> $label ): $player_id = 0; - $player_performance = sportspress_array_value( $data, 0, array() ); - $value = sportspress_array_value( $player_performance, $column, '' ); + $player_performance = sp_array_value( $data, 0, array() ); + $value = sp_array_value( $player_performance, $column, '' ); ?> @@ -1418,27 +1368,6 @@ if ( !function_exists( 'sp_edit_event_players_table' ) ) { } } -if ( !function_exists( 'sp_player_nationality_selector' ) ) { - function sp_player_nationality_selector( $value = null ) { - - $options = array( - 'lineup' => __( 'Starting Lineup', 'sportspress' ), - 'sub' => __( 'Substitute', 'sportspress' ), - ); - - $output = ''; - - return $output; - - } -} - if ( !function_exists( 'sp_post_adder' ) ) { function sp_post_adder( $post_type = 'post', $label = null ) { $obj = get_post_type_object( $post_type ); @@ -1491,30 +1420,6 @@ if ( !function_exists( 'sp_update_post_meta_recursive' ) ) { } } -if ( !function_exists( 'sp_render_option_field' ) ) { - function sp_render_option_field( $group, $name, $type = 'text' ) { - - $options = get_option( $group ); - $value = ''; - if ( is_array( $options ) && array_key_exists( $name, $options ) ): - $value = $options[ $name ]; - endif; - - switch ( $type ): - case 'textarea': - echo ''; - break; - case 'checkbox': - echo ''; - break; - default: - echo ''; - break; - endswitch; - - } -} - if ( !function_exists( 'sp_get_eos_safe_slug' ) ) { function sp_get_eos_safe_slug( $title, $post_id = 'var' ) { @@ -1522,7 +1427,7 @@ if ( !function_exists( 'sp_get_eos_safe_slug' ) ) { $title = strtolower( $title ); // Replace all numbers with words - $title = sportspress_numbers_to_words( $title ); + $title = sp_numbers_to_words( $title ); // Remove all other non-alphabet characters $title = preg_replace( "/[^a-z]/", '', $title ); @@ -1530,7 +1435,7 @@ if ( !function_exists( 'sp_get_eos_safe_slug' ) ) { // Convert post ID to words if title is empty if ( $title == '' ): - $title = sportspress_numbers_to_words( $post_id ); + $title = sp_numbers_to_words( $post_id ); endif; @@ -1545,12 +1450,12 @@ if ( !function_exists( 'sp_solve' ) ) { if ( strpos( $equation, '$streak' ) !== false ): // Return direct value - return sportspress_array_value( $vars, 'streak', '-' ); + return sp_array_value( $vars, 'streak', '-' ); elseif ( strpos( $equation, '$last5' ) !== false ): // Return imploded string - $last5 = sportspress_array_value( $vars, 'last5', array( 0 ) ); + $last5 = sp_array_value( $vars, 'last5', array( 0 ) ); if ( array_sum( $last5 ) > 0 ): return implode( '-', $last5 ); else: @@ -1560,7 +1465,7 @@ if ( !function_exists( 'sp_solve' ) ) { elseif ( strpos( $equation, '$last10' ) !== false ): // Return imploded string - $last10 = sportspress_array_value( $vars, 'last10', array( 0 ) ); + $last10 = sp_array_value( $vars, 'last10', array( 0 ) ); if ( array_sum( $last10 ) > 0 ): return implode( '-', $last10 ); else: @@ -1574,7 +1479,7 @@ if ( !function_exists( 'sp_solve' ) ) { unset( $vars['last5'] ); unset( $vars['last10'] ); - if ( sportspress_array_value( $vars, 'eventsplayed', 0 ) <= 0 ) + if ( sp_array_value( $vars, 'eventsplayed', 0 ) <= 0 ) return '-'; // Clearance to begin calculating remains true if all equation variables are in vars @@ -1608,20 +1513,6 @@ if ( !function_exists( 'sp_solve' ) ) { } -if ( !function_exists( 'sp_event_players_lineup_filter' ) ) { - function sp_event_players_lineup_filter( $arr ) { - return sportspress_array_value( $arr, 'status', 'lineup' ) == 'lineup'; - } -} - - -if ( !function_exists( 'sp_event_players_sub_filter' ) ) { - function sp_event_players_sub_filter( $arr ) { - return sportspress_array_value( $arr, 'status', 'lineup' ) == 'sub'; - } -} - - if ( !function_exists( 'sp_get_calendar_data' ) ) { function sp_get_calendar_data( $post_id = null, $admin = false ) { global $pagenow; @@ -1716,13 +1607,13 @@ if ( !function_exists( 'sp_get_team_columns_data' ) ) { $seasons = (array)get_the_terms( $post_id, 'sp_season' ); $columns = (array)get_post_meta( $post_id, 'sp_columns', true ); - $leagues_seasons = sportspress_array_value( (array)get_post_meta( $post_id, 'sp_leagues_seasons', true ), $league_id, array() ); + $leagues_seasons = sp_array_value( (array)get_post_meta( $post_id, 'sp_leagues_seasons', true ), $league_id, array() ); // Get labels from result variables - $result_labels = (array)sportspress_get_var_labels( 'sp_result' ); + $result_labels = (array)sp_get_var_labels( 'sp_result' ); // Get labels from outcome variables - $outcome_labels = (array)sportspress_get_var_labels( 'sp_outcome' ); + $outcome_labels = (array)sp_get_var_labels( 'sp_outcome' ); // Generate array of all season ids and season names $div_ids = array(); @@ -1737,10 +1628,10 @@ if ( !function_exists( 'sp_get_team_columns_data' ) ) { $data = array(); // Get all seasons populated with data where available - $data = sportspress_array_combine( $div_ids, sportspress_array_value( $columns, $league_id, array() ) ); + $data = sp_array_combine( $div_ids, sp_array_value( $columns, $league_id, array() ) ); // Get equations from column variables - $equations = sportspress_get_var_equations( 'sp_column' ); + $equations = sp_get_var_equations( 'sp_column' ); // Initialize placeholders array $placeholders = array(); @@ -1885,23 +1776,23 @@ if ( !function_exists( 'sp_get_team_columns_data' ) ) { // Generate array of placeholder values for each league $placeholders[ $div_id ] = array(); foreach ( $equations as $key => $value ): - $placeholders[ $div_id ][ $key ] = sportspress_solve( $value['equation'], $totals, $value['precision'] ); + $placeholders[ $div_id ][ $key ] = sp_solve( $value['equation'], $totals, $value['precision'] ); endforeach; endforeach; // Get columns from column variables - $columns = sportspress_get_var_labels( 'sp_column' ); + $columns = sp_get_var_labels( 'sp_column' ); // Merge the data and placeholders arrays $merged = array(); foreach( $placeholders as $season_id => $season_data ): - if ( ! sportspress_array_value( $leagues_seasons, $season_id, 0 ) ) + if ( ! sp_array_value( $leagues_seasons, $season_id, 0 ) ) continue; - $season_name = sportspress_array_value( $season_names, $season_id, ' ' ); + $season_name = sp_array_value( $season_names, $season_id, ' ' ); // Add season name to row $merged[ $season_id ] = array( @@ -1935,20 +1826,20 @@ if ( !function_exists( 'sp_get_team_columns_data' ) ) { if ( !function_exists( 'sp_get_league_table_data' ) ) { function sp_get_league_table_data( $post_id, $breakdown = false ) { - $league_id = sportspress_get_the_term_id( $post_id, 'sp_league', 0 ); - $div_id = sportspress_get_the_term_id( $post_id, 'sp_season', 0 ); + $league_id = sp_get_the_term_id( $post_id, 'sp_league', 0 ); + $div_id = sp_get_the_term_id( $post_id, 'sp_season', 0 ); $team_ids = (array)get_post_meta( $post_id, 'sp_team', false ); $table_stats = (array)get_post_meta( $post_id, 'sp_teams', true ); $usecolumns = get_post_meta( $post_id, 'sp_columns', true ); // Get labels from result variables - $result_labels = (array)sportspress_get_var_labels( 'sp_result' ); + $result_labels = (array)sp_get_var_labels( 'sp_result' ); // Get labels from outcome variables - $outcome_labels = (array)sportspress_get_var_labels( 'sp_outcome' ); + $outcome_labels = (array)sp_get_var_labels( 'sp_outcome' ); // Get all leagues populated with stats where available - $tempdata = sportspress_array_combine( $team_ids, $table_stats ); + $tempdata = sp_array_combine( $team_ids, $table_stats ); // Create entry for each team in totals $totals = array(); @@ -1994,7 +1885,7 @@ if ( !function_exists( 'sp_get_league_table_data' ) ) { $static = get_post_meta( $team_id, 'sp_columns', true ); // Add static stats to placeholders - $placeholders[ $team_id ] = sportspress_array_value( $static, $div_id, array() ); + $placeholders[ $team_id ] = sp_array_value( $static, $div_id, array() ); endforeach; @@ -2074,7 +1965,7 @@ if ( !function_exists( 'sp_get_league_table_data' ) ) { $totals[ $team_id ][ $key . 'for' ] += $value; foreach( $results as $other_team_id => $other_result ): if ( $other_team_id != $team_id && array_key_exists( $key . 'against', $totals[ $team_id ] ) ): - $totals[ $team_id ][ $key . 'against' ] += sportspress_array_value( $other_result, $key, 0 ); + $totals[ $team_id ][ $key . 'against' ] += sp_array_value( $other_result, $key, 0 ); endif; endforeach; endif; @@ -2137,18 +2028,18 @@ if ( !function_exists( 'sp_get_league_table_data' ) ) { $meta = get_post_meta( $stat->ID ); // Add equation to object - $stat->equation = sportspress_array_value( sportspress_array_value( $meta, 'sp_equation', array() ), 0, 0 ); - $stat->precision = sportspress_array_value( sportspress_array_value( $meta, 'sp_precision', array() ), 0, 0 ); + $stat->equation = sp_array_value( sp_array_value( $meta, 'sp_equation', array() ), 0, 0 ); + $stat->precision = sp_array_value( sp_array_value( $meta, 'sp_precision', array() ), 0, 0 ); // Add column name to columns $columns[ $stat->post_name ] = $stat->post_title; // Add order to priorities if priority is set and does not exist in array already - $priority = sportspress_array_value( sportspress_array_value( $meta, 'sp_priority', array() ), 0, 0 ); + $priority = sp_array_value( sp_array_value( $meta, 'sp_priority', array() ), 0, 0 ); if ( $priority && ! array_key_exists( $priority, $sportspress_column_priorities ) ): $sportspress_column_priorities[ $priority ] = array( 'column' => $stat->post_name, - 'order' => sportspress_array_value( sportspress_array_value( $meta, 'sp_order', array() ), 0, 'DESC' ) + 'order' => sp_array_value( sp_array_value( $meta, 'sp_order', array() ), 0, 'DESC' ) ); endif; @@ -2163,8 +2054,8 @@ if ( !function_exists( 'sp_get_league_table_data' ) ) { continue; foreach ( $stats as $stat ): - if ( sportspress_array_value( $placeholders[ $team_id ], $stat->post_name, '' ) == '' ): - $placeholders[ $team_id ][ $stat->post_name ] = sportspress_solve( $stat->equation, sportspress_array_value( $totals, $team_id, array() ), $stat->precision ); + if ( sp_array_value( $placeholders[ $team_id ], $stat->post_name, '' ) == '' ): + $placeholders[ $team_id ][ $stat->post_name ] = sp_solve( $stat->equation, sp_array_value( $totals, $team_id, array() ), $stat->precision ); endif; endforeach; endforeach; @@ -2191,7 +2082,7 @@ if ( !function_exists( 'sp_get_league_table_data' ) ) { endforeach; endforeach; - uasort( $merged, 'sportspress_sort_table_teams' ); + uasort( $merged, 'sp_sort_table_teams' ); // Rearrange data array to reflect values $data = array(); @@ -2216,13 +2107,6 @@ if ( !function_exists( 'sp_get_league_table_data' ) ) { } } -if ( !function_exists( 'sp_sort_sports' ) ) { - function sp_sort_sports ( $a, $b ) { - - return strcmp( sportspress_array_value( $a, 'name', '' ), sportspress_array_value( $b, 'name', '' ) ); - } -} - if ( !function_exists( 'sp_sort_table_teams' ) ) { function sp_sort_table_teams ( $a, $b ) { @@ -2232,10 +2116,10 @@ if ( !function_exists( 'sp_sort_table_teams' ) ) { foreach( $sportspress_column_priorities as $priority ): // Proceed if columns are not equal - if ( sportspress_array_value( $a, $priority['column'], 0 ) != sportspress_array_value( $b, $priority['column'], 0 ) ): + if ( sp_array_value( $a, $priority['column'], 0 ) != sp_array_value( $b, $priority['column'], 0 ) ): // Compare column values - $output = sportspress_array_value( $a, $priority['column'], 0 ) - sportspress_array_value( $b, $priority['column'], 0 ); + $output = sp_array_value( $a, $priority['column'], 0 ) - sp_array_value( $b, $priority['column'], 0 ); // Flip value if descending order if ( $priority['order'] == 'DESC' ) $output = 0 - $output; @@ -2247,14 +2131,14 @@ if ( !function_exists( 'sp_sort_table_teams' ) ) { endforeach; // Default sort by alphabetical - return strcmp( sportspress_array_value( $a, 'name', '' ), sportspress_array_value( $b, 'name', '' ) ); + return strcmp( sp_array_value( $a, 'name', '' ), sp_array_value( $b, 'name', '' ) ); } } if ( !function_exists( 'sp_get_player_list_data' ) ) { function sp_get_player_list_data( $post_id, $admin = false ) { - $league_id = sportspress_get_the_term_id( $post_id, 'sp_league', 0 ); - $div_id = sportspress_get_the_term_id( $post_id, 'sp_season', 0 ); + $league_id = sp_get_the_term_id( $post_id, 'sp_league', 0 ); + $div_id = sp_get_the_term_id( $post_id, 'sp_season', 0 ); $team_id = get_post_meta( $post_id, 'sp_team', true ); $player_ids = (array)get_post_meta( $post_id, 'sp_player', false ); $stats = (array)get_post_meta( $post_id, 'sp_players', true ); @@ -2263,10 +2147,10 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) { $usecolumns = get_post_meta( $post_id, 'sp_columns', true ); // Get labels from result variables - $columns = (array)sportspress_get_var_labels( 'sp_performance' ); + $columns = (array)sp_get_var_labels( 'sp_performance' ); // Get all leagues populated with stats where available - $tempdata = sportspress_array_combine( $player_ids, $stats ); + $tempdata = sp_array_combine( $player_ids, $stats ); // Create entry for each player in totals $totals = array(); @@ -2341,7 +2225,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) { if ( ! array_key_exists( $team_id, $teams ) ) continue; - $players = sportspress_array_value( $teams, $team_id, array() ); + $players = sp_array_value( $teams, $team_id, array() ); foreach ( $players as $player_id => $player_performance ): @@ -2349,7 +2233,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) { continue; // Increment events played - if ( sportspress_array_value( $player_performance, 'status' ) != 'sub' || sportspress_array_value( $player_performance, 'sub', 0 ) ): + if ( sp_array_value( $player_performance, 'status' ) != 'sub' || sp_array_value( $player_performance, 'sub', 0 ) ): $totals[ $player_id ]['eventsplayed']++; endif; @@ -2373,7 +2257,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) { continue; // Increment events played - if ( sportspress_array_value( $player_performance, 'status' ) != 'sub' || sportspress_array_value( $player_performance, 'sub', 0 ) ): + if ( sp_array_value( $player_performance, 'status' ) != 'sub' || sp_array_value( $player_performance, 'sub', 0 ) ): $totals[ $player_id ]['eventsplayed']++; endif; @@ -2410,7 +2294,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) { $meta = get_post_meta( $performance->ID ); // Add equation to object - $performance->equation = sportspress_array_value( sportspress_array_value( $meta, 'sp_equation', array() ), 0, 0 ); + $performance->equation = sp_array_value( sp_array_value( $meta, 'sp_equation', array() ), 0, 0 ); // Add column name to columns $columns[ $performance->post_name ] = $performance->post_title; @@ -2429,7 +2313,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) { array_unshift( $performances, $epstat ); foreach ( $performances as $performance ): - if ( sportspress_array_value( $placeholders[ $player_id ], $performance->post_name, '' ) == '' ): + if ( sp_array_value( $placeholders[ $player_id ], $performance->post_name, '' ) == '' ): if ( $performance->post_name == 'eventsplayed' ): $calculate = 'total'; @@ -2440,17 +2324,17 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) { if ( $calculate && $calculate == 'average' ): // Reflect average - $eventsplayed = (int)sportspress_array_value( $totals[ $player_id ], 'eventsplayed', 0 ); + $eventsplayed = (int)sp_array_value( $totals[ $player_id ], 'eventsplayed', 0 ); if ( ! $eventsplayed ): $placeholders[ $player_id ][ $performance->post_name ] = 0; else: - $placeholders[ $player_id ][ $performance->post_name ] = sportspress_array_value( sportspress_array_value( $totals, $player_id, array() ), $performance->post_name, 0 ) / $eventsplayed; + $placeholders[ $player_id ][ $performance->post_name ] = sp_array_value( sp_array_value( $totals, $player_id, array() ), $performance->post_name, 0 ) / $eventsplayed; endif; else: // Reflect total - $placeholders[ $player_id ][ $performance->post_name ] = sportspress_array_value( sportspress_array_value( $totals, $player_id, array() ), $performance->post_name, 0 ); + $placeholders[ $player_id ][ $performance->post_name ] = sp_array_value( sp_array_value( $totals, $player_id, array() ), $performance->post_name, 0 ); endif; @@ -2486,7 +2370,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) { 'order' => $order, ), ); - uasort( $merged, 'sportspress_sort_list_players' ); + uasort( $merged, 'sp_sort_list_players' ); endif; // Rearrange data array to reflect performance @@ -2514,8 +2398,8 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) { if ( !function_exists( 'sp_get_player_roster_data' ) ) { function sp_get_player_roster_data( $post_id, $admin = false ) { - $league_id = sportspress_get_the_term_id( $post_id, 'sp_league', 0 ); - $div_id = sportspress_get_the_term_id( $post_id, 'sp_season', 0 ); + $league_id = sp_get_the_term_id( $post_id, 'sp_league', 0 ); + $div_id = sp_get_the_term_id( $post_id, 'sp_season', 0 ); $team_id = get_post_meta( $post_id, 'sp_team', true ); $player_ids = (array)get_post_meta( $post_id, 'sp_player', false ); $stats = (array)get_post_meta( $post_id, 'sp_players', true ); @@ -2523,10 +2407,10 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) { $order = get_post_meta( $post_id, 'sp_order', true ); // Get labels from result variables - $columns = (array)sportspress_get_var_labels( 'sp_performance' ); + $columns = (array)sp_get_var_labels( 'sp_performance' ); // Get all leagues populated with stats where available - $tempdata = sportspress_array_combine( $player_ids, $stats ); + $tempdata = sp_array_combine( $player_ids, $stats ); // Create entry for each player in totals $totals = array(); @@ -2607,7 +2491,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) { if ( ! array_key_exists( $team_id, $teams ) ) continue; - $players = sportspress_array_value( $teams, $team_id, array() ); + $players = sp_array_value( $teams, $team_id, array() ); foreach ( $players as $player_id => $player_performance ): @@ -2615,7 +2499,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) { continue; // Increment events played - if ( sportspress_array_value( $player_performance, 'status' ) != 'sub' || sportspress_array_value( $player_performance, 'sub', 0 ) ): + if ( sp_array_value( $player_performance, 'status' ) != 'sub' || sp_array_value( $player_performance, 'sub', 0 ) ): $totals[ $player_id ]['eventsplayed']++; endif; @@ -2639,7 +2523,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) { continue; // Increment events played - if ( sportspress_array_value( $player_performance, 'status' ) != 'sub' || sportspress_array_value( $player_performance, 'sub', 0 ) ): + if ( sp_array_value( $player_performance, 'status' ) != 'sub' || sp_array_value( $player_performance, 'sub', 0 ) ): $totals[ $player_id ]['eventsplayed']++; endif; @@ -2676,7 +2560,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) { $meta = get_post_meta( $performance->ID ); // Add equation to object - $performance->equation = sportspress_array_value( sportspress_array_value( $meta, 'sp_equation', array() ), 0, 0 ); + $performance->equation = sp_array_value( sp_array_value( $meta, 'sp_equation', array() ), 0, 0 ); // Add column name to columns $columns[ $performance->post_name ] = $performance->post_title; @@ -2695,7 +2579,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) { array_unshift( $performances, $epstat ); foreach ( $performances as $performance ): - if ( sportspress_array_value( $placeholders[ $player_id ], $performance->post_name, '' ) == '' ): + if ( sp_array_value( $placeholders[ $player_id ], $performance->post_name, '' ) == '' ): if ( $performance->post_name == 'eventsplayed' ): $calculate = 'total'; @@ -2706,17 +2590,17 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) { if ( $calculate && $calculate == 'average' ): // Reflect average - $eventsplayed = (int)sportspress_array_value( $totals[ $player_id ], 'eventsplayed', 0 ); + $eventsplayed = (int)sp_array_value( $totals[ $player_id ], 'eventsplayed', 0 ); if ( ! $eventsplayed ): $placeholders[ $player_id ][ $performance->post_name ] = 0; else: - $placeholders[ $player_id ][ $performance->post_name ] = sportspress_array_value( sportspress_array_value( $totals, $player_id, array() ), $performance->post_name, 0 ) / $eventsplayed; + $placeholders[ $player_id ][ $performance->post_name ] = sp_array_value( sp_array_value( $totals, $player_id, array() ), $performance->post_name, 0 ) / $eventsplayed; endif; else: // Reflect total - $placeholders[ $player_id ][ $performance->post_name ] = sportspress_array_value( sportspress_array_value( $totals, $player_id, array() ), $performance->post_name, 0 ); + $placeholders[ $player_id ][ $performance->post_name ] = sp_array_value( sp_array_value( $totals, $player_id, array() ), $performance->post_name, 0 ); endif; @@ -2752,7 +2636,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) { 'order' => $order, ), ); - uasort( $merged, 'sportspress_sort_list_players' ); + uasort( $merged, 'sp_sort_list_players' ); endif; // Rearrange data array to reflect performance @@ -2780,16 +2664,16 @@ if ( !function_exists( 'sp_sort_list_players' ) ) { foreach( $sportspress_performance_priorities as $priority ): // Proceed if columns are not equal - if ( sportspress_array_value( $a, $priority['key'], 0 ) != sportspress_array_value( $b, $priority['key'], 0 ) ): + if ( sp_array_value( $a, $priority['key'], 0 ) != sp_array_value( $b, $priority['key'], 0 ) ): if ( $priority['key'] == 'name' ): - $output = strcmp( sportspress_array_value( $a, 'name', null ), sportspress_array_value( $b, 'name', null ) ); + $output = strcmp( sp_array_value( $a, 'name', null ), sp_array_value( $b, 'name', null ) ); else: // Compare performance values - $output = sportspress_array_value( $a, $priority['key'], 0 ) - sportspress_array_value( $b, $priority['key'], 0 ); + $output = sp_array_value( $a, $priority['key'], 0 ) - sp_array_value( $b, $priority['key'], 0 ); endif; @@ -2803,7 +2687,7 @@ if ( !function_exists( 'sp_sort_list_players' ) ) { endforeach; // Default sort by number - return sportspress_array_value( $a, 'number', 0 ) - sportspress_array_value( $b, 'number', 0 ); + return sp_array_value( $a, 'number', 0 ) - sp_array_value( $b, 'number', 0 ); } } @@ -2813,17 +2697,17 @@ if ( !function_exists( 'sp_get_player_metrics_data' ) ) { $metrics = (array)get_post_meta( $post_id, 'sp_metrics', true ); // Get labels from metric variables - $metric_labels = (array)sportspress_get_var_labels( 'sp_metric' ); + $metric_labels = (array)sp_get_var_labels( 'sp_metric' ); $data = array(); foreach( $metric_labels as $key => $value ): - $metric = sportspress_array_value( $metrics, $key, null ); + $metric = sp_array_value( $metrics, $key, null ); if ( $metric == null ) continue; - $data[ $value ] = sportspress_array_value( $metrics, $key, ' ' ); + $data[ $value ] = sp_array_value( $metrics, $key, ' ' ); endforeach; @@ -2838,7 +2722,7 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) { $seasons = (array)get_the_terms( $post_id, 'sp_season' ); $positions = get_the_terms( $post_id, 'sp_position' ); $stats = (array)get_post_meta( $post_id, 'sp_performance', true ); - $seasons_teams = sportspress_array_value( (array)get_post_meta( $post_id, 'sp_leagues', true ), $league_id, array() ); + $seasons_teams = sp_array_value( (array)get_post_meta( $post_id, 'sp_leagues', true ), $league_id, array() ); $args = array( 'post_type' => 'sp_performance', @@ -2885,11 +2769,11 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) { $tempdata = array(); // Get all seasons populated with stats where available - $tempdata = sportspress_array_combine( $div_ids, sportspress_array_value( $stats, $league_id, array() ) ); + $tempdata = sp_array_combine( $div_ids, sp_array_value( $stats, $league_id, array() ) ); foreach ( $div_ids as $div_id ): - $team_id = sportspress_array_value( $seasons_teams, $div_id, '-1' ); + $team_id = sp_array_value( $seasons_teams, $div_id, '-1' ); $totals = array( 'eventsattended' => 0, 'eventsplayed' => 0 ); @@ -2930,8 +2814,8 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) { // Add all team performance foreach ( $team_performance as $players ): if ( array_key_exists( $post_id, $players ) ): - $player_performance = sportspress_array_value( $players, $post_id, array() ); - if ( sportspress_array_value( $player_performance, 'status' ) != 'sub' || sportspress_array_value( $player_performance, 'sub', 0 ) ): + $player_performance = sp_array_value( $players, $post_id, array() ); + if ( sp_array_value( $player_performance, 'status' ) != 'sub' || sp_array_value( $player_performance, 'sub', 0 ) ): $totals['eventsplayed']++; endif; foreach ( $player_performance as $key => $value ): @@ -2950,17 +2834,17 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) { if ( $value == 'average' ): // Reflect average - $eventsplayed = (int)sportspress_array_value( $totals, 'eventsplayed', 0 ); + $eventsplayed = (int)sp_array_value( $totals, 'eventsplayed', 0 ); if ( ! $eventsplayed ): $placeholders[ $div_id ][ $key ] = 0; else: - $placeholders[ $div_id ][ $key ] = sportspress_array_value( $totals, $key, 0 ) / $eventsplayed; + $placeholders[ $div_id ][ $key ] = sp_array_value( $totals, $key, 0 ) / $eventsplayed; endif; else: // Reflect total - $placeholders[ $div_id ][ $key ] = sportspress_array_value( $totals, $key, 0 ); + $placeholders[ $div_id ][ $key ] = sp_array_value( $totals, $key, 0 ); endif; @@ -2973,7 +2857,7 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) { foreach( $placeholders as $season_id => $season_data ): - $team_id = sportspress_array_value( $seasons_teams, $season_id, array() ); + $team_id = sp_array_value( $seasons_teams, $season_id, array() ); if ( ! $team_id || $team_id == '-1' ) continue; @@ -2981,7 +2865,7 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) { $team_name = get_the_title( $team_id ); $team_permalink = get_permalink( $team_id ); - $season_name = sportspress_array_value( $season_names, $season_id, ' ' ); + $season_name = sp_array_value( $season_names, $season_id, ' ' ); // Add season name to row $merged[ $season_id ] = array( @@ -3034,8 +2918,8 @@ if ( !function_exists( 'sp_delete_duplicate_post' ) ) { $key = isset( $post['sp_key'] ) ? $post['sp_key'] : null; if ( ! $key ) $key = $post['post_title']; - $id = sportspress_array_value( $post, 'post_ID', 'var' ); - $title = sportspress_get_eos_safe_slug( $key, $id ); + $id = sp_array_value( $post, 'post_ID', 'var' ); + $title = sp_get_eos_safe_slug( $key, $id ); $check_sql = "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $title, $post['post_type'], $id ) ); diff --git a/includes/sp-template-hooks.php b/includes/sp-template-hooks.php index 7df38d78..6512189c 100644 --- a/includes/sp-template-hooks.php +++ b/includes/sp-template-hooks.php @@ -49,7 +49,7 @@ function sportspress_default_venue_content( $query ) { if ( ! is_tax( 'sp_venue' ) ) return; - $slug = sportspress_array_value( $query->query, 'sp_venue', null ); + $slug = sp_array_value( $query->query, 'sp_venue', null ); if ( ! $slug ) return; @@ -57,9 +57,9 @@ function sportspress_default_venue_content( $query ) { $venue = get_term_by( 'slug', $slug, 'sp_venue' ); $t_id = $venue->term_id; $venue_meta = get_option( "taxonomy_$t_id" ); - $address = sportspress_array_value( $venue_meta, 'sp_address', null ); - $latitude = sportspress_array_value( $venue_meta, 'sp_latitude', null ); - $longitude = sportspress_array_value( $venue_meta, 'sp_longitude', null ); + $address = sp_array_value( $venue_meta, 'sp_address', null ); + $latitude = sp_array_value( $venue_meta, 'sp_latitude', null ); + $longitude = sp_array_value( $venue_meta, 'sp_longitude', null ); if ( $latitude != null && $longitude != null ) echo '
    '; @@ -194,13 +194,13 @@ function sportspress_pre_get_posts( $query ) { } add_filter('pre_get_posts', 'sportspress_pre_get_posts'); -function sportspress_posts_where( $where, $that ) { +function sp_posts_where( $where, $that ) { global $wpdb; if( 'sp_event' == $that->query_vars['post_type'] && is_archive() ) $where = str_replace( "{$wpdb->posts}.post_status = 'publish'", "{$wpdb->posts}.post_status = 'publish' OR $wpdb->posts.post_status = 'future'", $where ); return $where; } -add_filter( 'posts_where', 'sportspress_posts_where', 2, 10 ); +add_filter( 'posts_where', 'sp_posts_where', 2, 10 ); function sportspress_sanitize_title( $title ) { @@ -214,9 +214,9 @@ function sportspress_sanitize_title( $title ) { if ( ! $key ) $key = $_POST['post_title']; - $id = sportspress_array_value( $_POST, 'post_ID', 'var' ); + $id = sp_array_value( $_POST, 'post_ID', 'var' ); - $title = sportspress_get_eos_safe_slug( $key, $id ); + $title = sp_get_eos_safe_slug( $key, $id ); elseif ( isset( $_POST ) && array_key_exists( 'post_type', $_POST ) && $_POST['post_type'] == 'sp_event' ): @@ -235,7 +235,7 @@ add_filter( 'sanitize_title', 'sportspress_sanitize_title' ); function sportspress_the_content( $content ) { if ( is_single() || is_page() ) - sportspress_set_post_views( get_the_ID() ); + sp_set_post_views( get_the_ID() ); return $content; } add_filter( 'the_content', 'sportspress_the_content' ); diff --git a/includes/widgets/class-sp-widget-countdown.php b/includes/widgets/class-sp-widget-countdown.php index df4547fe..5eee85b0 100644 --- a/includes/widgets/class-sp-widget-countdown.php +++ b/includes/widgets/class-sp-widget-countdown.php @@ -49,8 +49,8 @@ class SP_Widget_Countdown extends WP_Widget { 'show_dates' => true, 'post_status' => 'future', ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_event', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_pages( $args ) ): + sp_post_adder( 'sp_event', __( 'Add New', 'sportspress' ) ); endif; ?>

    diff --git a/includes/widgets/class-sp-widget-event-calendar.php b/includes/widgets/class-sp-widget-event-calendar.php index 05018ade..ec2861da 100644 --- a/includes/widgets/class-sp-widget-event-calendar.php +++ b/includes/widgets/class-sp-widget-event-calendar.php @@ -49,8 +49,8 @@ class SP_Widget_Event_Calendar extends WP_Widget { 'values' => 'ID', 'class' => 'sp-event-calendar-select widefat', ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_pages( $args ) ): + sp_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) ); endif; ?>

    diff --git a/includes/widgets/class-sp-widget-event-list.php b/includes/widgets/class-sp-widget-event-list.php index ec7ccc00..f731427d 100644 --- a/includes/widgets/class-sp-widget-event-list.php +++ b/includes/widgets/class-sp-widget-event-list.php @@ -53,8 +53,8 @@ class SP_Widget_Event_List extends WP_Widget { 'values' => 'ID', 'class' => 'sp-event-calendar-select widefat', ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_pages( $args ) ): + sp_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) ); endif; ?>

    diff --git a/includes/widgets/class-sp-widget-league-table.php b/includes/widgets/class-sp-widget-league-table.php index 11f87741..6fc85524 100644 --- a/includes/widgets/class-sp-widget-league-table.php +++ b/includes/widgets/class-sp-widget-league-table.php @@ -57,8 +57,8 @@ class SP_Widget_League_Table extends WP_Widget { 'values' => 'ID', 'class' => 'widefat', ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_table', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_pages( $args ) ): + sp_post_adder( 'sp_table', __( 'Add New', 'sportspress' ) ); endif; ?>

    diff --git a/includes/widgets/class-sp-widget-player-gallery.php b/includes/widgets/class-sp-widget-player-gallery.php index c1cebf3e..f0d9ef34 100644 --- a/includes/widgets/class-sp-widget-player-gallery.php +++ b/includes/widgets/class-sp-widget-player-gallery.php @@ -60,8 +60,8 @@ class SP_Widget_Player_Gallery extends WP_Widget { 'values' => 'ID', 'class' => 'widefat', ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_pages( $args ) ): + sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); endif; ?>

    @@ -85,8 +85,8 @@ class SP_Widget_Player_Gallery extends WP_Widget { 'values' => 'slug', 'class' => 'sp-select-orderby widefat', ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_pages( $args ) ): + sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); endif; ?>

    diff --git a/includes/widgets/class-sp-widget-player-list.php b/includes/widgets/class-sp-widget-player-list.php index 4b560a56..53c9c751 100644 --- a/includes/widgets/class-sp-widget-player-list.php +++ b/includes/widgets/class-sp-widget-player-list.php @@ -60,8 +60,8 @@ class SP_Widget_Player_list extends WP_Widget { 'values' => 'ID', 'class' => 'widefat', ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_pages( $args ) ): + sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); endif; ?>

    @@ -106,8 +106,8 @@ class SP_Widget_Player_list extends WP_Widget { 'values' => 'slug', 'class' => 'sp-select-orderby widefat', ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); + if ( ! sp_dropdown_pages( $args ) ): + sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); endif; ?>

    diff --git a/templates/countdown.php b/templates/countdown.php index 336e5776..14e1a0b9 100644 --- a/templates/countdown.php +++ b/templates/countdown.php @@ -5,7 +5,7 @@ else: $args = array(); if ( isset( $team ) ) $args = array( 'key' => 'sp_team', 'value' => $team ); - $post = sportspress_get_next_event( $args ); + $post = sp_get_next_event( $args ); endif; $output = ''; diff --git a/templates/event-calendar.php b/templates/event-calendar.php index 43da1088..8f9ed114 100644 --- a/templates/event-calendar.php +++ b/templates/event-calendar.php @@ -15,7 +15,7 @@ $defaults = array( extract( $defaults, EXTR_SKIP ); if ( isset( $id ) ): - $events = sportspress_get_calendar_data( $id ); + $events = sp_get_calendar_data( $id ); $event_ids = array(); foreach ( $events as $event ): $event_ids[] = $event->ID; diff --git a/templates/event-list.php b/templates/event-list.php index 6e6668a6..0af0ba77 100644 --- a/templates/event-list.php +++ b/templates/event-list.php @@ -1,6 +1,6 @@ -1, @@ -14,7 +14,7 @@ extract( $defaults, EXTR_SKIP ); $team_id ): $totals = array(); // Get results for players in the team - $players = sportspress_array_between( (array)get_post_meta( $id, 'sp_player', false ), 0, $key ); + $players = sp_array_between( (array)get_post_meta( $id, 'sp_player', false ), 0, $key ); if ( sizeof( $players ) <= 1 ) continue; - $data = sportspress_array_combine( $players, sportspress_array_value( $stats, $team_id, array() ) ); + $data = sp_array_combine( $players, sp_array_value( $stats, $team_id, array() ) ); $output .= '

    ' . get_the_title( $team_id ) . '

    '; @@ -108,7 +108,7 @@ foreach( $teams as $key => $team_id ): if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ): $value = $row[ $key ]; else: - $value = sportspress_array_value( $totals, $key, 0 ); + $value = sp_array_value( $totals, $key, 0 ); endif; $output .= ''; endforeach; diff --git a/templates/event-results.php b/templates/event-results.php index 108d65c0..decea8d4 100644 --- a/templates/event-results.php +++ b/templates/event-results.php @@ -3,8 +3,8 @@ if ( ! isset( $id ) ) $id = get_the_ID(); $teams = (array)get_post_meta( $id, 'sp_team', false ); -$results = array_filter( sportspress_array_combine( $teams, (array)get_post_meta( $id, 'sp_results', true ) ), 'array_filter' ); -$result_labels = sportspress_get_var_labels( 'sp_result' ); +$results = array_filter( sp_array_combine( $teams, (array)get_post_meta( $id, 'sp_results', true ) ), 'array_filter' ); +$result_labels = sp_get_var_labels( 'sp_result' ); $output = ''; @@ -17,7 +17,7 @@ if ( empty( $results ) ) return false; foreach( $results as $team_id => $result ): - if ( sportspress_array_value( $result, 'outcome', '-1' ) != '-1' ): + if ( sp_array_value( $result, 'outcome', '-1' ) != '-1' ): unset( $result['outcome'] ); diff --git a/templates/event-venue.php b/templates/event-venue.php index 71f9127b..2495a372 100644 --- a/templates/event-venue.php +++ b/templates/event-venue.php @@ -14,9 +14,9 @@ foreach( $venues as $venue ): $t_id = $venue->term_id; $term_meta = get_option( "taxonomy_$t_id" ); - $address = sportspress_array_value( $term_meta, 'sp_address', '' ); - $latitude = sportspress_array_value( $term_meta, 'sp_latitude', 0 ); - $longitude = sportspress_array_value( $term_meta, 'sp_longitude', 0 ); + $address = sp_array_value( $term_meta, 'sp_address', '' ); + $latitude = sp_array_value( $term_meta, 'sp_latitude', 0 ); + $longitude = sp_array_value( $term_meta, 'sp_longitude', 0 ); $output .= '

    ' . SP()->text->string('Venue', 'event') . '

    '; $output .= '

    ' . $venue->name . '
    ' . $address . '

    '; diff --git a/templates/league-table.php b/templates/league-table.php index eefc412e..c2ad47e8 100644 --- a/templates/league-table.php +++ b/templates/league-table.php @@ -17,7 +17,7 @@ extract( $defaults, EXTR_SKIP ); $output = '
    ' . '
    - > + > '; ?> 'sp_team', 'name' => 'sp_leagues[' . $league_id . '][' . $div_id . ']', @@ -1224,7 +1174,7 @@ if ( !function_exists( 'sp_edit_player_performance_table' ) ) { ), ), ); - if ( ! sportspress_dropdown_pages( $args ) ): + if ( ! sp_dropdown_pages( $args ) ): _e( 'No results found.', 'sportspress' ); endif; ?> @@ -1232,8 +1182,8 @@ if ( !function_exists( 'sp_edit_player_performance_table' ) ) { $label ): ?> '; ?> 'multiple', 'chosen' => true, ); - sportspress_dropdown_pages( $args ); + sp_dropdown_pages( $args ); ?>
    - - + +
    ' . $value . '
    ' . '' . ''; -$data = sportspress_get_league_table_data( $id ); +$data = sp_get_league_table_data( $id ); // The first row should be column labels $labels = $data[0]; @@ -49,7 +49,7 @@ foreach( $data as $team_id => $row ): if ( isset( $limit ) && $i >= $limit ) continue; - $name = sportspress_array_value( $row, 'name', null ); + $name = sp_array_value( $row, 'name', null ); if ( ! $name ) continue; $output .= ''; @@ -71,7 +71,7 @@ foreach( $data as $team_id => $row ): if ( $key == 'name' ) continue; if ( ! is_array( $columns ) || in_array( $key, $columns ) ) - $output .= ''; + $output .= ''; endforeach; $output .= ''; diff --git a/templates/player-gallery.php b/templates/player-gallery.php index 691206cf..0abf995c 100644 --- a/templates/player-gallery.php +++ b/templates/player-gallery.php @@ -34,7 +34,7 @@ $float = is_rtl() ? 'right' : 'left'; $selector = 'sp-player-gallery-' . $id; -$data = sportspress_get_player_list_data( $id ); +$data = sp_get_player_list_data( $id ); // The first row should be column labels $labels = $data[0]; @@ -53,7 +53,7 @@ else: 'order' => $order, ), ); - uasort( $data, 'sportspress_sort_list_players' ); + uasort( $data, 'sp_sort_list_players' ); endif; $gallery_style = $gallery_div = ''; diff --git a/templates/player-league-performance.php b/templates/player-league-performance.php index 48aaf33e..7d5bd788 100644 --- a/templates/player-league-performance.php +++ b/templates/player-league-performance.php @@ -7,7 +7,7 @@ if ( ! isset( $id ) ) $responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false; -$data = sportspress_get_player_performance_data( $id, $league->term_id ); +$data = sp_get_player_performance_data( $id, $league->term_id ); // The first row should be column labels $labels = $data[0]; @@ -36,7 +36,7 @@ foreach( $data as $season_id => $row ): $output .= ''; foreach( $labels as $key => $value ): - $output .= ''; + $output .= ''; endforeach; $output .= ''; diff --git a/templates/player-list.php b/templates/player-list.php index bcc09504..00ef2240 100644 --- a/templates/player-list.php +++ b/templates/player-list.php @@ -18,7 +18,7 @@ extract( $defaults, EXTR_SKIP ); $output = '
    ' . '
    ' . sportspress_array_value( $row, $key, '—' ) . '' . sp_array_value( $row, $key, '—' ) . '
    ' . sportspress_array_value( $row, $key, '—' ) . '' . sp_array_value( $row, $key, '—' ) . '
    ' . '' . ''; -$data = sportspress_get_player_list_data( $id ); +$data = sp_get_player_list_data( $id ); // The first row should be column labels $labels = $data[0]; @@ -37,7 +37,7 @@ else: 'order' => $order, ), ); - uasort( $data, 'sportspress_sort_list_players' ); + uasort( $data, 'sp_sort_list_players' ); endif; if ( in_array( $orderby, array( 'number', 'name' ) ) ): @@ -61,7 +61,7 @@ if ( is_int( $number ) && $number > 0 ) foreach( $data as $player_id => $row ): if ( isset( $limit ) && $i >= $limit ) continue; - $name = sportspress_array_value( $row, 'name', null ); + $name = sp_array_value( $row, 'name', null ); if ( ! $name ) continue; $output .= ''; @@ -85,7 +85,7 @@ foreach( $data as $player_id => $row ): if ( $key == 'name' ) continue; if ( ! is_array( $performance ) || in_array( $key, $performance ) ) - $output .= ''; + $output .= ''; endforeach; $output .= ''; diff --git a/templates/player-metrics.php b/templates/player-metrics.php index 6630db52..f8532ccc 100644 --- a/templates/player-metrics.php +++ b/templates/player-metrics.php @@ -15,11 +15,11 @@ $countries = SP()->countries->countries; $nationality = get_post_meta( $id, 'sp_nationality', true ); $current_team = get_post_meta( $id, 'sp_current_team', true ); $past_teams = get_post_meta( $id, 'sp_past_team', false ); -$metrics = sportspress_get_player_metrics_data( $id ); +$metrics = sp_get_player_metrics_data( $id ); $common = array(); if ( $nationality ): - $country_name = sportspress_array_value( $countries, $nationality, null ); + $country_name = sp_array_value( $countries, $nationality, null ); $common[ SP()->text->string('Nationality', 'player') ] = $country_name ? ( $show_nationality_flag ? '' . $nationality . ' ' : '' ) . $country_name : '—'; endif; diff --git a/templates/player-roster.php b/templates/player-roster.php index 120e6a8a..33d3efd3 100644 --- a/templates/player-roster.php +++ b/templates/player-roster.php @@ -12,7 +12,7 @@ $r = wp_parse_args( $args, $defaults ); $output = ''; -$data = sportspress_get_player_roster_data( $id ); +$data = sp_get_player_roster_data( $id ); // The first row should be column labels $labels = $data[0]; @@ -20,7 +20,7 @@ $labels = $data[0]; // Remove the first row to leave us with the actual data unset( $data[0] ); -$performance = sportspress_array_value( $r, 'performance', null ); +$performance = sp_array_value( $r, 'performance', null ); if ( $r['orderby'] == 'default' ): $r['orderby'] = get_post_meta( $id, 'sp_orderby', true ); @@ -33,7 +33,7 @@ else: 'order' => $r['order'], ), ); - uasort( $data, 'sportspress_sort_list_players' ); + uasort( $data, 'sp_sort_list_players' ); endif; $positions = get_terms ( 'sp_position' ); @@ -59,14 +59,14 @@ foreach ( $positions as $position ): // Name as link $permalink = get_post_permalink( $player_id ); - $name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', ' ' ) ); + $name = sp_array_value( $row, 'name', sp_array_value( $row, 'name', ' ' ) ); $rows .= ''; foreach( $labels as $key => $value ): if ( $key == 'name' ) continue; if ( ! is_array( $performance ) || in_array( $key, $performance ) ) - $rows .= ''; + $rows .= ''; endforeach; $rows .= ''; diff --git a/templates/team-columns.php b/templates/team-columns.php index 8d531cf6..0974c3f0 100644 --- a/templates/team-columns.php +++ b/templates/team-columns.php @@ -12,7 +12,7 @@ $output = ''; // Loop through data for each league foreach ( $leagues as $league ): - $data = sportspress_get_team_columns_data( $id, $league->term_id ); + $data = sp_get_team_columns_data( $id, $league->term_id ); if ( sizeof( $data ) <= 1 ) continue; @@ -40,7 +40,7 @@ foreach ( $leagues as $league ): $output .= ''; foreach( $labels as $key => $value ): - $output .= ''; + $output .= ''; endforeach; $output .= '';
    ' . sportspress_array_value( $row, $key, '—' ) . '' . sp_array_value( $row, $key, '—' ) . '
    ' . '' . $name . '' . sportspress_array_value( $row, $key, '—' ) . '' . sp_array_value( $row, $key, '—' ) . '
    ' . sportspress_array_value( $row, $key, '—' ) . '' . sp_array_value( $row, $key, '—' ) . '