Version Description
- Fix - Substitute Typo.
- Fix - WordPay image trailing slash.
Download this release
Release Info
Developer | brianmiyaji |
Plugin | SportsPress – Sports Club & League Manager |
Version | 2.4.3 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 2.4.3
- assets/css/admin.css +4 -0
- assets/css/menu.css +3 -0
- assets/css/sportspress.css +5 -0
- assets/fonts/sportspress.eot +0 -0
- assets/fonts/sportspress.svg +1 -0
- assets/fonts/sportspress.ttf +0 -0
- assets/fonts/sportspress.woff +0 -0
- assets/fonts/sportspress.woff2 +0 -0
- assets/images/modules/sportspress-pro-sidebar.png +0 -0
- assets/images/modules/sportspress-tv-sidebar.png +0 -0
- assets/images/modules/wordpay.png +0 -0
- assets/images/welcome/screenshot-better-career-totals.png +0 -0
- assets/images/welcome/screenshot-friendly-competitions.png +0 -0
- assets/images/welcome/screenshot-membership-payments.png +0 -0
- assets/images/welcome/screenshot-player-vs-player.png +0 -0
- assets/images/welcome/screenshot-send-offs.png +0 -0
- assets/images/welcome/screenshot-setup-wizard.png +0 -0
- assets/images/welcome/screenshot-team-galleries.png +0 -0
- assets/images/welcome/screenshot-team-player-registration.png +0 -0
- assets/images/welcome/screenshot-team-vs-team.png +0 -0
- assets/images/welcome/screenshot-user-registration.png +0 -0
- assets/images/welcome/screenshot-user-scores-admin.png +0 -0
- assets/images/welcome/screenshot-user-scores-frontend.png +0 -0
- assets/js/admin/editor-lang.php +4 -1
- assets/js/admin/sportspress-admin.js +5 -5
- includes/admin/class-sp-admin-editor.php +2 -2
- includes/admin/class-sp-admin-setup-wizard.php +6 -6
- includes/admin/class-sp-admin-sports.php +2 -1
- includes/admin/class-sp-admin-welcome.php +20 -288
- includes/admin/post-types/meta-boxes/class-sp-meta-box-metric-details.php +28 -0
- includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php +28 -33
- includes/admin/post-types/meta-boxes/class-sp-meta-box-statistic-details.php +16 -1
- includes/admin/post-types/meta-boxes/class-sp-meta-box-table-format.php +39 -0
- includes/admin/post-types/meta-boxes/class-sp-meta-box-table-shortcode.php +4 -2
- includes/admin/settings/class-sp-settings-modules.php +21 -2
- includes/class-sp-ajax.php +85 -7
- includes/class-sp-event.php +1 -1
- includes/class-sp-formats.php +5 -1
- includes/class-sp-modules.php +9 -1
- includes/class-sp-player.php +32 -41
- includes/class-sp-shortcodes.php +28 -15
- includes/shortcodes/class-sp-shortcode-team-gallery.php +24 -0
- includes/sp-core-functions.php +16 -1
- includes/sp-formatting-functions.php +33 -1
- includes/sp-template-functions.php +7 -2
- includes/widgets/class-sp-widget-team-gallery.php +119 -0
- modules/sportspress-league-tables.php +13 -4
- modules/sportspress-user-registration.php +69 -8
- modules/sportspress-wordpay.php +237 -0
- presets/esports/csgo.json +1 -1
- presets/esports/dota2.json +1 -1
- presets/esports/lol.json +3 -3
- presets/target-sports/snooker.json +1 -1
- presets/team-sports/baseball.json +1 -1
- presets/team-sports/basketball.json +9 -9
- presets/team-sports/cricket.json +1 -1
- presets/team-sports/floorball.json +3 -3
- presets/team-sports/football.json +2 -2
- presets/team-sports/footy.json +7 -7
- presets/team-sports/ice-hockey.json +2 -2
- presets/team-sports/lacrosse.json +2 -2
- presets/team-sports/soccer.json +3 -3
- presets/team-sports/softball.json +1 -1
- presets/team-sports/volleyball.json +3 -3
- presets/water-sports/water-polo.json +3 -3
- readme.txt +27 -6
- sportspress.php +4 -4
- templates/event-details.php +2 -2
- templates/player-gallery-thumbnail.php +1 -1
- templates/team-gallery-thumbnail.php +41 -0
- templates/team-gallery.php +150 -0
assets/css/admin.css
CHANGED
@@ -24,6 +24,10 @@
|
|
24 |
content: "\f334";
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
27 |
.post-state-format.post-format-list:before, .post-format-icon.post-format-list:before, a.post-state-format.format-list:before {
|
28 |
content: "\f163";
|
29 |
}
|
24 |
content: "\f334";
|
25 |
}
|
26 |
|
27 |
+
.post-state-format.post-format-standings:before, .post-format-icon.post-format-standings:before, a.post-state-format.format-standings:before {
|
28 |
+
content: "\f185";
|
29 |
+
}
|
30 |
+
|
31 |
.post-state-format.post-format-list:before, .post-format-icon.post-format-list:before, a.post-state-format.format-list:before {
|
32 |
content: "\f163";
|
33 |
}
|
assets/css/menu.css
CHANGED
@@ -155,6 +155,9 @@
|
|
155 |
.sp-icon-user-scores:before {
|
156 |
content: "\f101";
|
157 |
}
|
|
|
|
|
|
|
158 |
|
159 |
/* Performance Icons */
|
160 |
.sp-icon-card:before {
|
155 |
.sp-icon-user-scores:before {
|
156 |
content: "\f101";
|
157 |
}
|
158 |
+
.sp-icon-wordpay:before {
|
159 |
+
content: "\f526";
|
160 |
+
}
|
161 |
|
162 |
/* Performance Icons */
|
163 |
.sp-icon-card:before {
|
assets/css/sportspress.css
CHANGED
@@ -191,6 +191,11 @@
|
|
191 |
max-height: 2em;
|
192 |
}
|
193 |
|
|
|
|
|
|
|
|
|
|
|
194 |
/* Player List */
|
195 |
.sp-player-list td {
|
196 |
line-height: 2em;
|
191 |
max-height: 2em;
|
192 |
}
|
193 |
|
194 |
+
/* Team Gallery */
|
195 |
+
.sp-template-team-gallery img {
|
196 |
+
padding: 1em;
|
197 |
+
}
|
198 |
+
|
199 |
/* Player List */
|
200 |
.sp-player-list td {
|
201 |
line-height: 2em;
|
assets/fonts/sportspress.eot
CHANGED
Binary file
|
assets/fonts/sportspress.svg
CHANGED
@@ -60,4 +60,5 @@
|
|
60 |
<glyph unicode="" glyph-name="availability" d="M384 435.2h-51.2v-51.2h51.2v51.2zM435.2 435.2h-25.6v-76.8h-102.4v76.8h-102.4v-76.8h-102.4v76.8h-25.6c-14.16 0-25.6-11.44-25.6-25.6v-358.4c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v358.4c0 14.16-11.44 25.6-25.6 25.6zM409.6 76.8h-307.2v230.4h307.2v-230.4zM179.2 435.2h-51.2v-51.2h51.2v51.2zM230.4 115.2l-76.4 76.4 29.12 29.12 47.28-47.28 98.8 98.8 29.2-29.040-128-128z" />
|
61 |
<glyph unicode="" glyph-name="scoreboard" d="M435.2 25.6h-358.4c-14.16 0-25.6 11.44-25.6 25.6v358.4c0 14.16 11.44 25.6 25.6 25.6h358.4c14.16 0 25.6-11.44 25.6-25.6v-358.4c0-14.16-11.44-25.6-25.6-25.6zM409.6 384h-307.2v-307.2h307.2v307.2zM217.6 307.2l12.8-12.8v-51.2l-12.8-12.8 12.8-12.8v-51.2l-12.8-12.8h-64l-12.8 12.8v51.2l12.8 12.8-12.8 12.8v51.2l12.8 12.8h64zM166.4 179.2h38.4v38.4h-38.4v-38.4zM166.4 243.2h38.4v38.4h-38.4v-38.4zM256 268.8c7.040 0 12.8-5.76 12.8-12.8s-5.76-12.8-12.8-12.8-12.8 5.76-12.8 12.8 5.76 12.8 12.8 12.8zM256 217.6c7.040 0 12.8-5.76 12.8-12.8s-5.76-12.8-12.8-12.8-12.8 5.76-12.8 12.8 5.76 12.8 12.8 12.8zM358.4 307.2l12.8-12.8v-51.2l-12.8-12.8 12.8-12.8v-51.2l-12.8-12.8h-64l-12.8 12.8v51.2l12.8 12.8-12.8 12.8v51.2l12.8 12.8h64zM307.2 179.2h38.4v38.4h-38.4v-38.4zM307.2 243.2h38.4v38.4h-38.4v-38.4z" />
|
62 |
<glyph unicode="" glyph-name="ticket" d="M125.6 190.96l90.96-90.96 166.8 166.88-90.96 90.88-166.8-166.8zM489.12 315.84l-38.72 38.64c-7.36-4-15.76-6.32-24.8-6.32-28.56 0-51.76 23.2-51.76 51.84 0 8.96 2.24 17.44 6.32 24.8l-38.72 38.72c-10.080 10.080-26.56 10.080-36.64 0l-281.92-281.84c-10.080-10.080-10.080-26.56 0-36.64l38.72-38.72c7.36 4 15.84 6.32 24.8 6.32 28.64 0 51.84-23.2 51.84-51.76 0-8.96-2.24-17.44-6.32-24.8l38.72-38.72c10.080-10.080 26.56-10.080 36.64 0l281.84 281.76c10 10.16 10 26.64 0 36.72v0zM216.56 58.4l-132.56 132.56 208.48 208.4 132.48-132.48-208.4-208.48z" />
|
|
|
63 |
</font></defs></svg>
|
60 |
<glyph unicode="" glyph-name="availability" d="M384 435.2h-51.2v-51.2h51.2v51.2zM435.2 435.2h-25.6v-76.8h-102.4v76.8h-102.4v-76.8h-102.4v76.8h-25.6c-14.16 0-25.6-11.44-25.6-25.6v-358.4c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v358.4c0 14.16-11.44 25.6-25.6 25.6zM409.6 76.8h-307.2v230.4h307.2v-230.4zM179.2 435.2h-51.2v-51.2h51.2v51.2zM230.4 115.2l-76.4 76.4 29.12 29.12 47.28-47.28 98.8 98.8 29.2-29.040-128-128z" />
|
61 |
<glyph unicode="" glyph-name="scoreboard" d="M435.2 25.6h-358.4c-14.16 0-25.6 11.44-25.6 25.6v358.4c0 14.16 11.44 25.6 25.6 25.6h358.4c14.16 0 25.6-11.44 25.6-25.6v-358.4c0-14.16-11.44-25.6-25.6-25.6zM409.6 384h-307.2v-307.2h307.2v307.2zM217.6 307.2l12.8-12.8v-51.2l-12.8-12.8 12.8-12.8v-51.2l-12.8-12.8h-64l-12.8 12.8v51.2l12.8 12.8-12.8 12.8v51.2l12.8 12.8h64zM166.4 179.2h38.4v38.4h-38.4v-38.4zM166.4 243.2h38.4v38.4h-38.4v-38.4zM256 268.8c7.040 0 12.8-5.76 12.8-12.8s-5.76-12.8-12.8-12.8-12.8 5.76-12.8 12.8 5.76 12.8 12.8 12.8zM256 217.6c7.040 0 12.8-5.76 12.8-12.8s-5.76-12.8-12.8-12.8-12.8 5.76-12.8 12.8 5.76 12.8 12.8 12.8zM358.4 307.2l12.8-12.8v-51.2l-12.8-12.8 12.8-12.8v-51.2l-12.8-12.8h-64l-12.8 12.8v51.2l12.8 12.8-12.8 12.8v51.2l12.8 12.8h64zM307.2 179.2h38.4v38.4h-38.4v-38.4zM307.2 243.2h38.4v38.4h-38.4v-38.4z" />
|
62 |
<glyph unicode="" glyph-name="ticket" d="M125.6 190.96l90.96-90.96 166.8 166.88-90.96 90.88-166.8-166.8zM489.12 315.84l-38.72 38.64c-7.36-4-15.76-6.32-24.8-6.32-28.56 0-51.76 23.2-51.76 51.84 0 8.96 2.24 17.44 6.32 24.8l-38.72 38.72c-10.080 10.080-26.56 10.080-36.64 0l-281.92-281.84c-10.080-10.080-10.080-26.56 0-36.64l38.72-38.72c7.36 4 15.84 6.32 24.8 6.32 28.64 0 51.84-23.2 51.84-51.76 0-8.96-2.24-17.44-6.32-24.8l38.72-38.72c10.080-10.080 26.56-10.080 36.64 0l281.84 281.76c10 10.16 10 26.64 0 36.72v0zM216.56 58.4l-132.56 132.56 208.48 208.4 132.48-132.48-208.4-208.48z" />
|
63 |
+
<glyph unicode="" glyph-name="wordpay" d="M491.84 260.88v0l-82.32-142.56c-14.24-24.56-40.8-41.12-71.28-41.12-27.84 0-52.4 13.84-67.28 35.040l78.48 135.84c19.28 33.36 19.28 74.72 0.080 108-6.32 10.88-14.4 20.4-23.76 28.32h94.96c28.4 0 56-14.72 71.28-41.12 15.2-26.48 14.080-57.76-0.16-82.4zM327.28 260.88v0l-71.28-123.44v-0.080l-71.28 123.44c-14.24 24.64-15.28 55.92-0.080 82.4 15.2 26.4 42.88 41.12 71.28 41.12v0h0.16c28.4 0 56-14.72 71.28-41.12 15.2-26.4 14.16-57.68-0.080-82.32zM162.56 248.080l78.4-135.84c-14.88-21.2-39.44-35.040-67.28-35.040-30.48 0-57.12 16.56-71.28 41.2v0l-82.24 142.4c-14.24 24.72-15.36 56-0.080 82.4 15.2 26.4 42.88 41.12 71.28 41.12v0h94.88c-9.36-7.92-17.44-17.44-23.76-28.32-19.2-33.28-19.2-74.64 0.080-107.92z" />
|
64 |
</font></defs></svg>
|
assets/fonts/sportspress.ttf
CHANGED
Binary file
|
assets/fonts/sportspress.woff
CHANGED
Binary file
|
assets/fonts/sportspress.woff2
CHANGED
Binary file
|
assets/images/modules/sportspress-pro-sidebar.png
DELETED
Binary file
|
assets/images/modules/sportspress-tv-sidebar.png
DELETED
Binary file
|
assets/images/modules/wordpay.png
ADDED
Binary file
|
assets/images/welcome/screenshot-better-career-totals.png
ADDED
Binary file
|
assets/images/welcome/screenshot-friendly-competitions.png
ADDED
Binary file
|
assets/images/welcome/screenshot-membership-payments.png
ADDED
Binary file
|
assets/images/welcome/screenshot-player-vs-player.png
DELETED
Binary file
|
assets/images/welcome/screenshot-send-offs.png
DELETED
Binary file
|
assets/images/welcome/screenshot-setup-wizard.png
DELETED
Binary file
|
assets/images/welcome/screenshot-team-galleries.png
ADDED
Binary file
|
assets/images/welcome/screenshot-team-player-registration.png
ADDED
Binary file
|
assets/images/welcome/screenshot-team-vs-team.png
DELETED
Binary file
|
assets/images/welcome/screenshot-user-registration.png
DELETED
Binary file
|
assets/images/welcome/screenshot-user-scores-admin.png
DELETED
Binary file
|
assets/images/welcome/screenshot-user-scores-frontend.png
DELETED
Binary file
|
assets/js/admin/editor-lang.php
CHANGED
@@ -6,6 +6,7 @@ $options = array(
|
|
6 |
'event' => array(
|
7 |
'details', 'results', 'performance'
|
8 |
),
|
|
|
9 |
'player' => array(
|
10 |
'details', 'statistics'
|
11 |
),
|
@@ -14,6 +15,7 @@ $options = array(
|
|
14 |
$options = apply_filters( 'sportspress_shortcodes', $options );
|
15 |
|
16 |
foreach ( $options as $name => $group ) {
|
|
|
17 |
$shortcodes .= $name . '[' . implode( '|', $group ) . ']';
|
18 |
}
|
19 |
|
@@ -30,7 +32,8 @@ $raw = apply_filters( 'sportspress_tinymce_strings', array(
|
|
30 |
'performance' => __( 'Box Score', 'sportspress' ),
|
31 |
'calendar' => __( 'Calendar', 'sportspress' ),
|
32 |
'statistics' => __( 'Statistics', 'sportspress' ),
|
33 |
-
'
|
|
|
34 |
'player' => __( 'Player', 'sportspress' ),
|
35 |
'list' => __( 'List', 'sportspress' ),
|
36 |
'blocks' => __( 'Blocks', 'sportspress' ),
|
6 |
'event' => array(
|
7 |
'details', 'results', 'performance'
|
8 |
),
|
9 |
+
'team' => array(),
|
10 |
'player' => array(
|
11 |
'details', 'statistics'
|
12 |
),
|
15 |
$options = apply_filters( 'sportspress_shortcodes', $options );
|
16 |
|
17 |
foreach ( $options as $name => $group ) {
|
18 |
+
if ( empty( $group ) ) continue;
|
19 |
$shortcodes .= $name . '[' . implode( '|', $group ) . ']';
|
20 |
}
|
21 |
|
32 |
'performance' => __( 'Box Score', 'sportspress' ),
|
33 |
'calendar' => __( 'Calendar', 'sportspress' ),
|
34 |
'statistics' => __( 'Statistics', 'sportspress' ),
|
35 |
+
'team' => __( 'Team', 'sportspress' ),
|
36 |
+
'standings' => __( 'League Table', 'sportspress' ),
|
37 |
'player' => __( 'Player', 'sportspress' ),
|
38 |
'list' => __( 'List', 'sportspress' ),
|
39 |
'blocks' => __( 'Blocks', 'sportspress' ),
|
assets/js/admin/sportspress-admin.js
CHANGED
@@ -239,7 +239,7 @@ jQuery(document).ready(function($){
|
|
239 |
});
|
240 |
|
241 |
// Total stats calculator
|
242 |
-
$(".sp-data-table .sp-total input[data-sp-format=number]").on("updateTotal", function() {
|
243 |
index = $(this).parent().index();
|
244 |
var sum = 0;
|
245 |
$(this).closest(".sp-data-table").find(".sp-post").each(function() {
|
@@ -248,7 +248,7 @@ jQuery(document).ready(function($){
|
|
248 |
val = $(this).find("td").eq(index).find("input").attr("placeholder");
|
249 |
}
|
250 |
if($.isNumeric(val)) {
|
251 |
-
sum +=
|
252 |
}
|
253 |
});
|
254 |
$(this).attr("placeholder", sum);
|
@@ -257,12 +257,12 @@ jQuery(document).ready(function($){
|
|
257 |
// Activate total stats calculator
|
258 |
if($(".sp-data-table .sp-total").size()) {
|
259 |
$(".sp-data-table .sp-post td input").on("keyup", function() {
|
260 |
-
$(this).closest(".sp-data-table").find(".sp-total td").eq($(this).parent().index()).find("input").trigger("updateTotal");
|
261 |
});
|
262 |
}
|
263 |
|
264 |
// Trigger total stats calculator
|
265 |
-
$(".sp-data-table .sp-total input").trigger("updateTotal");
|
266 |
|
267 |
// Sync inputs
|
268 |
$(".sp-sync-input").on("keyup", function() {
|
@@ -467,7 +467,7 @@ jQuery(document).ready(function($){
|
|
467 |
$(".post-type-sp_event #post-formats-select input.post-format").change(function() {
|
468 |
layout = $(".post-type-sp_event #post-formats-select input:checked").val();
|
469 |
if ( layout == "friendly" ) {
|
470 |
-
$(".sp_event-sp_league-field").
|
471 |
$(".sp_event-sp_season-field").show().find("select").prop("disabled", false);
|
472 |
} else {
|
473 |
$(".sp_event-sp_league-field").show().find("select").prop("disabled", false);
|
239 |
});
|
240 |
|
241 |
// Total stats calculator
|
242 |
+
$(".sp-data-table .sp-total input[data-sp-format=number][data-sp-total-type!=average]").on("updateTotal", function() {
|
243 |
index = $(this).parent().index();
|
244 |
var sum = 0;
|
245 |
$(this).closest(".sp-data-table").find(".sp-post").each(function() {
|
248 |
val = $(this).find("td").eq(index).find("input").attr("placeholder");
|
249 |
}
|
250 |
if($.isNumeric(val)) {
|
251 |
+
sum += parseFloat(val, 10);
|
252 |
}
|
253 |
});
|
254 |
$(this).attr("placeholder", sum);
|
257 |
// Activate total stats calculator
|
258 |
if($(".sp-data-table .sp-total").size()) {
|
259 |
$(".sp-data-table .sp-post td input").on("keyup", function() {
|
260 |
+
$(this).closest(".sp-data-table").find(".sp-total td").eq($(this).parent().index()).find("input[data-sp-format=number][data-sp-total-type!=average]").trigger("updateTotal");
|
261 |
});
|
262 |
}
|
263 |
|
264 |
// Trigger total stats calculator
|
265 |
+
$(".sp-data-table .sp-total input[data-sp-format=number][data-sp-total-type!=average]").trigger("updateTotal");
|
266 |
|
267 |
// Sync inputs
|
268 |
$(".sp-sync-input").on("keyup", function() {
|
467 |
$(".post-type-sp_event #post-formats-select input.post-format").change(function() {
|
468 |
layout = $(".post-type-sp_event #post-formats-select input:checked").val();
|
469 |
if ( layout == "friendly" ) {
|
470 |
+
$(".sp_event-sp_league-field").show().find("select").prop("disabled", false);
|
471 |
$(".sp_event-sp_season-field").show().find("select").prop("disabled", false);
|
472 |
} else {
|
473 |
$(".sp_event-sp_league-field").show().find("select").prop("disabled", false);
|
includes/admin/class-sp-admin-editor.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author ThemeBoy
|
8 |
* @category Admin
|
9 |
* @package SportsPress/Admin
|
10 |
-
* @version
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -25,7 +25,7 @@ class SP_Admin_Editor {
|
|
25 |
* Constructor
|
26 |
*/
|
27 |
public function __construct() {
|
28 |
-
add_action( '
|
29 |
add_filter( 'tiny_mce_version', array( $this, 'refresh_mce' ) );
|
30 |
add_filter( 'mce_external_languages', array( $this, 'add_tinymce_lang' ), 10, 1 );
|
31 |
}
|
7 |
* @author ThemeBoy
|
8 |
* @category Admin
|
9 |
* @package SportsPress/Admin
|
10 |
+
* @version 2.4
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) {
|
25 |
* Constructor
|
26 |
*/
|
27 |
public function __construct() {
|
28 |
+
add_action( 'admin_init', array( $this, 'add_shortcode_button' ) );
|
29 |
add_filter( 'tiny_mce_version', array( $this, 'refresh_mce' ) );
|
30 |
add_filter( 'mce_external_languages', array( $this, 'add_tinymce_lang' ), 10, 1 );
|
31 |
}
|
includes/admin/class-sp-admin-setup-wizard.php
CHANGED
@@ -9,18 +9,18 @@
|
|
9 |
* @author WooThemes
|
10 |
* @category Admin
|
11 |
* @package SportsPress/Admin
|
12 |
-
* @version 2.
|
13 |
*/
|
14 |
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
exit;
|
16 |
}
|
17 |
|
18 |
/**
|
19 |
-
*
|
20 |
*/
|
21 |
-
class
|
22 |
|
23 |
-
/** @var string
|
24 |
private $step = '';
|
25 |
|
26 |
/** @var array Steps for the setup wizard */
|
@@ -672,7 +672,7 @@ class WC_Admin_Setup_Wizard {
|
|
672 |
$events = get_posts(
|
673 |
array(
|
674 |
'post_type' => 'sp_event',
|
675 |
-
'posts_per_page' =>
|
676 |
'post_status' => 'draft',
|
677 |
'meta_query' => array(
|
678 |
array(
|
@@ -787,4 +787,4 @@ class WC_Admin_Setup_Wizard {
|
|
787 |
}
|
788 |
}
|
789 |
|
790 |
-
new
|
9 |
* @author WooThemes
|
10 |
* @category Admin
|
11 |
* @package SportsPress/Admin
|
12 |
+
* @version 2.4
|
13 |
*/
|
14 |
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
exit;
|
16 |
}
|
17 |
|
18 |
/**
|
19 |
+
* SP_Admin_Setup_Wizard class.
|
20 |
*/
|
21 |
+
class SP_Admin_Setup_Wizard {
|
22 |
|
23 |
+
/** @var string Current Step */
|
24 |
private $step = '';
|
25 |
|
26 |
/** @var array Steps for the setup wizard */
|
672 |
$events = get_posts(
|
673 |
array(
|
674 |
'post_type' => 'sp_event',
|
675 |
+
'posts_per_page' => 1,
|
676 |
'post_status' => 'draft',
|
677 |
'meta_query' => array(
|
678 |
array(
|
787 |
}
|
788 |
}
|
789 |
|
790 |
+
new SP_Admin_Setup_Wizard();
|
includes/admin/class-sp-admin-sports.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress admin sports class stores preset sport data.
|
6 |
*
|
7 |
* @class SP_Admin_Sports
|
8 |
-
* @version 2.
|
9 |
* @package SportsPress/Admin
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -203,6 +203,7 @@ class SP_Admin_Sports {
|
|
203 |
$id = self::insert_preset_post( $post, $i + $index );
|
204 |
update_post_meta( $id, 'sp_equation', sp_array_value( $statistic, 'equation', null ) );
|
205 |
update_post_meta( $id, 'sp_precision', sp_array_value( $statistic, 'precision', 0 ) );
|
|
|
206 |
}
|
207 |
|
208 |
|
5 |
* The SportsPress admin sports class stores preset sport data.
|
6 |
*
|
7 |
* @class SP_Admin_Sports
|
8 |
+
* @version 2.4
|
9 |
* @package SportsPress/Admin
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
203 |
$id = self::insert_preset_post( $post, $i + $index );
|
204 |
update_post_meta( $id, 'sp_equation', sp_array_value( $statistic, 'equation', null ) );
|
205 |
update_post_meta( $id, 'sp_precision', sp_array_value( $statistic, 'precision', 0 ) );
|
206 |
+
update_post_meta( $id, 'sp_type', sp_array_value( $statistic, 'type', 'total' ) );
|
207 |
}
|
208 |
|
209 |
|
includes/admin/class-sp-admin-welcome.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @author ThemeBoy
|
10 |
* @category Admin
|
11 |
* @package SportsPress/Admin
|
12 |
-
* @version 2.
|
13 |
*/
|
14 |
|
15 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -124,7 +124,7 @@ class SP_Admin_Welcome {
|
|
124 |
<p class="sportspress-actions">
|
125 |
<a href="<?php echo admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ); ?>" class="button button-primary"><?php _e( 'Settings', 'sportspress' ); ?></a>
|
126 |
<a href="<?php echo esc_url( apply_filters( 'sportspress_docs_url', 'http://tboy.co/docs', 'sportspress' ) ); ?>" class="docs button button-primary"><?php _e( 'Docs', 'sportspress' ); ?></a>
|
127 |
-
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://wordpress.org/plugins/sportspress" data-text="An open-source (free) #WordPress plugin that helps you build professional league websites
|
128 |
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
129 |
</p>
|
130 |
|
@@ -176,74 +176,38 @@ class SP_Admin_Welcome {
|
|
176 |
|
177 |
do_action( 'sportspress_before_welcome_features' );
|
178 |
?>
|
179 |
-
<
|
180 |
-
<h2>Mode Switching</h2>
|
181 |
-
<div class="col">
|
182 |
-
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-team-vs-team.png" alt="Team vs Team">
|
183 |
-
<h3>Team vs Team</h3>
|
184 |
-
<p>Switch between team and individual mode per event. By default, events are held between teams with multiple players on each side.</p>
|
185 |
-
</div>
|
186 |
-
<div class="col">
|
187 |
-
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-player-vs-player.png" alt="Player vs Player">
|
188 |
-
<h3>Player vs Player</h3>
|
189 |
-
<p>Select this mode to remove team selectors in events. Instead, players compete with each other. Select a default mode in <a href="<?php echo add_query_arg( array( 'page' => 'sportspress', 'tab' => 'events' ), admin_url( 'admin.php' ) ); ?>">Event Options</a>.</p>
|
190 |
-
</div>
|
191 |
-
</div>
|
192 |
-
|
193 |
-
<hr>
|
194 |
-
|
195 |
<div class="feature-section three-col">
|
196 |
-
<h2>Time-Saving Features</h2>
|
197 |
<div class="col">
|
198 |
-
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-
|
199 |
-
<h3>
|
200 |
-
<p>
|
201 |
</div>
|
202 |
<div class="col">
|
203 |
-
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-
|
204 |
-
<h3>
|
205 |
-
<p>
|
206 |
</div>
|
207 |
<div class="col">
|
208 |
-
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-
|
209 |
-
<h3>
|
210 |
-
<p
|
211 |
</div>
|
212 |
</div>
|
213 |
|
214 |
<hr>
|
215 |
|
|
|
216 |
<div class="feature-section two-col">
|
217 |
-
<h2>New in SportsPress Pro</h2>
|
218 |
<div class="col">
|
219 |
-
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-
|
220 |
-
<h3>
|
221 |
-
<p>
|
222 |
</div>
|
223 |
<div class="col">
|
224 |
-
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-
|
225 |
-
<h3>
|
226 |
-
<p>
|
227 |
-
</div>
|
228 |
-
</div>
|
229 |
-
|
230 |
-
<hr />
|
231 |
-
|
232 |
-
<div class="changelog">
|
233 |
-
<h2>Under the Hood</h2>
|
234 |
-
<div class="under-the-hood three-col">
|
235 |
-
<div class="col">
|
236 |
-
<h3>Loading Borrowed Players</h3>
|
237 |
-
<p>Players borrowed from other teams are now automatically loaded when editing events in the dashboard.</p>
|
238 |
-
</div>
|
239 |
-
<div class="col">
|
240 |
-
<h3>Frontend Style Overrides</h3>
|
241 |
-
<p>Text colors have been adjusted to improve readability when using color schemes with dark backgrounds and light text.</p>
|
242 |
-
</div>
|
243 |
-
<div class="col">
|
244 |
-
<h3>Shared Box Score Template</h3>
|
245 |
-
<p>The templates used for rendering team and individual box scores have been combined into a single template.</p>
|
246 |
-
</div>
|
247 |
</div>
|
248 |
</div>
|
249 |
|
@@ -265,27 +229,8 @@ class SP_Admin_Welcome {
|
|
265 |
<p class="about-description"><?php printf( __( 'SportsPress is developed and maintained by a worldwide team of passionate individuals and backed by an awesome developer community. Want to see your name? <a href="%s">Contribute to SportsPress</a>.', 'sportspress' ), 'https://github.com/ThemeBoy/SportsPress/blob/master/CONTRIBUTING.md' ); ?></p>
|
266 |
|
267 |
<div class="sp-feature feature-section col one-col">
|
268 |
-
<h4><?php _e( 'Developers', 'sportspress' ); ?></h4>
|
269 |
<?php echo $this->contributors(); ?>
|
270 |
</div>
|
271 |
-
|
272 |
-
<p class="about-description"><?php printf( __( 'Some presets have been submitted by our helpful and generous users. Want to see your name? <a href="%s">Add a Sport Preset</a>.', 'sportspress' ), 'http://tboy.co/preset' ); ?></p>
|
273 |
-
|
274 |
-
<div class="sp-feature feature-section col one-col">
|
275 |
-
<h4><?php _e( 'Presets', 'sportspress' ); ?></h4>
|
276 |
-
<?php
|
277 |
-
$preset_credits = array(
|
278 |
-
__( 'Counter-Strike: Global Offensive', 'sportspress' ) => 'Oscar Wong',
|
279 |
-
__( 'Lacrosse', 'sportspress' ) => 'Jamie',
|
280 |
-
);
|
281 |
-
?>
|
282 |
-
<dl class="sp-presets">
|
283 |
-
<?php foreach ( $preset_credits as $preset => $name ) { ?>
|
284 |
-
<dt><?php echo $preset; ?></dt>
|
285 |
-
<dd><em><?php echo $name; ?></em></dd>
|
286 |
-
<?php } ?>
|
287 |
-
</dl>
|
288 |
-
</div>
|
289 |
</div>
|
290 |
<?php
|
291 |
}
|
@@ -299,220 +244,7 @@ class SP_Admin_Welcome {
|
|
299 |
|
300 |
<?php $this->intro(); ?>
|
301 |
|
302 |
-
<p class="about-description"><?php printf( __( 'SportsPress has been kindly translated into several other languages thanks to our translation team. Want to see your name? <a href="%s">Translate SportsPress</a>.', 'sportspress' ), 'https://
|
303 |
-
<div class="postbox sp-top-translations">
|
304 |
-
<h3 class="hndle"><span><?php _e( 'Top Translations', 'sportspress' ); ?></span></h3>
|
305 |
-
<p class="sp-transifex-chart">
|
306 |
-
<a target="_blank" href="https://www.transifex.com/projects/p/sportspress"><img border="0" src="https://www.transifex.com/projects/p/sportspress/resource/sportspress/chart/image_png"/></a>
|
307 |
-
</p>
|
308 |
-
</div>
|
309 |
-
<p class="wp-credits-list">
|
310 |
-
<?php
|
311 |
-
$translators = array(
|
312 |
-
'Shqip' => array(
|
313 |
-
'albpower',
|
314 |
-
),
|
315 |
-
'العربية' => array(
|
316 |
-
'Abdulelah',
|
317 |
-
'elgolden',
|
318 |
-
'hushiea',
|
319 |
-
),
|
320 |
-
'Հայերեն' => array(
|
321 |
-
'ArtakEVN',
|
322 |
-
),
|
323 |
-
'বাংলা' => array(
|
324 |
-
'alisiddique',
|
325 |
-
),
|
326 |
-
'Bosanski' => array(
|
327 |
-
'etcloki',
|
328 |
-
),
|
329 |
-
'Български' => array(
|
330 |
-
'alltimecams',
|
331 |
-
'den_zlateva',
|
332 |
-
),
|
333 |
-
'简体中文' => array(
|
334 |
-
'dic_2008',
|
335 |
-
'mobking',
|
336 |
-
),
|
337 |
-
'繁體中文' => array(
|
338 |
-
'wah826',
|
339 |
-
),
|
340 |
-
'Hrvatski' => array(
|
341 |
-
'etcloki',
|
342 |
-
'i__k',
|
343 |
-
'iojvan',
|
344 |
-
'vlinicx',
|
345 |
-
),
|
346 |
-
'Čeština' => array(
|
347 |
-
'eifelstudio',
|
348 |
-
'thegreat',
|
349 |
-
),
|
350 |
-
'Nederlands' => array(
|
351 |
-
'demoyer',
|
352 |
-
'paulcoppen',
|
353 |
-
'poelie',
|
354 |
-
'SilverXp',
|
355 |
-
'valentijnreza',
|
356 |
-
),
|
357 |
-
'Suomi' => array(
|
358 |
-
'hanro',
|
359 |
-
'Hermanni',
|
360 |
-
'JuKi',
|
361 |
-
'Taurus',
|
362 |
-
),
|
363 |
-
'Français' => array(
|
364 |
-
'francois53',
|
365 |
-
'fredodq',
|
366 |
-
'HuguesD',
|
367 |
-
'MohamedZ',
|
368 |
-
'wolforg',
|
369 |
-
),
|
370 |
-
'Deutsch' => array(
|
371 |
-
'alexander.salomon99',
|
372 |
-
'Bhelpful2',
|
373 |
-
'chr86',
|
374 |
-
'deckerweb',
|
375 |
-
'denkuhn',
|
376 |
-
'FollowCandyPanda',
|
377 |
-
'green_big_frog',
|
378 |
-
'King3R',
|
379 |
-
'Tandor',
|
380 |
-
'tkausch',
|
381 |
-
),
|
382 |
-
'Ελληνικά' => array(
|
383 |
-
'filippos.sdr',
|
384 |
-
'Spirossmil',
|
385 |
-
),
|
386 |
-
'Íslenska' => array(
|
387 |
-
'ValliFudd',
|
388 |
-
),
|
389 |
-
'Italiano' => array(
|
390 |
-
'eNnvi',
|
391 |
-
'Flubber89',
|
392 |
-
'GhiMax',
|
393 |
-
'joegalaxy66',
|
394 |
-
'massimo.marra',
|
395 |
-
'sododesign',
|
396 |
-
'violaud',
|
397 |
-
'webby1973',
|
398 |
-
'xFrAx',
|
399 |
-
),
|
400 |
-
'日本語' => array(
|
401 |
-
'aylaview',
|
402 |
-
),
|
403 |
-
'한국어' => array(
|
404 |
-
'jikji96',
|
405 |
-
),
|
406 |
-
'Македонски' => array(
|
407 |
-
'doncer',
|
408 |
-
),
|
409 |
-
'Norsk bokmål' => array(
|
410 |
-
'jenymoen',
|
411 |
-
'Laislebai',
|
412 |
-
'm4rsal',
|
413 |
-
'sijo',
|
414 |
-
'slappfiskene.no',
|
415 |
-
'vetsmi',
|
416 |
-
),
|
417 |
-
'فارسی' => array(
|
418 |
-
'mahdi12',
|
419 |
-
),
|
420 |
-
'Polski' => array(
|
421 |
-
'Elmister',
|
422 |
-
'karimjarro',
|
423 |
-
'krisop',
|
424 |
-
),
|
425 |
-
'Português do Brasil' => array(
|
426 |
-
'AugustoNeto',
|
427 |
-
'Ferenan',
|
428 |
-
'lfrodines',
|
429 |
-
'Ozias',
|
430 |
-
'pgbenini',
|
431 |
-
'rochester',
|
432 |
-
),
|
433 |
-
'Português' => array(
|
434 |
-
'Andrew_Melim',
|
435 |
-
'nagashitw',
|
436 |
-
),
|
437 |
-
'Română' => array(
|
438 |
-
'GonerSTUDIO',
|
439 |
-
'tyby94',
|
440 |
-
),
|
441 |
-
'Русский' => array(
|
442 |
-
'elrawys',
|
443 |
-
'kanakoff',
|
444 |
-
'sashaCZ',
|
445 |
-
'Selskei',
|
446 |
-
'SmilyCarrot',
|
447 |
-
'zzcs',
|
448 |
-
),
|
449 |
-
'Српски језик' => array(
|
450 |
-
'etcloki',
|
451 |
-
),
|
452 |
-
'Slovenščina' => array(
|
453 |
-
'Ales70',
|
454 |
-
'BOCo',
|
455 |
-
'cofeman.sl',
|
456 |
-
'matiqos',
|
457 |
-
),
|
458 |
-
'Español' => array(
|
459 |
-
'albertone',
|
460 |
-
'diego.battistella',
|
461 |
-
'elarequi',
|
462 |
-
'EmiDelCaz',
|
463 |
-
'edesl',
|
464 |
-
'fernandori',
|
465 |
-
'GonerSTUDIO',
|
466 |
-
'i1m3a7n92',
|
467 |
-
'latixns',
|
468 |
-
'opticadeharo',
|
469 |
-
'popeosorio',
|
470 |
-
),
|
471 |
-
'Svenska' => array(
|
472 |
-
'fiiz',
|
473 |
-
'JensZ',
|
474 |
-
),
|
475 |
-
'தமிழ்' => array(
|
476 |
-
'chinnz25',
|
477 |
-
),
|
478 |
-
'Türkçe' => array(
|
479 |
-
'ALooNeBoy87',
|
480 |
-
'ceyhunulas',
|
481 |
-
'GuneshGamza95',
|
482 |
-
'muhahmetkara',
|
483 |
-
'overbite',
|
484 |
-
),
|
485 |
-
'Українська' => array(
|
486 |
-
'ViktoriaRuzhylo',
|
487 |
-
),
|
488 |
-
'Tiếng Việt' => array(
|
489 |
-
'bizover',
|
490 |
-
),
|
491 |
-
'ಕನ್ನಡ' => array(
|
492 |
-
'Paramamithra',
|
493 |
-
),
|
494 |
-
'ไทย' => array(
|
495 |
-
'Xyteton',
|
496 |
-
),
|
497 |
-
);
|
498 |
-
$languages = array_keys( $translators );
|
499 |
-
shuffle( $languages );
|
500 |
-
$translation_teams = array();
|
501 |
-
foreach ( $languages as $language ):
|
502 |
-
$handles = $translators[ $language ];
|
503 |
-
$team = '<strong>' . $language . '</strong> ' . __( 'by', 'sportspress' ) . ' ';
|
504 |
-
$team_members = array();
|
505 |
-
foreach ( $handles as $handle ):
|
506 |
-
$team_members[] = '<a href="https://www.transifex.com/accounts/profile/' . $handle . '">' . $handle . '</a>';
|
507 |
-
endforeach;
|
508 |
-
$members = implode( ', ', $team_members );
|
509 |
-
$team .= $members;
|
510 |
-
$team .= '';
|
511 |
-
$translation_teams[] = $team;
|
512 |
-
endforeach;
|
513 |
-
echo implode( '<br>', $translation_teams );
|
514 |
-
?>
|
515 |
-
</p>
|
516 |
</div>
|
517 |
<?php
|
518 |
}
|
9 |
* @author ThemeBoy
|
10 |
* @category Admin
|
11 |
* @package SportsPress/Admin
|
12 |
+
* @version 2.4
|
13 |
*/
|
14 |
|
15 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
124 |
<p class="sportspress-actions">
|
125 |
<a href="<?php echo admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ); ?>" class="button button-primary"><?php _e( 'Settings', 'sportspress' ); ?></a>
|
126 |
<a href="<?php echo esc_url( apply_filters( 'sportspress_docs_url', 'http://tboy.co/docs', 'sportspress' ) ); ?>" class="docs button button-primary"><?php _e( 'Docs', 'sportspress' ); ?></a>
|
127 |
+
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://wordpress.org/plugins/sportspress" data-text="An open-source (free) #WordPress plugin that helps you build professional league websites" data-via="ThemeBoy" data-size="large" data-hashtags="SportsPress">Tweet</a>
|
128 |
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
129 |
</p>
|
130 |
|
176 |
|
177 |
do_action( 'sportspress_before_welcome_features' );
|
178 |
?>
|
179 |
+
<h2>New Features</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
<div class="feature-section three-col">
|
|
|
181 |
<div class="col">
|
182 |
+
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-team-galleries.png" alt="Team Galleries">
|
183 |
+
<h3>Team Galleries</h3>
|
184 |
+
<p>Display a gallery of logos that link to each team using the new <strong>[team_gallery]</strong> shortcode, or by adding a <strong>Team Gallery</strong> widget to your sidebar.</p>
|
185 |
</div>
|
186 |
<div class="col">
|
187 |
+
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-better-career-totals.png" alt="Better Career Totals">
|
188 |
+
<h3>Better Career Totals</h3>
|
189 |
+
<p><strong>Player Statistics</strong> can be configured to display career totals by adding season totals or calculating averages using the <strong>Type</strong> option.</p>
|
190 |
</div>
|
191 |
<div class="col">
|
192 |
+
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-friendly-competitions.png" alt="Friendly Competitions">
|
193 |
+
<h3>Friendly Competitions</h3>
|
194 |
+
<p><strong>Competitions</strong> can now be assigned to any event, making it easier to organize and display <strong>Friendly</strong> events into custom calendars.</p>
|
195 |
</div>
|
196 |
</div>
|
197 |
|
198 |
<hr>
|
199 |
|
200 |
+
<h2>WordPay Integration</h2>
|
201 |
<div class="feature-section two-col">
|
|
|
202 |
<div class="col">
|
203 |
+
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-team-player-registration.png" alt="Team & Player Registration">
|
204 |
+
<h3>Team & Player Registration</h3>
|
205 |
+
<p>Automatically create teams and players when new members sign up to your site using <a href="https://wordpay.org/sportspress/" target="_blank">WordPay</a>. Once installed, don't forget to activate the <strong>WordPay</strong> module from <a href="<?php echo add_query_arg( array( 'page' => 'sportspress' ), admin_url( 'admin.php' ) ); ?>">SportsPress Settings</a>.</p>
|
206 |
</div>
|
207 |
<div class="col">
|
208 |
+
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-membership-payments.png" alt="Membership Payments">
|
209 |
+
<h3>Collect Membership Payments</h3>
|
210 |
+
<p>By using <strong>WordPay</strong>, you can create different membership levels and start accepting recurring fees directly on your website using <strong>PayPal</strong> or <strong>Stripe</strong> with seamless credit card processing. <a href="https://wordpay.org/sportspress/" target="_blank">Learn more</a></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
</div>
|
212 |
</div>
|
213 |
|
229 |
<p class="about-description"><?php printf( __( 'SportsPress is developed and maintained by a worldwide team of passionate individuals and backed by an awesome developer community. Want to see your name? <a href="%s">Contribute to SportsPress</a>.', 'sportspress' ), 'https://github.com/ThemeBoy/SportsPress/blob/master/CONTRIBUTING.md' ); ?></p>
|
230 |
|
231 |
<div class="sp-feature feature-section col one-col">
|
|
|
232 |
<?php echo $this->contributors(); ?>
|
233 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
</div>
|
235 |
<?php
|
236 |
}
|
244 |
|
245 |
<?php $this->intro(); ?>
|
246 |
|
247 |
+
<p class="about-description"><?php printf( __( 'SportsPress has been kindly translated into several other languages thanks to our translation team. Want to see your name? <a href="%s">Translate SportsPress</a>.', 'sportspress' ), 'https://translate.wordpress.org/projects/wp-plugins/sportspress' ); ?></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
</div>
|
249 |
<?php
|
250 |
}
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-metric-details.php
CHANGED
@@ -23,12 +23,40 @@ class SP_Meta_Box_Metric_Details extends SP_Meta_Box_Config {
|
|
23 |
*/
|
24 |
public static function output( $post ) {
|
25 |
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
|
|
|
|
26 |
?>
|
27 |
<p><strong><?php _e( 'Variable', 'sportspress' ); ?></strong></p>
|
28 |
<p>
|
29 |
<input name="sp_default_key" type="hidden" id="sp_default_key" value="<?php echo $post->post_name; ?>">
|
30 |
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
|
31 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
<?php
|
33 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
23 |
*/
|
24 |
public static function output( $post ) {
|
25 |
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
26 |
+
$visible = get_post_meta( $post->ID, 'sp_visible', true );
|
27 |
+
if ( '' === $visible ) $visible = 1;
|
28 |
?>
|
29 |
<p><strong><?php _e( 'Variable', 'sportspress' ); ?></strong></p>
|
30 |
<p>
|
31 |
<input name="sp_default_key" type="hidden" id="sp_default_key" value="<?php echo $post->post_name; ?>">
|
32 |
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
|
33 |
</p>
|
34 |
+
<p>
|
35 |
+
<strong><?php _e( 'Visible', 'sportspress' ); ?></strong>
|
36 |
+
<i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php _e( 'Display in player profile?', 'sportspress' ); ?>"></i>
|
37 |
+
</p>
|
38 |
+
<ul class="sp-visible-selector">
|
39 |
+
<li>
|
40 |
+
<label class="selectit">
|
41 |
+
<input name="sp_visible" id="sp_visible_yes" type="radio" value="1" <?php checked( $visible ); ?>>
|
42 |
+
<?php _e( 'Yes', 'sportspress' ); ?>
|
43 |
+
</label>
|
44 |
+
</li>
|
45 |
+
<li>
|
46 |
+
<label class="selectit">
|
47 |
+
<input name="sp_visible" id="sp_visible_no" type="radio" value="0" <?php checked( ! $visible ); ?>>
|
48 |
+
<?php _e( 'No', 'sportspress' ); ?>
|
49 |
+
</label>
|
50 |
+
</li>
|
51 |
+
</ul>
|
52 |
<?php
|
53 |
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Save meta box data
|
57 |
+
*/
|
58 |
+
public static function save( $post_id, $post ) {
|
59 |
+
self::delete_duplicate( $_POST );
|
60 |
+
update_post_meta( $post_id, 'sp_visible', sp_array_value( $_POST, 'sp_visible', 1 ) );
|
61 |
+
}
|
62 |
}
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -33,16 +33,16 @@ class SP_Meta_Box_Player_Statistics {
|
|
33 |
?>
|
34 |
<p><strong><?php echo $league->name; ?></strong></p>
|
35 |
<?php
|
36 |
-
list( $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes, $formats ) = $player->data( $league->term_id, true );
|
37 |
-
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0, true, $formats );
|
38 |
$i ++;
|
39 |
endforeach;
|
40 |
if ( $show_career_totals ) {
|
41 |
?>
|
42 |
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?></strong></p>
|
43 |
<?php
|
44 |
-
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = $player->data( 0, true );
|
45 |
-
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams );
|
46 |
}
|
47 |
} else {
|
48 |
// Determine order of sections
|
@@ -60,16 +60,16 @@ class SP_Meta_Box_Player_Statistics {
|
|
60 |
?>
|
61 |
<p><strong><?php echo $league->name; ?> — <?php echo $section_label; ?></strong></p>
|
62 |
<?php
|
63 |
-
list( $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes ) = $player->data( $league->term_id, true, $section_id );
|
64 |
-
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 );
|
65 |
$i ++;
|
66 |
endforeach;
|
67 |
if ( $show_career_totals ) {
|
68 |
?>
|
69 |
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?> — <?php echo $section_label; ?></strong></p>
|
70 |
<?php
|
71 |
-
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = $player->data( 0, true, $section_id );
|
72 |
-
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 );
|
73 |
}
|
74 |
$s ++;
|
75 |
}
|
@@ -88,7 +88,7 @@ class SP_Meta_Box_Player_Statistics {
|
|
88 |
/**
|
89 |
* Admin edit table
|
90 |
*/
|
91 |
-
public static function table( $id = null, $league_id, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $leagues = array(), $has_checkboxes = false, $team_select = false, $formats = array() ) {
|
92 |
$readonly = false;
|
93 |
$teams = array_filter( get_post_meta( $id, 'sp_team', false ) );
|
94 |
?>
|
@@ -121,10 +121,23 @@ class SP_Meta_Box_Player_Statistics {
|
|
121 |
<td><?php
|
122 |
$value = sp_array_value( sp_array_value( $data, 0, array() ), $column, null );
|
123 |
$placeholder = sp_array_value( sp_array_value( $placeholders, 0, array() ), $column, 0 );
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
echo $value ? $value : $placeholder;
|
126 |
-
else
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
?></td>
|
129 |
<?php endforeach; ?>
|
130 |
</tr>
|
@@ -196,26 +209,8 @@ class SP_Meta_Box_Player_Statistics {
|
|
196 |
|
197 |
// Convert value and placeholder to time format
|
198 |
if ( 'time' === sp_array_value( $formats, $column, 'number' ) ) {
|
199 |
-
|
200 |
-
|
201 |
-
$intval = intval( $value );
|
202 |
-
$timeval = gmdate( 'i:s', $intval );
|
203 |
-
$hours = floor( $intval / 3600 );
|
204 |
-
|
205 |
-
if ( '00' != $hours )
|
206 |
-
$timeval = $hours . ':' . $timeval;
|
207 |
-
|
208 |
-
$timeval = preg_replace( '/^0/', '', $timeval );
|
209 |
-
|
210 |
-
// Convert placeholder
|
211 |
-
$intval = intval( $placeholder );
|
212 |
-
$placeholder = gmdate( 'i:s', $intval );
|
213 |
-
$hours = floor( $intval / 3600 );
|
214 |
-
|
215 |
-
if ( '00' != $hours )
|
216 |
-
$placeholder = $hours . ':' . $placeholder;
|
217 |
-
|
218 |
-
$placeholder = preg_replace( '/^0/', '', $placeholder );
|
219 |
}
|
220 |
|
221 |
if ( $readonly ) {
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.4
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
33 |
?>
|
34 |
<p><strong><?php echo $league->name; ?></strong></p>
|
35 |
<?php
|
36 |
+
list( $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes, $formats, $total_types ) = $player->data( $league->term_id, true );
|
37 |
+
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0, true, $formats, $total_types );
|
38 |
$i ++;
|
39 |
endforeach;
|
40 |
if ( $show_career_totals ) {
|
41 |
?>
|
42 |
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?></strong></p>
|
43 |
<?php
|
44 |
+
list( $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes, $formats, $total_types ) = $player->data( 0, true );
|
45 |
+
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams, false, false, $formats, $total_types );
|
46 |
}
|
47 |
} else {
|
48 |
// Determine order of sections
|
60 |
?>
|
61 |
<p><strong><?php echo $league->name; ?> — <?php echo $section_label; ?></strong></p>
|
62 |
<?php
|
63 |
+
list( $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes, $formats, $total_types ) = $player->data( $league->term_id, true, $section_id );
|
64 |
+
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0, $formats, $total_types );
|
65 |
$i ++;
|
66 |
endforeach;
|
67 |
if ( $show_career_totals ) {
|
68 |
?>
|
69 |
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?> — <?php echo $section_label; ?></strong></p>
|
70 |
<?php
|
71 |
+
list( $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes, $formats, $total_types ) = $player->data( 0, true, $section_id );
|
72 |
+
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0, $formats, $total_types );
|
73 |
}
|
74 |
$s ++;
|
75 |
}
|
88 |
/**
|
89 |
* Admin edit table
|
90 |
*/
|
91 |
+
public static function table( $id = null, $league_id, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $leagues = array(), $has_checkboxes = false, $team_select = false, $formats = array(), $total_types = array() ) {
|
92 |
$readonly = false;
|
93 |
$teams = array_filter( get_post_meta( $id, 'sp_team', false ) );
|
94 |
?>
|
121 |
<td><?php
|
122 |
$value = sp_array_value( sp_array_value( $data, 0, array() ), $column, null );
|
123 |
$placeholder = sp_array_value( sp_array_value( $placeholders, 0, array() ), $column, 0 );
|
124 |
+
|
125 |
+
// Convert value and placeholder to time format
|
126 |
+
if ( 'time' === sp_array_value( $formats, $column, 'number' ) ) {
|
127 |
+
$timeval = sp_time_value( $value );
|
128 |
+
$placeholder = sp_time_value( $placeholder );
|
129 |
+
}
|
130 |
+
|
131 |
+
if ( $readonly ) {
|
132 |
echo $value ? $value : $placeholder;
|
133 |
+
} else {
|
134 |
+
if ( 'time' === sp_array_value( $formats, $column, 'number' ) ) {
|
135 |
+
echo '<input class="sp-convert-time-input" type="text" name="sp_times[' . $league_id . '][0][' . $column . ']" value="' . ( '' === $value ? '' : esc_attr( $timeval ) ) . '" placeholder="' . esc_attr( $placeholder ) . '"' . ( $readonly ? ' disabled="disabled"' : '' ) . ' />';
|
136 |
+
echo '<input class="sp-convert-time-output" type="hidden" name="sp_statistics[' . $league_id . '][0][' . $column . ']" value="' . esc_attr( $value ) . '" data-sp-format="' . sp_array_value( $formats, $column, 'number' ) . '" data-sp-total-type="' . sp_array_value( $total_types, $column, 'total' ) . '" />';
|
137 |
+
} else {
|
138 |
+
echo '<input type="text" name="sp_statistics[' . $league_id . '][0][' . $column . ']" value="' . esc_attr( $value ) . '" placeholder="' . esc_attr( $placeholder ) . '"' . ( $readonly ? ' disabled="disabled"' : '' ) . ' data-sp-format="' . sp_array_value( $formats, $column, 'number' ) . '" data-sp-total-type="' . sp_array_value( $total_types, $column, 'total' ) . '" />';
|
139 |
+
}
|
140 |
+
}
|
141 |
?></td>
|
142 |
<?php endforeach; ?>
|
143 |
</tr>
|
209 |
|
210 |
// Convert value and placeholder to time format
|
211 |
if ( 'time' === sp_array_value( $formats, $column, 'number' ) ) {
|
212 |
+
$timeval = sp_time_value( $value );
|
213 |
+
$placeholder = sp_time_value( $placeholder );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
}
|
215 |
|
216 |
if ( $readonly ) {
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-statistic-details.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -25,11 +25,14 @@ class SP_Meta_Box_Statistic_Details extends SP_Meta_Box_Config {
|
|
25 |
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
26 |
$precision = get_post_meta( $post->ID, 'sp_precision', true );
|
27 |
$section = get_post_meta( $post->ID, 'sp_section', true );
|
|
|
|
|
28 |
$visible = get_post_meta( $post->ID, 'sp_visible', true );
|
29 |
|
30 |
// Defaults
|
31 |
if ( '' === $precision ) $precision = 0;
|
32 |
if ( '' === $section ) $section = -1;
|
|
|
33 |
if ( '' === $visible ) $visible = 1;
|
34 |
?>
|
35 |
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
|
@@ -63,6 +66,17 @@ class SP_Meta_Box_Statistic_Details extends SP_Meta_Box_Config {
|
|
63 |
?>
|
64 |
</select>
|
65 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
<p>
|
67 |
<strong><?php _e( 'Visible', 'sportspress' ); ?></strong>
|
68 |
<i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php _e( 'Display in player profile?', 'sportspress' ); ?>"></i>
|
@@ -90,6 +104,7 @@ class SP_Meta_Box_Statistic_Details extends SP_Meta_Box_Config {
|
|
90 |
public static function save( $post_id, $post ) {
|
91 |
self::delete_duplicate( $_POST );
|
92 |
update_post_meta( $post_id, 'sp_section', (int) sp_array_value( $_POST, 'sp_section', -1 ) );
|
|
|
93 |
update_post_meta( $post_id, 'sp_format', sp_array_value( $_POST, 'sp_format', 'number' ) );
|
94 |
update_post_meta( $post_id, 'sp_precision', (int) sp_array_value( $_POST, 'sp_precision', 1 ) );
|
95 |
update_post_meta( $post_id, 'sp_visible', sp_array_value( $_POST, 'sp_visible', 1 ) );
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.4
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
25 |
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
26 |
$precision = get_post_meta( $post->ID, 'sp_precision', true );
|
27 |
$section = get_post_meta( $post->ID, 'sp_section', true );
|
28 |
+
$format = get_post_meta( $post->ID, 'sp_format', true );
|
29 |
+
$total = get_post_meta( $post->ID, 'sp_type', true );
|
30 |
$visible = get_post_meta( $post->ID, 'sp_visible', true );
|
31 |
|
32 |
// Defaults
|
33 |
if ( '' === $precision ) $precision = 0;
|
34 |
if ( '' === $section ) $section = -1;
|
35 |
+
if ( '' === $format ) $format = 'number';
|
36 |
if ( '' === $visible ) $visible = 1;
|
37 |
?>
|
38 |
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
|
66 |
?>
|
67 |
</select>
|
68 |
</p>
|
69 |
+
<p><strong><?php _e( 'Type', 'sportspress' ); ?></strong></p>
|
70 |
+
<p>
|
71 |
+
<select name="sp_type">
|
72 |
+
<?php
|
73 |
+
$options = apply_filters( 'sportspress_statistic_total_types', array( 'total' => __( 'Total', 'sportspress' ), 'average' => __( 'Average', 'sportspress' ) ) );
|
74 |
+
foreach ( $options as $key => $value ):
|
75 |
+
printf( '<option value="%s" %s>%s</option>', $key, selected( $key == $total, true, false ), $value );
|
76 |
+
endforeach;
|
77 |
+
?>
|
78 |
+
</select>
|
79 |
+
</p>
|
80 |
<p>
|
81 |
<strong><?php _e( 'Visible', 'sportspress' ); ?></strong>
|
82 |
<i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php _e( 'Display in player profile?', 'sportspress' ); ?>"></i>
|
104 |
public static function save( $post_id, $post ) {
|
105 |
self::delete_duplicate( $_POST );
|
106 |
update_post_meta( $post_id, 'sp_section', (int) sp_array_value( $_POST, 'sp_section', -1 ) );
|
107 |
+
update_post_meta( $post_id, 'sp_type', sp_array_value( $_POST, 'sp_type', 'total' ) );
|
108 |
update_post_meta( $post_id, 'sp_format', sp_array_value( $_POST, 'sp_format', 'number' ) );
|
109 |
update_post_meta( $post_id, 'sp_precision', (int) sp_array_value( $_POST, 'sp_precision', 1 ) );
|
110 |
update_post_meta( $post_id, 'sp_visible', sp_array_value( $_POST, 'sp_visible', 1 ) );
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-table-format.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Table Format
|
4 |
+
*
|
5 |
+
* @author ThemeBoy
|
6 |
+
* @category Admin
|
7 |
+
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.4
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
+
|
13 |
+
/**
|
14 |
+
* SP_Meta_Box_Table_Format
|
15 |
+
*/
|
16 |
+
class SP_Meta_Box_Table_Format {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Output the metabox
|
20 |
+
*/
|
21 |
+
public static function output( $post ) {
|
22 |
+
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
23 |
+
$the_format = get_post_meta( $post->ID, 'sp_format', true );
|
24 |
+
?>
|
25 |
+
<div id="post-formats-select">
|
26 |
+
<?php foreach ( SP()->formats->table as $key => $format ): ?>
|
27 |
+
<input type="radio" name="sp_format" class="post-format" id="post-format-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php checked( true, ( $key == 'standings' && ! $the_format ) || $the_format == $key ); ?>> <label for="post-format-<?php echo $key; ?>" class="post-format-icon post-format-<?php echo $key; ?>"><?php echo $format; ?></label><br>
|
28 |
+
<?php endforeach; ?>
|
29 |
+
</div>
|
30 |
+
<?php
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Save meta box data
|
35 |
+
*/
|
36 |
+
public static function save( $post_id, $post ) {
|
37 |
+
update_post_meta( $post_id, 'sp_format', sp_array_value( $_POST, 'sp_format', 'standings' ) );
|
38 |
+
}
|
39 |
+
}
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-table-shortcode.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -19,11 +19,13 @@ class SP_Meta_Box_Table_Shortcode {
|
|
19 |
* Output the metabox
|
20 |
*/
|
21 |
public static function output( $post ) {
|
|
|
|
|
22 |
?>
|
23 |
<p class="howto">
|
24 |
<?php _e( 'Copy this code and paste it into your post, page or text widget content.', 'sportspress' ); ?>
|
25 |
</p>
|
26 |
-
<p><input type="text" value="<?php sp_shortcode_template( '
|
27 |
<?php
|
28 |
}
|
29 |
}
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.4
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
19 |
* Output the metabox
|
20 |
*/
|
21 |
public static function output( $post ) {
|
22 |
+
$the_format = get_post_meta( $post->ID, 'sp_format', true );
|
23 |
+
if ( ! $the_format ) $the_format = 'standings';
|
24 |
?>
|
25 |
<p class="howto">
|
26 |
<?php _e( 'Copy this code and paste it into your post, page or text widget content.', 'sportspress' ); ?>
|
27 |
</p>
|
28 |
+
<p><input type="text" value="<?php sp_shortcode_template( 'team_' . $the_format, $post->ID ); ?>" readonly="readonly" class="code widefat"></p>
|
29 |
<?php
|
30 |
}
|
31 |
}
|
includes/admin/settings/class-sp-settings-modules.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -59,7 +59,7 @@ class SP_Settings_Modules extends SP_Settings_Page {
|
|
59 |
<table class="widefat" cellspacing="0">
|
60 |
<thead>
|
61 |
<tr><th>
|
62 |
-
<img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>/assets/images/modules/sportspress-pro
|
63 |
</th></tr>
|
64 |
</thead>
|
65 |
<tbody>
|
@@ -74,6 +74,25 @@ class SP_Settings_Modules extends SP_Settings_Page {
|
|
74 |
</table>
|
75 |
<?php } ?>
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
<?php if ( ! class_exists( 'SportsPress_Twitter' ) || ! class_exists( 'SportsPress_Facebook' ) ) { ?>
|
78 |
<table class="widefat" cellspacing="0">
|
79 |
<thead>
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
+
* @version 2.4
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
59 |
<table class="widefat" cellspacing="0">
|
60 |
<thead>
|
61 |
<tr><th>
|
62 |
+
<a href="<?php echo apply_filters( 'sportspress_pro_url', 'http://tboy.co/pro' ); ?>" target="_blank"><img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>/assets/images/modules/sportspress-pro.png" alt="<?php _e( 'SportsPress Pro', 'sportspress' ); ?>" width="174"></a>
|
63 |
</th></tr>
|
64 |
</thead>
|
65 |
<tbody>
|
74 |
</table>
|
75 |
<?php } ?>
|
76 |
|
77 |
+
<?php if ( ! class_exists( 'WordPay' ) ) { ?>
|
78 |
+
<table class="widefat" cellspacing="0">
|
79 |
+
<thead>
|
80 |
+
<tr><th>
|
81 |
+
<a href="https://wordpay.org/sportspress/" target="_blank"><img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/modules/wordpay.png" alt="<?php _e( 'WordPay', 'sportspress' ); ?>" width="150"></a>
|
82 |
+
</th></tr>
|
83 |
+
</thead>
|
84 |
+
<tbody>
|
85 |
+
<tr><td>
|
86 |
+
<p><?php _e( 'Start collecting club membership payments with WordPay.','sportspress' ); ?></p>
|
87 |
+
<p class="sp-module-actions">
|
88 |
+
<span><?php _e( 'Premium', 'sportspress' ); ?></span>
|
89 |
+
<a class="button" href="https://wordpay.org/sportspress/" target="_blank"><?php _e( 'Get WordPay', 'sportspress' ); ?></a>
|
90 |
+
</p>
|
91 |
+
</td></tr>
|
92 |
+
</tbody>
|
93 |
+
</table>
|
94 |
+
<?php } ?>
|
95 |
+
|
96 |
<?php if ( ! class_exists( 'SportsPress_Twitter' ) || ! class_exists( 'SportsPress_Facebook' ) ) { ?>
|
97 |
<table class="widefat" cellspacing="0">
|
98 |
<thead>
|
includes/class-sp-ajax.php
CHANGED
@@ -8,7 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
8 |
* AJAX Event Handler
|
9 |
*
|
10 |
* @class SP_AJAX
|
11 |
-
* @version 2.
|
12 |
* @package SportsPress/Classes
|
13 |
* @category Class
|
14 |
* @author ThemeBoy
|
@@ -30,7 +30,8 @@ class SP_AJAX {
|
|
30 |
'event_calendar_shortcode' => false,
|
31 |
'event_list_shortcode' => false,
|
32 |
'event_blocks_shortcode' => false,
|
33 |
-
'
|
|
|
34 |
'player_details_shortcode' => false,
|
35 |
'player_statistics_shortcode' => false,
|
36 |
'player_list_shortcode' => false,
|
@@ -610,11 +611,11 @@ class SP_AJAX {
|
|
610 |
}
|
611 |
|
612 |
/**
|
613 |
-
* AJAX
|
614 |
*/
|
615 |
-
public function
|
616 |
?>
|
617 |
-
<div class="wrap sp-thickbox-content" id="sp-thickbox-
|
618 |
<p>
|
619 |
<label>
|
620 |
<?php _e( 'Title:', 'sportspress' ); ?>
|
@@ -673,7 +674,71 @@ class SP_AJAX {
|
|
673 |
</p>
|
674 |
<?php do_action( 'sportspress_ajax_shortcode_form', 'league-table' ); ?>
|
675 |
<p class="submit">
|
676 |
-
<input type="button" class="button-primary" value="<?php _e( 'Insert Shortcode', 'sportspress' ); ?>" onclick="insertSportsPress('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
<a class="button-secondary" onclick="tb_remove();" title="<?php _e( 'Cancel', 'sportspress' ); ?>"><?php _e( 'Cancel', 'sportspress' ); ?></a>
|
678 |
</p>
|
679 |
</div>
|
@@ -873,6 +938,12 @@ class SP_AJAX {
|
|
873 |
<input type="text" size="3" name="number" id="number" value="5">
|
874 |
</label>
|
875 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
876 |
<p>
|
877 |
<label>
|
878 |
<?php _e( 'Sort by:', 'sportspress' ); ?>
|
@@ -971,12 +1042,18 @@ class SP_AJAX {
|
|
971 |
args.orderby = $div.find('[name=orderby]').val();
|
972 |
args.order = $div.find('[name=order]').val();
|
973 |
args.show_all_events_link = $div.find('[name=show_all_events_link]:checked').length;
|
974 |
-
} else if ( '
|
975 |
args.title = $div.find('[name=title]').val();
|
976 |
args.number = $div.find('[name=number]').val();
|
977 |
args.columns = $div.find('[name="columns[]"]:checked').map(function() { return this.value; }).get().join(',');
|
978 |
args.show_team_logo = $div.find('[name=show_team_logo]:checked').length;
|
979 |
args.show_full_table_link = $div.find('[name=show_full_table_link]:checked').length;
|
|
|
|
|
|
|
|
|
|
|
|
|
980 |
} else if ( 'player_list' == type ) {
|
981 |
args.title = $div.find('[name=title]').val();
|
982 |
args.number = $div.find('[name=number]').val();
|
@@ -987,6 +1064,7 @@ class SP_AJAX {
|
|
987 |
} else if ( 'player_gallery' == type ) {
|
988 |
args.title = $div.find('[name=title]').val();
|
989 |
args.number = $div.find('[name=number]').val();
|
|
|
990 |
args.orderby = $div.find('[name=orderby]').val();
|
991 |
args.order = $div.find('[name=order]').val();
|
992 |
args.show_all_players_link = $div.find('[name=show_all_players_link]:checked').length;
|
8 |
* AJAX Event Handler
|
9 |
*
|
10 |
* @class SP_AJAX
|
11 |
+
* @version 2.4
|
12 |
* @package SportsPress/Classes
|
13 |
* @category Class
|
14 |
* @author ThemeBoy
|
30 |
'event_calendar_shortcode' => false,
|
31 |
'event_list_shortcode' => false,
|
32 |
'event_blocks_shortcode' => false,
|
33 |
+
'team_standings_shortcode' => false,
|
34 |
+
'team_gallery_shortcode' => false,
|
35 |
'player_details_shortcode' => false,
|
36 |
'player_statistics_shortcode' => false,
|
37 |
'player_list_shortcode' => false,
|
611 |
}
|
612 |
|
613 |
/**
|
614 |
+
* AJAX team_standings shortcode
|
615 |
*/
|
616 |
+
public function team_standings_shortcode() {
|
617 |
?>
|
618 |
+
<div class="wrap sp-thickbox-content" id="sp-thickbox-team_standings">
|
619 |
<p>
|
620 |
<label>
|
621 |
<?php _e( 'Title:', 'sportspress' ); ?>
|
674 |
</p>
|
675 |
<?php do_action( 'sportspress_ajax_shortcode_form', 'league-table' ); ?>
|
676 |
<p class="submit">
|
677 |
+
<input type="button" class="button-primary" value="<?php _e( 'Insert Shortcode', 'sportspress' ); ?>" onclick="insertSportsPress('team_standings');" />
|
678 |
+
<a class="button-secondary" onclick="tb_remove();" title="<?php _e( 'Cancel', 'sportspress' ); ?>"><?php _e( 'Cancel', 'sportspress' ); ?></a>
|
679 |
+
</p>
|
680 |
+
</div>
|
681 |
+
<?php
|
682 |
+
self::scripts();
|
683 |
+
die();
|
684 |
+
}
|
685 |
+
|
686 |
+
/**
|
687 |
+
* AJAX team_gallery shortcode
|
688 |
+
*/
|
689 |
+
public function team_gallery_shortcode() {
|
690 |
+
?>
|
691 |
+
<div class="wrap sp-thickbox-content" id="sp-thickbox-team_gallery">
|
692 |
+
<p>
|
693 |
+
<label>
|
694 |
+
<?php _e( 'Title:', 'sportspress' ); ?>
|
695 |
+
<input class="regular-text" type="text" name="title">
|
696 |
+
</label>
|
697 |
+
</p>
|
698 |
+
<p>
|
699 |
+
<label>
|
700 |
+
<?php printf( __( 'Select %s:', 'sportspress' ), __( 'League Table', 'sportspress' ) ); ?>
|
701 |
+
<?php
|
702 |
+
$args = array(
|
703 |
+
'post_type' => 'sp_table',
|
704 |
+
'name' => 'id',
|
705 |
+
'values' => 'ID',
|
706 |
+
);
|
707 |
+
sp_dropdown_pages( $args );
|
708 |
+
?>
|
709 |
+
</label>
|
710 |
+
</p>
|
711 |
+
<p>
|
712 |
+
<label>
|
713 |
+
<?php _e( 'Number of teams to show:', 'sportspress' ); ?>
|
714 |
+
<input type="text" size="3" name="number" id="number" value="5">
|
715 |
+
</label>
|
716 |
+
</p>
|
717 |
+
<p>
|
718 |
+
<label>
|
719 |
+
<?php _e( 'Columns:', 'sportspress' ); ?>
|
720 |
+
<input type="text" size="3" name="columns" id="columns" value="3">
|
721 |
+
</label>
|
722 |
+
</p>
|
723 |
+
<p>
|
724 |
+
<label>
|
725 |
+
<?php _e( 'Order by', 'sportspress' ); ?>:
|
726 |
+
<select name="orderby">
|
727 |
+
<option value="default"><?php _e( 'Rank', 'sportspress' ); ?></option>
|
728 |
+
<option value="name"><?php _e( 'Alphabetical', 'sportspress' ); ?></option>
|
729 |
+
<option value="rand"><?php _e( 'Random', 'sportspress' ); ?></option>
|
730 |
+
</select>
|
731 |
+
</label>
|
732 |
+
</p>
|
733 |
+
<p>
|
734 |
+
<label>
|
735 |
+
<input type="checkbox" name="show_full_table_link" id="show_full_table_link">
|
736 |
+
<?php _e( 'Display link to view full table', 'sportspress' ); ?>
|
737 |
+
</label>
|
738 |
+
</p>
|
739 |
+
<?php do_action( 'sportspress_ajax_shortcode_form', 'league-table' ); ?>
|
740 |
+
<p class="submit">
|
741 |
+
<input type="button" class="button-primary" value="<?php _e( 'Insert Shortcode', 'sportspress' ); ?>" onclick="insertSportsPress('team_gallery');" />
|
742 |
<a class="button-secondary" onclick="tb_remove();" title="<?php _e( 'Cancel', 'sportspress' ); ?>"><?php _e( 'Cancel', 'sportspress' ); ?></a>
|
743 |
</p>
|
744 |
</div>
|
938 |
<input type="text" size="3" name="number" id="number" value="5">
|
939 |
</label>
|
940 |
</p>
|
941 |
+
<p>
|
942 |
+
<label>
|
943 |
+
<?php _e( 'Columns:', 'sportspress' ); ?>
|
944 |
+
<input type="text" size="3" name="columns" id="columns" value="3">
|
945 |
+
</label>
|
946 |
+
</p>
|
947 |
<p>
|
948 |
<label>
|
949 |
<?php _e( 'Sort by:', 'sportspress' ); ?>
|
1042 |
args.orderby = $div.find('[name=orderby]').val();
|
1043 |
args.order = $div.find('[name=order]').val();
|
1044 |
args.show_all_events_link = $div.find('[name=show_all_events_link]:checked').length;
|
1045 |
+
} else if ( 'team_standings' == type ) {
|
1046 |
args.title = $div.find('[name=title]').val();
|
1047 |
args.number = $div.find('[name=number]').val();
|
1048 |
args.columns = $div.find('[name="columns[]"]:checked').map(function() { return this.value; }).get().join(',');
|
1049 |
args.show_team_logo = $div.find('[name=show_team_logo]:checked').length;
|
1050 |
args.show_full_table_link = $div.find('[name=show_full_table_link]:checked').length;
|
1051 |
+
} else if ( 'team_gallery' == type ) {
|
1052 |
+
args.title = $div.find('[name=title]').val();
|
1053 |
+
args.number = $div.find('[name=number]').val();
|
1054 |
+
args.columns = $div.find('[name=columns]').val();
|
1055 |
+
args.orderby = $div.find('[name=orderby]').val();
|
1056 |
+
args.show_full_table_link = $div.find('[name=show_full_table_link]:checked').length;
|
1057 |
} else if ( 'player_list' == type ) {
|
1058 |
args.title = $div.find('[name=title]').val();
|
1059 |
args.number = $div.find('[name=number]').val();
|
1064 |
} else if ( 'player_gallery' == type ) {
|
1065 |
args.title = $div.find('[name=title]').val();
|
1066 |
args.number = $div.find('[name=number]').val();
|
1067 |
+
args.columns = $div.find('[name=columns]').val();
|
1068 |
args.orderby = $div.find('[name=orderby]').val();
|
1069 |
args.order = $div.find('[name=order]').val();
|
1070 |
args.show_all_players_link = $div.find('[name=show_all_players_link]:checked').length;
|
includes/class-sp-event.php
CHANGED
@@ -399,7 +399,7 @@ class SP_Event extends SP_Custom_Post{
|
|
399 |
|
400 |
$stats[ $index ]['sub_name'] = $sub_name;
|
401 |
$stats[ $index ]['sub_number'] = $sub_number;
|
402 |
-
$stats[ $index ]['label'] = __( '
|
403 |
$stats[ $index ]['icon'] = '<i class="sp-icon-sub" title="' . $icon_title . '"></i>';
|
404 |
} else {
|
405 |
$stats[ $index ]['label'] = sp_array_value( $performance_labels, $details['key'] );
|
399 |
|
400 |
$stats[ $index ]['sub_name'] = $sub_name;
|
401 |
$stats[ $index ]['sub_number'] = $sub_number;
|
402 |
+
$stats[ $index ]['label'] = __( 'Substitute', 'sportspress' );
|
403 |
$stats[ $index ]['icon'] = '<i class="sp-icon-sub" title="' . $icon_title . '"></i>';
|
404 |
} else {
|
405 |
$stats[ $index ]['label'] = sp_array_value( $performance_labels, $details['key'] );
|
includes/class-sp-formats.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress formats class stores preset sport data.
|
6 |
*
|
7 |
* @class SP_Formats
|
8 |
-
* @version
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -32,6 +32,10 @@ class SP_Formats {
|
|
32 |
'list' => __( 'List', 'sportspress' ),
|
33 |
'blocks' => __( 'Blocks', 'sportspress' ),
|
34 |
),
|
|
|
|
|
|
|
|
|
35 |
'list' => array(
|
36 |
'list' => __( 'List', 'sportspress' ),
|
37 |
'gallery' => __( 'Gallery', 'sportspress' ),
|
5 |
* The SportsPress formats class stores preset sport data.
|
6 |
*
|
7 |
* @class SP_Formats
|
8 |
+
* @version 2.4
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
32 |
'list' => __( 'List', 'sportspress' ),
|
33 |
'blocks' => __( 'Blocks', 'sportspress' ),
|
34 |
),
|
35 |
+
'table' => array(
|
36 |
+
'standings' => __( 'Standings', 'sportspress' ),
|
37 |
+
'gallery' => __( 'Gallery', 'sportspress' ),
|
38 |
+
),
|
39 |
'list' => array(
|
40 |
'list' => __( 'List', 'sportspress' ),
|
41 |
'gallery' => __( 'Gallery', 'sportspress' ),
|
includes/class-sp-modules.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress modules class stores available modules.
|
6 |
*
|
7 |
* @class SP_Modules
|
8 |
-
* @version 2.
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -152,6 +152,14 @@ class SP_Modules {
|
|
152 |
'link' => 'https://www.themeboy.com/sportspress-extensions/sponsors/',
|
153 |
'desc' => __( 'Attract sponsors by offering them advertising space on your website.', 'sportspress' ),
|
154 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
),
|
156 |
));
|
157 |
|
5 |
* The SportsPress modules class stores available modules.
|
6 |
*
|
7 |
* @class SP_Modules
|
8 |
+
* @version 2.4
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
152 |
'link' => 'https://www.themeboy.com/sportspress-extensions/sponsors/',
|
153 |
'desc' => __( 'Attract sponsors by offering them advertising space on your website.', 'sportspress' ),
|
154 |
),
|
155 |
+
'wordpay' => array(
|
156 |
+
'label' => __( 'WordPay', 'sportspress' ),
|
157 |
+
'class' => 'WordPay',
|
158 |
+
'icon' => 'sp-icon-wordpay',
|
159 |
+
'link' => 'https://wordpay.org/sportspress/',
|
160 |
+
'desc' => __( 'Start collecting club membership payments with WordPay.', 'sportspress' ),
|
161 |
+
'tip' => __( 'Get WordPay', 'sportspress' ),
|
162 |
+
),
|
163 |
),
|
164 |
));
|
165 |
|
includes/class-sp-player.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress player class handles individual player data.
|
6 |
*
|
7 |
* @class SP_Player
|
8 |
-
* @version 2.
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -89,7 +89,7 @@ class SP_Player extends SP_Custom_Post {
|
|
89 |
*/
|
90 |
public function metrics( $neg = null ) {
|
91 |
$metrics = (array)get_post_meta( $this->ID, 'sp_metrics', true );
|
92 |
-
$metric_labels = (array)sp_get_var_labels( 'sp_metric', $neg );
|
93 |
$data = array();
|
94 |
|
95 |
foreach ( $metric_labels as $key => $value ):
|
@@ -613,6 +613,7 @@ class SP_Player extends SP_Custom_Post {
|
|
613 |
$columns = array_merge( $performance_labels, $stats );
|
614 |
|
615 |
$formats = array();
|
|
|
616 |
|
617 |
$args = array(
|
618 |
'post_type' => array( 'sp_performance', 'sp_statistic' ),
|
@@ -640,49 +641,49 @@ class SP_Player extends SP_Custom_Post {
|
|
640 |
$format = 'number';
|
641 |
}
|
642 |
$formats[ $post->post_name ] = $format;
|
|
|
|
|
|
|
|
|
|
|
|
|
643 |
}
|
644 |
$columns = array_merge( $column_order, $columns );
|
645 |
$usecolumns = array_merge( $usecolumn_order, $usecolumns );
|
646 |
}
|
647 |
|
648 |
-
// Convert to time notation
|
649 |
-
if ( in_array( 'time', $formats ) ):
|
650 |
-
foreach ( $placeholders as $season => $stats ):
|
651 |
-
if ( ! is_array( $stats ) ) continue;
|
652 |
-
|
653 |
-
foreach ( $stats as $key => $value ):
|
654 |
-
|
655 |
-
// Continue if not time format
|
656 |
-
if ( 'time' !== sp_array_value( $formats, $key ) ) continue;
|
657 |
-
|
658 |
-
$intval = intval( $value );
|
659 |
-
$timeval = gmdate( 'i:s', $intval );
|
660 |
-
$hours = floor( $intval / 3600 );
|
661 |
-
|
662 |
-
if ( '00' != $hours )
|
663 |
-
$timeval = $hours . ':' . $timeval;
|
664 |
-
|
665 |
-
$timeval = preg_replace( '/^0/', '', $timeval );
|
666 |
-
|
667 |
-
$placeholders[ $season ][ $key ] = $timeval;
|
668 |
-
endforeach;
|
669 |
-
endforeach;
|
670 |
-
endif;
|
671 |
-
|
672 |
// Calculate total statistics
|
673 |
-
$
|
674 |
'name' => __( 'Total', 'sportspress' ),
|
675 |
'team' => '-',
|
676 |
);
|
|
|
|
|
677 |
foreach ( $merged as $season => $stats ):
|
678 |
if ( ! is_array( $stats ) ) continue;
|
679 |
foreach ( $stats as $key => $value ):
|
680 |
if ( in_array( $key, array( 'name', 'team' ) ) ) continue;
|
681 |
$value = floatval( $value );
|
682 |
-
$
|
683 |
endforeach;
|
684 |
endforeach;
|
685 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
686 |
|
687 |
if ( $admin ):
|
688 |
$labels = array();
|
@@ -694,7 +695,7 @@ class SP_Player extends SP_Custom_Post {
|
|
694 |
endif;
|
695 |
endforeach; endif;
|
696 |
$placeholders[0] = $merged[-1];
|
697 |
-
return array( $labels, $data, $placeholders, $merged, $leagues, $has_checkboxes, $formats );
|
698 |
else:
|
699 |
if ( is_array( $usecolumns ) ):
|
700 |
foreach ( $columns as $key => $label ):
|
@@ -720,23 +721,13 @@ class SP_Player extends SP_Custom_Post {
|
|
720 |
// Convert to time notation
|
721 |
if ( in_array( 'time', $formats ) ):
|
722 |
foreach ( $merged as $season => $season_performance ):
|
723 |
-
if ( $season <= 0 ) continue;
|
724 |
-
|
725 |
foreach ( $season_performance as $performance_key => $performance_value ):
|
726 |
|
727 |
// Continue if not time format
|
728 |
if ( 'time' !== sp_array_value( $formats, $performance_key ) ) continue;
|
729 |
|
730 |
-
$
|
731 |
-
$timeval = gmdate( 'i:s', $intval );
|
732 |
-
$hours = floor( $intval / 3600 );
|
733 |
-
|
734 |
-
if ( '00' != $hours )
|
735 |
-
$timeval = $hours . ':' . $timeval;
|
736 |
-
|
737 |
-
$timeval = preg_replace( '/^0/', '', $timeval );
|
738 |
|
739 |
-
$merged[ $season ][ $performance_key ] = $timeval;
|
740 |
endforeach;
|
741 |
endforeach;
|
742 |
endif;
|
5 |
* The SportsPress player class handles individual player data.
|
6 |
*
|
7 |
* @class SP_Player
|
8 |
+
* @version 2.4
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
89 |
*/
|
90 |
public function metrics( $neg = null ) {
|
91 |
$metrics = (array)get_post_meta( $this->ID, 'sp_metrics', true );
|
92 |
+
$metric_labels = (array)sp_get_var_labels( 'sp_metric', $neg, false );
|
93 |
$data = array();
|
94 |
|
95 |
foreach ( $metric_labels as $key => $value ):
|
613 |
$columns = array_merge( $performance_labels, $stats );
|
614 |
|
615 |
$formats = array();
|
616 |
+
$total_types = array();
|
617 |
|
618 |
$args = array(
|
619 |
'post_type' => array( 'sp_performance', 'sp_statistic' ),
|
641 |
$format = 'number';
|
642 |
}
|
643 |
$formats[ $post->post_name ] = $format;
|
644 |
+
|
645 |
+
$total_type = get_post_meta( $post->ID, 'sp_type', true );
|
646 |
+
if ( '' === $total_type ) {
|
647 |
+
$total_type = 'total';
|
648 |
+
}
|
649 |
+
$total_types[ $post->post_name ] = $total_type;
|
650 |
}
|
651 |
$columns = array_merge( $column_order, $columns );
|
652 |
$usecolumns = array_merge( $usecolumn_order, $usecolumns );
|
653 |
}
|
654 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
655 |
// Calculate total statistics
|
656 |
+
$career = array(
|
657 |
'name' => __( 'Total', 'sportspress' ),
|
658 |
'team' => '-',
|
659 |
);
|
660 |
+
|
661 |
+
// Add values from all seasons for total-based statistics
|
662 |
foreach ( $merged as $season => $stats ):
|
663 |
if ( ! is_array( $stats ) ) continue;
|
664 |
foreach ( $stats as $key => $value ):
|
665 |
if ( in_array( $key, array( 'name', 'team' ) ) ) continue;
|
666 |
$value = floatval( $value );
|
667 |
+
$career[ $key ] = sp_array_value( $career, $key, 0 ) + $value;
|
668 |
endforeach;
|
669 |
endforeach;
|
670 |
+
|
671 |
+
// Calculate average-based statistics from performance
|
672 |
+
foreach ( $posts as $post ) {
|
673 |
+
$type = get_post_meta( $post->ID, 'sp_type', 'total' );
|
674 |
+
if ( 'average' !== $type ) continue;
|
675 |
+
$value = sp_array_value( $equations, $post->post_name, null );
|
676 |
+
if ( null === $value || ! isset( $value['equation'] ) ) continue;
|
677 |
+
$precision = sp_array_value( $value, 'precision', 0 );
|
678 |
+
$career[ $post->post_name ] = sp_solve( $value['equation'], $totals, $precision );
|
679 |
+
}
|
680 |
+
|
681 |
+
// Get manually entered career totals
|
682 |
+
$manual_career = sp_array_value( $data, 0, array() );
|
683 |
+
$manual_career = array_filter( $manual_career, 'sp_filter_non_empty' );
|
684 |
+
|
685 |
+
// Add career totals to merged array
|
686 |
+
$merged[-1] = array_merge( $career, $manual_career );
|
687 |
|
688 |
if ( $admin ):
|
689 |
$labels = array();
|
695 |
endif;
|
696 |
endforeach; endif;
|
697 |
$placeholders[0] = $merged[-1];
|
698 |
+
return array( $labels, $data, $placeholders, $merged, $leagues, $has_checkboxes, $formats, $total_types );
|
699 |
else:
|
700 |
if ( is_array( $usecolumns ) ):
|
701 |
foreach ( $columns as $key => $label ):
|
721 |
// Convert to time notation
|
722 |
if ( in_array( 'time', $formats ) ):
|
723 |
foreach ( $merged as $season => $season_performance ):
|
|
|
|
|
724 |
foreach ( $season_performance as $performance_key => $performance_value ):
|
725 |
|
726 |
// Continue if not time format
|
727 |
if ( 'time' !== sp_array_value( $formats, $performance_key ) ) continue;
|
728 |
|
729 |
+
$merged[ $season ][ $performance_key ] = sp_time_value( $performance_value );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
730 |
|
|
|
731 |
endforeach;
|
732 |
endforeach;
|
733 |
endif;
|
includes/class-sp-shortcodes.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* SP_Shortcodes class.
|
4 |
*
|
5 |
* @class SP_Shortcodes
|
6 |
-
* @version
|
7 |
* @package SportsPress/Classes
|
8 |
* @category Class
|
9 |
* @author ThemeBoy
|
@@ -16,19 +16,21 @@ class SP_Shortcodes {
|
|
16 |
public static function init() {
|
17 |
// Define shortcodes
|
18 |
$shortcodes = array(
|
19 |
-
'event_results'
|
20 |
-
'event_details'
|
21 |
-
'event_performance'
|
22 |
-
'countdown'
|
23 |
-
'player_details'
|
24 |
-
'player_statistics'
|
25 |
-
'staff'
|
26 |
-
'event_calendar'
|
27 |
-
'event_list'
|
28 |
-
'event_blocks'
|
29 |
-
'league_table'
|
30 |
-
'
|
31 |
-
'
|
|
|
|
|
32 |
);
|
33 |
|
34 |
foreach ( $shortcodes as $shortcode => $function ) {
|
@@ -144,7 +146,7 @@ class SP_Shortcodes {
|
|
144 |
}
|
145 |
|
146 |
/**
|
147 |
-
* League table shortcode.
|
148 |
*
|
149 |
* @access public
|
150 |
* @param mixed $atts
|
@@ -154,6 +156,17 @@ class SP_Shortcodes {
|
|
154 |
return self::shortcode_wrapper( array( 'SP_Shortcode_League_Table', 'output' ), $atts );
|
155 |
}
|
156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
/**
|
158 |
* Player details shortcode.
|
159 |
*
|
3 |
* SP_Shortcodes class.
|
4 |
*
|
5 |
* @class SP_Shortcodes
|
6 |
+
* @version 2.4
|
7 |
* @package SportsPress/Classes
|
8 |
* @category Class
|
9 |
* @author ThemeBoy
|
16 |
public static function init() {
|
17 |
// Define shortcodes
|
18 |
$shortcodes = array(
|
19 |
+
'event_results' => __CLASS__ . '::event_results',
|
20 |
+
'event_details' => __CLASS__ . '::event_details',
|
21 |
+
'event_performance' => __CLASS__ . '::event_performance',
|
22 |
+
'countdown' => __CLASS__ . '::countdown',
|
23 |
+
'player_details' => __CLASS__ . '::player_details',
|
24 |
+
'player_statistics' => __CLASS__ . '::player_statistics',
|
25 |
+
'staff' => __CLASS__ . '::staff',
|
26 |
+
'event_calendar' => __CLASS__ . '::event_calendar',
|
27 |
+
'event_list' => __CLASS__ . '::event_list',
|
28 |
+
'event_blocks' => __CLASS__ . '::event_blocks',
|
29 |
+
'league_table' => __CLASS__ . '::league_table',
|
30 |
+
'team_standings' => __CLASS__ . '::league_table',
|
31 |
+
'team_gallery' => __CLASS__ . '::team_gallery',
|
32 |
+
'player_list' => __CLASS__ . '::player_list',
|
33 |
+
'player_gallery' => __CLASS__ . '::player_gallery',
|
34 |
);
|
35 |
|
36 |
foreach ( $shortcodes as $shortcode => $function ) {
|
146 |
}
|
147 |
|
148 |
/**
|
149 |
+
* League table (team standings) shortcode.
|
150 |
*
|
151 |
* @access public
|
152 |
* @param mixed $atts
|
156 |
return self::shortcode_wrapper( array( 'SP_Shortcode_League_Table', 'output' ), $atts );
|
157 |
}
|
158 |
|
159 |
+
/**
|
160 |
+
* Team gallery shortcode.
|
161 |
+
*
|
162 |
+
* @access public
|
163 |
+
* @param mixed $atts
|
164 |
+
* @return string
|
165 |
+
*/
|
166 |
+
public static function team_gallery( $atts ) {
|
167 |
+
return self::shortcode_wrapper( array( 'SP_Shortcode_Team_Gallery', 'output' ), $atts );
|
168 |
+
}
|
169 |
+
|
170 |
/**
|
171 |
* Player details shortcode.
|
172 |
*
|
includes/shortcodes/class-sp-shortcode-team-gallery.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Team Gallery Shortcode
|
4 |
+
*
|
5 |
+
* @author ThemeBoy
|
6 |
+
* @category Shortcodes
|
7 |
+
* @package SportsPress/Shortcodes/Team_Gallery
|
8 |
+
* @version 2.4
|
9 |
+
*/
|
10 |
+
class SP_Shortcode_Team_Gallery {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Output the team gallery shortcode.
|
14 |
+
*
|
15 |
+
* @param array $atts
|
16 |
+
*/
|
17 |
+
public static function output( $atts ) {
|
18 |
+
|
19 |
+
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
|
20 |
+
$atts['id'] = $atts[0];
|
21 |
+
|
22 |
+
sp_get_template( 'team-gallery.php', $atts );
|
23 |
+
}
|
24 |
+
}
|
includes/sp-core-functions.php
CHANGED
@@ -1067,7 +1067,7 @@ if ( !function_exists( 'sp_draft_or_post_title' ) ) {
|
|
1067 |
}
|
1068 |
|
1069 |
if ( !function_exists( 'sp_get_var_labels' ) ) {
|
1070 |
-
function sp_get_var_labels( $post_type, $neg = null ) {
|
1071 |
$args = array(
|
1072 |
'post_type' => $post_type,
|
1073 |
'numberposts' => -1,
|
@@ -1076,6 +1076,21 @@ if ( !function_exists( 'sp_get_var_labels' ) ) {
|
|
1076 |
'order' => 'ASC',
|
1077 |
);
|
1078 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1079 |
$vars = get_posts( $args );
|
1080 |
|
1081 |
$output = array();
|
1067 |
}
|
1068 |
|
1069 |
if ( !function_exists( 'sp_get_var_labels' ) ) {
|
1070 |
+
function sp_get_var_labels( $post_type, $neg = null, $all = true ) {
|
1071 |
$args = array(
|
1072 |
'post_type' => $post_type,
|
1073 |
'numberposts' => -1,
|
1076 |
'order' => 'ASC',
|
1077 |
);
|
1078 |
|
1079 |
+
if ( ! $all ) {
|
1080 |
+
$args['meta_query'] = array(
|
1081 |
+
array(
|
1082 |
+
'key' => 'sp_visible',
|
1083 |
+
'value' => 1,
|
1084 |
+
),
|
1085 |
+
array(
|
1086 |
+
'key' => 'sp_visible',
|
1087 |
+
'value' => 1,
|
1088 |
+
'compare' => 'NOT EXISTS',
|
1089 |
+
),
|
1090 |
+
'relation' => 'OR',
|
1091 |
+
);
|
1092 |
+
}
|
1093 |
+
|
1094 |
$vars = get_posts( $args );
|
1095 |
|
1096 |
$output = array();
|
includes/sp-formatting-functions.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
-
* @version
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -96,6 +96,17 @@ function sp_sort_random() {
|
|
96 |
return mt_rand( 0, 1 );
|
97 |
}
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
/**
|
100 |
* let_to_num function.
|
101 |
*
|
@@ -143,6 +154,27 @@ function sp_time_format() {
|
|
143 |
return apply_filters( 'sportspress_time_format', get_option( 'time_format' ) );
|
144 |
}
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
if ( ! function_exists( 'sp_rgb_from_hex' ) ) {
|
147 |
|
148 |
/**
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
+
* @version 2.4
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
96 |
return mt_rand( 0, 1 );
|
97 |
}
|
98 |
|
99 |
+
/**
|
100 |
+
* Sort array by name field.
|
101 |
+
*
|
102 |
+
* @access public
|
103 |
+
* @param array $array
|
104 |
+
* @return bool
|
105 |
+
*/
|
106 |
+
function sp_sort_by_name( $a, $b ) {
|
107 |
+
return strcmp( $a['name'], $b['name'] );
|
108 |
+
}
|
109 |
+
|
110 |
/**
|
111 |
* let_to_num function.
|
112 |
*
|
154 |
return apply_filters( 'sportspress_time_format', get_option( 'time_format' ) );
|
155 |
}
|
156 |
|
157 |
+
if ( ! function_exists( 'sp_time_from_int' ) ) {
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Convert number of seconds to formatted time
|
161 |
+
*
|
162 |
+
* @access public
|
163 |
+
* @param mixed $value
|
164 |
+
* @return string
|
165 |
+
*/
|
166 |
+
function sp_time_value( $value = 0 ) {
|
167 |
+
$intval = intval( $value );
|
168 |
+
$timeval = gmdate( 'i:s', $intval );
|
169 |
+
$hours = floor( $intval / 3600 );
|
170 |
+
|
171 |
+
if ( '00' != $hours )
|
172 |
+
$timeval = $hours . ':' . $timeval;
|
173 |
+
|
174 |
+
return preg_replace( '/^0/', '', $timeval );
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
if ( ! function_exists( 'sp_rgb_from_hex' ) ) {
|
179 |
|
180 |
/**
|
includes/sp-template-functions.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
-
* @version
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -330,7 +330,12 @@ if ( ! function_exists( 'sportspress_output_league_table' ) ) {
|
|
330 |
* @return void
|
331 |
*/
|
332 |
function sportspress_output_league_table() {
|
333 |
-
|
|
|
|
|
|
|
|
|
|
|
334 |
}
|
335 |
}
|
336 |
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
+
* @version 2.4
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
330 |
* @return void
|
331 |
*/
|
332 |
function sportspress_output_league_table() {
|
333 |
+
$id = get_the_ID();
|
334 |
+
$format = get_post_meta( $id, 'sp_format', true );
|
335 |
+
if ( array_key_exists( $format, SP()->formats->table ) && 'standings' !== $format )
|
336 |
+
sp_get_template( 'team-' . $format . '.php', array( 'id' => $id ) );
|
337 |
+
else
|
338 |
+
sp_get_template( 'league-table.php', array( 'id' => $id ) );
|
339 |
}
|
340 |
}
|
341 |
|
includes/widgets/class-sp-widget-team-gallery.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class SP_Widget_Team_Gallery extends WP_Widget {
|
3 |
+
|
4 |
+
function __construct() {
|
5 |
+
$widget_ops = array('classname' => 'widget_sportspress widget_team_gallery widget_sp_team_gallery', 'description' => __( 'Display a gallery of teams.', 'sportspress' ) );
|
6 |
+
parent::__construct('sportspress-team-gallery', __( 'Team Gallery', 'sportspress' ), $widget_ops);
|
7 |
+
}
|
8 |
+
|
9 |
+
function widget( $args, $instance ) {
|
10 |
+
extract($args);
|
11 |
+
|
12 |
+
$id = empty($instance['id']) ? 0 : $instance['id'];
|
13 |
+
|
14 |
+
if ( $id <= 0 ) return;
|
15 |
+
|
16 |
+
if ( 'yes' == get_option( 'sportspress_widget_unique', 'no' ) && get_the_ID() === $id ) {
|
17 |
+
$format = get_post_meta( $id, 'sp_format', true );
|
18 |
+
if ( 'gallery' == $format ) return;
|
19 |
+
}
|
20 |
+
|
21 |
+
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
|
22 |
+
$caption = empty($instance['caption']) ? null : $instance['caption'];
|
23 |
+
$number = empty($instance['number']) ? null : $instance['number'];
|
24 |
+
$columns = empty($instance['columns']) ? null : $instance['columns'];
|
25 |
+
$orderby = empty($instance['orderby']) ? 'default' : $instance['orderby'];
|
26 |
+
$show_all_teams_link = empty($instance['show_all_teams_link']) ? false : $instance['show_all_teams_link'];
|
27 |
+
|
28 |
+
do_action( 'sportspress_before_widget', $args, $instance, 'team-gallery' );
|
29 |
+
echo $before_widget;
|
30 |
+
|
31 |
+
if ( $title )
|
32 |
+
echo $before_title . $title . $after_title;
|
33 |
+
|
34 |
+
// Action to hook into
|
35 |
+
do_action( 'sportspress_before_widget_template', $args, $instance, 'team-gallery' );
|
36 |
+
|
37 |
+
sp_get_template( 'team-gallery.php', array( 'id' => $id, 'title' => $caption, 'number' => $number, 'columns' => $columns, 'orderby' => $orderby , 'grouping' => 0, 'show_all_teams_link' => $show_all_teams_link ) );
|
38 |
+
|
39 |
+
// Action to hook into
|
40 |
+
do_action( 'sportspress_after_widget_template', $args, $instance, 'team-gallery' );
|
41 |
+
|
42 |
+
echo $after_widget;
|
43 |
+
do_action( 'sportspress_after_widget', $args, $instance, 'team-gallery' );
|
44 |
+
}
|
45 |
+
|
46 |
+
function update( $new_instance, $old_instance ) {
|
47 |
+
$instance = $old_instance;
|
48 |
+
$instance['title'] = strip_tags($new_instance['title']);
|
49 |
+
$instance['id'] = intval($new_instance['id']);
|
50 |
+
$instance['caption'] = strip_tags($new_instance['caption']);
|
51 |
+
$instance['number'] = intval($new_instance['number']);
|
52 |
+
$instance['columns'] = intval($new_instance['columns']);
|
53 |
+
$instance['orderby'] = strip_tags($new_instance['orderby']);
|
54 |
+
$instance['show_all_teams_link'] = $new_instance['show_all_teams_link'];
|
55 |
+
|
56 |
+
// Filter to hook into
|
57 |
+
$instance = apply_filters( 'sportspress_widget_update', $instance, $new_instance, $old_instance, 'team-gallery' );
|
58 |
+
|
59 |
+
return $instance;
|
60 |
+
}
|
61 |
+
|
62 |
+
function form( $instance ) {
|
63 |
+
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'caption' => '', 'number' => 5, 'columns' => 2, 'orderby' => 'default', 'show_all_teams_link' => true ) );
|
64 |
+
$title = strip_tags($instance['title']);
|
65 |
+
$id = intval($instance['id']);
|
66 |
+
$caption = strip_tags($instance['caption']);
|
67 |
+
$number = intval($instance['number']);
|
68 |
+
$columns = intval($instance['columns']);
|
69 |
+
$orderby = strip_tags($instance['orderby']);
|
70 |
+
$show_all_teams_link = $instance['show_all_teams_link'];
|
71 |
+
|
72 |
+
// Action to hook into
|
73 |
+
do_action( 'sportspress_before_widget_template_form', $this, $instance, 'team-gallery' );
|
74 |
+
?>
|
75 |
+
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
|
76 |
+
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
|
77 |
+
|
78 |
+
<p><label for="<?php echo $this->get_field_id('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
|
79 |
+
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
|
80 |
+
|
81 |
+
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'League Table', 'sportspress' ) ); ?></label>
|
82 |
+
<?php
|
83 |
+
$args = array(
|
84 |
+
'post_type' => 'sp_table',
|
85 |
+
'name' => $this->get_field_name('id'),
|
86 |
+
'id' => $this->get_field_id('id'),
|
87 |
+
'selected' => $id,
|
88 |
+
'values' => 'ID',
|
89 |
+
'class' => 'widefat',
|
90 |
+
);
|
91 |
+
if ( ! sp_dropdown_pages( $args ) ):
|
92 |
+
sp_post_adder( 'sp_table', __( 'Add New', 'sportspress' ) );
|
93 |
+
endif;
|
94 |
+
?>
|
95 |
+
</p>
|
96 |
+
|
97 |
+
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e( 'Number of teams to show:', 'sportspress' ); ?></label>
|
98 |
+
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo esc_attr($number); ?>" size="3"></p>
|
99 |
+
|
100 |
+
<p><label for="<?php echo $this->get_field_id('columns'); ?>"><?php _e( 'Columns:', 'sportspress' ); ?></label>
|
101 |
+
<input id="<?php echo $this->get_field_id('columns'); ?>" name="<?php echo $this->get_field_name('columns'); ?>" type="text" value="<?php echo esc_attr($columns); ?>" size="3"></p>
|
102 |
+
|
103 |
+
<p><label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e( 'Sort by:', 'sportspress' ); ?></label>
|
104 |
+
<select id="<?php echo $this->get_field_id('orderby'); ?>" name="<?php echo $this->get_field_name('orderby'); ?>">
|
105 |
+
<option value="default" <?php selected( 'default', $orderby ); ?>><?php _e( 'Rank', 'sportspress' ); ?></option>
|
106 |
+
<option value="name" <?php selected( 'name', $orderby ); ?>><?php _e( 'Alphabetical', 'sportspress' ); ?></option>
|
107 |
+
<option value="rand" <?php selected( 'rand', $orderby ); ?>><?php _e( 'Random', 'sportspress' ); ?></option>
|
108 |
+
</select></p>
|
109 |
+
|
110 |
+
<p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_teams_link'); ?>" name="<?php echo $this->get_field_name('show_all_teams_link'); ?>" value="1" <?php checked( $show_all_teams_link, 1 ); ?>>
|
111 |
+
<label for="<?php echo $this->get_field_id('show_all_teams_link'); ?>"><?php _e( 'Display link to view all teams', 'sportspress' ); ?></label></p>
|
112 |
+
|
113 |
+
<?php
|
114 |
+
// Action to hook into
|
115 |
+
do_action( 'sportspress_after_widget_template_form', $this, $instance, 'team-gallery' );
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
register_widget( 'SP_Widget_Team_Gallery' );
|
modules/sportspress-league-tables.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Add league tables to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
-
Version: 2.
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_League_Tables' ) ) :
|
|
17 |
* Main SportsPress League Tables Class
|
18 |
*
|
19 |
* @class SportsPress_League_Tables
|
20 |
-
* @version 2.
|
21 |
*/
|
22 |
class SportsPress_League_Tables {
|
23 |
|
@@ -48,7 +48,7 @@ class SportsPress_League_Tables {
|
|
48 |
*/
|
49 |
private function define_constants() {
|
50 |
if ( !defined( 'SP_LEAGUE_TABLES_VERSION' ) )
|
51 |
-
define( 'SP_LEAGUE_TABLES_VERSION', '2.
|
52 |
|
53 |
if ( !defined( 'SP_LEAGUE_TABLES_URL' ) )
|
54 |
define( 'SP_LEAGUE_TABLES_URL', plugin_dir_url( __FILE__ ) );
|
@@ -118,6 +118,7 @@ class SportsPress_League_Tables {
|
|
118 |
*/
|
119 |
public function include_widgets() {
|
120 |
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-league-table.php' );
|
|
|
121 |
}
|
122 |
|
123 |
/**
|
@@ -185,6 +186,13 @@ class SportsPress_League_Tables {
|
|
185 |
'context' => 'side',
|
186 |
'priority' => 'default',
|
187 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
'details' => array(
|
189 |
'title' => __( 'Details', 'sportspress' ),
|
190 |
'save' => 'SP_Meta_Box_Table_Details::save',
|
@@ -209,7 +217,8 @@ class SportsPress_League_Tables {
|
|
209 |
* @return array
|
210 |
*/
|
211 |
public function add_shortcodes( $shortcodes ) {
|
212 |
-
$shortcodes['
|
|
|
213 |
return $shortcodes;
|
214 |
}
|
215 |
|
5 |
Description: Add league tables to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.4
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress League Tables Class
|
18 |
*
|
19 |
* @class SportsPress_League_Tables
|
20 |
+
* @version 2.4
|
21 |
*/
|
22 |
class SportsPress_League_Tables {
|
23 |
|
48 |
*/
|
49 |
private function define_constants() {
|
50 |
if ( !defined( 'SP_LEAGUE_TABLES_VERSION' ) )
|
51 |
+
define( 'SP_LEAGUE_TABLES_VERSION', '2.4' );
|
52 |
|
53 |
if ( !defined( 'SP_LEAGUE_TABLES_URL' ) )
|
54 |
define( 'SP_LEAGUE_TABLES_URL', plugin_dir_url( __FILE__ ) );
|
118 |
*/
|
119 |
public function include_widgets() {
|
120 |
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-league-table.php' );
|
121 |
+
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-team-gallery.php' );
|
122 |
}
|
123 |
|
124 |
/**
|
186 |
'context' => 'side',
|
187 |
'priority' => 'default',
|
188 |
),
|
189 |
+
'format' => array(
|
190 |
+
'title' => __( 'Layout', 'sportspress' ),
|
191 |
+
'save' => 'SP_Meta_Box_Table_Format::save',
|
192 |
+
'output' => 'SP_Meta_Box_Table_Format::output',
|
193 |
+
'context' => 'side',
|
194 |
+
'priority' => 'default',
|
195 |
+
),
|
196 |
'details' => array(
|
197 |
'title' => __( 'Details', 'sportspress' ),
|
198 |
'save' => 'SP_Meta_Box_Table_Details::save',
|
217 |
* @return array
|
218 |
*/
|
219 |
public function add_shortcodes( $shortcodes ) {
|
220 |
+
$shortcodes['team'][] = 'standings';
|
221 |
+
$shortcodes['team'][] = 'gallery';
|
222 |
return $shortcodes;
|
223 |
}
|
224 |
|
modules/sportspress-user-registration.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Create a new player during user registration.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
-
Version: 2.
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_User_Registration' ) ) :
|
|
17 |
* Main SportsPress User Registration Class
|
18 |
*
|
19 |
* @class SportsPress_User_Registration
|
20 |
-
* @version 2.
|
21 |
*/
|
22 |
class SportsPress_User_Registration {
|
23 |
|
@@ -39,7 +39,7 @@ class SportsPress_User_Registration {
|
|
39 |
*/
|
40 |
private function define_constants() {
|
41 |
if ( !defined( 'SP_USER_REGISTRATION_VERSION' ) )
|
42 |
-
define( 'SP_USER_REGISTRATION_VERSION', '2.
|
43 |
|
44 |
if ( !defined( 'SP_USER_REGISTRATION_URL' ) )
|
45 |
define( 'SP_USER_REGISTRATION_URL', plugin_dir_url( __FILE__ ) );
|
@@ -64,6 +64,22 @@ class SportsPress_User_Registration {
|
|
64 |
'checkboxgroup' => 'start',
|
65 |
),
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
array(
|
68 |
'desc' => __( 'Create player profiles for new users', 'sportspress' ),
|
69 |
'id' => 'sportspress_registration_add_player',
|
@@ -85,16 +101,35 @@ class SportsPress_User_Registration {
|
|
85 |
$last_name = ( ! empty( $_POST['last_name'] ) ) ? trim( $_POST['last_name'] ) : '';
|
86 |
?>
|
87 |
<p>
|
88 |
-
<label for="first_name"><?php _e( 'First Name', '
|
89 |
-
|
90 |
</p>
|
91 |
|
92 |
<p>
|
93 |
-
<label for="last_name"><?php _e( 'Last Name', '
|
94 |
-
|
95 |
</p>
|
96 |
<?php
|
97 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
|
100 |
/**
|
@@ -118,6 +153,27 @@ class SportsPress_User_Registration {
|
|
118 |
}
|
119 |
}
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
// Add player
|
122 |
if ( 'yes' === get_option( 'sportspress_registration_add_player', 'no' ) ) {
|
123 |
if ( ! sizeof( $parts ) && ! empty( $_POST['user_login'] ) ) {
|
@@ -129,8 +185,13 @@ class SportsPress_User_Registration {
|
|
129 |
$post['post_type'] = 'sp_player';
|
130 |
$post['post_title'] = trim( $name );
|
131 |
$post['post_author'] = $user_id;
|
132 |
-
$post['post_status'] = '
|
133 |
$id = wp_insert_post( $post );
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
}
|
136 |
}
|
5 |
Description: Create a new player during user registration.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.4
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress User Registration Class
|
18 |
*
|
19 |
* @class SportsPress_User_Registration
|
20 |
+
* @version 2.4
|
21 |
*/
|
22 |
class SportsPress_User_Registration {
|
23 |
|
39 |
*/
|
40 |
private function define_constants() {
|
41 |
if ( !defined( 'SP_USER_REGISTRATION_VERSION' ) )
|
42 |
+
define( 'SP_USER_REGISTRATION_VERSION', '2.4' );
|
43 |
|
44 |
if ( !defined( 'SP_USER_REGISTRATION_URL' ) )
|
45 |
define( 'SP_USER_REGISTRATION_URL', plugin_dir_url( __FILE__ ) );
|
64 |
'checkboxgroup' => 'start',
|
65 |
),
|
66 |
|
67 |
+
array(
|
68 |
+
'desc' => __( 'Add a team name field to signup form', 'sportspress' ),
|
69 |
+
'id' => 'sportspress_registration_team_input',
|
70 |
+
'default' => 'no',
|
71 |
+
'type' => 'checkbox',
|
72 |
+
'checkboxgroup' => '',
|
73 |
+
),
|
74 |
+
|
75 |
+
array(
|
76 |
+
'desc' => __( 'Add a team selector to signup form', 'sportspress' ),
|
77 |
+
'id' => 'sportspress_registration_team_select',
|
78 |
+
'default' => 'no',
|
79 |
+
'type' => 'checkbox',
|
80 |
+
'checkboxgroup' => '',
|
81 |
+
),
|
82 |
+
|
83 |
array(
|
84 |
'desc' => __( 'Create player profiles for new users', 'sportspress' ),
|
85 |
'id' => 'sportspress_registration_add_player',
|
101 |
$last_name = ( ! empty( $_POST['last_name'] ) ) ? trim( $_POST['last_name'] ) : '';
|
102 |
?>
|
103 |
<p>
|
104 |
+
<label for="first_name"><?php _e( 'First Name', 'sportspress' ) ?><br />
|
105 |
+
<input type="text" name="first_name" id="first_name" class="input" value="<?php echo esc_attr( wp_unslash( $first_name ) ); ?>" size="25" /></label>
|
106 |
</p>
|
107 |
|
108 |
<p>
|
109 |
+
<label for="last_name"><?php _e( 'Last Name', 'sportspress' ) ?><br />
|
110 |
+
<input type="text" name="last_name" id="last_name" class="input" value="<?php echo esc_attr( wp_unslash( $last_name ) ); ?>" size="25" /></label>
|
111 |
</p>
|
112 |
<?php
|
113 |
}
|
114 |
+
|
115 |
+
if ( 'yes' === get_option( 'sportspress_registration_team_select', 'no' ) ) {
|
116 |
+
?>
|
117 |
+
<p>
|
118 |
+
<label for="sp_team"><?php _e( 'Team', 'sportspress' ) ?><br />
|
119 |
+
<?php
|
120 |
+
$args = array(
|
121 |
+
'post_type' => 'sp_team',
|
122 |
+
'name' => 'sp_team',
|
123 |
+
'values' => 'ID',
|
124 |
+
'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Team', 'sportspress' ) ),
|
125 |
+
'property' => 'style="width:100%;height:36px;margin-bottom:16px"',
|
126 |
+
);
|
127 |
+
sp_dropdown_pages( $args );
|
128 |
+
?>
|
129 |
+
</p>
|
130 |
+
<?php
|
131 |
+
wp_nonce_field( 'submit_team', 'sp_register_form_player' );
|
132 |
+
}
|
133 |
}
|
134 |
|
135 |
/**
|
153 |
}
|
154 |
}
|
155 |
|
156 |
+
// Add team from team name
|
157 |
+
if ( isset( $_POST['sp_register_form_team'] ) && wp_verify_nonce( $_POST['sp_register_form_team'], 'submit_team_name' ) ) {
|
158 |
+
if ( ! empty( $_POST['team_name'] ) ) {
|
159 |
+
$team_name = trim( $_POST['team_name'] );
|
160 |
+
$post['post_type'] = 'sp_team';
|
161 |
+
$post['post_title'] = $team_name;
|
162 |
+
$post['post_author'] = $user_id;
|
163 |
+
$post['post_status'] = 'draft';
|
164 |
+
$id = wp_insert_post( $post );
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
// Save team
|
169 |
+
if ( isset( $_POST['sp_register_form_player'] ) && wp_verify_nonce( $_POST['sp_register_form_player'], 'submit_team' ) ) {
|
170 |
+
if ( ! empty( $_POST['sp_team'] ) ) {
|
171 |
+
$team = trim( $_POST['sp_team'] );
|
172 |
+
if ( $team <= 0 ) $team = 0;
|
173 |
+
update_user_meta( $user_id, 'sp_team', $team );
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
// Add player
|
178 |
if ( 'yes' === get_option( 'sportspress_registration_add_player', 'no' ) ) {
|
179 |
if ( ! sizeof( $parts ) && ! empty( $_POST['user_login'] ) ) {
|
185 |
$post['post_type'] = 'sp_player';
|
186 |
$post['post_title'] = trim( $name );
|
187 |
$post['post_author'] = $user_id;
|
188 |
+
$post['post_status'] = 'draft';
|
189 |
$id = wp_insert_post( $post );
|
190 |
+
|
191 |
+
if ( isset( $team ) && $team ) {
|
192 |
+
update_post_meta( $id, 'sp_team', $team );
|
193 |
+
update_post_meta( $id, 'sp_current_team', $team );
|
194 |
+
}
|
195 |
}
|
196 |
}
|
197 |
}
|
modules/sportspress-wordpay.php
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: SportsPress WordPay
|
4 |
+
Plugin URI: http://themeboy.com/
|
5 |
+
Description: Add team and player registration shortcodes to WordPay.
|
6 |
+
Author: ThemeBoy
|
7 |
+
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.4.1
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
if ( ! class_exists( 'SportsPress_WordPay' ) ) :
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Main SportsPress WordPay Class
|
18 |
+
*
|
19 |
+
* @class SportsPress_WordPay
|
20 |
+
* @version 2.4.1
|
21 |
+
*/
|
22 |
+
class SportsPress_WordPay {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Constructor
|
26 |
+
*/
|
27 |
+
public function __construct() {
|
28 |
+
// Define constants
|
29 |
+
$this->define_constants();
|
30 |
+
|
31 |
+
// Shortcode
|
32 |
+
add_action( 'init', array( $this, 'add_shortcodes' ) );
|
33 |
+
add_action( 'wpay_register_form_after_fields', array( $this, 'form_field' ) );
|
34 |
+
|
35 |
+
// Editor
|
36 |
+
add_filter( 'wordpay_shortcodes', array( $this, 'editor_shortcodes' ) );
|
37 |
+
add_filter( 'wordpay_tinymce_strings', array( $this, 'editor_strings' ) );
|
38 |
+
|
39 |
+
// Widgets
|
40 |
+
add_action( 'wordpay_after_widget_register_form', array( $this, 'widget_form' ), 10, 2 );
|
41 |
+
add_filter( 'wordpay_widget_register_update', array( $this, 'widget_update' ), 10, 2 );
|
42 |
+
add_filter( 'wordpay_widget_register_shortcode', array( $this, 'widget_shortcode' ), 10, 2 );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Define constants.
|
47 |
+
*/
|
48 |
+
private function define_constants() {
|
49 |
+
if ( !defined( 'SP_WORDPAY_VERSION' ) )
|
50 |
+
define( 'SP_WORDPAY_VERSION', '2.4.1' );
|
51 |
+
|
52 |
+
if ( !defined( 'SP_WORDPAY_URL' ) )
|
53 |
+
define( 'SP_WORDPAY_URL', plugin_dir_url( __FILE__ ) );
|
54 |
+
|
55 |
+
if ( !defined( 'SP_WORDPAY_DIR' ) )
|
56 |
+
define( 'SP_WORDPAY_DIR', plugin_dir_path( __FILE__ ) );
|
57 |
+
}
|
58 |
+
/**
|
59 |
+
* Add team and player registration shortcodes.
|
60 |
+
*/
|
61 |
+
public function add_shortcodes() {
|
62 |
+
add_shortcode( 'wpay-register-team', array( $this, 'register_team' ) );
|
63 |
+
add_shortcode( 'wpay-register-player', array( $this, 'register_player' ) );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Team registration shortcode.
|
68 |
+
*/
|
69 |
+
public static function register_team( $atts = array() ) {
|
70 |
+
$args = array(
|
71 |
+
'post_type' => 'wpay-subscription',
|
72 |
+
'post_status' => 'active',
|
73 |
+
'posts_per_page' => 500,
|
74 |
+
'meta_query' => array(
|
75 |
+
array(
|
76 |
+
'key' => 'wpay_subscription_plan_user_role',
|
77 |
+
'value' => 'sp_team_manager',
|
78 |
+
),
|
79 |
+
),
|
80 |
+
'fields' => 'ids',
|
81 |
+
);
|
82 |
+
|
83 |
+
$plans = get_posts( $args );
|
84 |
+
|
85 |
+
if ( empty( $plans ) ) {
|
86 |
+
return '<p>' . __( 'There are no plans associated with the Team Manager role.', 'sportspress' ) . '<p>';
|
87 |
+
}
|
88 |
+
|
89 |
+
return self::register_form( $atts, 'team', $plans );
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Player registration shortcode.
|
94 |
+
*/
|
95 |
+
public static function register_player( $atts = array() ) {
|
96 |
+
$args = array(
|
97 |
+
'post_type' => 'wpay-subscription',
|
98 |
+
'post_status' => 'active',
|
99 |
+
'posts_per_page' => 500,
|
100 |
+
'meta_query' => array(
|
101 |
+
array(
|
102 |
+
'key' => 'wpay_subscription_plan_user_role',
|
103 |
+
'value' => 'sp_player',
|
104 |
+
),
|
105 |
+
),
|
106 |
+
'fields' => 'ids',
|
107 |
+
);
|
108 |
+
|
109 |
+
$plans = get_posts( $args );
|
110 |
+
|
111 |
+
if ( empty( $plans ) ) {
|
112 |
+
return '<p>' . __( 'There are no plans associated with the Player role.', 'sportspress' ) . '<p>';
|
113 |
+
}
|
114 |
+
|
115 |
+
return self::register_form( $atts, 'player', $plans );
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Registration form template.
|
120 |
+
*/
|
121 |
+
public static function register_form( $atts = array(), $context = '', $plans = array() ) {
|
122 |
+
|
123 |
+
$atts = shortcode_atts( array(
|
124 |
+
'plans_position' => 'bottom',
|
125 |
+
'selected' => '',
|
126 |
+
), $atts );
|
127 |
+
|
128 |
+
$atts['subscription_plans'] = implode( ',', $plans );
|
129 |
+
|
130 |
+
$atts['context'] = $context;
|
131 |
+
|
132 |
+
$shortcode = '[wpay-register';
|
133 |
+
|
134 |
+
foreach ( $atts as $key => $value ) {
|
135 |
+
$shortcode .= ' ' . $key . '="' . esc_attr( $value ) . '"';
|
136 |
+
}
|
137 |
+
|
138 |
+
$shortcode .= ']';
|
139 |
+
|
140 |
+
return do_shortcode( $shortcode );
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Add field to registration form.
|
145 |
+
*/
|
146 |
+
public static function form_field( $atts = array() ) {
|
147 |
+
if ( 'team' == $atts['context'] ) {
|
148 |
+
?>
|
149 |
+
<li class="wpay-field">
|
150 |
+
<label for="wpay_team_name"><?php _e( 'Team Name', 'sportspress' ); ?></label>
|
151 |
+
<input id="wpay_team_name" name="team_name" type="text" value="">
|
152 |
+
</li>
|
153 |
+
<?php
|
154 |
+
wp_nonce_field( 'submit_team_name', 'sp_register_form_team' );
|
155 |
+
} elseif ( 'player' == $atts['context'] ) {
|
156 |
+
?>
|
157 |
+
<li class="wpay-field">
|
158 |
+
<label for="sp_team"><?php _e( 'Team', 'sportspress' ); ?></label>
|
159 |
+
<?php
|
160 |
+
$args = array(
|
161 |
+
'post_type' => 'sp_team',
|
162 |
+
'name' => 'sp_team',
|
163 |
+
'values' => 'ID',
|
164 |
+
'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Team', 'sportspress' ) ),
|
165 |
+
'class' => 'widefat',
|
166 |
+
);
|
167 |
+
sp_dropdown_pages( $args );
|
168 |
+
?>
|
169 |
+
</li>
|
170 |
+
<?php
|
171 |
+
wp_nonce_field( 'submit_team', 'sp_register_form_player' );
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Add shortcodes to editor.
|
177 |
+
*/
|
178 |
+
public static function editor_shortcodes( $shortcodes = array() ) {
|
179 |
+
$shortcodes[] = 'register_team';
|
180 |
+
$shortcodes[] = 'register_player';
|
181 |
+
return $shortcodes;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Add strings to editor.
|
186 |
+
*/
|
187 |
+
public static function editor_strings( $strings = array() ) {
|
188 |
+
$strings['register_team'] = __( 'Register Team', 'sportspress' );
|
189 |
+
$strings['register_player'] = __( 'Register Player', 'sportspress' );
|
190 |
+
return $strings;
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Add selector to widget form.
|
195 |
+
*/
|
196 |
+
public static function widget_form( $widget, $instance = array() ) {
|
197 |
+
$contexts = array(
|
198 |
+
'' => __( 'Members', 'sportspress' ),
|
199 |
+
'team' => __( 'Teams', 'sportspress' ),
|
200 |
+
'player' => __( 'Players', 'sportspress' ),
|
201 |
+
);
|
202 |
+
?>
|
203 |
+
<p>
|
204 |
+
<label for="<?php echo $widget->get_field_id('context'); ?>"><?php _e( 'For:', 'sportspress' ); ?></label>
|
205 |
+
<select id="<?php echo $widget->get_field_id('context'); ?>" name="<?php echo $widget->get_field_name('context'); ?>">
|
206 |
+
<?php foreach ( $contexts as $value => $label ) { ?>
|
207 |
+
<option value="<?php echo $value; ?>" <?php selected( $value, sp_array_value( $instance, 'context' ) ); ?>><?php echo $label; ?></option>
|
208 |
+
<?php } ?>
|
209 |
+
</select>
|
210 |
+
</p>
|
211 |
+
<?php
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Update widget form.
|
216 |
+
*/
|
217 |
+
public static function widget_update( $instance = array(), $new_instance = array() ) {
|
218 |
+
$instance['context'] = strip_tags($new_instance['context']);
|
219 |
+
return $instance;
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Modify widget shortcode.
|
224 |
+
*/
|
225 |
+
public static function widget_shortcode( $shortcode = '[wpay-register]', $instance = array() ) {
|
226 |
+
if ( ! empty( $instance['context'] ) && in_array( $instance['context'], array( 'team', 'player' ) ) ) {
|
227 |
+
$shortcode = str_replace( 'wpay-register', 'wpay-register-' . $instance['context'], $shortcode );
|
228 |
+
}
|
229 |
+
return $shortcode;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
endif;
|
234 |
+
|
235 |
+
if ( get_option( 'sportspress_load_wordpay_module', 'yes' ) == 'yes' ) {
|
236 |
+
new SportsPress_WordPay();
|
237 |
+
}
|
presets/esports/csgo.json
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
"metrics": [
|
17 |
],
|
18 |
"statistics": [
|
19 |
-
{ "name" : "KDA Ratio", "equation" : "( $kills + $assists ) / $deaths", "precision" : 2, "description" : "Kills/deaths/assists ratio" }
|
20 |
],
|
21 |
"options": {
|
22 |
"mode" : "team"
|
16 |
"metrics": [
|
17 |
],
|
18 |
"statistics": [
|
19 |
+
{ "name" : "KDA Ratio", "equation" : "( $kills + $assists ) / $deaths", "precision" : 2, "type" : "average", "description" : "Kills/deaths/assists ratio" }
|
20 |
],
|
21 |
"options": {
|
22 |
"mode" : "team"
|
presets/esports/dota2.json
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
"statistics": [
|
21 |
{ "name" : "Wins", "equation" : "$win" },
|
22 |
{ "name" : "Losses", "equation" : "$loss" },
|
23 |
-
{ "name" : "Winrate", "equation" : "$win / $eventsplayed * 100" }
|
24 |
],
|
25 |
"options": {
|
26 |
"mode" : "team"
|
20 |
"statistics": [
|
21 |
{ "name" : "Wins", "equation" : "$win" },
|
22 |
{ "name" : "Losses", "equation" : "$loss" },
|
23 |
+
{ "name" : "Winrate", "equation" : "$win / $eventsplayed * 100", "type" : "average" }
|
24 |
],
|
25 |
"options": {
|
26 |
"mode" : "team"
|
presets/esports/lol.json
CHANGED
@@ -23,9 +23,9 @@
|
|
23 |
"metrics": [
|
24 |
],
|
25 |
"statistics": [
|
26 |
-
{ "name" : "Avg. KDA Ratio", "equation" : "( $kills + $assists ) / $deaths", "precision" : 1, "description" : "Average kills/deaths/assists ratio" },
|
27 |
-
{ "name" : "Avg. Gold per Min", "equation" : "$gold / $eventminutes", "description" : "Average gold per minute" },
|
28 |
-
{ "name" : "Avg. Total Gold", "equation" : "$gold / $eventsplayed", "description" : "Average total gold" }
|
29 |
],
|
30 |
"options": {
|
31 |
"mode" : "team"
|
23 |
"metrics": [
|
24 |
],
|
25 |
"statistics": [
|
26 |
+
{ "name" : "Avg. KDA Ratio", "equation" : "( $kills + $assists ) / $deaths", "precision" : 1, "type" : "average", "description" : "Average kills/deaths/assists ratio" },
|
27 |
+
{ "name" : "Avg. Gold per Min", "equation" : "$gold / $eventminutes", "type" : "average", "description" : "Average gold per minute" },
|
28 |
+
{ "name" : "Avg. Total Gold", "equation" : "$gold / $eventsplayed", "type" : "average", "description" : "Average total gold" }
|
29 |
],
|
30 |
"options": {
|
31 |
"mode" : "team"
|
presets/target-sports/snooker.json
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
"statistics": [
|
26 |
{ "name" : "Games Played", "equation" : "$eventsplayed" },
|
27 |
{ "name" : "Games Won", "equation" : "$win" },
|
28 |
-
{ "name" : "Win Percentage", "equation" : "$win / $eventsplayed * 100", "precision" : 2 }
|
29 |
],
|
30 |
"options": {
|
31 |
"mode" : "player"
|
25 |
"statistics": [
|
26 |
{ "name" : "Games Played", "equation" : "$eventsplayed" },
|
27 |
{ "name" : "Games Won", "equation" : "$win" },
|
28 |
+
{ "name" : "Win Percentage", "equation" : "$win / $eventsplayed * 100", "precision" : 2, "type" : "average" }
|
29 |
],
|
30 |
"options": {
|
31 |
"mode" : "player"
|
presets/team-sports/baseball.json
CHANGED
@@ -71,7 +71,7 @@
|
|
71 |
],
|
72 |
"statistics": [
|
73 |
{ "name" : "G", "equation" : "$eventsplayed", "description" : "Games played" },
|
74 |
-
{ "name" : "AVG", "equation" : "$h / $ab", "precision" : 3, "description" : "Batting average" }
|
75 |
],
|
76 |
"options": {
|
77 |
"mode" : "team",
|
71 |
],
|
72 |
"statistics": [
|
73 |
{ "name" : "G", "equation" : "$eventsplayed", "description" : "Games played" },
|
74 |
+
{ "name" : "AVG", "equation" : "$h / $ab", "precision" : 3, "type" : "average", "description" : "Batting average" }
|
75 |
],
|
76 |
"options": {
|
77 |
"mode" : "team",
|
presets/team-sports/basketball.json
CHANGED
@@ -59,15 +59,15 @@
|
|
59 |
"statistics": [
|
60 |
{ "name" : "G", "equation" : "$eventsattended", "description" : "Games played" },
|
61 |
{ "name" : "GS", "equation" : "$eventsstarted", "description" : "Games started" },
|
62 |
-
{ "name" : "FG%", "equation" : "( $fgm / $fga ) * 100", "precision" : 3, "description" : "Field goal percentage" },
|
63 |
-
{ "name" : "FT%", "equation" : "( $ftm / $fta ) * 100", "precision" : 3, "description" : "Free throw percentage" },
|
64 |
-
{ "name" : "3P%", "equation" : "( $threepm / $threepa ) * 100", "precision" : 3, "description" : "3-pointer percentage" },
|
65 |
-
{ "name" : "RPG", "equation" : "( $off + $def ) / $eventsplayed", "precision" : 1, "description" : "Rebounds per game" },
|
66 |
-
{ "name" : "APG", "equation" : "$ast / $eventsplayed", "precision" : 1, "description" : "Assists per game" },
|
67 |
-
{ "name" : "SPG", "equation" : "$stl / $eventsplayed", "precision" : 1, "description" : "Steals per game" },
|
68 |
-
{ "name" : "BPG", "equation" : "$blk / $eventsplayed", "precision" : 1, "description" : "Blocks per game" },
|
69 |
-
{ "name" : "PPG", "equation" : "$pts / $eventsplayed", "precision" : 1, "description" : "Points per game" },
|
70 |
-
{ "name" : "EFF", "equation" : "$pts + $off + $def + $ast + $stl + $blk - $fga + $fgm - $fta + $ftm + $to", "description" : "Efficiency rating" }
|
71 |
],
|
72 |
"options": {
|
73 |
"mode" : "team"
|
59 |
"statistics": [
|
60 |
{ "name" : "G", "equation" : "$eventsattended", "description" : "Games played" },
|
61 |
{ "name" : "GS", "equation" : "$eventsstarted", "description" : "Games started" },
|
62 |
+
{ "name" : "FG%", "equation" : "( $fgm / $fga ) * 100", "precision" : 3, "type" : "average", "description" : "Field goal percentage" },
|
63 |
+
{ "name" : "FT%", "equation" : "( $ftm / $fta ) * 100", "precision" : 3, "type" : "average", "description" : "Free throw percentage" },
|
64 |
+
{ "name" : "3P%", "equation" : "( $threepm / $threepa ) * 100", "precision" : 3, "type" : "average", "description" : "3-pointer percentage" },
|
65 |
+
{ "name" : "RPG", "equation" : "( $off + $def ) / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Rebounds per game" },
|
66 |
+
{ "name" : "APG", "equation" : "$ast / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Assists per game" },
|
67 |
+
{ "name" : "SPG", "equation" : "$stl / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Steals per game" },
|
68 |
+
{ "name" : "BPG", "equation" : "$blk / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Blocks per game" },
|
69 |
+
{ "name" : "PPG", "equation" : "$pts / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Points per game" },
|
70 |
+
{ "name" : "EFF", "equation" : "$pts + $off + $def + $ast + $stl + $blk - $fga + $fgm - $fta + $ftm + $to", "type" : "average", "description" : "Efficiency rating" }
|
71 |
],
|
72 |
"options": {
|
73 |
"mode" : "team"
|
presets/team-sports/cricket.json
CHANGED
@@ -46,7 +46,7 @@
|
|
46 |
],
|
47 |
"statistics": [
|
48 |
{ "name" : "Mat", "equation" : "$eventsplayed", "description" : "Matches played" },
|
49 |
-
{ "name" : "SR", "equation" : "( $runs / $b ) * 100", "precision" : 2, "description" : "Strike Rate" }
|
50 |
],
|
51 |
"options": {
|
52 |
"mode" : "team",
|
46 |
],
|
47 |
"statistics": [
|
48 |
{ "name" : "Mat", "equation" : "$eventsplayed", "description" : "Matches played" },
|
49 |
+
{ "name" : "SR", "equation" : "( $runs / $b ) * 100", "precision" : 2, "type" : "average", "description" : "Strike Rate" }
|
50 |
],
|
51 |
"options": {
|
52 |
"mode" : "team",
|
presets/team-sports/floorball.json
CHANGED
@@ -50,9 +50,9 @@
|
|
50 |
"statistics": [
|
51 |
{ "name" : "GP", "equation" : "$eventsplayed", "description" : "Games played" },
|
52 |
{ "name" : "P", "equation" : "$g + $assists", "description" : "Points" },
|
53 |
-
{ "name" : "GAA", "equation" : "$ga / $eventsplayed", "precision" : 2, "description" : "Goals against average" },
|
54 |
-
{ "name" : "S%", "equation" : "$g / $s * 100", "precision" : 2, "description" : "Shot percentage" },
|
55 |
-
{ "name" : "SV%", "equation" : "$sv / $sa * 100", "precision" : 2, "description" : "Save percentage" }
|
56 |
],
|
57 |
"options": {
|
58 |
"mode" : "team"
|
50 |
"statistics": [
|
51 |
{ "name" : "GP", "equation" : "$eventsplayed", "description" : "Games played" },
|
52 |
{ "name" : "P", "equation" : "$g + $assists", "description" : "Points" },
|
53 |
+
{ "name" : "GAA", "equation" : "$ga / $eventsplayed", "precision" : 2, "type" : "average", "description" : "Goals against average" },
|
54 |
+
{ "name" : "S%", "equation" : "$g / $s * 100", "precision" : 2, "type" : "average", "description" : "Shot percentage" },
|
55 |
+
{ "name" : "SV%", "equation" : "$sv / $sa * 100", "precision" : 2, "type" : "average", "description" : "Save percentage" }
|
56 |
],
|
57 |
"options": {
|
58 |
"mode" : "team"
|
presets/team-sports/football.json
CHANGED
@@ -59,8 +59,8 @@
|
|
59 |
"statistics": [
|
60 |
{ "name" : "G", "equation" : "$eventsplayed", "description" : "Games played" },
|
61 |
{ "name" : "GS", "equation" : "$eventsstarted", "description" : "Games started" },
|
62 |
-
{ "name" : "Avg", "equation" : "$yds / $att", "precision" : 1, "description" : "Average yards per carry" },
|
63 |
-
{ "name" : "Rec Avg", "equation" : "$recyds / $rec", "precision" : 1, "description" : "Average yards per reception" }
|
64 |
],
|
65 |
"options": {
|
66 |
"mode" : "team"
|
59 |
"statistics": [
|
60 |
{ "name" : "G", "equation" : "$eventsplayed", "description" : "Games played" },
|
61 |
{ "name" : "GS", "equation" : "$eventsstarted", "description" : "Games started" },
|
62 |
+
{ "name" : "Avg", "equation" : "$yds / $att", "precision" : 1, "type" : "average", "description" : "Average yards per carry" },
|
63 |
+
{ "name" : "Rec Avg", "equation" : "$recyds / $rec", "precision" : 1, "type" : "average", "description" : "Average yards per reception" }
|
64 |
],
|
65 |
"options": {
|
66 |
"mode" : "team"
|
presets/team-sports/footy.json
CHANGED
@@ -44,13 +44,13 @@
|
|
44 |
],
|
45 |
"statistics": [
|
46 |
{ "name" : "Games played", "equation" : "$eventsplayed" },
|
47 |
-
{ "name" : "K", "equation" : "$kicks / $eventsplayed", "precision" : 1, "description" : "Average kicks per game" },
|
48 |
-
{ "name" : "H", "equation" : "$handballs / $eventsplayed", "precision" : 1, "description" : "Average handballs per game" },
|
49 |
-
{ "name" : "D", "equation" : "$disposals / $eventsplayed", "precision" : 1, "description" : "Average disposals per game" },
|
50 |
-
{ "name" : "M", "equation" : "$marks / $eventsplayed", "precision" : 1, "description" : "Average marks per game" },
|
51 |
-
{ "name" : "HO", "equation" : "$hitouts / $eventsplayed", "precision" : 1, "description" : "Average hitouts per game" },
|
52 |
-
{ "name" : "T", "equation" : "$tackles / $eventsplayed", "precision" : 1, "description" : "Average tackles per game" },
|
53 |
-
{ "name" : "G", "equation" : "$goals / $eventsplayed", "precision" : 1, "description" : "Average goals per game" }
|
54 |
],
|
55 |
"options": {
|
56 |
"mode" : "team"
|
44 |
],
|
45 |
"statistics": [
|
46 |
{ "name" : "Games played", "equation" : "$eventsplayed" },
|
47 |
+
{ "name" : "K", "equation" : "$kicks / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Average kicks per game" },
|
48 |
+
{ "name" : "H", "equation" : "$handballs / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Average handballs per game" },
|
49 |
+
{ "name" : "D", "equation" : "$disposals / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Average disposals per game" },
|
50 |
+
{ "name" : "M", "equation" : "$marks / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Average marks per game" },
|
51 |
+
{ "name" : "HO", "equation" : "$hitouts / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Average hitouts per game" },
|
52 |
+
{ "name" : "T", "equation" : "$tackles / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Average tackles per game" },
|
53 |
+
{ "name" : "G", "equation" : "$goals / $eventsplayed", "precision" : 1, "type" : "average", "description" : "Average goals per game" }
|
54 |
],
|
55 |
"options": {
|
56 |
"mode" : "team"
|
presets/team-sports/ice-hockey.json
CHANGED
@@ -53,8 +53,8 @@
|
|
53 |
"statistics": [
|
54 |
{ "name" : "GP", "equation" : "$eventsplayed", "description" : "Games played" },
|
55 |
{ "name" : "P", "equation" : "$g + $assists", "description" : "Points" },
|
56 |
-
{ "name" : "S%", "equation" : "$g / $s * 100", "precision" : 2, "description" : "Shot percentage" },
|
57 |
-
{ "name" : "SV%", "equation" : "$sv / $sa * 100", "precision" : 2, "description" : "Save percentage" }
|
58 |
],
|
59 |
"options": {
|
60 |
"mode" : "team",
|
53 |
"statistics": [
|
54 |
{ "name" : "GP", "equation" : "$eventsplayed", "description" : "Games played" },
|
55 |
{ "name" : "P", "equation" : "$g + $assists", "description" : "Points" },
|
56 |
+
{ "name" : "S%", "equation" : "$g / $s * 100", "precision" : 2, "type" : "average", "description" : "Shot percentage" },
|
57 |
+
{ "name" : "SV%", "equation" : "$sv / $sa * 100", "precision" : 2, "type" : "average", "description" : "Save percentage" }
|
58 |
],
|
59 |
"options": {
|
60 |
"mode" : "team",
|
presets/team-sports/lacrosse.json
CHANGED
@@ -43,8 +43,8 @@
|
|
43 |
],
|
44 |
"statistics": [
|
45 |
{ "name" : "Games", "equation" : "$eventsplayed", "description" : "Games played" },
|
46 |
-
{ "name" : "Shooting %", "equation" : "$goals / $shots", "precision" : 1, "description" : "Shooting percentage" },
|
47 |
-
{ "name" : "SoG %", "equation" : "$sog / $shots", "precision" : 1, "description" : "Shots on goal percentage" }
|
48 |
],
|
49 |
"options": {
|
50 |
"mode" : "team"
|
43 |
],
|
44 |
"statistics": [
|
45 |
{ "name" : "Games", "equation" : "$eventsplayed", "description" : "Games played" },
|
46 |
+
{ "name" : "Shooting %", "equation" : "$goals / $shots", "precision" : 1, "type" : "average", "description" : "Shooting percentage" },
|
47 |
+
{ "name" : "SoG %", "equation" : "$sog / $shots", "precision" : 1, "type" : "average", "description" : "Shots on goal percentage" }
|
48 |
],
|
49 |
"options": {
|
50 |
"mode" : "team"
|
presets/team-sports/soccer.json
CHANGED
@@ -38,9 +38,9 @@
|
|
38 |
],
|
39 |
"statistics": [
|
40 |
{ "name" : "Appearances", "equation" : "$eventsplayed", "description" : "Matches played" },
|
41 |
-
{ "name" : "Win Ratio", "equation" : "$win / $eventsplayed * 100", "precision" : 2, "description" : "Win ratio" },
|
42 |
-
{ "name" : "Draw Ratio", "equation" : "$draw / $eventsplayed * 100", "precision" : 2, "description" : "Draw ratio" },
|
43 |
-
{ "name" : "Loss Ratio", "equation" : "$loss / $eventsplayed * 100", "precision" : 2, "description" : "Loss ratio" }
|
44 |
],
|
45 |
"options": {
|
46 |
"mode" : "team",
|
38 |
],
|
39 |
"statistics": [
|
40 |
{ "name" : "Appearances", "equation" : "$eventsplayed", "description" : "Matches played" },
|
41 |
+
{ "name" : "Win Ratio", "equation" : "$win / $eventsplayed * 100", "precision" : 2, "type" : "average", "description" : "Win ratio" },
|
42 |
+
{ "name" : "Draw Ratio", "equation" : "$draw / $eventsplayed * 100", "precision" : 2, "type" : "average", "description" : "Draw ratio" },
|
43 |
+
{ "name" : "Loss Ratio", "equation" : "$loss / $eventsplayed * 100", "precision" : 2, "type" : "average", "description" : "Loss ratio" }
|
44 |
],
|
45 |
"options": {
|
46 |
"mode" : "team",
|
presets/team-sports/softball.json
CHANGED
@@ -68,7 +68,7 @@
|
|
68 |
],
|
69 |
"statistics": [
|
70 |
{ "name" : "G", "equation" : "$eventsplayed", "description" : "Games played" },
|
71 |
-
{ "name" : "AVG", "equation" : "$h / $ab", "precision" : 3, "description" : "Batting average" }
|
72 |
],
|
73 |
"options": {
|
74 |
"mode" : "team",
|
68 |
],
|
69 |
"statistics": [
|
70 |
{ "name" : "G", "equation" : "$eventsplayed", "description" : "Games played" },
|
71 |
+
{ "name" : "AVG", "equation" : "$h / $ab", "precision" : 3, "type" : "average", "description" : "Batting average" }
|
72 |
],
|
73 |
"options": {
|
74 |
"mode" : "team",
|
presets/team-sports/volleyball.json
CHANGED
@@ -45,9 +45,9 @@
|
|
45 |
"Height"
|
46 |
],
|
47 |
"statistics": [
|
48 |
-
{ "name" : "Pct", "equation" : "( $k - $e ) / $ta", "description" : "Hitting percentage" },
|
49 |
-
{ "name" : "B/S", "equation" : "$b / $sets", "description" : "Blocks per set" },
|
50 |
-
{ "name" : "A/S", "equation" : "$a / $sets", "description" : "Assists per set" }
|
51 |
],
|
52 |
"options": {
|
53 |
"mode" : "team"
|
45 |
"Height"
|
46 |
],
|
47 |
"statistics": [
|
48 |
+
{ "name" : "Pct", "equation" : "( $k - $e ) / $ta", "type" : "average", "description" : "Hitting percentage" },
|
49 |
+
{ "name" : "B/S", "equation" : "$b / $sets", "type" : "average", "description" : "Blocks per set" },
|
50 |
+
{ "name" : "A/S", "equation" : "$a / $sets", "type" : "average", "description" : "Assists per set" }
|
51 |
],
|
52 |
"options": {
|
53 |
"mode" : "team"
|
presets/water-sports/water-polo.json
CHANGED
@@ -47,9 +47,9 @@
|
|
47 |
],
|
48 |
"statistics": [
|
49 |
{ "name" : "Appearances", "equation" : "$eventsplayed", "description" : "Matches played" },
|
50 |
-
{ "name" : "Win Ratio", "equation" : "$win / $eventsplayed * 100", "precision" : 2 },
|
51 |
-
{ "name" : "Draw Ratio", "equation" : "$draw / $eventsplayed * 100", "precision" : 2 },
|
52 |
-
{ "name" : "Loss Ratio", "equation" : "$loss / $eventsplayed * 100", "precision" : 2 }
|
53 |
],
|
54 |
"options": {
|
55 |
"mode" : "team"
|
47 |
],
|
48 |
"statistics": [
|
49 |
{ "name" : "Appearances", "equation" : "$eventsplayed", "description" : "Matches played" },
|
50 |
+
{ "name" : "Win Ratio", "equation" : "$win / $eventsplayed * 100", "precision" : 2, "type" : "average" },
|
51 |
+
{ "name" : "Draw Ratio", "equation" : "$draw / $eventsplayed * 100", "precision" : 2, "type" : "average" },
|
52 |
+
{ "name" : "Loss Ratio", "equation" : "$loss / $eventsplayed * 100", "precision" : 2, "type" : "average" }
|
53 |
],
|
54 |
"options": {
|
55 |
"mode" : "team"
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: ThemeBoy, brianmiyaji, aylaview, rochesterj
|
|
3 |
Tags: calendars, club, club management, esports, events, fixtures, leagues, league management, sports, sports club, sports data, team rosters
|
4 |
Donate link: http://tboy.co/donate
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 2.3
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -18,13 +18,11 @@ Transform your WordPress blog into a fully configurable team, club, or league we
|
|
18 |
[youtube http://www.youtube.com/watch?v=KQyga_C5a6M]
|
19 |
|
20 |
= Industry Reviews =
|
21 |
-
> "*There are number of professional sports club who likes to maintain their information and statistics online, SportsPress plugin makes this process really easy, cost effective and quick.*" — [
|
22 |
>
|
23 |
> "*Script of the Day: While the WordPress repository holds various team and sports-related plugins, few of them come close to what you can achieve with SportsPress.*" — [Softpedia](http://news.softpedia.com/news/Script-of-the-Day-SportsPress-409247.shtml)
|
24 |
>
|
25 |
-
> "*SportsPress is
|
26 |
-
>
|
27 |
-
> "*The freely available and highly impressive SportsPress plugin offers terrific functionality including a fixtures listing, league table, player & staff profiles, customizable point system and a built-in translation system for 36 different languages.*" — [Club Themes](http://clubthemes.com/awesome-sporting-templates-themes-wordpress-joomla/)
|
28 |
|
29 |
= Features =
|
30 |
* Equation Builder
|
@@ -238,6 +236,29 @@ When you upgrade to one of the SportsPress Pro licenses, you can simply activate
|
|
238 |
|
239 |
== Changelog ==
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
= 2.3.2 =
|
242 |
* Fix - Team in player statistics total row displaying as zero.
|
243 |
* Fix - Notice when no sendoffs are available during minutes played calculation.
|
3 |
Tags: calendars, club, club management, esports, events, fixtures, leagues, league management, sports, sports club, sports data, team rosters
|
4 |
Donate link: http://tboy.co/donate
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 2.4.3
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
18 |
[youtube http://www.youtube.com/watch?v=KQyga_C5a6M]
|
19 |
|
20 |
= Industry Reviews =
|
21 |
+
> "*There are number of professional sports club who likes to maintain their information and statistics online, SportsPress plugin makes this process really easy, cost effective and quick.*" — [IndexWP](http://www.indexwp.com/sportspress-plugin-review/)
|
22 |
>
|
23 |
> "*Script of the Day: While the WordPress repository holds various team and sports-related plugins, few of them come close to what you can achieve with SportsPress.*" — [Softpedia](http://news.softpedia.com/news/Script-of-the-Day-SportsPress-409247.shtml)
|
24 |
>
|
25 |
+
> "*SportsPress is probably one of the most complete WordPress sports plugins out there. If you have a sports website and you’re looking to showcase your team, or even your entire league, then give this plugin a try.*" — [HostGator](https://www.hostgator.com/blog/best-wordpress-plugins-themes-sports-websites/)
|
|
|
|
|
26 |
|
27 |
= Features =
|
28 |
* Equation Builder
|
236 |
|
237 |
== Changelog ==
|
238 |
|
239 |
+
= 2.4.3 =
|
240 |
+
* Fix - Substitute Typo.
|
241 |
+
* Fix - WordPay image trailing slash.
|
242 |
+
|
243 |
+
= 2.4.2 =
|
244 |
+
* Feature - Add visibility option to player metrics.
|
245 |
+
* Fix - Remove protocol from default Gravatar images to prevent mix content warnings.
|
246 |
+
|
247 |
+
= 2.4.1 =
|
248 |
+
* Fix - Static function displaying notice in header.
|
249 |
+
|
250 |
+
= 2.4 =
|
251 |
+
* Feature - Integration with WordPay to allow paid team and player registrations.
|
252 |
+
* Feature - New team gallery shortcode and widget for displaying a gallery of team logos.
|
253 |
+
* Feature - Added support for player career totals based on calculated averages.
|
254 |
+
* Tweak - Allow competitions to be selected for friendly matches.
|
255 |
+
* Tweak - Added columns selector to gallery shortcodes.
|
256 |
+
* Fix - Full time defaulting to 90 minutes.
|
257 |
+
* Fix - Statistic format not reflected in meta box.
|
258 |
+
* Fix - Shortcode button hook timing conflicts.
|
259 |
+
* Preset - Swap par and score in golf preset.
|
260 |
+
* Preset - Update all presets to reflect new career total type.
|
261 |
+
|
262 |
= 2.3.2 =
|
263 |
* Fix - Team in player statistics total row displaying as zero.
|
264 |
* Fix - Notice when no sendoffs are available during minutes played calculation.
|
sportspress.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Plugin Name: SportsPress
|
4 |
* Plugin URI: http://themeboy.com/sportspress/
|
5 |
* Description: Manage your club and its players, staff, events, league tables, and player lists.
|
6 |
-
* Version: 2.3
|
7 |
* Author: ThemeBoy
|
8 |
* Author URI: http://themeboy.com
|
9 |
* Requires at least: 3.8
|
10 |
-
* Tested up to: 4.
|
11 |
*
|
12 |
* Text Domain: sportspress
|
13 |
* Domain Path: /languages/
|
@@ -26,14 +26,14 @@ if ( ! class_exists( 'SportsPress' ) ) :
|
|
26 |
* Main SportsPress Class
|
27 |
*
|
28 |
* @class SportsPress
|
29 |
-
* @version 2.3
|
30 |
*/
|
31 |
final class SportsPress {
|
32 |
|
33 |
/**
|
34 |
* @var string
|
35 |
*/
|
36 |
-
public $version = '2.3
|
37 |
|
38 |
/**
|
39 |
* @var SportsPress The single instance of the class
|
3 |
* Plugin Name: SportsPress
|
4 |
* Plugin URI: http://themeboy.com/sportspress/
|
5 |
* Description: Manage your club and its players, staff, events, league tables, and player lists.
|
6 |
+
* Version: 2.4.3
|
7 |
* Author: ThemeBoy
|
8 |
* Author URI: http://themeboy.com
|
9 |
* Requires at least: 3.8
|
10 |
+
* Tested up to: 4.8
|
11 |
*
|
12 |
* Text Domain: sportspress
|
13 |
* Domain Path: /languages/
|
26 |
* Main SportsPress Class
|
27 |
*
|
28 |
* @class SportsPress
|
29 |
+
* @version 2.4.3
|
30 |
*/
|
31 |
final class SportsPress {
|
32 |
|
33 |
/**
|
34 |
* @var string
|
35 |
*/
|
36 |
+
public $version = '2.4.3';
|
37 |
|
38 |
/**
|
39 |
* @var SportsPress The single instance of the class
|
templates/event-details.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -48,7 +48,7 @@ if ( 'yes' === get_option( 'sportspress_event_show_day', 'yes' ) ) {
|
|
48 |
if ( 'yes' === get_option( 'sportspress_event_show_full_time', 'yes' ) ) {
|
49 |
$full_time = get_post_meta( $id, 'sp_minutes', true );
|
50 |
if ( '' === $full_time ) {
|
51 |
-
$full_time = get_option( '
|
52 |
}
|
53 |
$data[ __( 'Full Time', 'sportspress' ) ] = $full_time . '\'';
|
54 |
}
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.4
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
48 |
if ( 'yes' === get_option( 'sportspress_event_show_full_time', 'yes' ) ) {
|
49 |
$full_time = get_post_meta( $id, 'sp_minutes', true );
|
50 |
if ( '' === $full_time ) {
|
51 |
+
$full_time = get_option( 'sportspress_event_minutes', 90 );
|
52 |
}
|
53 |
$data[ __( 'Full Time', 'sportspress' ) ] = $full_time . '\'';
|
54 |
}
|
templates/player-gallery-thumbnail.php
CHANGED
@@ -35,7 +35,7 @@ if ( $link_posts )
|
|
35 |
if ( has_post_thumbnail( $id ) )
|
36 |
$thumbnail = get_the_post_thumbnail( $id, $size );
|
37 |
else
|
38 |
-
$thumbnail = '<img width="150" height="150" src="
|
39 |
|
40 |
echo "<{$itemtag} class='gallery-item'>";
|
41 |
echo "
|
35 |
if ( has_post_thumbnail( $id ) )
|
36 |
$thumbnail = get_the_post_thumbnail( $id, $size );
|
37 |
else
|
38 |
+
$thumbnail = '<img width="150" height="150" src="//www.gravatar.com/avatar/?s=150&d=mm&f=y" class="attachment-thumbnail wp-post-image">';
|
39 |
|
40 |
echo "<{$itemtag} class='gallery-item'>";
|
41 |
echo "
|
templates/team-gallery-thumbnail.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Team Gallery Thumbnail
|
4 |
+
*
|
5 |
+
* @author ThemeBoy
|
6 |
+
* @package SportsPress/Templates
|
7 |
+
* @version 2.4
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
+
|
12 |
+
$defaults = array(
|
13 |
+
'id' => null,
|
14 |
+
'icontag' => 'dt',
|
15 |
+
'captiontag' => 'dd',
|
16 |
+
'caption' => null,
|
17 |
+
'size' => 'sportspress-crop-medium',
|
18 |
+
'link_posts' => get_option( 'sportspress_link_teams', 'yes' ) == 'yes' ? true : false,
|
19 |
+
);
|
20 |
+
|
21 |
+
extract( $defaults, EXTR_SKIP );
|
22 |
+
|
23 |
+
// Add caption tag if has caption
|
24 |
+
if ( $captiontag && $caption )
|
25 |
+
$caption = '<' . $captiontag . ' class="wp-caption-text gallery-caption small-3 columns">' . wptexturize( $caption ) . '</' . $captiontag . '>';
|
26 |
+
|
27 |
+
if ( $link_posts )
|
28 |
+
$caption = '<a href="' . get_permalink( $id ) . '">' . $caption . '</a>';
|
29 |
+
|
30 |
+
if ( has_post_thumbnail( $id ) )
|
31 |
+
$thumbnail = get_the_post_thumbnail( $id, $size );
|
32 |
+
else
|
33 |
+
$thumbnail = '<img width="150" height="150" src="//www.gravatar.com/avatar/?s=150&d=blank&f=y" class="attachment-thumbnail wp-post-image">';
|
34 |
+
|
35 |
+
echo "<{$itemtag} class='gallery-item'>";
|
36 |
+
echo "
|
37 |
+
<{$icontag} class='gallery-icon portrait'>"
|
38 |
+
. '<a href="' . get_permalink( $id ) . '">' . $thumbnail . '</a>'
|
39 |
+
. "</{$icontag}>";
|
40 |
+
echo $caption;
|
41 |
+
echo "</{$itemtag}>";
|
templates/team-gallery.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Team Gallery
|
4 |
+
*
|
5 |
+
* @author ThemeBoy
|
6 |
+
* @package SportsPress/Templates
|
7 |
+
* @version 2.4
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
+
|
12 |
+
$html5 = current_theme_supports( 'html5', 'gallery' );
|
13 |
+
$defaults = array(
|
14 |
+
'id' => get_the_ID(),
|
15 |
+
'title' => false,
|
16 |
+
'number' => -1,
|
17 |
+
'orderby' => 'default',
|
18 |
+
'itemtag' => 'dl',
|
19 |
+
'icontag' => 'dt',
|
20 |
+
'captiontag' => 'dd',
|
21 |
+
'columns' => 3,
|
22 |
+
'size' => 'sportspress-crop-medium',
|
23 |
+
'show_all_teams_link' => false,
|
24 |
+
'link_posts' => get_option( 'sportspress_link_teams', 'yes' ) == 'yes' ? true : false,
|
25 |
+
);
|
26 |
+
|
27 |
+
extract( $defaults, EXTR_SKIP );
|
28 |
+
|
29 |
+
// Determine number of teams to display
|
30 |
+
if ( -1 === $number ):
|
31 |
+
$number = (int) get_post_meta( $id, 'sp_number', true );
|
32 |
+
if ( $number <= 0 ) $number = -1;
|
33 |
+
endif;
|
34 |
+
|
35 |
+
$itemtag = tag_escape( $itemtag );
|
36 |
+
$captiontag = tag_escape( $captiontag );
|
37 |
+
$icontag = tag_escape( $icontag );
|
38 |
+
$valid_tags = wp_kses_allowed_html( 'post' );
|
39 |
+
if ( ! isset( $valid_tags[ $itemtag ] ) )
|
40 |
+
$itemtag = 'dl';
|
41 |
+
if ( ! isset( $valid_tags[ $captiontag ] ) )
|
42 |
+
$captiontag = 'dd';
|
43 |
+
if ( ! isset( $valid_tags[ $icontag ] ) )
|
44 |
+
$icontag = 'dt';
|
45 |
+
|
46 |
+
$columns = intval( $columns );
|
47 |
+
$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
|
48 |
+
$size = $size;
|
49 |
+
$float = is_rtl() ? 'right' : 'left';
|
50 |
+
|
51 |
+
$selector = 'sp-team-gallery-' . $id;
|
52 |
+
|
53 |
+
$table = new SP_League_Table( $id );
|
54 |
+
$data = $table->data();
|
55 |
+
|
56 |
+
// Remove the first row to leave us with the actual data
|
57 |
+
unset( $data[0] );
|
58 |
+
|
59 |
+
if ( $orderby == 'name' ):
|
60 |
+
uasort( $data, 'sp_sort_by_name' );
|
61 |
+
elseif ( $orderby == 'rand' ):
|
62 |
+
uasort( $data, 'sp_sort_random' );
|
63 |
+
endif;
|
64 |
+
|
65 |
+
if ( $title )
|
66 |
+
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
|
67 |
+
|
68 |
+
$gallery_style = $gallery_div = '';
|
69 |
+
if ( apply_filters( 'use_default_gallery_style', ! $html5 ) )
|
70 |
+
$gallery_style = "
|
71 |
+
<style type='text/css'>
|
72 |
+
#{$selector} {
|
73 |
+
margin: auto;
|
74 |
+
}
|
75 |
+
#{$selector} .gallery-item {
|
76 |
+
float: {$float};
|
77 |
+
margin-top: 10px;
|
78 |
+
text-align: center;
|
79 |
+
width: {$itemwidth}%;
|
80 |
+
}
|
81 |
+
#{$selector} img {
|
82 |
+
border: 2px solid #cfcfcf;
|
83 |
+
}
|
84 |
+
#{$selector} .gallery-caption {
|
85 |
+
margin-left: 0;
|
86 |
+
}
|
87 |
+
/* see gallery_shortcode() in wp-includes/media.php */
|
88 |
+
</style>";
|
89 |
+
$size_class = sanitize_html_class( $size );
|
90 |
+
$gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
|
91 |
+
echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
|
92 |
+
?>
|
93 |
+
<?php echo $gallery_div; ?>
|
94 |
+
<?php
|
95 |
+
if ( intval( $number ) > 0 )
|
96 |
+
$limit = $number;
|
97 |
+
|
98 |
+
$i = 0;
|
99 |
+
|
100 |
+
$gallery = '';
|
101 |
+
|
102 |
+
foreach( $data as $team_id => $row ):
|
103 |
+
|
104 |
+
if ( isset( $limit ) && $i >= $limit ) continue;
|
105 |
+
|
106 |
+
$caption = get_the_title( $team_id );
|
107 |
+
$caption = trim( $caption );
|
108 |
+
|
109 |
+
ob_start();
|
110 |
+
|
111 |
+
sp_get_template( 'team-gallery-thumbnail.php', array(
|
112 |
+
'id' => $team_id,
|
113 |
+
'itemtag' => $itemtag,
|
114 |
+
'icontag' => $icontag,
|
115 |
+
'captiontag' => $captiontag,
|
116 |
+
'caption' => $caption,
|
117 |
+
'size' => $size,
|
118 |
+
'link_posts' => $link_posts,
|
119 |
+
) );
|
120 |
+
|
121 |
+
$gallery .= ob_get_clean();
|
122 |
+
|
123 |
+
$i++;
|
124 |
+
|
125 |
+
endforeach;
|
126 |
+
|
127 |
+
echo '<div class="sp-template sp-template-team-gallery sp-template-gallery">';
|
128 |
+
|
129 |
+
echo '<div class="sp-team-gallery-wrapper sp-gallery-wrapper">';
|
130 |
+
|
131 |
+
echo $gallery;
|
132 |
+
|
133 |
+
if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
|
134 |
+
echo '<br style="clear: both" />';
|
135 |
+
}
|
136 |
+
|
137 |
+
echo '</div>';
|
138 |
+
|
139 |
+
if ( $show_all_teams_link ) {
|
140 |
+
echo '<div class="sp-team-gallery-link sp-gallery-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all teams', 'sportspress' ) . '</a></div>';
|
141 |
+
}
|
142 |
+
|
143 |
+
echo '</div>';
|
144 |
+
|
145 |
+
if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
|
146 |
+
echo '<br style="clear: both" />';
|
147 |
+
}
|
148 |
+
|
149 |
+
echo "</div>\n";
|
150 |
+
?>
|