Expand theme prefix and clean up file structure

This commit is contained in:
Brian Miyaji
2014-01-07 17:44:33 +11:00
parent 66c1639e7e
commit 0dd53482b6
40 changed files with 1838 additions and 1851 deletions

View File

@@ -1,9 +1,9 @@
<?php
function sp_column_cpt_init() {
function sportspress_column_post_init() {
$name = __( 'Table Columns', 'sportspress' );
$singular_name = __( 'Table Column', 'sportspress' );
$lowercase_name = __( 'table columns', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name, true );
$labels = sportspress_get_post_labels( $name, $singular_name, $lowercase_name, true );
$args = array(
'label' => $name,
'labels' => $labels,
@@ -17,7 +17,7 @@ function sp_column_cpt_init() {
);
register_post_type( 'sp_column', $args );
}
add_action( 'init', 'sp_column_cpt_init' );
add_action( 'init', 'sportspress_column_post_init' );
function sp_column_edit_columns() {
$columns = array(
@@ -37,7 +37,7 @@ function sp_column_meta_init() {
}
function sp_column_details_meta( $post ) {
$formats = sp_get_config_formats();
$formats = sportspress_get_config_formats();
$equation = explode( ' ', get_post_meta( $post->ID, 'sp_equation', true ) );
$order = get_post_meta( $post->ID, 'sp_order', true );
@@ -69,7 +69,7 @@ function sp_column_details_meta( $post ) {
<p class="sp-equation-selector">
<?php
foreach ( $equation as $piece ):
sp_get_equation_selector( $post->ID, $piece, array( 'team_event', 'result', 'outcome' ) );
sportspress_get_equation_selector( $post->ID, $piece, array( 'team_event', 'result', 'outcome' ) );
endforeach;
?>
</p>
@@ -93,5 +93,5 @@ function sp_column_details_meta( $post ) {
</select>
</p>
<?php
sp_nonce();
sportspress_nonce();
}

View File

@@ -1,9 +1,9 @@
<?php
function sp_event_cpt_init() {
function sportspress_event_post_init() {
$name = __( 'Events', 'sportspress' );
$singular_name = __( 'Event', 'sportspress' );
$lowercase_name = __( 'events', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name );
$labels = sportspress_get_post_labels( $name, $singular_name, $lowercase_name );
$args = array(
'label' => $name,
'labels' => $labels,
@@ -17,7 +17,7 @@ function sp_event_cpt_init() {
);
register_post_type( 'sp_event', $args );
}
add_action( 'init', 'sp_event_cpt_init' );
add_action( 'init', 'sportspress_event_post_init' );
function sp_event_display_scheduled( $posts ) {
global $wp_query, $wpdb;
@@ -65,8 +65,8 @@ function sp_event_team_meta( $post ) {
<li class="wp-tab"><a href="#sp_staff-all"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
</ul>
<?php
sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_team', $key );
sp_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_team', $key );
sportspress_post_checklist( $post->ID, 'sp_player', 'block', 'sp_team', $key );
sportspress_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_team', $key );
?>
</div>
<?php endforeach; ?>
@@ -85,8 +85,8 @@ function sp_event_team_meta( $post ) {
</p>
</div>
<?php
sp_post_adder( 'sp_team' );
sp_nonce();
sportspress_post_adder( 'sp_team' );
sportspress_nonce();
}
function sp_event_players_meta( $post ) {
@@ -94,19 +94,19 @@ function sp_event_players_meta( $post ) {
$stats = (array)get_post_meta( $post->ID, 'sp_players', true );
// Get columns from result variables
$columns = sp_get_var_labels( 'sp_statistic', true );
$columns = sportspress_get_var_labels( 'sp_statistic', true );
foreach ( $teams as $key => $team_id ):
if ( ! $team_id ) continue;
// Get results for players in the team
$players = sp_array_between( (array)get_post_meta( $post->ID, 'sp_player', false ), 0, $key );
$data = sp_array_combine( $players, sp_array_value( $stats, $team_id, array() ) );
$players = sportspress_array_between( (array)get_post_meta( $post->ID, 'sp_player', false ), 0, $key );
$data = sportspress_array_combine( $players, sportspress_array_value( $stats, $team_id, array() ) );
?>
<div>
<p><strong><?php echo get_the_title( $team_id ); ?></strong></p>
<?php sp_event_players_table( $columns, $data, $team_id ); ?>
<?php sportspress_event_players_table( $columns, $data, $team_id ); ?>
</div>
<?php
@@ -120,14 +120,14 @@ function sp_event_results_meta( $post ) {
$results = (array)get_post_meta( $post->ID, 'sp_results', true );
// Get columns from result variables
$columns = sp_get_var_labels( 'sp_result' );
$columns = sportspress_get_var_labels( 'sp_result' );
// Get results for all teams
$data = sp_array_combine( $teams, $results );
$data = sportspress_array_combine( $teams, $results );
?>
<div>
<?php sp_event_results_table( $columns, $data ); ?>
<?php sportspress_edit_event_results_table( $columns, $data ); ?>
</div>
<?php
}

View File

@@ -1,9 +1,9 @@
<?php
function sp_list_cpt_init() {
function sportspress_list_post_init() {
$name = __( 'Player Lists', 'sportspress' );
$singular_name = __( 'Player List', 'sportspress' );
$lowercase_name = __( 'player lists', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name, true );
$labels = sportspress_get_post_labels( $name, $singular_name, $lowercase_name, true );
$args = array(
'label' => $name,
'labels' => $labels,
@@ -17,7 +17,7 @@ function sp_list_cpt_init() {
);
register_post_type( 'sp_list', $args );
}
add_action( 'init', 'sp_list_cpt_init' );
add_action( 'init', 'sportspress_list_post_init' );
function sp_list_edit_columns() {
$columns = array(
@@ -42,7 +42,7 @@ function sp_list_meta_init( $post ) {
}
function sp_list_player_meta( $post ) {
$season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 );
$season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 );
$team_id = get_post_meta( $post->ID, 'sp_team', true );
?>
<div>
@@ -54,7 +54,7 @@ function sp_list_player_meta( $post ) {
'selected' => $season_id,
'value' => 'term_id'
);
sp_dropdown_taxonomies( $args );
sportspress_dropdown_taxonomies( $args );
?>
</p>
<p class="sp-tab-select">
@@ -68,18 +68,18 @@ function sp_list_player_meta( $post ) {
?>
</p>
<?php
sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_team' );
sp_post_adder( 'sp_player' );
sportspress_post_checklist( $post->ID, 'sp_player', 'block', 'sp_team' );
sportspress_post_adder( 'sp_player' );
?>
</div>
<?php
sp_nonce();
sportspress_nonce();
}
function sp_list_stats_meta( $post ) {
list( $columns, $data, $placeholders, $merged ) = sp_get_list( $post->ID, true );
list( $columns, $data, $placeholders, $merged ) = sportspress_get_list( $post->ID, true );
sp_player_table( $columns, $data, $placeholders );
sp_nonce();
sportspress_edit_player_table( $columns, $data, $placeholders );
sportspress_nonce();
}

View File

@@ -1,9 +1,9 @@
<?php
function sp_outcome_cpt_init() {
function sportspress_outcome_post_init() {
$name = __( 'Outcomes', 'sportspress' );
$singular_name = __( 'Outcome', 'sportspress' );
$lowercase_name = __( 'outcome', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name, true );
$labels = sportspress_get_post_labels( $name, $singular_name, $lowercase_name, true );
$args = array(
'label' => $name,
'labels' => $labels,
@@ -17,7 +17,7 @@ function sp_outcome_cpt_init() {
);
register_post_type( 'sp_outcome', $args );
}
add_action( 'init', 'sp_outcome_cpt_init' );
add_action( 'init', 'sportspress_outcome_post_init' );
function sp_outcome_edit_columns() {
$columns = array(
@@ -40,5 +40,5 @@ function sp_outcome_details_meta( $post ) {
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
</p>
<?php
sp_nonce();
sportspress_nonce();
}

View File

@@ -1,9 +1,9 @@
<?php
function sp_player_cpt_init() {
function sportspress_player_post_init() {
$name = __( 'Players', 'sportspress' );
$singular_name = __( 'Player', 'sportspress' );
$lowercase_name = __( 'players', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name );
$labels = sportspress_get_post_labels( $name, $singular_name, $lowercase_name );
$args = array(
'label' => $name,
'labels' => $labels,
@@ -17,7 +17,7 @@ function sp_player_cpt_init() {
);
register_post_type( 'sp_player', $args );
}
add_action( 'init', 'sp_player_cpt_init' );
add_action( 'init', 'sportspress_player_post_init' );
function sp_player_edit_columns() {
$columns = array(
@@ -51,8 +51,8 @@ function sp_player_meta_init( $post ) {
}
function sp_player_team_meta( $post ) {
sp_post_checklist( $post->ID, 'sp_team' );
sp_post_adder( 'sp_team' );
sportspress_post_checklist( $post->ID, 'sp_team' );
sportspress_post_adder( 'sp_team' );
}
function sp_player_stats_meta( $post ) {
@@ -64,7 +64,7 @@ function sp_player_stats_meta( $post ) {
$eos = new eqEOS();
// Get labels from statistic variables
$statistic_labels = (array)sp_get_var_labels( 'sp_statistic' );
$statistic_labels = (array)sportspress_get_var_labels( 'sp_statistic' );
// Generate array of all league ids
$div_ids = array();
@@ -93,10 +93,10 @@ function sp_player_stats_meta( $post ) {
$data = array();
// Get all leagues populated with stats where available
$data[ $team_id ] = sp_array_combine( $div_ids, sp_array_value( $stats, $team_id, array() ) );
$data[ $team_id ] = sportspress_array_combine( $div_ids, sportspress_array_value( $stats, $team_id, array() ) );
// Get equations from statistics variables
$equations = sp_get_var_equations( 'sp_statistic' );
$equations = sportspress_get_var_equations( 'sp_statistic' );
foreach ( $div_ids as $div_id ):
@@ -135,9 +135,9 @@ function sp_player_stats_meta( $post ) {
$totals['eventsplayed']++; // TODO: create tab for substitutes in sidebar
$team_statistics = (array)get_post_meta( $event->ID, 'sp_players', true );
if ( array_key_exists( $team_id, $team_statistics ) ):
$players = sp_array_value( $team_statistics, $team_id, array() );
$players = sportspress_array_value( $team_statistics, $team_id, array() );
if ( array_key_exists( $post->ID, $players ) ):
$player_statistics = sp_array_value( $players, $post->ID, array() );
$player_statistics = sportspress_array_value( $players, $post->ID, array() );
foreach ( $player_statistics as $key => $value ):
if ( array_key_exists( $key, $totals ) ):
$totals[ $key ] += $value;
@@ -154,13 +154,13 @@ function sp_player_stats_meta( $post ) {
if ( empty( $value ) ):
// Reflect totals
$placeholders[ $team_id ][ $div_id ][ $key ] = sp_array_value( $totals, $key, 0 );
$placeholders[ $team_id ][ $div_id ][ $key ] = sportspress_array_value( $totals, $key, 0 );
else:
// Calculate value
if ( sizeof( $events ) > 0 ):
$placeholders[ $team_id ][ $div_id ][ $key ] = sp_solve( $value, $totals );
$placeholders[ $team_id ][ $div_id ][ $key ] = sportspress_solve( $value, $totals );
else:
$placeholders[ $team_id ][ $div_id ][ $key ] = 0;
endif;
@@ -172,7 +172,7 @@ function sp_player_stats_meta( $post ) {
endforeach;
// Get columns from statistics variables
$columns = sp_get_var_labels( 'sp_statistic' );
$columns = sportspress_get_var_labels( 'sp_statistic' );
if ( $team_num > 1 ):
?>
@@ -180,7 +180,7 @@ function sp_player_stats_meta( $post ) {
<?php
endif;
sp_player_statistics_table( $columns, $data, $placeholders );
sportspress_edit_player_statistics_table( $columns, $data, $placeholders );
endforeach;
}
@@ -222,9 +222,9 @@ function sp_player_details_meta( $post ) {
?>
<p><strong><?php echo $var->post_title; ?></strong></p>
<p>
<input name="sp_details[<?php echo $var->post_name; ?>]" type="text" value="<?php echo sp_array_value( $details, $var->post_name, ''); ?>">
<input name="sp_details[<?php echo $var->post_name; ?>]" type="text" value="<?php echo sportspress_array_value( $details, $var->post_name, ''); ?>">
</p>
<?php
endforeach;
sp_nonce();
sportspress_nonce();
}

View File

@@ -1,9 +1,9 @@
<?php
function sp_result_cpt_init() {
function sportspress_result_post_init() {
$name = __( 'Results', 'sportspress' );
$singular_name = __( 'Result', 'sportspress' );
$lowercase_name = __( 'result', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name, true );
$labels = sportspress_get_post_labels( $name, $singular_name, $lowercase_name, true );
$args = array(
'label' => $name,
'labels' => $labels,
@@ -17,7 +17,7 @@ function sp_result_cpt_init() {
);
register_post_type( 'sp_result', $args );
}
add_action( 'init', 'sp_result_cpt_init' );
add_action( 'init', 'sportspress_result_post_init' );
function sp_result_edit_columns() {
$columns = array(
@@ -35,7 +35,7 @@ function sp_result_meta_init() {
}
function sp_result_details_meta( $post ) {
$formats = sp_get_config_formats();
$formats = sportspress_get_config_formats();
?>
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
<p>
@@ -52,5 +52,5 @@ function sp_result_details_meta( $post ) {
</select>
</p>
<?php
sp_nonce();
sportspress_nonce();
}

View File

@@ -1,5 +1,5 @@
<?php
function sp_separator_cpt_init() {
function sportspress_separator_post_init() {
$args = array(
'public' => false,
'show_ui' => true,
@@ -7,4 +7,4 @@ function sp_separator_cpt_init() {
);
register_post_type( 'sp_separator', $args );
}
add_action( 'init', 'sp_separator_cpt_init' );
add_action( 'init', 'sportspress_separator_post_init' );

View File

@@ -1,9 +1,9 @@
<?php
function sp_staff_cpt_init() {
function sportspress_staff_post_init() {
$name = __( 'Staff', 'sportspress' );
$singular_name = __( 'Staff', 'sportspress' );
$lowercase_name = __( 'staff', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name );
$labels = sportspress_get_post_labels( $name, $singular_name, $lowercase_name );
$args = array(
'label' => $name,
'labels' => $labels,
@@ -17,7 +17,7 @@ function sp_staff_cpt_init() {
);
register_post_type( 'sp_staff', $args );
}
add_action( 'init', 'sp_staff_cpt_init' );
add_action( 'init', 'sportspress_staff_post_init' );
function sp_staff_meta_init() {
remove_meta_box( 'submitdiv', 'sp_staff', 'side' );
@@ -28,9 +28,9 @@ function sp_staff_meta_init() {
add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sp_staff_profile_meta', 'sp_staff', 'normal', 'high' );
}
function sp_staff_team_meta( $post ) {
sp_post_checklist( $post->ID, 'sp_team' );
sp_post_adder( 'sp_team' );
sp_nonce();
sportspress_post_checklist( $post->ID, 'sp_team' );
sportspress_post_adder( 'sp_team' );
sportspress_nonce();
}
function sp_staff_profile_meta( $post ) {

View File

@@ -1,9 +1,9 @@
<?php
function sp_statistic_cpt_init() {
function sportspress_statistic_post_init() {
$name = __( 'Statistics', 'sportspress' );
$singular_name = __( 'Statistic', 'sportspress' );
$lowercase_name = __( 'statistics', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name, true );
$labels = sportspress_get_post_labels( $name, $singular_name, $lowercase_name, true );
$args = array(
'label' => $name,
'labels' => $labels,
@@ -17,7 +17,7 @@ function sp_statistic_cpt_init() {
);
register_post_type( 'sp_statistic', $args );
}
add_action( 'init', 'sp_statistic_cpt_init' );
add_action( 'init', 'sportspress_statistic_post_init' );
function sp_statistic_edit_columns() {
$columns = array(
@@ -37,7 +37,7 @@ function sp_statistic_meta_init() {
}
function sp_statistic_equation_meta( $post ) {
$formats = sp_get_config_formats();
$formats = sportspress_get_config_formats();
$equation = explode( ' ', get_post_meta( $post->ID, 'sp_equation', true ) );
$order = get_post_meta( $post->ID, 'sp_order', true );
@@ -69,7 +69,7 @@ function sp_statistic_equation_meta( $post ) {
<p class="sp-equation-selector">
<?php
foreach ( $equation as $piece ):
sp_get_equation_selector( $post->ID, $piece, array( 'player_event' ) );
sportspress_get_equation_selector( $post->ID, $piece, array( 'player_event' ) );
endforeach;
?>
</p>
@@ -93,5 +93,5 @@ function sp_statistic_equation_meta( $post ) {
</select>
</p>
<?php
sp_nonce();
sportspress_nonce();
}

View File

@@ -1,9 +1,9 @@
<?php
function sp_table_cpt_init() {
function sportspress_table_post_init() {
$name = __( 'League Tables', 'sportspress' );
$singular_name = __( 'League Table', 'sportspress' );
$lowercase_name = __( 'league tables', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name, true );
$labels = sportspress_get_post_labels( $name, $singular_name, $lowercase_name, true );
$args = array(
'label' => $name,
'labels' => $labels,
@@ -17,7 +17,7 @@ function sp_table_cpt_init() {
);
register_post_type( 'sp_table', $args );
}
add_action( 'init', 'sp_table_cpt_init' );
add_action( 'init', 'sportspress_table_post_init' );
function sp_table_edit_columns() {
$columns = array(
@@ -41,7 +41,7 @@ function sp_table_meta_init( $post ) {
}
function sp_table_team_meta( $post, $test ) {
$league_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 );
$league_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 );
?>
<div>
<p class="sp-tab-select">
@@ -52,23 +52,23 @@ function sp_table_team_meta( $post, $test ) {
'selected' => $league_id,
'value' => 'term_id'
);
sp_dropdown_taxonomies( $args );
sportspress_dropdown_taxonomies( $args );
?>
</p>
<?php
sp_post_checklist( $post->ID, 'sp_team', 'block', 'sp_season' );
sp_post_adder( 'sp_team' );
sportspress_post_checklist( $post->ID, 'sp_team', 'block', 'sp_season' );
sportspress_post_adder( 'sp_team' );
?>
</div>
<?php
sp_nonce();
sportspress_nonce();
}
function sp_table_columns_meta( $post ) {
list( $columns, $data, $placeholders, $merged ) = sp_get_table( $post->ID, true );
list( $columns, $data, $placeholders, $merged ) = sportspress_get_table( $post->ID, true );
sp_league_table( $columns, $data, $placeholders );
sportspress_edit_league_table( $columns, $data, $placeholders );
sp_nonce();
sportspress_nonce();
}

View File

@@ -1,9 +1,9 @@
<?php
function sp_team_cpt_init() {
function sportspress_team_post_init() {
$name = __( 'Teams', 'sportspress' );
$singular_name = __( 'Team', 'sportspress' );
$lowercase_name = __( 'teams', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name );
$labels = sportspress_get_post_labels( $name, $singular_name, $lowercase_name );
$args = array(
'label' => $name,
'labels' => $labels,
@@ -17,7 +17,7 @@ function sp_team_cpt_init() {
);
register_post_type( 'sp_team', $args );
}
add_action( 'init', 'sp_team_cpt_init' );
add_action( 'init', 'sportspress_team_post_init' );
function sp_team_meta_init( $post ) {
$leagues = (array)get_the_terms( $post->ID, 'sp_season' );
@@ -51,10 +51,10 @@ function sp_team_columns_meta( $post ) {
$eos = new eqEOS();
// Get labels from result variables
$result_labels = (array)sp_get_var_labels( 'sp_result' );
$result_labels = (array)sportspress_get_var_labels( 'sp_result' );
// Get labels from outcome variables
$outcome_labels = (array)sp_get_var_labels( 'sp_outcome' );
$outcome_labels = (array)sportspress_get_var_labels( 'sp_outcome' );
// Generate array of all league ids
$div_ids = array();
@@ -64,10 +64,10 @@ function sp_team_columns_meta( $post ) {
endforeach;
// Get all leagues populated with columns where available
$data = sp_array_combine( $div_ids, $columns );
$data = sportspress_array_combine( $div_ids, $columns );
// Get equations from column variables
$equations = sp_get_var_equations( 'sp_column' );
$equations = sportspress_get_var_equations( 'sp_column' );
// Initialize placeholders array
$placeholders = array();
@@ -161,7 +161,7 @@ function sp_team_columns_meta( $post ) {
$placeholders[ $div_id ] = array();
foreach ( $equations as $key => $value ):
if ( $totals['eventsplayed'] > 0 ):
$placeholders[ $div_id ][ $key ] = sp_solve( $value, $totals );
$placeholders[ $div_id ][ $key ] = sportspress_solve( $value, $totals );
else:
$placeholders[ $div_id ][ $key ] = 0;
endif;
@@ -170,8 +170,8 @@ function sp_team_columns_meta( $post ) {
endforeach;
// Get columns from statistics variables
$columns = sp_get_var_labels( 'sp_column' );
$columns = sportspress_get_var_labels( 'sp_column' );
sp_team_columns_table( $columns, $data, $placeholders );
sp_nonce();
sportspress_edit_team_columns_table( $columns, $data, $placeholders );
sportspress_nonce();
}