Fix up presets

This commit is contained in:
Brian Miyaji
2014-01-04 22:29:59 +11:00
parent 997226195d
commit 23ccb653a6
24 changed files with 469 additions and 486 deletions

187
admin/presets/baseball.php Normal file
View File

@@ -0,0 +1,187 @@
<?php
global $sportspress_sports;
$sportspress_sports['baseball'] = array(
'name' => __( 'Baseball', 'sportspress' ),
'posts' => array(
// Columns
'sp_column' => array(
array(
'post_title' => __( 'Wins', 'sportspress' ),
'meta' => array(
'sp_equation' => '$win',
'sp_abbreviation' => __( 'W', 'sportspress' ),
'sp_priority' => 1,
'sp_order' => 'DESC'
)
),
array(
'post_title' => __( 'Losses', 'sportspress' ),
'meta' => array(
'sp_equation' => '$loss',
'sp_abbreviation' => __( 'L', 'sportspress' ),
'sp_priority' => 2,
'sp_order' => 'ASC'
)
),
array(
'post_title' => __( 'Win Percentage', 'sportspress' ),
'meta' => array(
'sp_equation' => '$win / $eventsplayed',
'sp_abbreviation' => __( 'Pct', 'sportspress' )
)
),
array(
'post_title' => __( 'Games Back', 'sportspress' ),
'meta' => array(
'sp_equation' => '( $winmax + $loss - $win - $lossmax ) / 2',
'sp_abbreviation' => __( 'GB', 'sportspress' )
)
),
array(
'post_title' => __( 'Runs Scored', 'sportspress' ),
'meta' => array(
'sp_equation' => '$rfor',
'sp_abbreviation' => __( 'RS', 'sportspress' ),
'sp_priority' => 3,
'sp_order' => 'DESC'
)
),
array(
'post_title' => __( 'Runs Against', 'sportspress' ),
'meta' => array(
'sp_equation' => '$ragainst',
'sp_abbreviation' => __( 'RA', 'sportspress' )
)
),
array(
'post_title' => __( 'Streak', 'sportspress' ),
'meta' => array(
'sp_equation' => '$streak',
'sp_abbreviation' => __( 'Strk', 'sportspress' )
)
)
),
// Statistics
'sp_statistic' => array(
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'meta' => array(
'sp_equation' => '$eventsplayed'
)
),
array(
'post_title' => __( 'Goals', 'sportspress' ),
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Assists', 'sportspress' ),
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Yellow Cards', 'sportspress' ),
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Red Cards', 'sportspress' ),
'meta' => array( 'sp_equation' => '' )
)
),
// Results
'sp_result' => array(
array(
'post_title' => __( '1st Inning', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '1', 'sportspress' )
)
),
array(
'post_title' => __( '2nd Inning', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '2', 'sportspress' )
)
),
array(
'post_title' => __( '3rd Inning', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '3', 'sportspress' )
)
),
array(
'post_title' => __( '4th Inning', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '4', 'sportspress' )
)
),
array(
'post_title' => __( '5th Inning', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '5', 'sportspress' )
)
),
array(
'post_title' => __( '6th Inning', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '6', 'sportspress' )
)
),
array(
'post_title' => __( '7th Inning', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '7', 'sportspress' )
)
),
array(
'post_title' => __( '8th Inning', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '8', 'sportspress' )
)
),
array(
'post_title' => __( '9th Inning', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '9', 'sportspress' )
)
),
array(
'post_title' => __( 'Extra Innings', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '&nbsp;', 'sportspress' )
)
),
array(
'post_title' => __( 'Runs', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( 'R', 'sportspress' )
)
),
array(
'post_title' => __( 'Hits', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( 'H', 'sportspress' )
)
),
array(
'post_title' => __( 'Errors', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( 'E', 'sportspress' )
)
)
),
// Outcomes
'sp_outcome' => array(
array(
'post_title' => __( 'Win', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( 'W', 'sportspress' )
)
),
array(
'post_title' => __( 'Loss', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( 'L', 'sportspress' )
)
)
)
)
);

