diff --git a/admin/presets/baseball.php b/admin/presets/baseball.php new file mode 100644 index 00000000..2e9dd5f0 --- /dev/null +++ b/admin/presets/baseball.php @@ -0,0 +1,187 @@ + __( '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' => __( ' ', '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' ) + ) + ) + ) + ) +); \ No newline at end of file diff --git a/admin/presets/basketball.php b/admin/presets/basketball.php new file mode 100644 index 00000000..cf82ec62 --- /dev/null +++ b/admin/presets/basketball.php @@ -0,0 +1,127 @@ + __( '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' => __( ' ', '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' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/cricket.php b/admin/presets/cricket.php similarity index 100% rename from presets/cricket.php rename to admin/presets/cricket.php diff --git a/presets/football.php b/admin/presets/football.php similarity index 100% rename from presets/football.php rename to admin/presets/football.php diff --git a/presets/footy.php b/admin/presets/footy.php similarity index 100% rename from presets/footy.php rename to admin/presets/footy.php diff --git a/presets/gaming.php b/admin/presets/gaming.php similarity index 100% rename from presets/gaming.php rename to admin/presets/gaming.php diff --git a/presets/golf.php b/admin/presets/golf.php similarity index 100% rename from presets/golf.php rename to admin/presets/golf.php diff --git a/presets/handball.php b/admin/presets/handball.php similarity index 100% rename from presets/handball.php rename to admin/presets/handball.php diff --git a/presets/hockey.php b/admin/presets/hockey.php similarity index 100% rename from presets/hockey.php rename to admin/presets/hockey.php diff --git a/presets/presets.php b/admin/presets/presets.php similarity index 100% rename from presets/presets.php rename to admin/presets/presets.php diff --git a/presets/racing.php b/admin/presets/racing.php similarity index 100% rename from presets/racing.php rename to admin/presets/racing.php diff --git a/presets/rugby.php b/admin/presets/rugby.php similarity index 100% rename from presets/rugby.php rename to admin/presets/rugby.php diff --git a/admin/presets/soccer.php b/admin/presets/soccer.php new file mode 100644 index 00000000..4ad7f5b9 --- /dev/null +++ b/admin/presets/soccer.php @@ -0,0 +1,122 @@ + __( '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' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/swimming.php b/admin/presets/swimming.php similarity index 100% rename from presets/swimming.php rename to admin/presets/swimming.php diff --git a/presets/tennis.php b/admin/presets/tennis.php similarity index 100% rename from presets/tennis.php rename to admin/presets/tennis.php diff --git a/presets/volleyball.php b/admin/presets/volleyball.php similarity index 100% rename from presets/volleyball.php rename to admin/presets/volleyball.php diff --git a/admin/settings/general.php b/admin/settings/general.php index 3df6bf58..2cd73790 100644 --- a/admin/settings/general.php +++ b/admin/settings/general.php @@ -1,3 +1,4 @@ +

__( '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' => __( ' ', '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' ) - ) - ) - ) -); \ No newline at end of file diff --git a/presets/basketball.php b/presets/basketball.php deleted file mode 100644 index 678538bb..00000000 --- a/presets/basketball.php +++ /dev/null @@ -1,109 +0,0 @@ - __( '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' ) - ) - ) - ) -); \ No newline at end of file diff --git a/presets/soccer.php b/presets/soccer.php deleted file mode 100644 index ff73bd62..00000000 --- a/presets/soccer.php +++ /dev/null @@ -1,109 +0,0 @@ - __( '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' ) - ) - ) - ) -); \ No newline at end of file diff --git a/sports.php b/sports.php deleted file mode 100644 index 6dd8bfa6..00000000 --- a/sports.php +++ /dev/null @@ -1,111 +0,0 @@ - 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' ) - ) - ) - - ) - ) -); -?> \ No newline at end of file diff --git a/sportspress-filters.php b/sportspress-filters.php index 79421ef5..fe2a08ba 100644 --- a/sportspress-filters.php +++ b/sportspress-filters.php @@ -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' ): diff --git a/sportspress-functions.php b/sportspress-functions.php index 0d5fc033..4c56c40d 100644 --- a/sportspress-functions.php +++ b/sportspress-functions.php @@ -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 ) { diff --git a/sportspress.php b/sportspress.php index c22aeb21..4c7211f4 100644 --- a/sportspress.php +++ b/sportspress.php @@ -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';