From 1add35a47ffd4fa489a78a9fc5e0a643598f5f41 Mon Sep 17 00:00:00 2001
From: Brian Miyaji ' . __( 'None', 'sportspress' ) . ' ' . __( 'None', 'sportspress' ) . '
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 ); ?>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' ) ); ?>
| @@ -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' ) ) {'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 ): ?> | '; ?> | @@ -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, '' ); ?>'multiple', 'chosen' => true, ); - sportspress_dropdown_pages( $args ); + sp_dropdown_pages( $args ); ?> | $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 ); | |||
| ' . $value . ' | '; 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 .= '
| ' . sportspress_array_value( $row, $key, '—' ) . ' | '; + $output .= '' . sp_array_value( $row, $key, '—' ) . ' | '; endforeach; $output .= '
| ' . sportspress_array_value( $row, $key, '—' ) . ' | '; + $output .= '' . sp_array_value( $row, $key, '—' ) . ' | '; endforeach; $output .= '
| ' . sportspress_array_value( $row, $key, '—' ) . ' | '; + $output .= '' . sp_array_value( $row, $key, '—' ) . ' | '; endforeach; $output .= '' . '' . $name . ' | '; foreach( $labels as $key => $value ): if ( $key == 'name' ) continue; if ( ! is_array( $performance ) || in_array( $key, $performance ) ) - $rows .= '' . sportspress_array_value( $row, $key, '—' ) . ' | '; + $rows .= '' . sp_array_value( $row, $key, '—' ) . ' | '; 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 .= '
| ' . sportspress_array_value( $row, $key, '—' ) . ' | '; + $output .= '' . sp_array_value( $row, $key, '—' ) . ' | '; endforeach; $output .= '