View File

@@ -0,0 +1,127 @@
<?php
global $sportspress_sports;
$sportspress_sports['baseball'] = array(
'name' => __( 'Baseball', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(
array(
'post_title' => __( 'Wins', 'sportspress' ),
'meta' => array(
'sp_equation' => '$win',
'sp_abbreviation' => __( 'W', 'sportspress' )
)
),
array(
'post_title' => __( 'Losses', 'sportspress' ),
'meta' => array(
'sp_equation' => '$loss',
'sp_abbreviation' => __( 'L', 'sportspress' )
)
),
array(
'post_title' => __( 'Win Percentage', 'sportspress' ),
'meta' => array(
'sp_equation' => '$win / $eventsplayed',
'sp_abbreviation' => __( 'Pct', 'sportspress' )
)
),
array(
'post_title' => __( 'Games Behind', 'sportspress' ),
'meta' => array(
'sp_equation' => '( $winmax + $loss - $win - $lossmax ) / 2',
'sp_abbreviation' => __( 'GB', 'sportspress' )
)
),
array(
'post_title' => __( 'Streak', 'sportspress' ),
'meta' => array(
'sp_equation' => '$streak',
'sp_abbreviation' => __( 'Strk', 'sportspress' )
)
)
),
// Statistics
'sp_statistic' => array(
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'meta' => array(
'sp_equation' => '$eventsplayed'
)
),
array(
'post_title' => __( 'Goals', 'sportspress' ),
'meta' => array(
'sp_equation' => ''
)
),
array(
'post_title' => __( 'Assists', 'sportspress' ),
'meta' => array(
'sp_equation' => ''
)
),
array(
'post_title' => __( 'Yellow Cards', 'sportspress' ),
'meta' => array(
'sp_equation' => ''
)
),
array(
'post_title' => __( 'Red Cards', 'sportspress' ),
'meta' => array(
'sp_equation' => ''
)
)
),
// Results
'sp_result' => array(
array(
'post_title' => __( '1st Quarter', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '1', 'sportspress' )
)
),
array(
'post_title' => __( '2nd Quarter', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '2', 'sportspress' )
)
),
array(
'post_title' => __( '3rd Quarter', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '3', 'sportspress' )
)
),
array(
'post_title' => __( '4th Quarter', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '4', 'sportspress' )
)
),
array(
'post_title' => __( 'Overtime', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( '&nbsp;', 'sportspress' )
)
),
array(
'post_title' => __( 'Total', 'sportspress' ),
'meta' => array(
'sp_abbreviation' => __( 'T', 'sportspress' )
)
)
),
// Outcomes
'sp_outcome' => array(
array(
'post_title' => __( 'Win', 'sportspress' )
),
array(
'post_title' => __( 'Loss', 'sportspress' )
)
)
)
);

122
admin/presets/soccer.php Normal file
View File

