Replace deprecated functions
This commit is contained in:
@@ -38,7 +38,7 @@ class SP_Admin_Dashboard {
|
|||||||
* Show status widget
|
* Show status widget
|
||||||
*/
|
*/
|
||||||
public function 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 ) );
|
$now = new DateTime( current_time( 'mysql', 0 ) );
|
||||||
$date = new DateTime( $next_event->post_date );
|
$date = new DateTime( $next_event->post_date );
|
||||||
$interval = date_diff( $now, $date );
|
$interval = date_diff( $now, $date );
|
||||||
|
|||||||
@@ -42,15 +42,15 @@ class SP_Admin_Menus {
|
|||||||
public function menu_highlight() {
|
public function menu_highlight() {
|
||||||
global $typenow;
|
global $typenow;
|
||||||
if ( in_array( $typenow, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_performance', 'sp_metric' ) ) )
|
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' )
|
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' )
|
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' )
|
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' )
|
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' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class SP_Admin_Permalink_Settings {
|
|||||||
else
|
else
|
||||||
update_option( $key, $value );
|
update_option( $key, $value );
|
||||||
endforeach;
|
endforeach;
|
||||||
sportspress_flush_rewrite_rules();
|
sp_flush_rewrite_rules();
|
||||||
endif;
|
endif;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ class SP_Admin_Taxonomies {
|
|||||||
$term = reset( $terms );
|
$term = reset( $terms );
|
||||||
$t_id = $term->term_id;
|
$t_id = $term->term_id;
|
||||||
$term_meta = get_option( "taxonomy_$t_id" );
|
$term_meta = get_option( "taxonomy_$t_id" );
|
||||||
$latitude = sportspress_array_value( $term_meta, 'sp_latitude', '40.7324319' );
|
$latitude = sp_array_value( $term_meta, 'sp_latitude', '40.7324319' );
|
||||||
$longitude = sportspress_array_value( $term_meta, 'sp_longitude', '-73.82480799999996' );
|
$longitude = sp_array_value( $term_meta, 'sp_longitude', '-73.82480799999996' );
|
||||||
else:
|
else:
|
||||||
$latitude = '40.7324319';
|
$latitude = '40.7324319';
|
||||||
$longitude = '-73.82480799999996';
|
$longitude = '-73.82480799999996';
|
||||||
|
|||||||
@@ -120,8 +120,8 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|||||||
$season = ( empty( $_POST['sp_season'] ) ? false : $_POST['sp_season'] );
|
$season = ( empty( $_POST['sp_season'] ) ? false : $_POST['sp_season'] );
|
||||||
|
|
||||||
// Get labels from result and performance post types
|
// Get labels from result and performance post types
|
||||||
$result_labels = sportspress_get_var_labels( 'sp_result' );
|
$result_labels = sp_get_var_labels( 'sp_result' );
|
||||||
$performance_labels = sportspress_get_var_labels( 'sp_performance' );
|
$performance_labels = sp_get_var_labels( 'sp_performance' );
|
||||||
|
|
||||||
while ( ( $row = fgetcsv( $handle, 0, $this->delimiter ) ) !== FALSE ):
|
while ( ( $row = fgetcsv( $handle, 0, $this->delimiter ) ) !== FALSE ):
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|||||||
|
|
||||||
// Add delimiter if event name is set
|
// Add delimiter if event name is set
|
||||||
if ( $title ):
|
if ( $title ):
|
||||||
$title .= ' ' . sportspress_array_value( $sportspress_options, 'event_teams_delimiter', 'vs' ) . ' ';
|
$title .= ' ' . sp_array_value( $sportspress_options, 'event_teams_delimiter', 'vs' ) . ' ';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Append team name to event name
|
// Append team name to event name
|
||||||
@@ -575,9 +575,9 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|||||||
'values' => 'slug',
|
'values' => 'slug',
|
||||||
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
echo '<p>' . __( 'None', 'sportspress' ) . '</p>';
|
echo '<p>' . __( 'None', 'sportspress' ) . '</p>';
|
||||||
sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?></td>
|
?></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -590,9 +590,9 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|||||||
'values' => 'slug',
|
'values' => 'slug',
|
||||||
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
echo '<p>' . __( 'None', 'sportspress' ) . '</p>';
|
echo '<p>' . __( 'None', 'sportspress' ) . '</p>';
|
||||||
sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?></td>
|
?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -92,10 +92,10 @@ class SP_Admin_CPT_Calendar extends SP_Admin_CPT {
|
|||||||
endif;
|
endif;
|
||||||
break;
|
break;
|
||||||
case 'sp_events':
|
case 'sp_events':
|
||||||
echo sizeof( sportspress_get_calendar_data( $post_id ) );
|
echo sizeof( sp_get_calendar_data( $post_id ) );
|
||||||
break;
|
break;
|
||||||
case 'sp_views':
|
case 'sp_views':
|
||||||
echo sportspress_get_post_views( $post_id );
|
echo sp_get_post_views( $post_id );
|
||||||
break;
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ class SP_Admin_CPT_Calendar extends SP_Admin_CPT {
|
|||||||
if ( $typenow != 'sp_calendar' )
|
if ( $typenow != 'sp_calendar' )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sportspress_highlight_admin_menu();
|
sp_highlight_admin_menu();
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -134,7 +134,7 @@ class SP_Admin_CPT_Calendar extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_league',
|
'name' => 'sp_league',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -143,7 +143,7 @@ class SP_Admin_CPT_Calendar extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_season',
|
'name' => 'sp_season',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
|
|||||||
@@ -60,13 +60,13 @@ class SP_Admin_CPT_Column extends SP_Admin_CPT {
|
|||||||
echo $post->post_name;
|
echo $post->post_name;
|
||||||
break;
|
break;
|
||||||
case 'sp_equation':
|
case 'sp_equation':
|
||||||
echo sportspress_get_post_equation( $post_id );
|
echo sp_get_post_equation( $post_id );
|
||||||
break;
|
break;
|
||||||
case 'sp_precision':
|
case 'sp_precision':
|
||||||
echo sportspress_get_post_precision( $post_id );
|
echo sp_get_post_precision( $post_id );
|
||||||
break;
|
break;
|
||||||
case 'sp_order':
|
case 'sp_order':
|
||||||
echo sportspress_get_post_order( $post_id );
|
echo sp_get_post_order( $post_id );
|
||||||
break;
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,14 +69,14 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|||||||
|
|
||||||
if ( $data['post_type'] == 'sp_event' && $data['post_title'] == '' ):
|
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();
|
$team_names = array();
|
||||||
foreach( $teams as $team ):
|
foreach( $teams as $team ):
|
||||||
$team_names[] = get_the_title( $team );
|
$team_names[] = get_the_title( $team );
|
||||||
endforeach;
|
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;
|
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' ) : '—';
|
echo get_the_terms ( $post_id, 'sp_venue' ) ? the_terms( $post_id, 'sp_venue' ) : '—';
|
||||||
break;
|
break;
|
||||||
case 'sp_views':
|
case 'sp_views':
|
||||||
echo sportspress_get_post_views( $post_id );
|
echo sp_get_post_views( $post_id );
|
||||||
break;
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|||||||
if ( $typenow != 'sp_event' )
|
if ( $typenow != 'sp_event' )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sportspress_highlight_admin_menu();
|
sp_highlight_admin_menu();
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -201,7 +201,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_league',
|
'name' => 'sp_league',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -210,7 +210,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_season',
|
'name' => 'sp_season',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class SP_Admin_CPT_List extends SP_Admin_CPT {
|
|||||||
public function custom_columns( $column, $post_id ) {
|
public function custom_columns( $column, $post_id ) {
|
||||||
switch ( $column ):
|
switch ( $column ):
|
||||||
case 'sp_player':
|
case 'sp_player':
|
||||||
echo sportspress_posts( $post_id, 'sp_player' );
|
echo sp_posts( $post_id, 'sp_player' );
|
||||||
break;
|
break;
|
||||||
case 'sp_league':
|
case 'sp_league':
|
||||||
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, '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;
|
endif;
|
||||||
break;
|
break;
|
||||||
case 'sp_views':
|
case 'sp_views':
|
||||||
echo sportspress_get_post_views( $post_id );
|
echo sp_get_post_views( $post_id );
|
||||||
break;
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ class SP_Admin_CPT_List extends SP_Admin_CPT {
|
|||||||
if ( $typenow != 'sp_list' )
|
if ( $typenow != 'sp_list' )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sportspress_highlight_admin_menu();
|
sp_highlight_admin_menu();
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -123,7 +123,7 @@ class SP_Admin_CPT_List extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_league',
|
'name' => 'sp_league',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -132,7 +132,7 @@ class SP_Admin_CPT_List extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_season',
|
'name' => 'sp_season',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
|
|||||||
@@ -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' ) : '—';
|
echo get_the_terms( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—';
|
||||||
break;
|
break;
|
||||||
case 'sp_calculate':
|
case 'sp_calculate':
|
||||||
echo sportspress_get_post_calculate( $post_id );
|
echo sp_get_post_calculate( $post_id );
|
||||||
break;
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,16 +89,16 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT {
|
|||||||
else:
|
else:
|
||||||
$results = get_post_meta( $post_id, 'sp_results', true );
|
$results = get_post_meta( $post_id, 'sp_results', true );
|
||||||
global $sportspress_options;
|
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 ):
|
foreach( $teams as $team_id ):
|
||||||
if ( ! $team_id ) continue;
|
if ( ! $team_id ) continue;
|
||||||
$team = get_post( $team_id );
|
$team = get_post( $team_id );
|
||||||
|
|
||||||
if ( $team ):
|
if ( $team ):
|
||||||
$team_results = sportspress_array_value( $results, $team_id, null );
|
$team_results = sp_array_value( $results, $team_id, null );
|
||||||
|
|
||||||
if ( $main_result ):
|
if ( $main_result ):
|
||||||
$team_result = sportspress_array_value( $team_results, $main_result, null );
|
$team_result = sp_array_value( $team_results, $main_result, null );
|
||||||
else:
|
else:
|
||||||
if ( is_array( $team_results ) ):
|
if ( is_array( $team_results ) ):
|
||||||
end( $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' ) : '—';
|
echo get_the_terms ( $post_id, 'sp_venue' ) ? the_terms( $post_id, 'sp_venue' ) : '—';
|
||||||
break;
|
break;
|
||||||
case 'sp_views':
|
case 'sp_views':
|
||||||
echo sportspress_get_post_views( $post_id );
|
echo sp_get_post_views( $post_id );
|
||||||
break;
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT {
|
|||||||
if ( $typenow != 'sp_player' )
|
if ( $typenow != 'sp_player' )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sportspress_highlight_admin_menu();
|
sp_highlight_admin_menu();
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -180,7 +180,7 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_league',
|
'name' => 'sp_league',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -189,7 +189,7 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_season',
|
'name' => 'sp_season',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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' ) : '—';
|
echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—';
|
||||||
break;
|
break;
|
||||||
case 'sp_views':
|
case 'sp_views':
|
||||||
echo sportspress_get_post_views( $post_id );
|
echo sp_get_post_views( $post_id );
|
||||||
break;
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ class SP_Admin_CPT_Staff extends SP_Admin_CPT {
|
|||||||
if ( $typenow != 'sp_staff' )
|
if ( $typenow != 'sp_staff' )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sportspress_highlight_admin_menu();
|
sp_highlight_admin_menu();
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -157,7 +157,7 @@ class SP_Admin_CPT_Staff extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_league',
|
'name' => 'sp_league',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -166,7 +166,7 @@ class SP_Admin_CPT_Staff extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_season',
|
'name' => 'sp_season',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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' ) : '—';
|
echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—';
|
||||||
break;
|
break;
|
||||||
case 'sp_team':
|
case 'sp_team':
|
||||||
echo sportspress_posts( $post_id, 'sp_team' );
|
echo sp_posts( $post_id, 'sp_team' );
|
||||||
break;
|
break;
|
||||||
case 'sp_views':
|
case 'sp_views':
|
||||||
echo sportspress_get_post_views( $post_id );
|
echo sp_get_post_views( $post_id );
|
||||||
break;
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ class SP_Admin_CPT_Table extends SP_Admin_CPT {
|
|||||||
if ( $typenow != 'sp_table' )
|
if ( $typenow != 'sp_table' )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sportspress_highlight_admin_menu();
|
sp_highlight_admin_menu();
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -109,7 +109,7 @@ class SP_Admin_CPT_Table extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_league',
|
'name' => 'sp_league',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -118,7 +118,7 @@ class SP_Admin_CPT_Table extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_season',
|
'name' => 'sp_season',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
|
|||||||
@@ -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' ) : '—';
|
echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—';
|
||||||
break;
|
break;
|
||||||
case 'sp_views':
|
case 'sp_views':
|
||||||
echo sportspress_get_post_views( $post_id );
|
echo sp_get_post_views( $post_id );
|
||||||
break;
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT {
|
|||||||
if ( $typenow != 'sp_team' )
|
if ( $typenow != 'sp_team' )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sportspress_highlight_admin_menu();
|
sp_highlight_admin_menu();
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -121,7 +121,7 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_league',
|
'name' => 'sp_league',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
|
|
||||||
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
|
||||||
$args = array(
|
$args = array(
|
||||||
@@ -130,7 +130,7 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT {
|
|||||||
'name' => 'sp_season',
|
'name' => 'sp_season',
|
||||||
'selected' => $selected
|
'selected' => $selected
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,17 +19,14 @@ class SP_Meta_Box_Calendar_Data {
|
|||||||
* Output the metabox
|
* Output the metabox
|
||||||
*/
|
*/
|
||||||
public static function output( $post ) {
|
public static function output( $post ) {
|
||||||
list( $data, $usecolumns ) = sportspress_get_calendar_data( $post->ID, true );
|
list( $data, $usecolumns ) = sp_get_calendar_data( $post->ID, true );
|
||||||
|
sp_edit_calendar_table( $data, $usecolumns );
|
||||||
sportspress_edit_calendar_table( $data, $usecolumns );
|
|
||||||
|
|
||||||
sportspress_nonce();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
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() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,9 +20,9 @@ class SP_Meta_Box_Calendar_Details {
|
|||||||
*/
|
*/
|
||||||
public static function output( $post ) {
|
public static function output( $post ) {
|
||||||
global $sportspress_formats;
|
global $sportspress_formats;
|
||||||
$league_id = sportspress_get_the_term_id( $post->ID, 'sp_league', 0 );
|
$league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 );
|
||||||
$season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 );
|
$season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 );
|
||||||
$venue_id = sportspress_get_the_term_id( $post->ID, 'sp_venue', 0 );
|
$venue_id = sp_get_the_term_id( $post->ID, 'sp_venue', 0 );
|
||||||
$team_id = get_post_meta( $post->ID, 'sp_team', true );
|
$team_id = get_post_meta( $post->ID, 'sp_team', true );
|
||||||
$formats = get_post_meta( $post->ID, 'sp_format' );
|
$formats = get_post_meta( $post->ID, 'sp_format' );
|
||||||
?>
|
?>
|
||||||
@@ -37,8 +37,8 @@ class SP_Meta_Box_Calendar_Details {
|
|||||||
'selected' => $league_id,
|
'selected' => $league_id,
|
||||||
'values' => 'term_id'
|
'values' => 'term_id'
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -52,8 +52,8 @@ class SP_Meta_Box_Calendar_Details {
|
|||||||
'selected' => $season_id,
|
'selected' => $season_id,
|
||||||
'values' => 'term_id'
|
'values' => 'term_id'
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -67,8 +67,8 @@ class SP_Meta_Box_Calendar_Details {
|
|||||||
'selected' => $venue_id,
|
'selected' => $venue_id,
|
||||||
'values' => 'term_id'
|
'values' => 'term_id'
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -82,8 +82,8 @@ class SP_Meta_Box_Calendar_Details {
|
|||||||
'selected' => $team_id,
|
'selected' => $team_id,
|
||||||
'values' => 'ID'
|
'values' => 'ID'
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sp_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -95,9 +95,9 @@ class SP_Meta_Box_Calendar_Details {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
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, sp_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, sp_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_venue', 0 ), 'sp_venue' );
|
||||||
update_post_meta( $post_id, 'sp_team', sportspress_array_value( $_POST, 'sp_team', 0 ) );
|
update_post_meta( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', 0 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,6 @@ class SP_Meta_Box_Calendar_Format {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
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' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ class SP_Meta_Box_Column_Details {
|
|||||||
<p class="sp-equation-selector">
|
<p class="sp-equation-selector">
|
||||||
<?php
|
<?php
|
||||||
foreach ( $equation as $piece ):
|
foreach ( $equation as $piece ):
|
||||||
sportspress_equation_selector( $post->ID, $piece, array( 'team_event', 'result', 'outcome' ) );
|
sp_equation_selector( $post->ID, $piece, array( 'team_event', 'result', 'outcome' ) );
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -74,10 +74,10 @@ class SP_Meta_Box_Column_Details {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
sportspress_delete_duplicate_post( $_POST );
|
sp_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_equation', implode( ' ', sp_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_precision', (int) sp_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_priority', sp_array_value( $_POST, 'sp_priority', '0' ) );
|
||||||
update_post_meta( $post_id, 'sp_order', sportspress_array_value( $_POST, 'sp_order', 'DESC' ) );
|
update_post_meta( $post_id, 'sp_order', sp_array_value( $_POST, 'sp_order', 'DESC' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,10 +19,10 @@ class SP_Meta_Box_Event_Details {
|
|||||||
* Output the metabox
|
* Output the metabox
|
||||||
*/
|
*/
|
||||||
public static function output( $post ) {
|
public static function output( $post ) {
|
||||||
$type = sportspress_get_the_term_id( $post->ID, 'sp_type', null );
|
$type = sp_get_the_term_id( $post->ID, 'sp_type', null );
|
||||||
$league_id = sportspress_get_the_term_id( $post->ID, 'sp_league', 0 );
|
$league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 );
|
||||||
$season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 );
|
$season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 );
|
||||||
$venue_id = sportspress_get_the_term_id( $post->ID, 'sp_venue', 0 );
|
$venue_id = sp_get_the_term_id( $post->ID, 'sp_venue', 0 );
|
||||||
?>
|
?>
|
||||||
<div>
|
<div>
|
||||||
<fieldset class="sp-event-format-field sp-league-event-field sp-friendly-event-field">
|
<fieldset class="sp-event-format-field sp-league-event-field sp-friendly-event-field">
|
||||||
@@ -36,8 +36,8 @@ class SP_Meta_Box_Event_Details {
|
|||||||
'values' => 'term_id',
|
'values' => 'term_id',
|
||||||
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -51,8 +51,8 @@ class SP_Meta_Box_Event_Details {
|
|||||||
'values' => 'term_id',
|
'values' => 'term_id',
|
||||||
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -67,8 +67,8 @@ class SP_Meta_Box_Event_Details {
|
|||||||
'values' => 'term_id',
|
'values' => 'term_id',
|
||||||
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
'show_option_none' => __( '-- Not set --', 'sportspress' ),
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
sportspress_taxonomy_adder( 'sp_venue', 'sp_event', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_venue', 'sp_event', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -80,8 +80,8 @@ class SP_Meta_Box_Event_Details {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
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, sp_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, sp_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_venue', 0 ), 'sp_venue' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,6 @@ class SP_Meta_Box_Event_Format {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
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' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,19 +23,19 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
$stats = (array)get_post_meta( $post->ID, 'sp_players', true );
|
$stats = (array)get_post_meta( $post->ID, 'sp_players', true );
|
||||||
|
|
||||||
// Get columns from performance variables
|
// 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 ):
|
foreach ( $teams as $key => $team_id ):
|
||||||
if ( ! $team_id ) continue;
|
if ( ! $team_id ) continue;
|
||||||
|
|
||||||
// Get results for players in the team
|
// Get results for players in the team
|
||||||
$players = sportspress_array_between( (array)get_post_meta( $post->ID, 'sp_player', false ), 0, $key );
|
$players = sp_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() ) );
|
$data = sp_array_combine( $players, sp_array_value( $stats, $team_id, array() ) );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div>
|
<div>
|
||||||
<p><strong><?php echo get_the_title( $team_id ); ?></strong></p>
|
<p><strong><?php echo get_the_title( $team_id ); ?></strong></p>
|
||||||
<?php sportspress_edit_event_players_table( $columns, $data, $team_id ); ?>
|
<?php sp_edit_event_players_table( $columns, $data, $team_id ); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -46,6 +46,6 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
update_post_meta( $post_id, 'sp_players', sportspress_array_value( $_POST, 'sp_players', array() ) );
|
update_post_meta( $post_id, 'sp_players', sp_array_value( $_POST, 'sp_players', array() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,14 +24,14 @@ class SP_Meta_Box_Event_Results {
|
|||||||
$results = (array)get_post_meta( $post->ID, 'sp_results', true );
|
$results = (array)get_post_meta( $post->ID, 'sp_results', true );
|
||||||
|
|
||||||
// Get columns from result variables
|
// Get columns from result variables
|
||||||
$columns = sportspress_get_var_labels( 'sp_result' );
|
$columns = sp_get_var_labels( 'sp_result' );
|
||||||
|
|
||||||
// Get results for all teams
|
// Get results for all teams
|
||||||
$data = sportspress_array_combine( $teams, $results );
|
$data = sp_array_combine( $teams, $results );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div>
|
<div>
|
||||||
<?php sportspress_edit_event_results_table( $columns, $data ); ?>
|
<?php sp_edit_event_results_table( $columns, $data ); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ class SP_Meta_Box_Event_Results {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
$results = (array)sportspress_array_value( $_POST, 'sp_results', array() );
|
$results = (array)sp_array_value( $_POST, 'sp_results', array() );
|
||||||
update_post_meta( $post_id, 'sp_results', $results );
|
update_post_meta( $post_id, 'sp_results', $results );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,8 +41,8 @@ class SP_Meta_Box_Event_Teams {
|
|||||||
<li class="wp-tab"><a href="#sp_staff-all"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
|
<li class="wp-tab"><a href="#sp_staff-all"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<?php
|
<?php
|
||||||
sportspress_post_checklist( $post->ID, 'sp_player', 'block', 'sp_current_team', $key );
|
sp_post_checklist( $post->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_staff', 'none', 'sp_current_team', $key );
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -67,8 +67,8 @@ class SP_Meta_Box_Event_Teams {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
sportspress_update_post_meta_recursive( $post_id, 'sp_team', sportspress_array_value( $_POST, 'sp_team', array() ) );
|
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
|
||||||
sportspress_update_post_meta_recursive( $post_id, 'sp_player', sportspress_array_value( $_POST, 'sp_player', array() ) );
|
sp_update_post_meta_recursive( $post_id, 'sp_player', sp_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_staff', sp_array_value( $_POST, 'sp_staff', array() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,6 +42,6 @@ class SP_Meta_Box_Event_Video {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
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 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,16 +19,16 @@ class SP_Meta_Box_List_Data {
|
|||||||
* Output the metabox
|
* Output the metabox
|
||||||
*/
|
*/
|
||||||
public static function output( $post ) {
|
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
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
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() ) );
|
||||||
update_post_meta( $post_id, 'sp_players', sportspress_array_value( $_POST, 'sp_players', array() ) );
|
update_post_meta( $post_id, 'sp_players', sp_array_value( $_POST, 'sp_players', array() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,8 +19,8 @@ class SP_Meta_Box_List_Details {
|
|||||||
* Output the metabox
|
* Output the metabox
|
||||||
*/
|
*/
|
||||||
public static function output( $post ) {
|
public static function output( $post ) {
|
||||||
$league_id = sportspress_get_the_term_id( $post->ID, 'sp_league', 0 );
|
$league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 );
|
||||||
$season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 );
|
$season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 );
|
||||||
$team_id = get_post_meta( $post->ID, 'sp_team', true );
|
$team_id = get_post_meta( $post->ID, 'sp_team', true );
|
||||||
$orderby = get_post_meta( $post->ID, 'sp_orderby', true );
|
$orderby = get_post_meta( $post->ID, 'sp_orderby', true );
|
||||||
$order = get_post_meta( $post->ID, 'sp_order', true );
|
$order = get_post_meta( $post->ID, 'sp_order', true );
|
||||||
@@ -35,8 +35,8 @@ class SP_Meta_Box_List_Details {
|
|||||||
'selected' => $league_id,
|
'selected' => $league_id,
|
||||||
'values' => 'term_id',
|
'values' => 'term_id',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -49,8 +49,8 @@ class SP_Meta_Box_List_Details {
|
|||||||
'selected' => $season_id,
|
'selected' => $season_id,
|
||||||
'values' => 'term_id',
|
'values' => 'term_id',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -64,8 +64,8 @@ class SP_Meta_Box_List_Details {
|
|||||||
'selected' => $team_id,
|
'selected' => $team_id,
|
||||||
'values' => 'ID',
|
'values' => 'ID',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sp_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -83,8 +83,8 @@ class SP_Meta_Box_List_Details {
|
|||||||
'selected' => $orderby,
|
'selected' => $orderby,
|
||||||
'values' => 'slug',
|
'values' => 'slug',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sp_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -97,8 +97,8 @@ class SP_Meta_Box_List_Details {
|
|||||||
</p>
|
</p>
|
||||||
<p><strong><?php _e( 'Players', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Players', 'sportspress' ); ?></strong></p>
|
||||||
<?php
|
<?php
|
||||||
sportspress_post_checklist( $post->ID, 'sp_player', 'block', 'sp_team' );
|
sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_team' );
|
||||||
sportspress_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) );
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -108,11 +108,11 @@ class SP_Meta_Box_List_Details {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
update_post_meta( $post_id, 'sp_team', sportspress_array_value( $_POST, 'sp_team', array() ) );
|
update_post_meta( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
|
||||||
wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_league', 0 ), 'sp_league' );
|
wp_set_post_terms( $post_id, sp_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, sp_array_value( $_POST, 'sp_season', 0 ), 'sp_season' );
|
||||||
update_post_meta( $post_id, 'sp_orderby', sportspress_array_value( $_POST, 'sp_orderby', array() ) );
|
update_post_meta( $post_id, 'sp_orderby', sp_array_value( $_POST, 'sp_orderby', array() ) );
|
||||||
update_post_meta( $post_id, 'sp_order', sportspress_array_value( $_POST, 'sp_order', array() ) );
|
update_post_meta( $post_id, 'sp_order', sp_array_value( $_POST, 'sp_order', array() ) );
|
||||||
sportspress_update_post_meta_recursive( $post_id, 'sp_player', sportspress_array_value( $_POST, 'sp_player', array() ) );
|
sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,6 @@ class SP_Meta_Box_List_Format {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
update_post_meta( $post_id, 'sp_format', sportspress_array_value( $_POST, 'sp_format', 'list' ) );
|
update_post_meta( $post_id, 'sp_format', sp_array_value( $_POST, 'sp_format', 'list' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,6 @@ class SP_Meta_Box_Outcome_Details {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
sportspress_delete_duplicate_post( $_POST );
|
sp_delete_duplicate_post( $_POST );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ class SP_Meta_Box_Performance_Details {
|
|||||||
?>
|
?>
|
||||||
<p><strong><?php _e( 'Calculate', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Calculate', 'sportspress' ); ?></strong></p>
|
||||||
<p class="sp-calculate-selector">
|
<p class="sp-calculate-selector">
|
||||||
<?php sportspress_calculate_selector( $post->ID, $calculate ); ?>
|
<?php sp_calculate_selector( $post->ID, $calculate ); ?>
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ class SP_Meta_Box_Performance_Details {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
sportspress_delete_duplicate_post( $_POST );
|
sp_delete_duplicate_post( $_POST );
|
||||||
update_post_meta( $post_id, 'sp_calculate', sportspress_array_value( $_POST, 'sp_calculate', 'DESC' ) );
|
update_post_meta( $post_id, 'sp_calculate', sp_array_value( $_POST, 'sp_calculate', 'DESC' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ class SP_Meta_Box_Player_Details {
|
|||||||
'property' => 'multiple',
|
'property' => 'multiple',
|
||||||
'chosen' => true,
|
'chosen' => true,
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
?></p>
|
?></p>
|
||||||
|
|
||||||
<p><strong><?php _e( 'Current Team', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Current Team', 'sportspress' ); ?></strong></p>
|
||||||
@@ -95,7 +95,7 @@ class SP_Meta_Box_Player_Details {
|
|||||||
'class' => 'sp-current-team widefat',
|
'class' => 'sp-current-team widefat',
|
||||||
'chosen' => true,
|
'chosen' => true,
|
||||||
);
|
);
|
||||||
sportspress_dropdown_pages( $args );
|
sp_dropdown_pages( $args );
|
||||||
?></p>
|
?></p>
|
||||||
|
|
||||||
<p><strong><?php _e( 'Past Teams', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Past Teams', 'sportspress' ); ?></strong></p>
|
||||||
@@ -110,7 +110,7 @@ class SP_Meta_Box_Player_Details {
|
|||||||
'property' => 'multiple',
|
'property' => 'multiple',
|
||||||
'chosen' => true,
|
'chosen' => true,
|
||||||
);
|
);
|
||||||
sportspress_dropdown_pages( $args );
|
sp_dropdown_pages( $args );
|
||||||
?></p>
|
?></p>
|
||||||
|
|
||||||
<p><strong><?php _e( 'Leagues', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Leagues', 'sportspress' ); ?></strong></p>
|
||||||
@@ -125,7 +125,7 @@ class SP_Meta_Box_Player_Details {
|
|||||||
'property' => 'multiple',
|
'property' => 'multiple',
|
||||||
'chosen' => true,
|
'chosen' => true,
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
?></p>
|
?></p>
|
||||||
|
|
||||||
<p><strong><?php _e( 'Seasons', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Seasons', 'sportspress' ); ?></strong></p>
|
||||||
@@ -140,7 +140,7 @@ class SP_Meta_Box_Player_Details {
|
|||||||
'property' => 'multiple',
|
'property' => 'multiple',
|
||||||
'chosen' => true,
|
'chosen' => true,
|
||||||
);
|
);
|
||||||
sportspress_dropdown_taxonomies( $args );
|
sp_dropdown_taxonomies( $args );
|
||||||
?></p>
|
?></p>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@@ -149,10 +149,10 @@ class SP_Meta_Box_Player_Details {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
update_post_meta( $post_id, 'sp_number', sportspress_array_value( $_POST, 'sp_number', '' ) );
|
update_post_meta( $post_id, 'sp_number', sp_array_value( $_POST, 'sp_number', '' ) );
|
||||||
update_post_meta( $post_id, 'sp_nationality', sportspress_array_value( $_POST, 'sp_nationality', '' ) );
|
update_post_meta( $post_id, 'sp_nationality', sp_array_value( $_POST, 'sp_nationality', '' ) );
|
||||||
update_post_meta( $post_id, 'sp_current_team', sportspress_array_value( $_POST, 'sp_current_team', null ) );
|
update_post_meta( $post_id, 'sp_current_team', sp_array_value( $_POST, 'sp_current_team', null ) );
|
||||||
sportspress_update_post_meta_recursive( $post_id, 'sp_past_team', sportspress_array_value( $_POST, 'sp_past_team', array() ) );
|
sp_update_post_meta_recursive( $post_id, 'sp_past_team', sp_array_value( $_POST, 'sp_past_team', array() ) );
|
||||||
sportspress_update_post_meta_recursive( $post_id, 'sp_team', array_merge( array( sportspress_array_value( $_POST, 'sp_current_team', null ) ), sportspress_array_value( $_POST, 'sp_past_team', array() ) ) );
|
sp_update_post_meta_recursive( $post_id, 'sp_team', array_merge( array( sp_array_value( $_POST, 'sp_current_team', null ) ), sp_array_value( $_POST, 'sp_past_team', array() ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,11 +50,11 @@ class SP_Meta_Box_Player_Metrics {
|
|||||||
foreach ( $vars as $var ):
|
foreach ( $vars as $var ):
|
||||||
?>
|
?>
|
||||||
<p><strong><?php echo $var->post_title; ?></strong></p>
|
<p><strong><?php echo $var->post_title; ?></strong></p>
|
||||||
<p><input type="text" name="sp_metrics[<?php echo $var->post_name; ?>]" value="<?php echo sportspress_array_value( $metrics, $var->post_name, '' ); ?>" /></p>
|
<p><input type="text" name="sp_metrics[<?php echo $var->post_name; ?>]" value="<?php echo sp_array_value( $metrics, $var->post_name, '' ); ?>" /></p>
|
||||||
<?php
|
<?php
|
||||||
endforeach;
|
endforeach;
|
||||||
else:
|
else:
|
||||||
sportspress_post_adder( 'sp_metric', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_metric', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +62,6 @@ class SP_Meta_Box_Player_Metrics {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
update_post_meta( $post_id, 'sp_metrics', sportspress_array_value( $_POST, 'sp_metrics', array() ) );
|
update_post_meta( $post_id, 'sp_metrics', sp_array_value( $_POST, 'sp_metrics', array() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,9 +32,9 @@ class SP_Meta_Box_Player_Performance {
|
|||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = sportspress_get_player_performance_data( $post->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;
|
endforeach;
|
||||||
}
|
}
|
||||||
@@ -43,8 +43,8 @@ class SP_Meta_Box_Player_Performance {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
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' ) )
|
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() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,6 @@ class SP_Meta_Box_Result_Details {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
sportspress_delete_duplicate_post( $_POST );
|
sp_delete_duplicate_post( $_POST );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,18 +19,15 @@ class SP_Meta_Box_Table_Data {
|
|||||||
* Output the metabox
|
* Output the metabox
|
||||||
*/
|
*/
|
||||||
public static function output( $post ) {
|
public static function output( $post ) {
|
||||||
list( $columns, $usecolumns, $data, $placeholders, $merged ) = sportspress_get_league_table_data( $post->ID, true );
|
list( $columns, $usecolumns, $data, $placeholders, $merged ) = sp_get_league_table_data( $post->ID, true );
|
||||||
|
sp_edit_league_table( $columns, $usecolumns, $data, $placeholders );
|
||||||
sportspress_edit_league_table( $columns, $usecolumns, $data, $placeholders );
|
|
||||||
|
|
||||||
sportspress_nonce();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
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() ) );
|
||||||
update_post_meta( $post_id, 'sp_teams', sportspress_array_value( $_POST, 'sp_teams', array() ) );
|
update_post_meta( $post_id, 'sp_teams', sp_array_value( $_POST, 'sp_teams', array() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,8 +20,8 @@ class SP_Meta_Box_Table_Details {
|
|||||||
*/
|
*/
|
||||||
public static function output( $post ) {
|
public static function output( $post ) {
|
||||||
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
||||||
$league_id = sportspress_get_the_term_id( $post->ID, 'sp_league', 0 );
|
$league_id = sp_get_the_term_id( $post->ID, 'sp_league', 0 );
|
||||||
$season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 );
|
$season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 );
|
||||||
?>
|
?>
|
||||||
<div>
|
<div>
|
||||||
<p><strong><?php _e( 'League', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'League', 'sportspress' ); ?></strong></p>
|
||||||
@@ -33,8 +33,8 @@ class SP_Meta_Box_Table_Details {
|
|||||||
'selected' => $league_id,
|
'selected' => $league_id,
|
||||||
'values' => 'term_id'
|
'values' => 'term_id'
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
sportspress_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -47,15 +47,15 @@ class SP_Meta_Box_Table_Details {
|
|||||||
'selected' => $season_id,
|
'selected' => $season_id,
|
||||||
'values' => 'term_id'
|
'values' => 'term_id'
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_taxonomies( $args ) ):
|
if ( ! sp_dropdown_taxonomies( $args ) ):
|
||||||
sportspress_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
<p><strong><?php _e( 'Teams', 'sportspress' ); ?></strong></p>
|
<p><strong><?php _e( 'Teams', 'sportspress' ); ?></strong></p>
|
||||||
<?php
|
<?php
|
||||||
sportspress_post_checklist( $post->ID, 'sp_team', 'block', 'sp_season' );
|
sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_season' );
|
||||||
sportspress_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_team', __( 'Add New', 'sportspress' ) );
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -65,8 +65,8 @@ class SP_Meta_Box_Table_Details {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
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, sp_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, sp_array_value( $_POST, 'sp_season', 0 ), 'sp_season' );
|
||||||
sportspress_update_post_meta_recursive( $post_id, 'sp_team', sportspress_array_value( $_POST, 'sp_team', array() ) );
|
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,6 @@ class SP_Meta_Box_Team_Columns {
|
|||||||
* Output the metabox
|
* Output the metabox
|
||||||
*/
|
*/
|
||||||
public static function output( $post ) {
|
public static function output( $post ) {
|
||||||
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
|
||||||
$leagues = (array)get_the_terms( $post->ID, 'sp_league' );
|
$leagues = (array)get_the_terms( $post->ID, 'sp_league' );
|
||||||
$league_num = sizeof( $leagues );
|
$league_num = sizeof( $leagues );
|
||||||
|
|
||||||
@@ -34,9 +33,9 @@ class SP_Meta_Box_Team_Columns {
|
|||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
list( $columns, $data, $placeholders, $merged, $leagues_seasons ) = sportspress_get_team_columns_data( $post->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;
|
endforeach;
|
||||||
}
|
}
|
||||||
@@ -45,8 +44,8 @@ class SP_Meta_Box_Team_Columns {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
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' ) )
|
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() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -316,9 +316,9 @@ class SP_Settings_Config extends SP_Settings_Page {
|
|||||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
<td><?php echo $row->post_name; ?></td>
|
<td><?php echo $row->post_name; ?></td>
|
||||||
<td><?php echo sportspress_get_post_equation( $row->ID, $row->post_name ); ?></td>
|
<td><?php echo sp_get_post_equation( $row->ID, $row->post_name ); ?></td>
|
||||||
<td><?php echo sportspress_get_post_precision( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_precision( $row->ID ); ?></td>
|
||||||
<td><?php echo sportspress_get_post_order( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_order( $row->ID ); ?></td>
|
||||||
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php $i++; endforeach; ?>
|
<?php $i++; endforeach; ?>
|
||||||
@@ -417,7 +417,7 @@ class SP_Settings_Config extends SP_Settings_Page {
|
|||||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||||
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?></td>
|
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?></td>
|
||||||
<td><?php echo sportspress_get_post_calculate( $row->ID ); ?></td>
|
<td><?php echo sp_get_post_calculate( $row->ID ); ?></td>
|
||||||
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php $i++; endforeach; ?>
|
<?php $i++; endforeach; ?>
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ if ( !function_exists( 'sp_flush_rewrite_rules' ) ) {
|
|||||||
|
|
||||||
if ( !function_exists( 'sp_nonce' ) ) {
|
if ( !function_exists( 'sp_nonce' ) ) {
|
||||||
function sp_nonce() {
|
function sp_nonce() {
|
||||||
echo '<input type="hidden" name="sportspress_nonce" id="sportspress_nonce" value="' . wp_create_nonce( plugin_basename( SP_PLUGIN_FILE ) ) . '" />';
|
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' ) ) {
|
if ( !function_exists( 'sp_dropdown_taxonomies' ) ) {
|
||||||
function sp_dropdown_taxonomies( $args = array() ) {
|
function sp_dropdown_taxonomies( $args = array() ) {
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
@@ -589,7 +577,7 @@ if ( !function_exists( 'sp_post_checklist' ) ) {
|
|||||||
<ul class="categorychecklist form-no-clear">
|
<ul class="categorychecklist form-no-clear">
|
||||||
<li class="sp-select-all-container"><label class="selectit"><input type="checkbox" class="sp-select-all"> <strong><?php _e( 'Select All', 'sportspress' ); ?></strong></label></li>
|
<li class="sp-select-all-container"><label class="selectit"><input type="checkbox" class="sp-select-all"> <strong><?php _e( 'Select All', 'sportspress' ); ?></strong></label></li>
|
||||||
<?php
|
<?php
|
||||||
$selected = sportspress_array_between( (array)get_post_meta( $post_id, $meta, false ), 0, $index );
|
$selected = sp_array_between( (array)get_post_meta( $post_id, $meta, false ), 0, $index );
|
||||||
$posts = get_pages( array( 'post_type' => $meta, 'number' => 0 ) );
|
$posts = get_pages( array( 'post_type' => $meta, 'number' => 0 ) );
|
||||||
if ( empty( $posts ) ):
|
if ( empty( $posts ) ):
|
||||||
$query = array( 'post_type' => $meta, 'numberposts' => -1, 'post_per_page' => -1 );
|
$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' ) );
|
$options[ __( 'Events', 'sportspress' ) ] = array( '$eventsplayed' => __( 'Played', 'sportspress' ) );
|
||||||
break;
|
break;
|
||||||
case 'result':
|
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;
|
break;
|
||||||
case 'outcome':
|
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' ) ]['$streak'] = __( 'Streak', 'sportspress' );
|
||||||
$options[ __( 'Outcomes', 'sportspress' ) ]['$last5'] = __( 'Last 5', 'sportspress' );
|
$options[ __( 'Outcomes', 'sportspress' ) ]['$last5'] = __( 'Last 5', 'sportspress' );
|
||||||
$options[ __( 'Outcomes', 'sportspress' ) ]['$last10'] = __( 'Last 10', 'sportspress' );
|
$options[ __( 'Outcomes', 'sportspress' ) ]['$last10'] = __( 'Last 10', 'sportspress' );
|
||||||
break;
|
break;
|
||||||
case 'column':
|
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;
|
break;
|
||||||
case 'performance':
|
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;
|
break;
|
||||||
endswitch;
|
endswitch;
|
||||||
endforeach;
|
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' ) ) {
|
if ( !function_exists( 'sp_get_var_labels' ) ) {
|
||||||
function sp_get_var_labels( $post_type ) {
|
function sp_get_var_labels( $post_type ) {
|
||||||
$args = array(
|
$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' ) ) {
|
if ( !function_exists( 'sp_edit_calendar_table' ) ) {
|
||||||
function sp_edit_calendar_table( $data = array(), $usecolumns = null ) {
|
function sp_edit_calendar_table( $data = array(), $usecolumns = null ) {
|
||||||
if ( is_array( $usecolumns ) )
|
if ( is_array( $usecolumns ) )
|
||||||
@@ -907,7 +857,7 @@ if ( !function_exists( 'sp_edit_calendar_table' ) ) {
|
|||||||
<?php
|
<?php
|
||||||
if ( is_array( $data ) && sizeof( $data ) > 0 ):
|
if ( is_array( $data ) && sizeof( $data ) > 0 ):
|
||||||
global $sportspress_options;
|
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;
|
$i = 0;
|
||||||
foreach ( $data as $event ):
|
foreach ( $data as $event ):
|
||||||
$teams = get_post_meta( $event->ID, 'sp_team' );
|
$teams = get_post_meta( $event->ID, 'sp_team' );
|
||||||
@@ -922,10 +872,10 @@ if ( !function_exists( 'sp_edit_calendar_table' ) ) {
|
|||||||
foreach ( $teams as $team ):
|
foreach ( $teams as $team ):
|
||||||
$name = get_the_title( $team );
|
$name = get_the_title( $team );
|
||||||
if ( $name ):
|
if ( $name ):
|
||||||
$team_results = sportspress_array_value( $results, $team, null );
|
$team_results = sp_array_value( $results, $team, null );
|
||||||
|
|
||||||
if ( $main_result ):
|
if ( $main_result ):
|
||||||
$team_result = sportspress_array_value( $team_results, $main_result, null );
|
$team_result = sp_array_value( $team_results, $main_result, null );
|
||||||
else:
|
else:
|
||||||
if ( is_array( $team_results ) ):
|
if ( is_array( $team_results ) ):
|
||||||
end( $team_results );
|
end( $team_results );
|
||||||
@@ -992,7 +942,7 @@ if ( !function_exists( 'sp_edit_league_table' ) ) {
|
|||||||
if ( is_array( $usecolumns ) )
|
if ( is_array( $usecolumns ) )
|
||||||
$usecolumns = array_filter( $usecolumns );
|
$usecolumns = array_filter( $usecolumns );
|
||||||
global $sportspress_options;
|
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 );
|
||||||
?>
|
?>
|
||||||
<div class="sp-data-table-container">
|
<div class="sp-data-table-container">
|
||||||
<table class="widefat sp-data-table sp-league-table">
|
<table class="widefat sp-data-table sp-league-table">
|
||||||
@@ -1016,7 +966,7 @@ if ( !function_exists( 'sp_edit_league_table' ) ) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
$div = get_term( $team_id, 'sp_season' );
|
$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 )
|
if ( $default_name == null )
|
||||||
$default_name = get_the_title( $team_id );
|
$default_name = get_the_title( $team_id );
|
||||||
?>
|
?>
|
||||||
@@ -1028,14 +978,14 @@ if ( !function_exists( 'sp_edit_league_table' ) ) {
|
|||||||
<a class="dashicons dashicons-edit sp-edit-name" title="<?php _e( 'Edit', 'sportspress' ); ?>"></a>
|
<a class="dashicons dashicons-edit sp-edit-name" title="<?php _e( 'Edit', 'sportspress' ); ?>"></a>
|
||||||
</span>
|
</span>
|
||||||
<span class="hidden sp-custom-name">
|
<span class="hidden sp-custom-name">
|
||||||
<input type="text" name="sp_teams[<?php echo $team_id; ?>][name]" class="name sp-custom-name-input" value="<?php echo sportspress_array_value( $team_stats, 'name', '' ); ?>" placeholder="<?php echo get_the_title( $team_id ); ?>">
|
<input type="text" name="sp_teams[<?php echo $team_id; ?>][name]" class="name sp-custom-name-input" value="<?php echo sp_array_value( $team_stats, 'name', '' ); ?>" placeholder="<?php echo get_the_title( $team_id ); ?>">
|
||||||
<a class="button button-secondary sp-cancel"><?php _e( 'Cancel', 'sportspress' ); ?></a>
|
<a class="button button-secondary sp-cancel"><?php _e( 'Cancel', 'sportspress' ); ?></a>
|
||||||
<a class="button button-primary sp-save"><?php _e( 'Save', 'sportspress' ); ?></a>
|
<a class="button button-primary sp-save"><?php _e( 'Save', 'sportspress' ); ?></a>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<?php foreach( $columns as $column => $label ):
|
<?php foreach( $columns as $column => $label ):
|
||||||
$value = sportspress_array_value( $team_stats, $column, '' );
|
$value = sp_array_value( $team_stats, $column, '' );
|
||||||
$placeholder = sportspress_array_value( sportspress_array_value( $placeholders, $team_id, array() ), $column, 0 );
|
$placeholder = sp_array_value( sp_array_value( $placeholders, $team_id, array() ), $column, 0 );
|
||||||
?>
|
?>
|
||||||
<td><input type="text" name="sp_teams[<?php echo $team_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="<?php echo $placeholder; ?>" /></td>
|
<td><input type="text" name="sp_teams[<?php echo $team_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="<?php echo $placeholder; ?>" /></td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -1094,8 +1044,8 @@ if ( !function_exists( 'sp_edit_player_list_table' ) ) {
|
|||||||
<?php echo get_the_title( $player_id ); ?>
|
<?php echo get_the_title( $player_id ); ?>
|
||||||
</td>
|
</td>
|
||||||
<?php foreach( $columns as $column => $label ):
|
<?php foreach( $columns as $column => $label ):
|
||||||
$value = sportspress_array_value( $player_stats, $column, '' );
|
$value = sp_array_value( $player_stats, $column, '' );
|
||||||
$placeholder = sportspress_array_value( sportspress_array_value( $placeholders, $player_id, array() ), $column, 0 );
|
$placeholder = sp_array_value( sp_array_value( $placeholders, $player_id, array() ), $column, 0 );
|
||||||
?>
|
?>
|
||||||
<td><input type="text" name="sp_players[<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="<?php echo $placeholder; ?>" /></td>
|
<td><input type="text" name="sp_players[<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="<?php echo $placeholder; ?>" /></td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -1143,17 +1093,17 @@ if ( !function_exists( 'sp_edit_team_columns_table' ) ) {
|
|||||||
?>
|
?>
|
||||||
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" name="sp_leagues_seasons[<?php echo $league_id; ?>][<?php echo $div_id; ?>]" id="sp_leagues_seasons_<?php echo $league_id; ?>_<?php echo $div_id; ?>" value="1" <?php checked( sportspress_array_value( $seasons, $div_id, 0 ), 1 ); ?>>
|
<input type="checkbox" name="sp_leagues_seasons[<?php echo $league_id; ?>][<?php echo $div_id; ?>]" id="sp_leagues_seasons_<?php echo $league_id; ?>_<?php echo $div_id; ?>" value="1" <?php checked( sp_array_value( $seasons, $div_id, 0 ), 1 ); ?>>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<label for="sp_leagues_seasons_<?php echo $league_id; ?>_<?php echo $div_id; ?>"><?php echo $div->name; ?></label>
|
<label for="sp_leagues_seasons_<?php echo $league_id; ?>_<?php echo $div_id; ?>"><?php echo $div->name; ?></label>
|
||||||
</td>
|
</td>
|
||||||
<?php foreach( $columns as $column => $label ):
|
<?php foreach( $columns as $column => $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 );
|
||||||
?>
|
?>
|
||||||
<td><?php
|
<td><?php
|
||||||
$value = sportspress_array_value( sportspress_array_value( $data, $div_id, array() ), $column, null );
|
$value = sp_array_value( sp_array_value( $data, $div_id, array() ), $column, null );
|
||||||
$placeholder = sportspress_array_value( sportspress_array_value( $placeholders, $div_id, array() ), $column, 0 );
|
$placeholder = sp_array_value( sp_array_value( $placeholders, $div_id, array() ), $column, 0 );
|
||||||
echo '<input type="text" name="sp_columns[' . $league_id . '][' . $div_id . '][' . $column . ']" value="' . $value . '" placeholder="' . $placeholder . '"' . ( $readonly ? ' disabled="disabled"' : '' ) . ' />';
|
echo '<input type="text" name="sp_columns[' . $league_id . '][' . $div_id . '][' . $column . ']" value="' . $value . '" placeholder="' . $placeholder . '"' . ( $readonly ? ' disabled="disabled"' : '' ) . ' />';
|
||||||
?></td>
|
?></td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -1200,7 +1150,7 @@ if ( !function_exists( 'sp_edit_player_performance_table' ) ) {
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$value = sportspress_array_value( $seasons_teams, $div_id, '-1' );
|
$value = sp_array_value( $seasons_teams, $div_id, '-1' );
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_type' => 'sp_team',
|
'post_type' => 'sp_team',
|
||||||
'name' => 'sp_leagues[' . $league_id . '][' . $div_id . ']',
|
'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' );
|
_e( 'No results found.', 'sportspress' );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
@@ -1232,8 +1182,8 @@ if ( !function_exists( 'sp_edit_player_performance_table' ) ) {
|
|||||||
<?php foreach( $columns as $column => $label ):
|
<?php foreach( $columns as $column => $label ):
|
||||||
?>
|
?>
|
||||||
<td><?php
|
<td><?php
|
||||||
$value = sportspress_array_value( sportspress_array_value( $data, $div_id, array() ), $column, null );
|
$value = sp_array_value( sp_array_value( $data, $div_id, array() ), $column, null );
|
||||||
$placeholder = sportspress_array_value( sportspress_array_value( $placeholders, $div_id, array() ), $column, 0 );
|
$placeholder = sp_array_value( sp_array_value( $placeholders, $div_id, array() ), $column, 0 );
|
||||||
echo '<input type="text" name="sp_performance[' . $league_id . '][' . $div_id . '][' . $column . ']" value="' . $value . '" placeholder="' . $placeholder . '"' . ( $readonly ? ' disabled="disabled"' : '' ) . ' />';
|
echo '<input type="text" name="sp_performance[' . $league_id . '][' . $div_id . '][' . $column . ']" value="' . $value . '" placeholder="' . $placeholder . '"' . ( $readonly ? ' disabled="disabled"' : '' ) . ' />';
|
||||||
?></td>
|
?></td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -1274,13 +1224,13 @@ if ( !function_exists( 'sp_edit_event_results_table' ) ) {
|
|||||||
<?php echo get_the_title( $team_id ); ?>
|
<?php echo get_the_title( $team_id ); ?>
|
||||||
</td>
|
</td>
|
||||||
<?php foreach( $columns as $column => $label ):
|
<?php foreach( $columns as $column => $label ):
|
||||||
$value = sportspress_array_value( $team_results, $column, '' );
|
$value = sp_array_value( $team_results, $column, '' );
|
||||||
?>
|
?>
|
||||||
<td><input type="text" name="sp_results[<?php echo $team_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" /></td>
|
<td><input type="text" name="sp_results[<?php echo $team_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" /></td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$values = sportspress_array_value( $team_results, 'outcome', '' );
|
$values = sp_array_value( $team_results, 'outcome', '' );
|
||||||
if ( ! is_array( $values ) )
|
if ( ! is_array( $values ) )
|
||||||
$values = array( $values );
|
$values = array( $values );
|
||||||
|
|
||||||
@@ -1295,7 +1245,7 @@ if ( !function_exists( 'sp_edit_event_results_table' ) ) {
|
|||||||
'property' => 'multiple',
|
'property' => 'multiple',
|
||||||
'chosen' => true,
|
'chosen' => true,
|
||||||
);
|
);
|
||||||
sportspress_dropdown_pages( $args );
|
sp_dropdown_pages( $args );
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -1384,15 +1334,15 @@ if ( !function_exists( 'sp_edit_event_players_table' ) ) {
|
|||||||
<td><?php echo ( $number ? $number : ' ' ); ?></td>
|
<td><?php echo ( $number ? $number : ' ' ); ?></td>
|
||||||
<td><?php echo get_the_title( $player_id ); ?></td>
|
<td><?php echo get_the_title( $player_id ); ?></td>
|
||||||
<?php foreach( $columns as $column => $label ):
|
<?php foreach( $columns as $column => $label ):
|
||||||
$value = sportspress_array_value( $player_performance, $column, '' );
|
$value = sp_array_value( $player_performance, $column, '' );
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
<input class="sp-player-<?php echo $column; ?>-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="0" />
|
<input class="sp-player-<?php echo $column; ?>-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="0" />
|
||||||
</td>
|
</td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<td class="sp-status-selector">
|
<td class="sp-status-selector">
|
||||||
<?php echo sportspress_event_player_status_selector( $team_id, $player_id, sportspress_array_value( $player_performance, 'status', null ) ); ?>
|
<?php echo sp_event_player_status_selector( $team_id, $player_id, sp_array_value( $player_performance, 'status', null ) ); ?>
|
||||||
<?php echo sportspress_event_player_sub_selector( $team_id, $player_id, sportspress_array_value( $player_performance, 'sub', null ), $data ); ?>
|
<?php echo sp_event_player_sub_selector( $team_id, $player_id, sp_array_value( $player_performance, 'sub', null ), $data ); ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
@@ -1404,8 +1354,8 @@ if ( !function_exists( 'sp_edit_event_players_table' ) ) {
|
|||||||
<td><strong><?php _e( 'Total', 'sportspress' ); ?></strong></td>
|
<td><strong><?php _e( 'Total', 'sportspress' ); ?></strong></td>
|
||||||
<?php foreach( $columns as $column => $label ):
|
<?php foreach( $columns as $column => $label ):
|
||||||
$player_id = 0;
|
$player_id = 0;
|
||||||
$player_performance = sportspress_array_value( $data, 0, array() );
|
$player_performance = sp_array_value( $data, 0, array() );
|
||||||
$value = sportspress_array_value( $player_performance, $column, '' );
|
$value = sp_array_value( $player_performance, $column, '' );
|
||||||
?>
|
?>
|
||||||
<td><input type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="0" /></td>
|
<td><input type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo $value; ?>" placeholder="0" /></td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -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 = '<select name="sp_players[' . $team_id . '][' . $player_id . '][status]">';
|
|
||||||
|
|
||||||
foreach( $options as $key => $name ):
|
|
||||||
$output .= '<option value="' . $key . '"' . ( $key == $value ? ' selected' : '' ) . '>' . $name . '</option>';
|
|
||||||
endforeach;
|
|
||||||
|
|
||||||
$output .= '</select>';
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !function_exists( 'sp_post_adder' ) ) {
|
if ( !function_exists( 'sp_post_adder' ) ) {
|
||||||
function sp_post_adder( $post_type = 'post', $label = null ) {
|
function sp_post_adder( $post_type = 'post', $label = null ) {
|
||||||
$obj = get_post_type_object( $post_type );
|
$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 '<textarea id="' . $name . '" name="' . $group . '[' . $name . ']" rows="10" cols="50">' . $value . '</textarea>';
|
|
||||||
break;
|
|
||||||
case 'checkbox':
|
|
||||||
echo '<input type="checkbox" id="' . $name . '" name="' . $group . '[' . $name . ']" value="1" ' . checked( 1, isset( $value ) ? $value : 0, false ) . '/>';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
echo '<input type="text" id="' . $name . '" name="' . $group . '[' . $name . ']" value="' . $value . '" />';
|
|
||||||
break;
|
|
||||||
endswitch;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !function_exists( 'sp_get_eos_safe_slug' ) ) {
|
if ( !function_exists( 'sp_get_eos_safe_slug' ) ) {
|
||||||
function sp_get_eos_safe_slug( $title, $post_id = 'var' ) {
|
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 );
|
$title = strtolower( $title );
|
||||||
|
|
||||||
// Replace all numbers with words
|
// Replace all numbers with words
|
||||||
$title = sportspress_numbers_to_words( $title );
|
$title = sp_numbers_to_words( $title );
|
||||||
|
|
||||||
// Remove all other non-alphabet characters
|
// Remove all other non-alphabet characters
|
||||||
$title = preg_replace( "/[^a-z]/", '', $title );
|
$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
|
// Convert post ID to words if title is empty
|
||||||
if ( $title == '' ):
|
if ( $title == '' ):
|
||||||
|
|
||||||
$title = sportspress_numbers_to_words( $post_id );
|
$title = sp_numbers_to_words( $post_id );
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
@@ -1545,12 +1450,12 @@ if ( !function_exists( 'sp_solve' ) ) {
|
|||||||
if ( strpos( $equation, '$streak' ) !== false ):
|
if ( strpos( $equation, '$streak' ) !== false ):
|
||||||
|
|
||||||
// Return direct value
|
// Return direct value
|
||||||
return sportspress_array_value( $vars, 'streak', '-' );
|
return sp_array_value( $vars, 'streak', '-' );
|
||||||
|
|
||||||
elseif ( strpos( $equation, '$last5' ) !== false ):
|
elseif ( strpos( $equation, '$last5' ) !== false ):
|
||||||
|
|
||||||
// Return imploded string
|
// Return imploded string
|
||||||
$last5 = sportspress_array_value( $vars, 'last5', array( 0 ) );
|
$last5 = sp_array_value( $vars, 'last5', array( 0 ) );
|
||||||
if ( array_sum( $last5 ) > 0 ):
|
if ( array_sum( $last5 ) > 0 ):
|
||||||
return implode( '-', $last5 );
|
return implode( '-', $last5 );
|
||||||
else:
|
else:
|
||||||
@@ -1560,7 +1465,7 @@ if ( !function_exists( 'sp_solve' ) ) {
|
|||||||
elseif ( strpos( $equation, '$last10' ) !== false ):
|
elseif ( strpos( $equation, '$last10' ) !== false ):
|
||||||
|
|
||||||
// Return imploded string
|
// Return imploded string
|
||||||
$last10 = sportspress_array_value( $vars, 'last10', array( 0 ) );
|
$last10 = sp_array_value( $vars, 'last10', array( 0 ) );
|
||||||
if ( array_sum( $last10 ) > 0 ):
|
if ( array_sum( $last10 ) > 0 ):
|
||||||
return implode( '-', $last10 );
|
return implode( '-', $last10 );
|
||||||
else:
|
else:
|
||||||
@@ -1574,7 +1479,7 @@ if ( !function_exists( 'sp_solve' ) ) {
|
|||||||
unset( $vars['last5'] );
|
unset( $vars['last5'] );
|
||||||
unset( $vars['last10'] );
|
unset( $vars['last10'] );
|
||||||
|
|
||||||
if ( sportspress_array_value( $vars, 'eventsplayed', 0 ) <= 0 )
|
if ( sp_array_value( $vars, 'eventsplayed', 0 ) <= 0 )
|
||||||
return '-';
|
return '-';
|
||||||
|
|
||||||
// Clearance to begin calculating remains true if all equation variables are in vars
|
// 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' ) ) {
|
if ( !function_exists( 'sp_get_calendar_data' ) ) {
|
||||||
function sp_get_calendar_data( $post_id = null, $admin = false ) {
|
function sp_get_calendar_data( $post_id = null, $admin = false ) {
|
||||||
global $pagenow;
|
global $pagenow;
|
||||||
@@ -1716,13 +1607,13 @@ if ( !function_exists( 'sp_get_team_columns_data' ) ) {
|
|||||||
|
|
||||||
$seasons = (array)get_the_terms( $post_id, 'sp_season' );
|
$seasons = (array)get_the_terms( $post_id, 'sp_season' );
|
||||||
$columns = (array)get_post_meta( $post_id, 'sp_columns', true );
|
$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
|
// 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
|
// 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
|
// Generate array of all season ids and season names
|
||||||
$div_ids = array();
|
$div_ids = array();
|
||||||
@@ -1737,10 +1628,10 @@ if ( !function_exists( 'sp_get_team_columns_data' ) ) {
|
|||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
// Get all seasons populated with data where available
|
// 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
|
// Get equations from column variables
|
||||||
$equations = sportspress_get_var_equations( 'sp_column' );
|
$equations = sp_get_var_equations( 'sp_column' );
|
||||||
|
|
||||||
// Initialize placeholders array
|
// Initialize placeholders array
|
||||||
$placeholders = array();
|
$placeholders = array();
|
||||||
@@ -1885,23 +1776,23 @@ if ( !function_exists( 'sp_get_team_columns_data' ) ) {
|
|||||||
// Generate array of placeholder values for each league
|
// Generate array of placeholder values for each league
|
||||||
$placeholders[ $div_id ] = array();
|
$placeholders[ $div_id ] = array();
|
||||||
foreach ( $equations as $key => $value ):
|
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;
|
||||||
|
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
// Get columns from column variables
|
// 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
|
// Merge the data and placeholders arrays
|
||||||
$merged = array();
|
$merged = array();
|
||||||
|
|
||||||
foreach( $placeholders as $season_id => $season_data ):
|
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;
|
continue;
|
||||||
|
|
||||||
$season_name = sportspress_array_value( $season_names, $season_id, ' ' );
|
$season_name = sp_array_value( $season_names, $season_id, ' ' );
|
||||||
|
|
||||||
// Add season name to row
|
// Add season name to row
|
||||||
$merged[ $season_id ] = array(
|
$merged[ $season_id ] = array(
|
||||||
@@ -1935,20 +1826,20 @@ if ( !function_exists( 'sp_get_team_columns_data' ) ) {
|
|||||||
|
|
||||||
if ( !function_exists( 'sp_get_league_table_data' ) ) {
|
if ( !function_exists( 'sp_get_league_table_data' ) ) {
|
||||||
function sp_get_league_table_data( $post_id, $breakdown = false ) {
|
function sp_get_league_table_data( $post_id, $breakdown = false ) {
|
||||||
$league_id = sportspress_get_the_term_id( $post_id, 'sp_league', 0 );
|
$league_id = sp_get_the_term_id( $post_id, 'sp_league', 0 );
|
||||||
$div_id = sportspress_get_the_term_id( $post_id, 'sp_season', 0 );
|
$div_id = sp_get_the_term_id( $post_id, 'sp_season', 0 );
|
||||||
$team_ids = (array)get_post_meta( $post_id, 'sp_team', false );
|
$team_ids = (array)get_post_meta( $post_id, 'sp_team', false );
|
||||||
$table_stats = (array)get_post_meta( $post_id, 'sp_teams', true );
|
$table_stats = (array)get_post_meta( $post_id, 'sp_teams', true );
|
||||||
$usecolumns = get_post_meta( $post_id, 'sp_columns', true );
|
$usecolumns = get_post_meta( $post_id, 'sp_columns', true );
|
||||||
|
|
||||||
// Get labels from result variables
|
// 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
|
// 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
|
// 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
|
// Create entry for each team in totals
|
||||||
$totals = array();
|
$totals = array();
|
||||||
@@ -1994,7 +1885,7 @@ if ( !function_exists( 'sp_get_league_table_data' ) ) {
|
|||||||
$static = get_post_meta( $team_id, 'sp_columns', true );
|
$static = get_post_meta( $team_id, 'sp_columns', true );
|
||||||
|
|
||||||
// Add static stats to placeholders
|
// 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;
|
endforeach;
|
||||||
|
|
||||||
@@ -2074,7 +1965,7 @@ if ( !function_exists( 'sp_get_league_table_data' ) ) {
|
|||||||
$totals[ $team_id ][ $key . 'for' ] += $value;
|
$totals[ $team_id ][ $key . 'for' ] += $value;
|
||||||
foreach( $results as $other_team_id => $other_result ):
|
foreach( $results as $other_team_id => $other_result ):
|
||||||
if ( $other_team_id != $team_id && array_key_exists( $key . 'against', $totals[ $team_id ] ) ):
|
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;
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
endif;
|
endif;
|
||||||
@@ -2137,18 +2028,18 @@ if ( !function_exists( 'sp_get_league_table_data' ) ) {
|
|||||||
$meta = get_post_meta( $stat->ID );
|
$meta = get_post_meta( $stat->ID );
|
||||||
|
|
||||||
// Add equation to object
|
// Add equation to object
|
||||||
$stat->equation = sportspress_array_value( sportspress_array_value( $meta, 'sp_equation', array() ), 0, 0 );
|
$stat->equation = sp_array_value( sp_array_value( $meta, 'sp_equation', array() ), 0, 0 );
|
||||||
$stat->precision = sportspress_array_value( sportspress_array_value( $meta, 'sp_precision', array() ), 0, 0 );
|
$stat->precision = sp_array_value( sp_array_value( $meta, 'sp_precision', array() ), 0, 0 );
|
||||||
|
|
||||||
// Add column name to columns
|
// Add column name to columns
|
||||||
$columns[ $stat->post_name ] = $stat->post_title;
|
$columns[ $stat->post_name ] = $stat->post_title;
|
||||||
|
|
||||||
// Add order to priorities if priority is set and does not exist in array already
|
// 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 ) ):
|
if ( $priority && ! array_key_exists( $priority, $sportspress_column_priorities ) ):
|
||||||
$sportspress_column_priorities[ $priority ] = array(
|
$sportspress_column_priorities[ $priority ] = array(
|
||||||
'column' => $stat->post_name,
|
'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;
|
endif;
|
||||||
|
|
||||||
@@ -2163,8 +2054,8 @@ if ( !function_exists( 'sp_get_league_table_data' ) ) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach ( $stats as $stat ):
|
foreach ( $stats as $stat ):
|
||||||
if ( sportspress_array_value( $placeholders[ $team_id ], $stat->post_name, '' ) == '' ):
|
if ( sp_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 );
|
$placeholders[ $team_id ][ $stat->post_name ] = sp_solve( $stat->equation, sp_array_value( $totals, $team_id, array() ), $stat->precision );
|
||||||
endif;
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
endforeach;
|
endforeach;
|
||||||
@@ -2191,7 +2082,7 @@ if ( !function_exists( 'sp_get_league_table_data' ) ) {
|
|||||||
endforeach;
|
endforeach;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
uasort( $merged, 'sportspress_sort_table_teams' );
|
uasort( $merged, 'sp_sort_table_teams' );
|
||||||
|
|
||||||
// Rearrange data array to reflect values
|
// Rearrange data array to reflect values
|
||||||
$data = array();
|
$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' ) ) {
|
if ( !function_exists( 'sp_sort_table_teams' ) ) {
|
||||||
function sp_sort_table_teams ( $a, $b ) {
|
function sp_sort_table_teams ( $a, $b ) {
|
||||||
|
|
||||||
@@ -2232,10 +2116,10 @@ if ( !function_exists( 'sp_sort_table_teams' ) ) {
|
|||||||
foreach( $sportspress_column_priorities as $priority ):
|
foreach( $sportspress_column_priorities as $priority ):
|
||||||
|
|
||||||
// Proceed if columns are not equal
|
// 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
|
// 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
|
// Flip value if descending order
|
||||||
if ( $priority['order'] == 'DESC' ) $output = 0 - $output;
|
if ( $priority['order'] == 'DESC' ) $output = 0 - $output;
|
||||||
@@ -2247,14 +2131,14 @@ if ( !function_exists( 'sp_sort_table_teams' ) ) {
|
|||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
// Default sort by alphabetical
|
// 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' ) ) {
|
if ( !function_exists( 'sp_get_player_list_data' ) ) {
|
||||||
function sp_get_player_list_data( $post_id, $admin = false ) {
|
function sp_get_player_list_data( $post_id, $admin = false ) {
|
||||||
$league_id = sportspress_get_the_term_id( $post_id, 'sp_league', 0 );
|
$league_id = sp_get_the_term_id( $post_id, 'sp_league', 0 );
|
||||||
$div_id = sportspress_get_the_term_id( $post_id, 'sp_season', 0 );
|
$div_id = sp_get_the_term_id( $post_id, 'sp_season', 0 );
|
||||||
$team_id = get_post_meta( $post_id, 'sp_team', true );
|
$team_id = get_post_meta( $post_id, 'sp_team', true );
|
||||||
$player_ids = (array)get_post_meta( $post_id, 'sp_player', false );
|
$player_ids = (array)get_post_meta( $post_id, 'sp_player', false );
|
||||||
$stats = (array)get_post_meta( $post_id, 'sp_players', true );
|
$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 );
|
$usecolumns = get_post_meta( $post_id, 'sp_columns', true );
|
||||||
|
|
||||||
// Get labels from result variables
|
// 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
|
// 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
|
// Create entry for each player in totals
|
||||||
$totals = array();
|
$totals = array();
|
||||||
@@ -2341,7 +2225,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) {
|
|||||||
if ( ! array_key_exists( $team_id, $teams ) )
|
if ( ! array_key_exists( $team_id, $teams ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$players = sportspress_array_value( $teams, $team_id, array() );
|
$players = sp_array_value( $teams, $team_id, array() );
|
||||||
|
|
||||||
foreach ( $players as $player_id => $player_performance ):
|
foreach ( $players as $player_id => $player_performance ):
|
||||||
|
|
||||||
@@ -2349,7 +2233,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Increment events played
|
// 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']++;
|
$totals[ $player_id ]['eventsplayed']++;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
@@ -2373,7 +2257,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Increment events played
|
// 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']++;
|
$totals[ $player_id ]['eventsplayed']++;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
@@ -2410,7 +2294,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) {
|
|||||||
$meta = get_post_meta( $performance->ID );
|
$meta = get_post_meta( $performance->ID );
|
||||||
|
|
||||||
// Add equation to object
|
// 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
|
// Add column name to columns
|
||||||
$columns[ $performance->post_name ] = $performance->post_title;
|
$columns[ $performance->post_name ] = $performance->post_title;
|
||||||
@@ -2429,7 +2313,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) {
|
|||||||
array_unshift( $performances, $epstat );
|
array_unshift( $performances, $epstat );
|
||||||
|
|
||||||
foreach ( $performances as $performance ):
|
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' ):
|
if ( $performance->post_name == 'eventsplayed' ):
|
||||||
$calculate = 'total';
|
$calculate = 'total';
|
||||||
@@ -2440,17 +2324,17 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) {
|
|||||||
if ( $calculate && $calculate == 'average' ):
|
if ( $calculate && $calculate == 'average' ):
|
||||||
|
|
||||||
// Reflect 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 ):
|
if ( ! $eventsplayed ):
|
||||||
$placeholders[ $player_id ][ $performance->post_name ] = 0;
|
$placeholders[ $player_id ][ $performance->post_name ] = 0;
|
||||||
else:
|
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;
|
endif;
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
// Reflect total
|
// 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;
|
endif;
|
||||||
|
|
||||||
@@ -2486,7 +2370,7 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) {
|
|||||||
'order' => $order,
|
'order' => $order,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
uasort( $merged, 'sportspress_sort_list_players' );
|
uasort( $merged, 'sp_sort_list_players' );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Rearrange data array to reflect performance
|
// 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' ) ) {
|
if ( !function_exists( 'sp_get_player_roster_data' ) ) {
|
||||||
function sp_get_player_roster_data( $post_id, $admin = false ) {
|
function sp_get_player_roster_data( $post_id, $admin = false ) {
|
||||||
$league_id = sportspress_get_the_term_id( $post_id, 'sp_league', 0 );
|
$league_id = sp_get_the_term_id( $post_id, 'sp_league', 0 );
|
||||||
$div_id = sportspress_get_the_term_id( $post_id, 'sp_season', 0 );
|
$div_id = sp_get_the_term_id( $post_id, 'sp_season', 0 );
|
||||||
$team_id = get_post_meta( $post_id, 'sp_team', true );
|
$team_id = get_post_meta( $post_id, 'sp_team', true );
|
||||||
$player_ids = (array)get_post_meta( $post_id, 'sp_player', false );
|
$player_ids = (array)get_post_meta( $post_id, 'sp_player', false );
|
||||||
$stats = (array)get_post_meta( $post_id, 'sp_players', true );
|
$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 );
|
$order = get_post_meta( $post_id, 'sp_order', true );
|
||||||
|
|
||||||
// Get labels from result variables
|
// 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
|
// 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
|
// Create entry for each player in totals
|
||||||
$totals = array();
|
$totals = array();
|
||||||
@@ -2607,7 +2491,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) {
|
|||||||
if ( ! array_key_exists( $team_id, $teams ) )
|
if ( ! array_key_exists( $team_id, $teams ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$players = sportspress_array_value( $teams, $team_id, array() );
|
$players = sp_array_value( $teams, $team_id, array() );
|
||||||
|
|
||||||
foreach ( $players as $player_id => $player_performance ):
|
foreach ( $players as $player_id => $player_performance ):
|
||||||
|
|
||||||
@@ -2615,7 +2499,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Increment events played
|
// 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']++;
|
$totals[ $player_id ]['eventsplayed']++;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
@@ -2639,7 +2523,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Increment events played
|
// 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']++;
|
$totals[ $player_id ]['eventsplayed']++;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
@@ -2676,7 +2560,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) {
|
|||||||
$meta = get_post_meta( $performance->ID );
|
$meta = get_post_meta( $performance->ID );
|
||||||
|
|
||||||
// Add equation to object
|
// 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
|
// Add column name to columns
|
||||||
$columns[ $performance->post_name ] = $performance->post_title;
|
$columns[ $performance->post_name ] = $performance->post_title;
|
||||||
@@ -2695,7 +2579,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) {
|
|||||||
array_unshift( $performances, $epstat );
|
array_unshift( $performances, $epstat );
|
||||||
|
|
||||||
foreach ( $performances as $performance ):
|
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' ):
|
if ( $performance->post_name == 'eventsplayed' ):
|
||||||
$calculate = 'total';
|
$calculate = 'total';
|
||||||
@@ -2706,17 +2590,17 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) {
|
|||||||
if ( $calculate && $calculate == 'average' ):
|
if ( $calculate && $calculate == 'average' ):
|
||||||
|
|
||||||
// Reflect 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 ):
|
if ( ! $eventsplayed ):
|
||||||
$placeholders[ $player_id ][ $performance->post_name ] = 0;
|
$placeholders[ $player_id ][ $performance->post_name ] = 0;
|
||||||
else:
|
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;
|
endif;
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
// Reflect total
|
// 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;
|
endif;
|
||||||
|
|
||||||
@@ -2752,7 +2636,7 @@ if ( !function_exists( 'sp_get_player_roster_data' ) ) {
|
|||||||
'order' => $order,
|
'order' => $order,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
uasort( $merged, 'sportspress_sort_list_players' );
|
uasort( $merged, 'sp_sort_list_players' );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Rearrange data array to reflect performance
|
// Rearrange data array to reflect performance
|
||||||
@@ -2780,16 +2664,16 @@ if ( !function_exists( 'sp_sort_list_players' ) ) {
|
|||||||
foreach( $sportspress_performance_priorities as $priority ):
|
foreach( $sportspress_performance_priorities as $priority ):
|
||||||
|
|
||||||
// Proceed if columns are not equal
|
// 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' ):
|
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:
|
else:
|
||||||
|
|
||||||
// Compare performance values
|
// 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;
|
endif;
|
||||||
|
|
||||||
@@ -2803,7 +2687,7 @@ if ( !function_exists( 'sp_sort_list_players' ) ) {
|
|||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
// Default sort by number
|
// 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 );
|
$metrics = (array)get_post_meta( $post_id, 'sp_metrics', true );
|
||||||
|
|
||||||
// Get labels from metric variables
|
// 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();
|
$data = array();
|
||||||
|
|
||||||
foreach( $metric_labels as $key => $value ):
|
foreach( $metric_labels as $key => $value ):
|
||||||
|
|
||||||
$metric = sportspress_array_value( $metrics, $key, null );
|
$metric = sp_array_value( $metrics, $key, null );
|
||||||
if ( $metric == null )
|
if ( $metric == null )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$data[ $value ] = sportspress_array_value( $metrics, $key, ' ' );
|
$data[ $value ] = sp_array_value( $metrics, $key, ' ' );
|
||||||
|
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
@@ -2838,7 +2722,7 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) {
|
|||||||
$seasons = (array)get_the_terms( $post_id, 'sp_season' );
|
$seasons = (array)get_the_terms( $post_id, 'sp_season' );
|
||||||
$positions = get_the_terms( $post_id, 'sp_position' );
|
$positions = get_the_terms( $post_id, 'sp_position' );
|
||||||
$stats = (array)get_post_meta( $post_id, 'sp_performance', true );
|
$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(
|
$args = array(
|
||||||
'post_type' => 'sp_performance',
|
'post_type' => 'sp_performance',
|
||||||
@@ -2885,11 +2769,11 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) {
|
|||||||
$tempdata = array();
|
$tempdata = array();
|
||||||
|
|
||||||
// Get all seasons populated with stats where available
|
// 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 ):
|
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 );
|
$totals = array( 'eventsattended' => 0, 'eventsplayed' => 0 );
|
||||||
|
|
||||||
@@ -2930,8 +2814,8 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) {
|
|||||||
// Add all team performance
|
// Add all team performance
|
||||||
foreach ( $team_performance as $players ):
|
foreach ( $team_performance as $players ):
|
||||||
if ( array_key_exists( $post_id, $players ) ):
|
if ( array_key_exists( $post_id, $players ) ):
|
||||||
$player_performance = sportspress_array_value( $players, $post_id, array() );
|
$player_performance = sp_array_value( $players, $post_id, array() );
|
||||||
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['eventsplayed']++;
|
$totals['eventsplayed']++;
|
||||||
endif;
|
endif;
|
||||||
foreach ( $player_performance as $key => $value ):
|
foreach ( $player_performance as $key => $value ):
|
||||||
@@ -2950,17 +2834,17 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) {
|
|||||||
if ( $value == 'average' ):
|
if ( $value == 'average' ):
|
||||||
|
|
||||||
// Reflect average
|
// Reflect average
|
||||||
$eventsplayed = (int)sportspress_array_value( $totals, 'eventsplayed', 0 );
|
$eventsplayed = (int)sp_array_value( $totals, 'eventsplayed', 0 );
|
||||||
if ( ! $eventsplayed ):
|
if ( ! $eventsplayed ):
|
||||||
$placeholders[ $div_id ][ $key ] = 0;
|
$placeholders[ $div_id ][ $key ] = 0;
|
||||||
else:
|
else:
|
||||||
$placeholders[ $div_id ][ $key ] = sportspress_array_value( $totals, $key, 0 ) / $eventsplayed;
|
$placeholders[ $div_id ][ $key ] = sp_array_value( $totals, $key, 0 ) / $eventsplayed;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
// Reflect total
|
// Reflect total
|
||||||
$placeholders[ $div_id ][ $key ] = sportspress_array_value( $totals, $key, 0 );
|
$placeholders[ $div_id ][ $key ] = sp_array_value( $totals, $key, 0 );
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
@@ -2973,7 +2857,7 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) {
|
|||||||
|
|
||||||
foreach( $placeholders as $season_id => $season_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' )
|
if ( ! $team_id || $team_id == '-1' )
|
||||||
continue;
|
continue;
|
||||||
@@ -2981,7 +2865,7 @@ if ( !function_exists( 'sp_get_player_performance_data' ) ) {
|
|||||||
$team_name = get_the_title( $team_id );
|
$team_name = get_the_title( $team_id );
|
||||||
$team_permalink = get_permalink( $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
|
// Add season name to row
|
||||||
$merged[ $season_id ] = array(
|
$merged[ $season_id ] = array(
|
||||||
@@ -3034,8 +2918,8 @@ if ( !function_exists( 'sp_delete_duplicate_post' ) ) {
|
|||||||
|
|
||||||
$key = isset( $post['sp_key'] ) ? $post['sp_key'] : null;
|
$key = isset( $post['sp_key'] ) ? $post['sp_key'] : null;
|
||||||
if ( ! $key ) $key = $post['post_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 );
|
||||||
|
|
||||||
$check_sql = "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
|
$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 ) );
|
$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $title, $post['post_type'], $id ) );
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ function sportspress_default_venue_content( $query ) {
|
|||||||
if ( ! is_tax( 'sp_venue' ) )
|
if ( ! is_tax( 'sp_venue' ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$slug = sportspress_array_value( $query->query, 'sp_venue', null );
|
$slug = sp_array_value( $query->query, 'sp_venue', null );
|
||||||
|
|
||||||
if ( ! $slug )
|
if ( ! $slug )
|
||||||
return;
|
return;
|
||||||
@@ -57,9 +57,9 @@ function sportspress_default_venue_content( $query ) {
|
|||||||
$venue = get_term_by( 'slug', $slug, 'sp_venue' );
|
$venue = get_term_by( 'slug', $slug, 'sp_venue' );
|
||||||
$t_id = $venue->term_id;
|
$t_id = $venue->term_id;
|
||||||
$venue_meta = get_option( "taxonomy_$t_id" );
|
$venue_meta = get_option( "taxonomy_$t_id" );
|
||||||
$address = sportspress_array_value( $venue_meta, 'sp_address', null );
|
$address = sp_array_value( $venue_meta, 'sp_address', null );
|
||||||
$latitude = sportspress_array_value( $venue_meta, 'sp_latitude', null );
|
$latitude = sp_array_value( $venue_meta, 'sp_latitude', null );
|
||||||
$longitude = sportspress_array_value( $venue_meta, 'sp_longitude', null );
|
$longitude = sp_array_value( $venue_meta, 'sp_longitude', null );
|
||||||
|
|
||||||
if ( $latitude != null && $longitude != null )
|
if ( $latitude != null && $longitude != null )
|
||||||
echo '<div class="sp-google-map" data-address="' . $address . '" data-latitude="' . $latitude . '" data-longitude="' . $longitude . '"></div>';
|
echo '<div class="sp-google-map" data-address="' . $address . '" data-latitude="' . $latitude . '" data-longitude="' . $longitude . '"></div>';
|
||||||
@@ -194,13 +194,13 @@ function sportspress_pre_get_posts( $query ) {
|
|||||||
}
|
}
|
||||||
add_filter('pre_get_posts', 'sportspress_pre_get_posts');
|
add_filter('pre_get_posts', 'sportspress_pre_get_posts');
|
||||||
|
|
||||||
function sportspress_posts_where( $where, $that ) {
|
function sp_posts_where( $where, $that ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
if( 'sp_event' == $that->query_vars['post_type'] && is_archive() )
|
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 );
|
$where = str_replace( "{$wpdb->posts}.post_status = 'publish'", "{$wpdb->posts}.post_status = 'publish' OR $wpdb->posts.post_status = 'future'", $where );
|
||||||
return $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 ) {
|
function sportspress_sanitize_title( $title ) {
|
||||||
|
|
||||||
@@ -214,9 +214,9 @@ function sportspress_sanitize_title( $title ) {
|
|||||||
|
|
||||||
if ( ! $key ) $key = $_POST['post_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' ):
|
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 ) {
|
function sportspress_the_content( $content ) {
|
||||||
if ( is_single() || is_page() )
|
if ( is_single() || is_page() )
|
||||||
sportspress_set_post_views( get_the_ID() );
|
sp_set_post_views( get_the_ID() );
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
add_filter( 'the_content', 'sportspress_the_content' );
|
add_filter( 'the_content', 'sportspress_the_content' );
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ class SP_Widget_Countdown extends WP_Widget {
|
|||||||
'show_dates' => true,
|
'show_dates' => true,
|
||||||
'post_status' => 'future',
|
'post_status' => 'future',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sp_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_event', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_event', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ class SP_Widget_Event_Calendar extends WP_Widget {
|
|||||||
'values' => 'ID',
|
'values' => 'ID',
|
||||||
'class' => 'sp-event-calendar-select widefat',
|
'class' => 'sp-event-calendar-select widefat',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sp_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ class SP_Widget_Event_List extends WP_Widget {
|
|||||||
'values' => 'ID',
|
'values' => 'ID',
|
||||||
'class' => 'sp-event-calendar-select widefat',
|
'class' => 'sp-event-calendar-select widefat',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sp_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ class SP_Widget_League_Table extends WP_Widget {
|
|||||||
'values' => 'ID',
|
'values' => 'ID',
|
||||||
'class' => 'widefat',
|
'class' => 'widefat',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sp_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_table', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_table', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ class SP_Widget_Player_Gallery extends WP_Widget {
|
|||||||
'values' => 'ID',
|
'values' => 'ID',
|
||||||
'class' => 'widefat',
|
'class' => 'widefat',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sp_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -85,8 +85,8 @@ class SP_Widget_Player_Gallery extends WP_Widget {
|
|||||||
'values' => 'slug',
|
'values' => 'slug',
|
||||||
'class' => 'sp-select-orderby widefat',
|
'class' => 'sp-select-orderby widefat',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sp_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ class SP_Widget_Player_list extends WP_Widget {
|
|||||||
'values' => 'ID',
|
'values' => 'ID',
|
||||||
'class' => 'widefat',
|
'class' => 'widefat',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sp_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@@ -106,8 +106,8 @@ class SP_Widget_Player_list extends WP_Widget {
|
|||||||
'values' => 'slug',
|
'values' => 'slug',
|
||||||
'class' => 'sp-select-orderby widefat',
|
'class' => 'sp-select-orderby widefat',
|
||||||
);
|
);
|
||||||
if ( ! sportspress_dropdown_pages( $args ) ):
|
if ( ! sp_dropdown_pages( $args ) ):
|
||||||
sportspress_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) );
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ else:
|
|||||||
$args = array();
|
$args = array();
|
||||||
if ( isset( $team ) )
|
if ( isset( $team ) )
|
||||||
$args = array( 'key' => 'sp_team', 'value' => $team );
|
$args = array( 'key' => 'sp_team', 'value' => $team );
|
||||||
$post = sportspress_get_next_event( $args );
|
$post = sp_get_next_event( $args );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ $defaults = array(
|
|||||||
extract( $defaults, EXTR_SKIP );
|
extract( $defaults, EXTR_SKIP );
|
||||||
|
|
||||||
if ( isset( $id ) ):
|
if ( isset( $id ) ):
|
||||||
$events = sportspress_get_calendar_data( $id );
|
$events = sp_get_calendar_data( $id );
|
||||||
$event_ids = array();
|
$event_ids = array();
|
||||||
foreach ( $events as $event ):
|
foreach ( $events as $event ):
|
||||||
$event_ids[] = $event->ID;
|
$event_ids[] = $event->ID;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
global $sportspress_options;
|
global $sportspress_options;
|
||||||
$primary_result = sportspress_array_value( $sportspress_options, 'sportspress_primary_result', null );
|
$primary_result = sp_array_value( $sportspress_options, 'sportspress_primary_result', null );
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'number' => -1,
|
'number' => -1,
|
||||||
@@ -14,7 +14,7 @@ extract( $defaults, EXTR_SKIP );
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
list( $data, $usecolumns ) = sportspress_get_calendar_data( $id, true );
|
list( $data, $usecolumns ) = sp_get_calendar_data( $id, true );
|
||||||
|
|
||||||
if ( isset( $columns ) )
|
if ( isset( $columns ) )
|
||||||
$usecolumns = $columns;
|
$usecolumns = $columns;
|
||||||
@@ -67,10 +67,10 @@ extract( $defaults, EXTR_SKIP );
|
|||||||
foreach ( $teams as $team ):
|
foreach ( $teams as $team ):
|
||||||
$name = get_the_title( $team );
|
$name = get_the_title( $team );
|
||||||
if ( $name ):
|
if ( $name ):
|
||||||
$team_results = sportspress_array_value( $results, $team, null );
|
$team_results = sp_array_value( $results, $team, null );
|
||||||
|
|
||||||
if ( $primary_result ):
|
if ( $primary_result ):
|
||||||
$team_result = sportspress_array_value( $team_results, $primary_result, null );
|
$team_result = sp_array_value( $team_results, $primary_result, null );
|
||||||
else:
|
else:
|
||||||
if ( is_array( $team_results ) ):
|
if ( is_array( $team_results ) ):
|
||||||
end( $team_results );
|
end( $team_results );
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ if ( ! isset( $id ) )
|
|||||||
$teams = (array)get_post_meta( $id, 'sp_team', false );
|
$teams = (array)get_post_meta( $id, 'sp_team', false );
|
||||||
$staff = (array)get_post_meta( $id, 'sp_staff', false );
|
$staff = (array)get_post_meta( $id, 'sp_staff', false );
|
||||||
$stats = (array)get_post_meta( $id, 'sp_players', true );
|
$stats = (array)get_post_meta( $id, 'sp_players', true );
|
||||||
$performance_labels = sportspress_get_var_labels( 'sp_performance' );
|
$performance_labels = sp_get_var_labels( 'sp_performance' );
|
||||||
$link_posts = get_option( 'sportspress_event_link_players', 'yes' ) == 'yes' ? true : false;
|
$link_posts = get_option( 'sportspress_event_link_players', 'yes' ) == 'yes' ? true : false;
|
||||||
$sortable = get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false;
|
$sortable = get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false;
|
||||||
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
|
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
|
||||||
@@ -20,11 +20,11 @@ foreach( $teams as $key => $team_id ):
|
|||||||
$totals = array();
|
$totals = array();
|
||||||
|
|
||||||
// Get results for players in the team
|
// 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;
|
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 .= '<h3>' . get_the_title( $team_id ) . '</h3>';
|
$output .= '<h3>' . get_the_title( $team_id ) . '</h3>';
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ foreach( $teams as $key => $team_id ):
|
|||||||
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
||||||
$value = $row[ $key ];
|
$value = $row[ $key ];
|
||||||
else:
|
else:
|
||||||
$value = sportspress_array_value( $totals, $key, 0 );
|
$value = sp_array_value( $totals, $key, 0 );
|
||||||
endif;
|
endif;
|
||||||
$output .= '<td class="data-' . $key . '">' . $value . '</td>';
|
$output .= '<td class="data-' . $key . '">' . $value . '</td>';
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ if ( ! isset( $id ) )
|
|||||||
$id = get_the_ID();
|
$id = get_the_ID();
|
||||||
|
|
||||||
$teams = (array)get_post_meta( $id, 'sp_team', false );
|
$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' );
|
$results = array_filter( sp_array_combine( $teams, (array)get_post_meta( $id, 'sp_results', true ) ), 'array_filter' );
|
||||||
$result_labels = sportspress_get_var_labels( 'sp_result' );
|
$result_labels = sp_get_var_labels( 'sp_result' );
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ if ( empty( $results ) )
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach( $results as $team_id => $result ):
|
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'] );
|
unset( $result['outcome'] );
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ foreach( $venues as $venue ):
|
|||||||
$t_id = $venue->term_id;
|
$t_id = $venue->term_id;
|
||||||
$term_meta = get_option( "taxonomy_$t_id" );
|
$term_meta = get_option( "taxonomy_$t_id" );
|
||||||
|
|
||||||
$address = sportspress_array_value( $term_meta, 'sp_address', '' );
|
$address = sp_array_value( $term_meta, 'sp_address', '' );
|
||||||
$latitude = sportspress_array_value( $term_meta, 'sp_latitude', 0 );
|
$latitude = sp_array_value( $term_meta, 'sp_latitude', 0 );
|
||||||
$longitude = sportspress_array_value( $term_meta, 'sp_longitude', 0 );
|
$longitude = sp_array_value( $term_meta, 'sp_longitude', 0 );
|
||||||
|
|
||||||
$output .= '<h3>' . SP()->text->string('Venue', 'event') . '</h3>';
|
$output .= '<h3>' . SP()->text->string('Venue', 'event') . '</h3>';
|
||||||
$output .= '<p><a href="' . get_term_link( $t_id, 'sp_venue' ) . '">' . $venue->name . '</a><br><small>' . $address . '</small></p>';
|
$output .= '<p><a href="' . get_term_link( $t_id, 'sp_venue' ) . '">' . $venue->name . '</a><br><small>' . $address . '</small></p>';
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ extract( $defaults, EXTR_SKIP );
|
|||||||
$output = '<div class="sp-table-wrapper">' .
|
$output = '<div class="sp-table-wrapper">' .
|
||||||
'<table class="sp-league-table sp-data-table' . ( $responsive ? ' sp-responsive-table' : '' ) . ( $sortable ? ' sp-sortable-table' : '' ) . '">' . '<thead>' . '<tr>';
|
'<table class="sp-league-table sp-data-table' . ( $responsive ? ' sp-responsive-table' : '' ) . ( $sortable ? ' sp-sortable-table' : '' ) . '">' . '<thead>' . '<tr>';
|
||||||
|
|
||||||
$data = sportspress_get_league_table_data( $id );
|
$data = sp_get_league_table_data( $id );
|
||||||
|
|
||||||
// The first row should be column labels
|
// The first row should be column labels
|
||||||
$labels = $data[0];
|
$labels = $data[0];
|
||||||
@@ -49,7 +49,7 @@ foreach( $data as $team_id => $row ):
|
|||||||
|
|
||||||
if ( isset( $limit ) && $i >= $limit ) continue;
|
if ( isset( $limit ) && $i >= $limit ) continue;
|
||||||
|
|
||||||
$name = sportspress_array_value( $row, 'name', null );
|
$name = sp_array_value( $row, 'name', null );
|
||||||
if ( ! $name ) continue;
|
if ( ! $name ) continue;
|
||||||
|
|
||||||
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||||
@@ -71,7 +71,7 @@ foreach( $data as $team_id => $row ):
|
|||||||
if ( $key == 'name' )
|
if ( $key == 'name' )
|
||||||
continue;
|
continue;
|
||||||
if ( ! is_array( $columns ) || in_array( $key, $columns ) )
|
if ( ! is_array( $columns ) || in_array( $key, $columns ) )
|
||||||
$output .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '—' ) . '</td>';
|
$output .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
$output .= '</tr>';
|
$output .= '</tr>';
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ $float = is_rtl() ? 'right' : 'left';
|
|||||||
|
|
||||||
$selector = 'sp-player-gallery-' . $id;
|
$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
|
// The first row should be column labels
|
||||||
$labels = $data[0];
|
$labels = $data[0];
|
||||||
@@ -53,7 +53,7 @@ else:
|
|||||||
'order' => $order,
|
'order' => $order,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
uasort( $data, 'sportspress_sort_list_players' );
|
uasort( $data, 'sp_sort_list_players' );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$gallery_style = $gallery_div = '';
|
$gallery_style = $gallery_div = '';
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ if ( ! isset( $id ) )
|
|||||||
|
|
||||||
$responsive = get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false;
|
$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
|
// The first row should be column labels
|
||||||
$labels = $data[0];
|
$labels = $data[0];
|
||||||
@@ -36,7 +36,7 @@ foreach( $data as $season_id => $row ):
|
|||||||
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||||
|
|
||||||
foreach( $labels as $key => $value ):
|
foreach( $labels as $key => $value ):
|
||||||
$output .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '—' ) . '</td>';
|
$output .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
$output .= '</tr>';
|
$output .= '</tr>';
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ extract( $defaults, EXTR_SKIP );
|
|||||||
$output = '<div class="sp-table-wrapper">' .
|
$output = '<div class="sp-table-wrapper">' .
|
||||||
'<table class="sp-player-list sp-data-table' . ( $responsive ? ' sp-responsive-table' : '' ) . ( $sortable ? ' sp-sortable-table' : '' ) . '">' . '<thead>' . '<tr>';
|
'<table class="sp-player-list sp-data-table' . ( $responsive ? ' sp-responsive-table' : '' ) . ( $sortable ? ' sp-sortable-table' : '' ) . '">' . '<thead>' . '<tr>';
|
||||||
|
|
||||||
$data = sportspress_get_player_list_data( $id );
|
$data = sp_get_player_list_data( $id );
|
||||||
|
|
||||||
// The first row should be column labels
|
// The first row should be column labels
|
||||||
$labels = $data[0];
|
$labels = $data[0];
|
||||||
@@ -37,7 +37,7 @@ else:
|
|||||||
'order' => $order,
|
'order' => $order,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
uasort( $data, 'sportspress_sort_list_players' );
|
uasort( $data, 'sp_sort_list_players' );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ( in_array( $orderby, array( 'number', 'name' ) ) ):
|
if ( in_array( $orderby, array( 'number', 'name' ) ) ):
|
||||||
@@ -61,7 +61,7 @@ if ( is_int( $number ) && $number > 0 )
|
|||||||
foreach( $data as $player_id => $row ):
|
foreach( $data as $player_id => $row ):
|
||||||
if ( isset( $limit ) && $i >= $limit ) continue;
|
if ( isset( $limit ) && $i >= $limit ) continue;
|
||||||
|
|
||||||
$name = sportspress_array_value( $row, 'name', null );
|
$name = sp_array_value( $row, 'name', null );
|
||||||
if ( ! $name ) continue;
|
if ( ! $name ) continue;
|
||||||
|
|
||||||
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||||
@@ -85,7 +85,7 @@ foreach( $data as $player_id => $row ):
|
|||||||
if ( $key == 'name' )
|
if ( $key == 'name' )
|
||||||
continue;
|
continue;
|
||||||
if ( ! is_array( $performance ) || in_array( $key, $performance ) )
|
if ( ! is_array( $performance ) || in_array( $key, $performance ) )
|
||||||
$output .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '—' ) . '</td>';
|
$output .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
$output .= '</tr>';
|
$output .= '</tr>';
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ $countries = SP()->countries->countries;
|
|||||||
$nationality = get_post_meta( $id, 'sp_nationality', true );
|
$nationality = get_post_meta( $id, 'sp_nationality', true );
|
||||||
$current_team = get_post_meta( $id, 'sp_current_team', true );
|
$current_team = get_post_meta( $id, 'sp_current_team', true );
|
||||||
$past_teams = get_post_meta( $id, 'sp_past_team', false );
|
$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();
|
$common = array();
|
||||||
if ( $nationality ):
|
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 ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '—';
|
$common[ SP()->text->string('Nationality', 'player') ] = $country_name ? ( $show_nationality_flag ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '—';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ $r = wp_parse_args( $args, $defaults );
|
|||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
$data = sportspress_get_player_roster_data( $id );
|
$data = sp_get_player_roster_data( $id );
|
||||||
|
|
||||||
// The first row should be column labels
|
// The first row should be column labels
|
||||||
$labels = $data[0];
|
$labels = $data[0];
|
||||||
@@ -20,7 +20,7 @@ $labels = $data[0];
|
|||||||
// Remove the first row to leave us with the actual data
|
// Remove the first row to leave us with the actual data
|
||||||
unset( $data[0] );
|
unset( $data[0] );
|
||||||
|
|
||||||
$performance = sportspress_array_value( $r, 'performance', null );
|
$performance = sp_array_value( $r, 'performance', null );
|
||||||
|
|
||||||
if ( $r['orderby'] == 'default' ):
|
if ( $r['orderby'] == 'default' ):
|
||||||
$r['orderby'] = get_post_meta( $id, 'sp_orderby', true );
|
$r['orderby'] = get_post_meta( $id, 'sp_orderby', true );
|
||||||
@@ -33,7 +33,7 @@ else:
|
|||||||
'order' => $r['order'],
|
'order' => $r['order'],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
uasort( $data, 'sportspress_sort_list_players' );
|
uasort( $data, 'sp_sort_list_players' );
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$positions = get_terms ( 'sp_position' );
|
$positions = get_terms ( 'sp_position' );
|
||||||
@@ -59,14 +59,14 @@ foreach ( $positions as $position ):
|
|||||||
|
|
||||||
// Name as link
|
// Name as link
|
||||||
$permalink = get_post_permalink( $player_id );
|
$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 .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>';
|
$rows .= '<td class="data-name">' . '<a href="' . $permalink . '">' . $name . '</a></td>';
|
||||||
|
|
||||||
foreach( $labels as $key => $value ):
|
foreach( $labels as $key => $value ):
|
||||||
if ( $key == 'name' )
|
if ( $key == 'name' )
|
||||||
continue;
|
continue;
|
||||||
if ( ! is_array( $performance ) || in_array( $key, $performance ) )
|
if ( ! is_array( $performance ) || in_array( $key, $performance ) )
|
||||||
$rows .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '—' ) . '</td>';
|
$rows .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
$rows .= '</tr>';
|
$rows .= '</tr>';
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ $output = '';
|
|||||||
// Loop through data for each league
|
// Loop through data for each league
|
||||||
foreach ( $leagues as $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 )
|
if ( sizeof( $data ) <= 1 )
|
||||||
continue;
|
continue;
|
||||||
@@ -40,7 +40,7 @@ foreach ( $leagues as $league ):
|
|||||||
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||||
|
|
||||||
foreach( $labels as $key => $value ):
|
foreach( $labels as $key => $value ):
|
||||||
$output .= '<td class="data-' . $key . '">' . sportspress_array_value( $row, $key, '—' ) . '</td>';
|
$output .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
$output .= '</tr>';
|
$output .= '</tr>';
|
||||||
|
|||||||
Reference in New Issue
Block a user