@@ -0,0 +1,122 @@
<?php
global $sportspress_sports;
$sportspress_sports['soccer'] = array(
'name' => __( 'Association Football (Soccer)', 'sportspress' ),
'posts' => array(
// Table Columns
'sp_column' => array(
array(
'post_title' => __( 'Games Played', 'sportspress' ),
'meta' => array(
'sp_equation' => '$eventsplayed',
'sp_abbreviation' => __( 'GP', 'sportspress' )
)
),
array(
'post_title' => __( 'Wins', 'sportspress' ),
'meta' => array(
'sp_equation' => '$win',
'sp_abbreviation' => __( 'W', 'sportspress' )
)
),
array(
'post_title' => __( 'Draws', 'sportspress' ),
'meta' => array(
'sp_equation' => '$draw',
'sp_abbreviation' => __( 'D', 'sportspress' )
)
),
array(
'post_title' => __( 'Losses', 'sportspress' ),
'meta' => array(
'sp_equation' => '$loss',
'sp_abbreviation' => __( 'L', 'sportspress' )
)
),
array(
'post_title' => __( 'Goals For', 'sportspress' ),
'meta' => array(
'sp_equation' => '$goalsfor',
'sp_priority' => '3',
'sp_order' => 'DESC',
'sp_abbreviation' => __( 'GF', 'sportspress' )
)
),
array(
'post_title' => __( 'Goals Against', 'sportspress' ),
'meta' => array(
'sp_equation' => '$goalsagainst',
'sp_abbreviation' => __( 'GA', 'sportspress' )
)
),
array(
'post_title' => __( 'Goal Difference', 'sportspress' ),
'meta' => array(
'sp_equation' => '$goalsfor - $goalsagainst',
'sp_priority' => '2',
'sp_order' => 'DESC',
'sp_abbreviation' => __( 'GD', 'sportspress' )
)
),
array(
'post_title' => __( 'Points', 'sportspress' ),
'meta' => array(
'sp_equation' => '$win * 3 + $draw',
'sp_priority' => '1',
'sp_order' => 'DESC',
'sp_abbreviation' => __( 'Pts', 'sportspress' )
)
)
),
// Statistics
'sp_statistic' => array(
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'meta' => array(
'sp_equation' => '$eventsplayed'
)
),
array(
'post_title' => __( 'Goals', 'sportspress' ),
'meta' => array(
'sp_priority' => '1',
'sp_order' => 'DESC'
)
),
array(
'post_title' => __( 'Assists', 'sportspress' )
),
array(
'post_title' => __( 'Yellow Cards', 'sportspress' )
),
array(
'post_title' => __( 'Red Cards', 'sportspress' )
)
),
// Results
'sp_result' => array(
array(
'post_title' => __( 'Goals', 'sportspress' )
),
array(
'post_title' => __( '1st Half', 'sportspress' )
),
array(
'post_title' => __( '2nd Half', 'sportspress' )
)
),
// Outcomes
'sp_outcome' => array(
array(
'post_title' => __( 'Win', 'sportspress' )
),
array(
'post_title' => __( 'Draw', 'sportspress' )
),
array(
'post_title' => __( 'Loss', 'sportspress' )
)
)
)
);

View File

@@ -1,3 +1,4 @@
<h3 class="title"><?php _e( 'General Settings', 'sportspress' ); ?></h3>
<?php
settings_fields( 'sportspress_general' );

View File

@@ -1,130 +0,0 @@
<?php
global $sportspress_sports;
$sportspress_sports['baseball'] = array(
'name' => __( 'Baseball', 'sportspress' ),
'posts' => array(
// Statistics
'sp_statistic' => array(
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'post_name' => 'appearances',
'meta' => array( 'sp_equation' => '$eventsplayed' )
),
array(
'post_title' => __( 'Goals', 'sportspress' ),
'post_name' => 'goals',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Assists', 'sportspress' ),
'post_name' => 'assists',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Yellow Cards', 'sportspress' ),
'post_name' => 'yellowcards',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Red Cards', 'sportspress' ),
'post_name' => 'redcards',
'meta' => array( 'sp_equation' => '' )
)
),
// Outcomes
'sp_outcome' => array(
array(
'post_title' => __( 'Win', 'sportspress' ),
'post_name' => 'win'
),
array(
'post_title' => __( 'Loss', 'sportspress' ),
'post_name' => 'loss'
)
),
// Results
'sp_result' => array(
array(
'post_title' => __( '1', 'sportspress' ),
'post_name' => 'one'
),
array(
'post_title' => __( '2', 'sportspress' ),
'post_name' => 'two'
),
array(
'post_title' => __( '3', 'sportspress' ),
'post_name' => 'three'
),
array(
'post_title' => __( '4', 'sportspress' ),
'post_name' => 'four'
),
array(
'post_title' => __( '5', 'sportspress' ),
'post_name' => 'five'
),
array(
'post_title' => __( '6', 'sportspress' ),
'post_name' => 'six'
),
array(
'post_title' => __( '7', 'sportspress' ),
'post_name' => 'seven'
),
array(
'post_title' => __( '8', 'sportspress' ),
'post_name' => 'eight'
),
array(
'post_title' => __( '9', 'sportspress' ),
'post_name' => 'nine'
),
array(
'post_title' => __( '&nbsp;', 'sportspress' ),
'post_name' => 'nbsp'
),
array(
'post_title' => __( 'R', 'sportspress' ),
'post_name' => 'r'
),
array(
'post_title' => __( 'H', 'sportspress' ),
'post_name' => 'h'
),
array(
'post_title' => __( 'E', 'sportspress' ),
'post_name' => 'e'
)
),
// Columns
'sp_column' => array(
array(
'post_title' => __( 'W', 'sportspress' ),
'post_name' => 'w',
'meta' => array( 'sp_equation' => '$win' )
),
array(
'post_title' => __( 'L', 'sportspress' ),
'post_name' => 'l',
'meta' => array( 'sp_equation' => '$loss' )
),
array(
'post_title' => __( 'PCT', 'sportspress' ),
'post_name' => 'pct',
'meta' => array( 'sp_equation' => '$win / $eventsplayed' )
),
array(
'post_title' => __( 'GB', 'sportspress' ),
'post_name' => 'gb',
'meta' => array( 'sp_equation' => '( $winmax + $loss - $win - $lossmax ) / 2' )
),
array(
'post_title' => __( 'STRK', 'sportspress' ),
'post_name' => 'strk',
'meta' => array( 'sp_equation' => '$streak' )
)
)
)
);

View File

@@ -1,109 +0,0 @@
<?php
global $sportspress_sports;
$sportspress_sports['basketball'] = array(
'name' => __( 'Basketball', 'sportspress' ),
'posts' => array(
// Statistics
'sp_statistic' => array(
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'post_name' => 'appearances',
'meta' => array( 'sp_equation' => '$eventsplayed' )
),
array(
'post_title' => __( 'Goals', 'sportspress' ),
'post_name' => 'goals',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Assists', 'sportspress' ),
'post_name' => 'assists',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Yellow Cards', 'sportspress' ),
'post_name' => 'yellowcards',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Red Cards', 'sportspress' ),
'post_name' => 'redcards',
'meta' => array( 'sp_equation' => '' )
)
),
// Outcomes
'sp_outcome' => array(
array(
'post_title' => __( 'Win', 'sportspress' ),
'post_name' => 'win'
),
array(
'post_title' => __( 'Draw', 'sportspress' ),
'post_name' => 'draw'
),
array(
'post_title' => __( 'Loss', 'sportspress' ),
'post_name' => 'loss'
)
),
// Results
'sp_result' => array(
array(
'post_title' => __( 'Goals', 'sportspress' ),
'post_name' => 'goals'
),
array(
'post_title' => __( '1st Half', 'sportspress' ),
'post_name' => 'firsthalf'
),
array(
'post_title' => __( '2nd Half', 'sportspress' ),
'post_name' => 'secondhalf'
)
),
// Columns
'sp_column' => array(
array(
'post_title' => __( 'P', 'sportspress' ),
'post_name' => 'p',
'meta' => array( 'sp_equation' => '$eventsplayed' )
),
array(
'post_title' => __( 'W', 'sportspress' ),
'post_name' => 'w',
'meta' => array( 'sp_equation' => '$win' )
),
array(
'post_title' => __( 'D', 'sportspress' ),
'post_name' => 'd',
'meta' => array( 'sp_equation' => '$draw' )
),
array(
'post_title' => __( 'L', 'sportspress' ),
'post_name' => 'l',
'meta' => array( 'sp_equation' => '$loss' )
),
array(
'post_title' => __( 'F', 'sportspress' ),
'post_name' => 'f',
'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' )
),
array(
'post_title' => __( 'A', 'sportspress' ),
'post_name' => 'a',
'meta' => array( 'sp_equation' => '$goalsagainst' )
),
array(
'post_title' => __( 'GD', 'sportspress' ),
'post_name' => 'gd',
'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' )
),
array(
'post_title' => __( 'PTS', 'sportspress' ),
'post_name' => 'pts',
'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' )
)
)
)
);

View File

@@ -1,109 +0,0 @@
<?php
global $sportspress_sports;
$sportspress_sports['soccer'] = array(
'name' => __( 'Association Football (Soccer)', 'sportspress' ),
'posts' => array(
// Statistics
'sp_statistic' => array(
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'post_name' => 'appearances',
'meta' => array( 'sp_equation' => '$eventsplayed' )
),
array(
'post_title' => __( 'Goals', 'sportspress' ),
'post_name' => 'goals',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Assists', 'sportspress' ),
'post_name' => 'assists',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Yellow Cards', 'sportspress' ),
'post_name' => 'yellowcards',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Red Cards', 'sportspress' ),
'post_name' => 'redcards',
'meta' => array( 'sp_equation' => '' )
)
),
// Outcomes
'sp_outcome' => array(
array(
'post_title' => __( 'Win', 'sportspress' ),
'post_name' => 'win'
),
array(
'post_title' => __( 'Draw', 'sportspress' ),
'post_name' => 'draw'
),
array(
'post_title' => __( 'Loss', 'sportspress' ),
'post_name' => 'loss'
)
),
// Results
'sp_result' => array(
array(
'post_title' => __( 'Goals', 'sportspress' ),
'post_name' => 'goals'
),
array(
'post_title' => __( '1st Half', 'sportspress' ),
'post_name' => 'firsthalf'
),
array(
'post_title' => __( '2nd Half', 'sportspress' ),
'post_name' => 'secondhalf'
)
),
// Columns
'sp_column' => array(
array(
'post_title' => __( 'P', 'sportspress' ),
'post_name' => 'p',
'meta' => array( 'sp_equation' => '$eventsplayed' )
),
array(
'post_title' => __( 'W', 'sportspress' ),
'post_name' => 'w',
'meta' => array( 'sp_equation' => '$win' )
),
array(
'post_title' => __( 'D', 'sportspress' ),
'post_name' => 'd',
'meta' => array( 'sp_equation' => '$draw' )
),
array(
'post_title' => __( 'L', 'sportspress' ),
'post_name' => 'l',
'meta' => array( 'sp_equation' => '$loss' )
),
array(
'post_title' => __( 'F', 'sportspress' ),
'post_name' => 'f',
'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' )
),
array(
'post_title' => __( 'A', 'sportspress' ),
'post_name' => 'a',
'meta' => array( 'sp_equation' => '$goalsagainst' )
),
array(
'post_title' => __( 'GD', 'sportspress' ),
'post_name' => 'gd',
'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' )
),
array(
'post_title' => __( 'PTS', 'sportspress' ),
'post_name' => 'pts',
'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' )
)
)
)
);

View File

@@ -1,111 +0,0 @@
<?php
$sportspress_sports = array(
'soccer' => array(
'name' => __( 'Soccer', 'sportspress' ),
'posts' => array(
// Statistics
'sp_statistic' => array(
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'post_name' => 'appearances',
'meta' => array( 'sp_equation' => '$eventsplayed' )
),
array(
'post_title' => __( 'Goals', 'sportspress' ),
'post_name' => 'goals',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Assists', 'sportspress' ),
'post_name' => 'assists',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Yellow Cards', 'sportspress' ),
'post_name' => 'yellowcards',
'meta' => array( 'sp_equation' => '' )
),
array(
'post_title' => __( 'Red Cards', 'sportspress' ),
'post_name' => 'redcards',
'meta' => array( 'sp_equation' => '' )
)
),
// Outcomes
'sp_outcome' => array(
array(
'post_title' => __( 'Win', 'sportspress' ),
'post_name' => 'win'
),
array(
'post_title' => __( 'Draw', 'sportspress' ),
'post_name' => 'draw'
),
array(
'post_title' => __( 'Loss', 'sportspress' ),
'post_name' => 'loss'
)
),
// Results
'sp_result' => array(
array(
'post_title' => __( 'Goals', 'sportspress' ),
'post_name' => 'goals'
),
array(
'post_title' => __( '1st Half', 'sportspress' ),
'post_name' => 'firsthalf'
),
array(
'post_title' => __( '2nd Half', 'sportspress' ),
'post_name' => 'secondhalf'
)
),
// Columns
'sp_column' => array(
array(
'post_title' => __( 'P', 'sportspress' ),
'post_name' => 'p',
'meta' => array( 'sp_equation' => '$eventsplayed' )
),
array(
'post_title' => __( 'W', 'sportspress' ),
'post_name' => 'w',
'meta' => array( 'sp_equation' => '$win' )
),
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'post_name' => 'appearances',
'meta' => array( 'sp_equation' => '$draw' )
),
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'post_name' => 'appearances',
'meta' => array( 'sp_equation' => '$loss' )
),
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'post_name' => 'appearances',
'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' )
),
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'post_name' => 'appearances',
'meta' => array( 'sp_equation' => '$goalsagainst' )
),
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'post_name' => 'appearances',
'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' )
),
array(
'post_title' => __( 'Appearances', 'sportspress' ),
'post_name' => 'appearances',
'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' )
)
)
)
)
);
?>

View File

@@ -61,24 +61,7 @@ function sp_sanitize_title( $title ) {
if ( isset( $_POST ) && array_key_exists( 'post_type', $_POST ) && in_array( $_POST['post_type'], array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic' ) ) ):
// Get post title
$title = $_POST['post_title'];
// String to lowercase
$title = strtolower( $title );
// Replace all numbers with words
$title = sp_numbers_to_words( $title );
// Remove all other non-alphabet characters
$title = preg_replace( "/[^a-z]/", '', $title );
// Convert post ID to words if title is empty
if ( $title == '' ):
$title = sp_numbers_to_words( $_POST['ID'] );
endif;
$title = sp_get_eos_safe_slug( $_POST['post_title'], $_POST['ID'] );
elseif ( isset( $_POST ) && array_key_exists( 'post_type', $_POST ) && $_POST['post_type'] == 'sp_event' ):

View File

@@ -388,19 +388,17 @@ if ( !function_exists( 'sp_get_var_labels' ) ) {
'orderby' => 'menu_order',
'order' => 'ASC'
);
if ( $independent ):
$args['meta_query'] = array(
array(
'key' => 'sp_equation',
'value'=>''
)
);
endif;
$vars = get_posts( $args );
$output = array();
foreach ( $vars as $var ):
if ( $independent ):
$equation = get_post_meta( $var->ID, 'sp_equation', true );
if ( $equation && $equation != '' ):
continue;
endif;
endif;
$output[ $var->post_name ] = $var->post_title;
endforeach;
@@ -765,6 +763,30 @@ if ( !function_exists( 'sportspress_render_option_field' ) ) {
}
}
if ( !function_exists( 'sp_get_eos_safe_slug' ) ) {
function sp_get_eos_safe_slug( $title, $post_id = 'var' ) {
// String to lowercase
$title = strtolower( $title );
// Replace all numbers with words
$title = sp_numbers_to_words( $title );
// Remove all other non-alphabet characters
$title = preg_replace( "/[^a-z]/", '', $title );
// Convert post ID to words if title is empty
if ( $title == '' ):
$title = sp_numbers_to_words( $post_id );
endif;
return $title;
}
}
if ( !function_exists( 'sp_solve' ) ) {
function sp_solve( $equation, $vars ) {

View File

@@ -51,7 +51,7 @@ require_once dirname( __FILE__ ) . '/admin/terms/season.php';
require_once dirname( __FILE__ ) . '/admin/terms/position.php';
// Presets
include dirname( __FILE__ ) . '/presets/presets.php' ;
include dirname( __FILE__ ) . '/admin/presets/presets.php' ;
// Install
include dirname( __FILE__ ) . '/install.php';