Version Description
- Feature - New bulk actions to postpone and cancel multiple events.
- Feature - Add date of birth to player importer.
- Feature - Automatically select the home team's venue as the default venue when importing fixtures.
- Feature - Add ability to turn on comment for team profiles.
- Feature - Filter league tables by event status.
- Tweak - When an icon is used for player performance, display the icon in player lists and profiles.
- Tweak - Add title attribute for player statistic icons.
- Tweak - Default stylesheet sorting icon width.
- Fix - Icon color picker rendering issue.
- Fix - Image selector not working for player statistics.
- Fix - Enqueue scripts and styles for OpenStreetMap when used in shortcodes.
- Localization - Add translation options for countdown units.
Download this release
Release Info
Developer | brianmiyaji |
Plugin | SportsPress – Sports Club & League Manager |
Version | 2.7 |
Comparing to | |
See all releases |
Code changes from version 2.6.20 to 2.7
- assets/css/menu.css +1 -1
- assets/css/sportspress.css +2 -0
- assets/js/admin/iconpicker.js +2 -2
- changelog.txt +14 -0
- dummy-data/players-sample.csv +5 -5
- includes/admin/importers/class-sp-fixture-importer.php +6 -1
- includes/admin/importers/class-sp-player-importer.php +52 -3
- includes/admin/post-types/class-sp-admin-cpt-event.php +45 -22
- includes/admin/post-types/meta-boxes/class-sp-meta-box-table-details.php +11 -1
- includes/admin/settings/class-sp-settings-teams.php +9 -1
- includes/class-sp-ajax.php +15 -1
- includes/class-sp-league-table.php +39 -3
- includes/class-sp-player-list.php +8 -3
- includes/class-sp-player.php +39 -14
- includes/class-sp-post-types.php +11 -8
- includes/sp-api-functions.php +2 -2
- includes/sp-core-functions.php +30 -1
- license.txt +1 -1
- modules/sportspress-bulk-actions.php +137 -81
- modules/sportspress-countdowns.php +16 -3
- modules/sportspress-icons.php +7 -7
- modules/sportspress-openstreetmap.php +5 -4
- modules/sportspress-styles.php +11 -5
- readme.txt +16 -2
- sportspress.php +4 -4
- templates/event-venue.php +4 -5
- templates/league-table.php +8 -1
- templates/venue-map.php +2 -2
assets/css/menu.css
CHANGED
@@ -337,7 +337,7 @@
|
|
337 |
margin: 3px 0;
|
338 |
}
|
339 |
|
340 |
-
.sp-
|
341 |
color: #fff;
|
342 |
}
|
343 |
|
337 |
margin: 3px 0;
|
338 |
}
|
339 |
|
340 |
+
.sp-color-box-for-icon input[type=text] {
|
341 |
color: #fff;
|
342 |
}
|
343 |
|
assets/css/sportspress.css
CHANGED
@@ -104,6 +104,7 @@
|
|
104 |
.sp-data-table thead .sorting_asc_disabled,
|
105 |
.sp-data-table thead .sorting_desc_disabled {
|
106 |
cursor: pointer;
|
|
|
107 |
}
|
108 |
.sp-data-table tbody a {
|
109 |
text-decoration: none;
|
@@ -112,6 +113,7 @@
|
|
112 |
.sp-data-table .sorting_asc:after,
|
113 |
.sp-data-table .sorting_desc:after {
|
114 |
font-family: dashicons;
|
|
|
115 |
}
|
116 |
.sp-data-table .sorting:after {
|
117 |
content: "\f156";
|
104 |
.sp-data-table thead .sorting_asc_disabled,
|
105 |
.sp-data-table thead .sorting_desc_disabled {
|
106 |
cursor: pointer;
|
107 |
+
position: relative;
|
108 |
}
|
109 |
.sp-data-table tbody a {
|
110 |
text-decoration: none;
|
113 |
.sp-data-table .sorting_asc:after,
|
114 |
.sp-data-table .sorting_desc:after {
|
115 |
font-family: dashicons;
|
116 |
+
margin: 0 -.2em;
|
117 |
}
|
118 |
.sp-data-table .sorting:after {
|
119 |
content: "\f156";
|
assets/js/admin/iconpicker.js
CHANGED
@@ -23,14 +23,14 @@ jQuery(document).ready(function($){
|
|
23 |
})
|
24 |
.click(function(){
|
25 |
$('.iris-picker').hide();
|
26 |
-
$(this).closest('.sp-
|
27 |
});
|
28 |
|
29 |
$('body').click(function() {
|
30 |
$('.iris-picker').hide();
|
31 |
});
|
32 |
|
33 |
-
$('.sp-
|
34 |
event.stopPropagation();
|
35 |
});
|
36 |
|
23 |
})
|
24 |
.click(function(){
|
25 |
$('.iris-picker').hide();
|
26 |
+
$(this).closest('.sp-color-box-for-icon, td').find('.iris-picker').show();
|
27 |
});
|
28 |
|
29 |
$('body').click(function() {
|
30 |
$('.iris-picker').hide();
|
31 |
});
|
32 |
|
33 |
+
$('.sp-color-box-for-icon, .colorpick').click(function(event){
|
34 |
event.stopPropagation();
|
35 |
});
|
36 |
|
changelog.txt
CHANGED
@@ -1,5 +1,19 @@
|
|
1 |
== SportsPress Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
= 2.6.20 =
|
4 |
* Tweak - Improve compatibility with volleyball for checkbox performance.
|
5 |
* Preset - Update volleyball preset with additional options.
|
1 |
== SportsPress Changelog ==
|
2 |
|
3 |
+
= 2.7 =
|
4 |
+
* Feature - New bulk actions to postpone and cancel multiple events.
|
5 |
+
* Feature - Add date of birth to player importer.
|
6 |
+
* Feature - Automatically select the home team's venue as the default venue when importing fixtures.
|
7 |
+
* Feature - Add ability to turn on comment for team profiles.
|
8 |
+
* Feature - Filter league tables by event status.
|
9 |
+
* Tweak - When an icon is used for player performance, display the icon in player lists and profiles.
|
10 |
+
* Tweak - Add title attribute for player statistic icons.
|
11 |
+
* Tweak - Default stylesheet sorting icon width.
|
12 |
+
* Fix - Icon color picker rendering issue.
|
13 |
+
* Fix - Image selector not working for player statistics.
|
14 |
+
* Fix - Enqueue scripts and styles for OpenStreetMap when used in shortcodes.
|
15 |
+
* Localization - Add translation options for countdown units.
|
16 |
+
|
17 |
= 2.6.20 =
|
18 |
* Tweak - Improve compatibility with volleyball for checkbox performance.
|
19 |
* Preset - Update volleyball preset with additional options.
|
dummy-data/players-sample.csv
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
Number,Name,Positions,Teams,Leagues,Seasons,Nationality
|
2 |
-
1,Joe Allen,Goalkeeper,Eagles,Primary League|Secondary League,2014,aus
|
3 |
-
3,Steven Gerrard,Defender,Kangaroos,Primary League,2014|2013,usa
|
4 |
-
5,Daniel Sturridge,Midfielder|Forward,Sharks,Primary League|Secondary League,2014|2013,eng
|
5 |
-
6,Gabrielle Gonzalez,Forward,Kangaroos|Sharks,Primary League,2014,esp
|
1 |
+
Number,Name,Positions,Teams,Leagues,Seasons,Nationality,DoB
|
2 |
+
1,Joe Allen,Goalkeeper,Eagles,Primary League|Secondary League,2014,aus,1983/05/05
|
3 |
+
3,Steven Gerrard,Defender,Kangaroos,Primary League,2014|2013,usa,1970/03/10
|
4 |
+
5,Daniel Sturridge,Midfielder|Forward,Sharks,Primary League|Secondary League,2014|2013,eng,1990/02/15
|
5 |
+
6,Gabrielle Gonzalez,Forward,Kangaroos|Sharks,Primary League,2014,esp,1987/01/20
|
includes/admin/importers/class-sp-fixture-importer.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Importers
|
8 |
-
* @version 2.
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -138,6 +138,11 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|
138 |
endif;
|
139 |
|
140 |
// Update venue
|
|
|
|
|
|
|
|
|
|
|
141 |
wp_set_object_terms( $id, $venue, 'sp_venue', false );
|
142 |
|
143 |
// Update match day
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Importers
|
8 |
+
* @version 2.7
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
138 |
endif;
|
139 |
|
140 |
// Update venue
|
141 |
+
if ( $venue == '' ) {
|
142 |
+
$team = reset( $teams );
|
143 |
+
$team_object = get_page_by_title( stripslashes( $team ), OBJECT, 'sp_team' );
|
144 |
+
$venue = sp_get_the_term_id( $team_object->ID, 'sp_venue' );
|
145 |
+
}
|
146 |
wp_set_object_terms( $id, $venue, 'sp_venue', false );
|
147 |
|
148 |
// Update match day
|
includes/admin/importers/class-sp-player-importer.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Importers
|
8 |
-
* @version 2.
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -30,6 +30,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|
30 |
'sp_league' => __( 'Leagues', 'sportspress' ),
|
31 |
'sp_season' => __( 'Seasons', 'sportspress' ),
|
32 |
'sp_nationality' => __( 'Nationality', 'sportspress' ),
|
|
|
33 |
);
|
34 |
parent::__construct();
|
35 |
}
|
@@ -51,6 +52,9 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|
51 |
endif;
|
52 |
|
53 |
$rows = array_chunk( $array, sizeof( $columns ) );
|
|
|
|
|
|
|
54 |
|
55 |
foreach ( $rows as $row ):
|
56 |
|
@@ -69,7 +73,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|
69 |
'sp_season',
|
70 |
);
|
71 |
foreach ( $preservable_metas_keys as $p ) {
|
72 |
-
$meta[ $
|
73 |
}
|
74 |
|
75 |
foreach ( $columns as $index => $key ):
|
@@ -77,6 +81,27 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|
77 |
endforeach;
|
78 |
|
79 |
$name = sp_array_value( $meta, 'post_title' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
if ( ! $name ):
|
82 |
$this->skipped++;
|
@@ -97,6 +122,10 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|
97 |
}
|
98 |
else:
|
99 |
$args = array( 'post_type' => 'sp_player', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $name ) );
|
|
|
|
|
|
|
|
|
100 |
$id = wp_insert_post( $args );
|
101 |
|
102 |
// Flag as import
|
@@ -195,7 +224,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|
195 |
function greet() {
|
196 |
echo '<div class="narrow">';
|
197 |
echo '<p>' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'</p>';
|
198 |
-
echo '<p>' . sprintf( __( 'Players need to be defined with columns in a specific order (
|
199 |
wp_import_upload_form( 'admin.php?import=sp_player_csv&step=1' );
|
200 |
echo '</div>';
|
201 |
}
|
@@ -210,6 +239,26 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|
210 |
?>
|
211 |
<table class="form-table">
|
212 |
<tbody>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
<tr>
|
214 |
<td>
|
215 |
<label>
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Importers
|
8 |
+
* @version 2.7
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
30 |
'sp_league' => __( 'Leagues', 'sportspress' ),
|
31 |
'sp_season' => __( 'Seasons', 'sportspress' ),
|
32 |
'sp_nationality' => __( 'Nationality', 'sportspress' ),
|
33 |
+
'post_date' => __( 'Date of Birth', 'sportspress' ),
|
34 |
);
|
35 |
parent::__construct();
|
36 |
}
|
52 |
endif;
|
53 |
|
54 |
$rows = array_chunk( $array, sizeof( $columns ) );
|
55 |
+
|
56 |
+
// Get Date of Birth format from post vars
|
57 |
+
$date_format = ( empty( $_POST['sp_date_format'] ) ? 'yyyy/mm/dd' : $_POST['sp_date_format'] );
|
58 |
|
59 |
foreach ( $rows as $row ):
|
60 |
|
73 |
'sp_season',
|
74 |
);
|
75 |
foreach ( $preservable_metas_keys as $p ) {
|
76 |
+
$meta[ $p ] = '';
|
77 |
}
|
78 |
|
79 |
foreach ( $columns as $index => $key ):
|
81 |
endforeach;
|
82 |
|
83 |
$name = sp_array_value( $meta, 'post_title' );
|
84 |
+
$date = sp_array_value( $meta, 'post_date' );
|
85 |
+
|
86 |
+
// Format date of birth
|
87 |
+
$date = str_replace( '/', '-', trim( $date ) );
|
88 |
+
$date_array = explode( '-', $date );
|
89 |
+
switch ( $date_format ):
|
90 |
+
case 'dd/mm/yyyy':
|
91 |
+
$date = substr( str_pad( sp_array_value( $date_array, 2, '0000' ), 4, '0', STR_PAD_LEFT ), 0, 4 ) . '-' .
|
92 |
+
substr( str_pad( sp_array_value( $date_array, 1, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 ) . '-' .
|
93 |
+
substr( str_pad( sp_array_value( $date_array, 0, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 );
|
94 |
+
break;
|
95 |
+
case 'mm/dd/yyyy':
|
96 |
+
$date = substr( str_pad( sp_array_value( $date_array, 2, '0000' ), 4, '0', STR_PAD_LEFT ), 0, 4 ) . '-' .
|
97 |
+
substr( str_pad( sp_array_value( $date_array, 0, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 ) . '-' .
|
98 |
+
substr( str_pad( sp_array_value( $date_array, 1, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 );
|
99 |
+
break;
|
100 |
+
default:
|
101 |
+
$date = substr( str_pad( sp_array_value( $date_array, 0, '0000' ), 4, '0', STR_PAD_LEFT ), 0, 4 ) . '-' .
|
102 |
+
substr( str_pad( sp_array_value( $date_array, 1, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 ) . '-' .
|
103 |
+
substr( str_pad( sp_array_value( $date_array, 2, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 );
|
104 |
+
endswitch;
|
105 |
|
106 |
if ( ! $name ):
|
107 |
$this->skipped++;
|
122 |
}
|
123 |
else:
|
124 |
$args = array( 'post_type' => 'sp_player', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $name ) );
|
125 |
+
// Check if a DoB was set
|
126 |
+
if( '0000-00-00' !== $date ){
|
127 |
+
$args['post_date'] = $date;
|
128 |
+
}
|
129 |
$id = wp_insert_post( $args );
|
130 |
|
131 |
// Flag as import
|
224 |
function greet() {
|
225 |
echo '<div class="narrow">';
|
226 |
echo '<p>' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'</p>';
|
227 |
+
echo '<p>' . sprintf( __( 'Players need to be defined with columns in a specific order (8 columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/players-sample.csv' ) . '</p>';
|
228 |
wp_import_upload_form( 'admin.php?import=sp_player_csv&step=1' );
|
229 |
echo '</div>';
|
230 |
}
|
239 |
?>
|
240 |
<table class="form-table">
|
241 |
<tbody>
|
242 |
+
<tr>
|
243 |
+
<th scope="row" class="titledesc">
|
244 |
+
<?php _e( 'Date of Birth Format', 'sportspress' ); ?>
|
245 |
+
</th>
|
246 |
+
<td class="forminp forminp-radio">
|
247 |
+
<fieldset>
|
248 |
+
<ul>
|
249 |
+
<li>
|
250 |
+
<label><input name="sp_date_format" value="yyyy/mm/dd" type="radio" checked> yyyy/mm/dd</label>
|
251 |
+
</li>
|
252 |
+
<li>
|
253 |
+
<label><input name="sp_date_format" value="dd/mm/yyyy" type="radio"> dd/mm/yyyy</label>
|
254 |
+
</li>
|
255 |
+
<li>
|
256 |
+
<label><input name="sp_date_format" value="mm/dd/yyyy" type="radio"> mm/dd/yyyy</label>
|
257 |
+
</li>
|
258 |
+
</ul>
|
259 |
+
</fieldset>
|
260 |
+
</td>
|
261 |
+
</tr>
|
262 |
<tr>
|
263 |
<td>
|
264 |
<label>
|
includes/admin/post-types/class-sp-admin-cpt-event.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Post_Types
|
8 |
-
* @version 2.
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -44,6 +44,9 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|
44 |
// Filtering
|
45 |
add_action( 'restrict_manage_posts', array( $this, 'filters' ) );
|
46 |
add_filter( 'parse_query', array( $this, 'filters_query' ) );
|
|
|
|
|
|
|
47 |
|
48 |
// Call SP_Admin_CPT constructor
|
49 |
parent::__construct();
|
@@ -294,27 +297,47 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|
294 |
wp_nonce_field( 'sp-save-inline-results', 'sp-inline-nonce', false );
|
295 |
}
|
296 |
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
}
|
319 |
|
320 |
endif;
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Post_Types
|
8 |
+
* @version 2.7
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
44 |
// Filtering
|
45 |
add_action( 'restrict_manage_posts', array( $this, 'filters' ) );
|
46 |
add_filter( 'parse_query', array( $this, 'filters_query' ) );
|
47 |
+
|
48 |
+
// Post states
|
49 |
+
add_filter( 'display_post_states', array( $this, 'post_states' ), 10, 2 );
|
50 |
|
51 |
// Call SP_Admin_CPT constructor
|
52 |
parent::__construct();
|
297 |
wp_nonce_field( 'sp-save-inline-results', 'sp-inline-nonce', false );
|
298 |
}
|
299 |
|
300 |
+
/**
|
301 |
+
* Filter in admin based on options
|
302 |
+
*
|
303 |
+
* @param mixed $query
|
304 |
+
*/
|
305 |
+
public function filters_query( $query ) {
|
306 |
+
global $typenow, $wp_query;
|
307 |
+
|
308 |
+
if ( $typenow == 'sp_event' ) {
|
309 |
+
|
310 |
+
if ( ! empty( $_GET['team'] ) ) {
|
311 |
+
$query->query_vars['meta_value'] = $_GET['team'];
|
312 |
+
$query->query_vars['meta_key'] = 'sp_team';
|
313 |
+
}
|
314 |
+
|
315 |
+
if ( ! empty( $_GET['match_day'] ) ) {
|
316 |
+
$query->query_vars['meta_value'] = $_GET['match_day'];
|
317 |
+
$query->query_vars['meta_key'] = 'sp_day';
|
318 |
+
}
|
319 |
+
}
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Replace displayed post state for events
|
324 |
+
*
|
325 |
+
* @param array $post_states
|
326 |
+
* @param object $post
|
327 |
+
*/
|
328 |
+
public function post_states( $post_states, $post ) {
|
329 |
+
$status = get_post_meta( $post->ID, 'sp_status', true );
|
330 |
+
|
331 |
+
if ( 'postponed' == $status ) {
|
332 |
+
$post_states = array( __( 'Postponed', 'sportspress' ) );
|
333 |
+
} elseif ( 'cancelled' == $status ) {
|
334 |
+
$post_states = array( __( 'Canceled', 'sportspress' ) );
|
335 |
+
} elseif ( 'tbd' == $status ) {
|
336 |
+
$post_states = array( __( 'TBD', 'sportspress' ) );
|
337 |
+
}
|
338 |
+
|
339 |
+
return $post_states;
|
340 |
+
}
|
341 |
}
|
342 |
|
343 |
endif;
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-table-details.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version 2.
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -29,6 +29,10 @@ class SP_Meta_Box_Table_Details {
|
|
29 |
$date_to = get_post_meta( $post->ID, 'sp_date_to', true );
|
30 |
$date_past = get_post_meta( $post->ID, 'sp_date_past', true );
|
31 |
$date_relative = get_post_meta( $post->ID, 'sp_date_relative', true );
|
|
|
|
|
|
|
|
|
32 |
?>
|
33 |
<div>
|
34 |
<p><strong><?php _e( 'Heading', 'sportspress' ); ?></strong></p>
|
@@ -89,6 +93,11 @@ class SP_Meta_Box_Table_Details {
|
|
89 |
sp_post_adder( $post_type, __( 'Add New', 'sportspress' ) );
|
90 |
}
|
91 |
?>
|
|
|
|
|
|
|
|
|
|
|
92 |
</div>
|
93 |
<?php
|
94 |
}
|
@@ -108,5 +117,6 @@ class SP_Meta_Box_Table_Details {
|
|
108 |
update_post_meta( $post_id, 'sp_current_season', in_array( 'auto', sp_array_value( $tax_input, 'sp_season' ) ) );
|
109 |
update_post_meta( $post_id, 'sp_select', sp_array_value( $_POST, 'sp_select', array() ) );
|
110 |
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
|
|
|
111 |
}
|
112 |
}
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.7
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
$date_to = get_post_meta( $post->ID, 'sp_date_to', true );
|
30 |
$date_past = get_post_meta( $post->ID, 'sp_date_past', true );
|
31 |
$date_relative = get_post_meta( $post->ID, 'sp_date_relative', true );
|
32 |
+
$event_status = get_post_meta( $post->ID, 'sp_event_status', true );
|
33 |
+
if ( empty( $event_status ) ) {
|
34 |
+
$event_status = array( 'publish', 'future' );
|
35 |
+
}
|
36 |
?>
|
37 |
<div>
|
38 |
<p><strong><?php _e( 'Heading', 'sportspress' ); ?></strong></p>
|
93 |
sp_post_adder( $post_type, __( 'Add New', 'sportspress' ) );
|
94 |
}
|
95 |
?>
|
96 |
+
<p><strong><?php _e( 'Event Status (with results)', 'sportspress' ); ?></strong></p>
|
97 |
+
<p>
|
98 |
+
<input type="checkbox" name="sp_event_status[]" value="publish" <?php echo ( in_array( "publish" , $event_status) ) ? 'checked' : false; ?>> Published/Played<br>
|
99 |
+
<input type="checkbox" name="sp_event_status[]" value="future" <?php echo ( in_array( "future" , $event_status) ) ? 'checked' : false; ?>> Scheduled/Future<br>
|
100 |
+
</p>
|
101 |
</div>
|
102 |
<?php
|
103 |
}
|
117 |
update_post_meta( $post_id, 'sp_current_season', in_array( 'auto', sp_array_value( $tax_input, 'sp_season' ) ) );
|
118 |
update_post_meta( $post_id, 'sp_select', sp_array_value( $_POST, 'sp_select', array() ) );
|
119 |
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
|
120 |
+
update_post_meta( $post_id, 'sp_event_status', sp_array_value( $_POST, 'sp_event_status', array() ) );
|
121 |
}
|
122 |
}
|
includes/admin/settings/class-sp-settings-teams.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
-
* @version 2.
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -81,6 +81,14 @@ class SP_Settings_Teams extends SP_Settings_Page {
|
|
81 |
'default' => 'no',
|
82 |
'type' => 'checkbox',
|
83 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
)),
|
85 |
|
86 |
array(
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
+
* @version 2.7
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
81 |
'default' => 'no',
|
82 |
'type' => 'checkbox',
|
83 |
),
|
84 |
+
|
85 |
+
array(
|
86 |
+
'title' => __( 'Comments', 'sportspress' ),
|
87 |
+
'desc' => __( 'Allow people to post comments on Team page', 'sportspress' ),
|
88 |
+
'id' => 'sportspress_team_comment_status',
|
89 |
+
'default' => 'no',
|
90 |
+
'type' => 'checkbox',
|
91 |
+
),
|
92 |
)),
|
93 |
|
94 |
array(
|
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
|
@@ -913,6 +913,18 @@ class SP_AJAX {
|
|
913 |
<?php _e( 'Display link to view full table', 'sportspress' ); ?>
|
914 |
</label>
|
915 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
916 |
<?php do_action( 'sportspress_ajax_shortcode_form', 'league-table' ); ?>
|
917 |
<p class="submit">
|
918 |
<input type="button" class="button-primary" value="<?php _e( 'Insert Shortcode', 'sportspress' ); ?>" onclick="insertSportsPress('team_standings');" />
|
@@ -1349,6 +1361,8 @@ class SP_AJAX {
|
|
1349 |
args.number = $div.find('[name=number]').val();
|
1350 |
args.columns = $div.find('[name="columns[]"]:checked').map(function() { return this.value; }).get().join(',');
|
1351 |
args.show_team_logo = $div.find('[name=show_team_logo]:checked').length;
|
|
|
|
|
1352 |
args.show_full_table_link = $div.find('[name=show_full_table_link]:checked').length;
|
1353 |
} else if ( 'team_gallery' == type ) {
|
1354 |
args.title = $div.find('[name=title]').val();
|
8 |
* AJAX Event Handler
|
9 |
*
|
10 |
* @class SP_AJAX
|
11 |
+
* @version 2.7
|
12 |
* @package SportsPress/Classes
|
13 |
* @category Class
|
14 |
* @author ThemeBoy
|
913 |
<?php _e( 'Display link to view full table', 'sportspress' ); ?>
|
914 |
</label>
|
915 |
</p>
|
916 |
+
<p>
|
917 |
+
<?php _e( 'Event Status:', 'sportspress' ); ?><br/>
|
918 |
+
<label>
|
919 |
+
<input type="checkbox" name="show_published_events" id="show_published_events" checked>
|
920 |
+
<?php _e( 'Include Published/Played Events with results', 'sportspress' ); ?>
|
921 |
+
</label>
|
922 |
+
<br/>
|
923 |
+
<label>
|
924 |
+
<input type="checkbox" name="show_future_events" id="show_future_events" checked>
|
925 |
+
<?php _e( 'Include Scheduled/Future Events with results', 'sportspress' ); ?>
|
926 |
+
</label>
|
927 |
+
</p>
|
928 |
<?php do_action( 'sportspress_ajax_shortcode_form', 'league-table' ); ?>
|
929 |
<p class="submit">
|
930 |
<input type="button" class="button-primary" value="<?php _e( 'Insert Shortcode', 'sportspress' ); ?>" onclick="insertSportsPress('team_standings');" />
|
1361 |
args.number = $div.find('[name=number]').val();
|
1362 |
args.columns = $div.find('[name="columns[]"]:checked').map(function() { return this.value; }).get().join(',');
|
1363 |
args.show_team_logo = $div.find('[name=show_team_logo]:checked').length;
|
1364 |
+
args.show_published_events = $div.find('[name=show_published_events]:checked').length;
|
1365 |
+
args.show_future_events = $div.find('[name=show_future_events]:checked').length;
|
1366 |
args.show_full_table_link = $div.find('[name=show_full_table_link]:checked').length;
|
1367 |
} else if ( 'team_gallery' == type ) {
|
1368 |
args.title = $div.find('[name=title]').val();
|
includes/class-sp-league-table.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress league table class handles individual league table data.
|
6 |
*
|
7 |
* @class SP_League_Table
|
8 |
-
* @version 2.
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -23,6 +23,12 @@ class SP_League_Table extends SP_Secondary_Post {
|
|
23 |
|
24 |
/** @var array Teams to check for tiebreakers. */
|
25 |
public $tiebreakers = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
/**
|
28 |
* Returns formatted data
|
@@ -222,10 +228,40 @@ class SP_League_Table extends SP_Secondary_Post {
|
|
222 |
endif;
|
223 |
|
224 |
endforeach;
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
$args = array(
|
227 |
'post_type' => 'sp_event',
|
228 |
-
'post_status' =>
|
229 |
'numberposts' => -1,
|
230 |
'posts_per_page' => -1,
|
231 |
'orderby' => 'post_date',
|
5 |
* The SportsPress league table class handles individual league table data.
|
6 |
*
|
7 |
* @class SP_League_Table
|
8 |
+
* @version 2.7
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
23 |
|
24 |
/** @var array Teams to check for tiebreakers. */
|
25 |
public $tiebreakers = array();
|
26 |
+
|
27 |
+
/** @var int Show Published events. */
|
28 |
+
public $show_published_events;
|
29 |
+
|
30 |
+
/** @var int Show Scheduled events. */
|
31 |
+
public $show_future_events;
|
32 |
|
33 |
/**
|
34 |
* Returns formatted data
|
228 |
endif;
|
229 |
|
230 |
endforeach;
|
231 |
+
|
232 |
+
// Get which event status to include
|
233 |
+
$event_status = get_post_meta( $this->ID, 'sp_event_status', true );
|
234 |
+
|
235 |
+
if ( empty( $event_status ) ) {
|
236 |
+
$event_status = array( 'publish', 'future' );
|
237 |
+
}
|
238 |
+
|
239 |
+
if ( isset( $this->show_published_events ) ) { // If an attribute was pass through shortcode
|
240 |
+
if ( $this->show_published_events == '1' ) {
|
241 |
+
$event_status[] = 'publish';
|
242 |
+
}else{
|
243 |
+
if ( ( $status_key = array_search( 'publish', $event_status ) ) !== false ) {
|
244 |
+
unset( $event_status[ $status_key ] );
|
245 |
+
}
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
if ( isset( $this->show_future_events ) ) { // If an attribute was pass through shortcode
|
250 |
+
if ( $this->show_future_events == '1' ) {
|
251 |
+
$event_status[] = 'future';
|
252 |
+
}else{
|
253 |
+
if ( ( $status_key = array_search('future', $event_status) ) !== false ) {
|
254 |
+
unset( $event_status[ $status_key ] );
|
255 |
+
}
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
// Make sure to have unique values in the array
|
260 |
+
$event_status = array_unique( $event_status );
|
261 |
+
|
262 |
$args = array(
|
263 |
'post_type' => 'sp_event',
|
264 |
+
'post_status' => $event_status,
|
265 |
'numberposts' => -1,
|
266 |
'posts_per_page' => -1,
|
267 |
'orderby' => 'post_date',
|
includes/class-sp-player-list.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress player list class handles individual player list data.
|
6 |
*
|
7 |
* @class SP_Player_List
|
8 |
-
* @version 2.
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -229,9 +229,14 @@ class SP_Player_List extends SP_Secondary_Post {
|
|
229 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' && ( $stat->post_type == 'sp_performance' || $stat->post_type == 'sp_statistic' ) ) {
|
230 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $stat->ID, 1 );
|
231 |
if ( $icon != '' ) {
|
232 |
-
$columns[ $stat->post_name ] =
|
233 |
}else{
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
235 |
}
|
236 |
}else{
|
237 |
$columns[ $stat->post_name ] = $stat->post_title;
|
5 |
* The SportsPress player list class handles individual player list data.
|
6 |
*
|
7 |
* @class SP_Player_List
|
8 |
+
* @version 2.7
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
229 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' && ( $stat->post_type == 'sp_performance' || $stat->post_type == 'sp_statistic' ) ) {
|
230 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $stat->ID, 1 );
|
231 |
if ( $icon != '' ) {
|
232 |
+
$columns[ $stat->post_name ] = $icon;
|
233 |
}else{
|
234 |
+
if ( has_post_thumbnail( $stat ) ) {
|
235 |
+
$icon = get_the_post_thumbnail( $stat, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $stat ) ) );
|
236 |
+
$columns[ $stat->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $stat->ID, 1 );
|
237 |
+
}else{
|
238 |
+
$columns[ $stat->post_name ] = $stat->post_title;
|
239 |
+
}
|
240 |
}
|
241 |
}else{
|
242 |
$columns[ $stat->post_name ] = $stat->post_title;
|
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
|
@@ -175,9 +175,14 @@ class SP_Player extends SP_Custom_Post {
|
|
175 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
176 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
177 |
if ( $icon != '' ) {
|
178 |
-
$performance_labels[ $post->post_name ] =
|
179 |
}else{
|
180 |
-
|
|
|
|
|
|
|
|
|
|
|
181 |
}
|
182 |
}else{
|
183 |
$performance_labels[ $post->post_name ] = $post->post_title;
|
@@ -193,9 +198,14 @@ class SP_Player extends SP_Custom_Post {
|
|
193 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
194 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
195 |
if ( $icon != '' ) {
|
196 |
-
$performance_labels[ $post->post_name ] =
|
197 |
}else{
|
198 |
-
|
|
|
|
|
|
|
|
|
|
|
199 |
}
|
200 |
}else{
|
201 |
$performance_labels[ $post->post_name ] = $post->post_title;
|
@@ -577,9 +587,14 @@ class SP_Player extends SP_Custom_Post {
|
|
577 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
578 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
579 |
if ( $icon != '' ) {
|
580 |
-
$stats[ $post->post_name ] =
|
581 |
}else{
|
582 |
-
|
|
|
|
|
|
|
|
|
|
|
583 |
}
|
584 |
}else{
|
585 |
$stats[ $post->post_name ] = $post->post_title;
|
@@ -597,9 +612,14 @@ class SP_Player extends SP_Custom_Post {
|
|
597 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
598 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
599 |
if ( $icon != '' ) {
|
600 |
-
$stats[ $post->post_name ] =
|
601 |
-
}
|
602 |
-
|
|
|
|
|
|
|
|
|
|
|
603 |
}
|
604 |
} else {
|
605 |
$stats[ $post->post_name ] = $post->post_title;
|
@@ -610,9 +630,14 @@ class SP_Player extends SP_Custom_Post {
|
|
610 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
611 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
612 |
if ( $icon != '' ) {
|
613 |
-
$stats[ $post->post_name ] =
|
614 |
-
}
|
615 |
-
|
|
|
|
|
|
|
|
|
|
|
616 |
}
|
617 |
} else {
|
618 |
$stats[ $post->post_name ] = $post->post_title;
|
@@ -623,7 +648,7 @@ class SP_Player extends SP_Custom_Post {
|
|
623 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
624 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
625 |
if ( $icon != '' ) {
|
626 |
-
$stats[ $post->post_name ] =
|
627 |
}else{
|
628 |
$stats[ $post->post_name ] = $post->post_title;
|
629 |
}
|
5 |
* The SportsPress player class handles individual player data.
|
6 |
*
|
7 |
* @class SP_Player
|
8 |
+
* @version 2.7
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
175 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
176 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
177 |
if ( $icon != '' ) {
|
178 |
+
$performance_labels[ $post->post_name ] = $icon;
|
179 |
}else{
|
180 |
+
if ( has_post_thumbnail( $post ) ) {
|
181 |
+
$icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) );
|
182 |
+
$performance_labels[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 );
|
183 |
+
}else{
|
184 |
+
$performance_labels[ $post->post_name ] = $post->post_title;
|
185 |
+
}
|
186 |
}
|
187 |
}else{
|
188 |
$performance_labels[ $post->post_name ] = $post->post_title;
|
198 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
199 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
200 |
if ( $icon != '' ) {
|
201 |
+
$performance_labels[ $post->post_name ] = $icon;
|
202 |
}else{
|
203 |
+
if ( has_post_thumbnail( $post ) ) {
|
204 |
+
$icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) );
|
205 |
+
$performance_labels[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 );
|
206 |
+
}else{
|
207 |
+
$performance_labels[ $post->post_name ] = $post->post_title;
|
208 |
+
}
|
209 |
}
|
210 |
}else{
|
211 |
$performance_labels[ $post->post_name ] = $post->post_title;
|
587 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
588 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
589 |
if ( $icon != '' ) {
|
590 |
+
$stats[ $post->post_name ] = $icon;
|
591 |
}else{
|
592 |
+
if ( has_post_thumbnail( $post ) ) {
|
593 |
+
$icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) );
|
594 |
+
$stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 );
|
595 |
+
}else{
|
596 |
+
$stats[ $post->post_name ] = $post->post_title;
|
597 |
+
}
|
598 |
}
|
599 |
}else{
|
600 |
$stats[ $post->post_name ] = $post->post_title;
|
612 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
613 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
614 |
if ( $icon != '' ) {
|
615 |
+
$stats[ $post->post_name ] = $icon;
|
616 |
+
}else{
|
617 |
+
if ( has_post_thumbnail( $post ) ) {
|
618 |
+
$icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) );
|
619 |
+
$stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 );
|
620 |
+
}else{
|
621 |
+
$stats[ $post->post_name ] = $post->post_title;
|
622 |
+
}
|
623 |
}
|
624 |
} else {
|
625 |
$stats[ $post->post_name ] = $post->post_title;
|
630 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
631 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
632 |
if ( $icon != '' ) {
|
633 |
+
$stats[ $post->post_name ] = $icon;
|
634 |
+
}else{
|
635 |
+
if ( has_post_thumbnail( $post ) ) {
|
636 |
+
$icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) );
|
637 |
+
$stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 );
|
638 |
+
}else{
|
639 |
+
$stats[ $post->post_name ] = $post->post_title;
|
640 |
+
}
|
641 |
}
|
642 |
} else {
|
643 |
$stats[ $post->post_name ] = $post->post_title;
|
648 |
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
|
649 |
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
|
650 |
if ( $icon != '' ) {
|
651 |
+
$stats[ $post->post_name ] = $icon;
|
652 |
}else{
|
653 |
$stats[ $post->post_name ] = $post->post_title;
|
654 |
}
|
includes/class-sp-post-types.php
CHANGED
@@ -9,7 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
9 |
* Registers post types and taxonomies
|
10 |
*
|
11 |
* @class SP_Post_types
|
12 |
-
* @version 2.
|
13 |
* @package SportsPress/Classes
|
14 |
* @category Class
|
15 |
* @author ThemeBoy
|
@@ -392,6 +392,7 @@ class SP_Post_types {
|
|
392 |
'search_items' => __( 'Search', 'sportspress' ),
|
393 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
394 |
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
|
|
|
395 |
'set_featured_image' => __( 'Select Icon', 'sportspress' ),
|
396 |
'remove_featured_image' => __( 'Remove icon', 'sportspress' ),
|
397 |
'use_featured_image' => __( 'Add icon', 'sportspress' ),
|
@@ -403,7 +404,7 @@ class SP_Post_types {
|
|
403 |
'publicly_queryable' => false,
|
404 |
'exclude_from_search' => true,
|
405 |
'hierarchical' => false,
|
406 |
-
'supports' => array( 'title', 'page-attributes', 'excerpt' ),
|
407 |
'has_archive' => false,
|
408 |
'show_in_nav_menus' => false,
|
409 |
'can_export' => false,
|
@@ -447,9 +448,7 @@ class SP_Post_types {
|
|
447 |
|
448 |
register_post_type( 'sp_event', apply_filters( 'sportspress_register_post_type_event', $args ) );
|
449 |
|
450 |
-
|
451 |
-
apply_filters( 'sportspress_register_post_type_team',
|
452 |
-
array(
|
453 |
'labels' => array(
|
454 |
'name' => __( 'Teams', 'sportspress' ),
|
455 |
'singular_name' => __( 'Team', 'sportspress' ),
|
@@ -480,9 +479,13 @@ class SP_Post_types {
|
|
480 |
'show_in_rest' => true,
|
481 |
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
482 |
'rest_base' => 'teams',
|
483 |
-
)
|
484 |
-
|
485 |
-
)
|
|
|
|
|
|
|
|
|
486 |
|
487 |
register_post_type( 'sp_player',
|
488 |
apply_filters( 'sportspress_register_post_type_player',
|
9 |
* Registers post types and taxonomies
|
10 |
*
|
11 |
* @class SP_Post_types
|
12 |
+
* @version 2.7
|
13 |
* @package SportsPress/Classes
|
14 |
* @category Class
|
15 |
* @author ThemeBoy
|
392 |
'search_items' => __( 'Search', 'sportspress' ),
|
393 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
394 |
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
|
395 |
+
'featured_image' => __( 'Icon', 'sportspress' ),
|
396 |
'set_featured_image' => __( 'Select Icon', 'sportspress' ),
|
397 |
'remove_featured_image' => __( 'Remove icon', 'sportspress' ),
|
398 |
'use_featured_image' => __( 'Add icon', 'sportspress' ),
|
404 |
'publicly_queryable' => false,
|
405 |
'exclude_from_search' => true,
|
406 |
'hierarchical' => false,
|
407 |
+
'supports' => array( 'title', 'thumbnail', 'page-attributes', 'excerpt' ),
|
408 |
'has_archive' => false,
|
409 |
'show_in_nav_menus' => false,
|
410 |
'can_export' => false,
|
448 |
|
449 |
register_post_type( 'sp_event', apply_filters( 'sportspress_register_post_type_event', $args ) );
|
450 |
|
451 |
+
$args = array(
|
|
|
|
|
452 |
'labels' => array(
|
453 |
'name' => __( 'Teams', 'sportspress' ),
|
454 |
'singular_name' => __( 'Team', 'sportspress' ),
|
479 |
'show_in_rest' => true,
|
480 |
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
481 |
'rest_base' => 'teams',
|
482 |
+
);
|
483 |
+
|
484 |
+
if ( get_option( 'sportspress_team_comment_status', 'no' ) == 'yes' ):
|
485 |
+
$args[ 'supports' ][] = 'comments';
|
486 |
+
endif;
|
487 |
+
|
488 |
+
register_post_type( 'sp_team', apply_filters( 'sportspress_register_post_type_team', $args ) );
|
489 |
|
490 |
register_post_type( 'sp_player',
|
491 |
apply_filters( 'sportspress_register_post_type_player',
|
includes/sp-api-functions.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
-
* @version 2.
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -178,7 +178,7 @@ function sp_get_performance( $post = 0 ) {
|
|
178 |
|
179 |
function sp_get_singular_name( $post = 0 ) {
|
180 |
$singular = get_post_meta( $post, 'sp_singular', true );
|
181 |
-
if ( '' !== $singular ) {
|
182 |
return $singular;
|
183 |
} else {
|
184 |
return get_the_title( $post );
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
+
* @version 2.7
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
178 |
|
179 |
function sp_get_singular_name( $post = 0 ) {
|
180 |
$singular = get_post_meta( $post, 'sp_singular', true );
|
181 |
+
if ( $singular && '' !== $singular ) {
|
182 |
return $singular;
|
183 |
} else {
|
184 |
return get_the_title( $post );
|
includes/sp-core-functions.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
-
* @version 2.
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -1684,3 +1684,32 @@ if( ! function_exists( 'array_replace' ) ) {
|
|
1684 |
return $res;
|
1685 |
}
|
1686 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
+
* @version 2.7
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
1684 |
return $res;
|
1685 |
}
|
1686 |
}
|
1687 |
+
|
1688 |
+
/**
|
1689 |
+
* Check if a shortcode is shown on content
|
1690 |
+
* @return bool
|
1691 |
+
*/
|
1692 |
+
function sp_has_shortcodes( $content, $tags ) {
|
1693 |
+
if( is_array( $tags ) ) {
|
1694 |
+
foreach ( $tags as $tag ) {
|
1695 |
+
preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
|
1696 |
+
if ( empty( $matches ) )
|
1697 |
+
return false;
|
1698 |
+
foreach ( $matches as $shortcode ) {
|
1699 |
+
if ( $tag === $shortcode[2] )
|
1700 |
+
return true;
|
1701 |
+
}
|
1702 |
+
}
|
1703 |
+
} else {
|
1704 |
+
if ( shortcode_exists( $tags ) ) {
|
1705 |
+
preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
|
1706 |
+
if ( empty( $matches ) )
|
1707 |
+
return false;
|
1708 |
+
foreach ( $matches as $shortcode ) {
|
1709 |
+
if ( $tags === $shortcode[2] )
|
1710 |
+
return true;
|
1711 |
+
}
|
1712 |
+
}
|
1713 |
+
}
|
1714 |
+
return false;
|
1715 |
+
}
|
license.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
SportsPress
|
2 |
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
1 |
SportsPress
|
2 |
|
3 |
+
Copyright 2020 by the contributors
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
modules/sportspress-bulk-actions.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Add bulk actions to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
-
Version: 2.
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
@@ -17,89 +17,145 @@ if ( ! class_exists( 'SportsPress_Bulk_Actions' ) ) :
|
|
17 |
* Main SportsPress Bulk Actions Class
|
18 |
*
|
19 |
* @class SportsPress_Bulk_Actions
|
20 |
-
* @version
|
21 |
*/
|
22 |
class SportsPress_Bulk_Actions {
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
endif;
|
5 |
Description: Add bulk actions to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.7
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress Bulk Actions Class
|
18 |
*
|
19 |
* @class SportsPress_Bulk_Actions
|
20 |
+
* @version 2.7
|
21 |
*/
|
22 |
class SportsPress_Bulk_Actions {
|
23 |
|
24 |
+
/**
|
25 |
+
* Constructor
|
26 |
+
*/
|
27 |
+
public function __construct() {
|
28 |
+
// Define constants
|
29 |
+
$this->define_constants();
|
30 |
+
|
31 |
+
// Teams
|
32 |
+
add_filter( 'bulk_actions-edit-sp_team', array( $this, 'team_actions' ) );
|
33 |
+
add_filter( 'handle_bulk_actions-edit-sp_team', array( $this, 'team_actions_handler' ), 10, 3 );
|
34 |
+
|
35 |
+
// Events
|
36 |
+
add_filter( 'bulk_actions-edit-sp_event', array( $this, 'event_actions' ) );
|
37 |
+
add_filter( 'handle_bulk_actions-edit-sp_event', array( $this, 'event_actions_handler' ), 10, 3 );
|
38 |
+
|
39 |
+
// Notices
|
40 |
+
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Define constants.
|
45 |
+
*/
|
46 |
+
private function define_constants() {
|
47 |
+
if ( !defined( 'SP_BULK_ACTIONS_VERSION' ) )
|
48 |
+
define( 'SP_BULK_ACTIONS_VERSION', '2.7' );
|
49 |
+
|
50 |
+
if ( !defined( 'SP_BULK_ACTIONS_URL' ) )
|
51 |
+
define( 'SP_BULK_ACTIONS_URL', plugin_dir_url( __FILE__ ) );
|
52 |
+
|
53 |
+
if ( !defined( 'SP_BULK_ACTIONS_DIR' ) )
|
54 |
+
define( 'SP_BULK_ACTIONS_DIR', plugin_dir_path( __FILE__ ) );
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Add option to the team bulk actions dropdown.
|
59 |
+
*/
|
60 |
+
public function team_actions( $bulk_actions ) {
|
61 |
+
$bulk_actions['sp_calendar'] = __( 'Generate Calendars', 'sportspress' );
|
62 |
+
return $bulk_actions;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Handle form submission for team bulk actions.
|
67 |
+
*/
|
68 |
+
public function team_actions_handler( $redirect_to, $doaction, $post_ids ) {
|
69 |
+
if ( $doaction !== 'sp_calendar' ) {
|
70 |
+
return $redirect_to;
|
71 |
+
}
|
72 |
+
|
73 |
+
foreach ( $post_ids as $post_id ) {
|
74 |
+
$post = array();
|
75 |
+
$post['post_title'] = get_the_title( $post_id ) . ' ' . __( 'Calendar', 'sportspress' );
|
76 |
+
$post['post_type'] = 'sp_calendar';
|
77 |
+
$post['post_status'] = 'publish';
|
78 |
+
|
79 |
+
// Insert post
|
80 |
+
$id = wp_insert_post( $post );
|
81 |
+
|
82 |
+
// Flag as bulk
|
83 |
+
update_post_meta( $id, '_sp_bulk', 1 );
|
84 |
+
|
85 |
+
// Update meta
|
86 |
+
update_post_meta( $id, 'sp_team', $post_id );
|
87 |
+
update_post_meta( $id, 'sp_format', 'calendar' );
|
88 |
+
}
|
89 |
+
|
90 |
+
$redirect_to = add_query_arg( 'sp_bulk_generated_calendars', count( $post_ids ), $redirect_to );
|
91 |
+
return $redirect_to;
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Add option to the event bulk actions dropdown.
|
96 |
+
*/
|
97 |
+
public function event_actions( $bulk_actions ) {
|
98 |
+
$bulk_actions['sp_postpone'] = __( 'Postpone events', 'sportspress' );
|
99 |
+
$bulk_actions['sp_cancel'] = __( 'Cancel events', 'sportspress' );
|
100 |
+
return $bulk_actions;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Handle form submission for event bulk actions.
|
105 |
+
*/
|
106 |
+
public function event_actions_handler( $redirect_to, $doaction, $post_ids ) {
|
107 |
+
if ( ! in_array( $doaction, array( 'sp_postpone', 'sp_cancel' ) ) ) {
|
108 |
+
return $redirect_to;
|
109 |
+
}
|
110 |
+
|
111 |
+
if ( 'sp_postpone' == $doaction ) {
|
112 |
+
foreach ( $post_ids as $post_id ) {
|
113 |
+
update_post_meta( $post_id, 'sp_status', 'postponed' );
|
114 |
+
}
|
115 |
+
$redirect_to = add_query_arg( 'sp_bulk_postponed_events', count( $post_ids ), $redirect_to );
|
116 |
+
} elseif ( 'sp_cancel' == $doaction ) {
|
117 |
+
foreach ( $post_ids as $post_id ) {
|
118 |
+
update_post_meta( $post_id, 'sp_status', 'cancelled' );
|
119 |
+
}
|
120 |
+
$redirect_to = add_query_arg( 'sp_bulk_cancelled_events', count( $post_ids ), $redirect_to );
|
121 |
+
}
|
122 |
+
|
123 |
+
return $redirect_to;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Display notices after form submission.
|
128 |
+
*/
|
129 |
+
public function admin_notices() {
|
130 |
+
if ( ! empty( $_REQUEST['sp_bulk_generated_calendars'] ) ) {
|
131 |
+
$count = intval( $_REQUEST['sp_bulk_generated_calendars'] );
|
132 |
+
|
133 |
+
printf( '<div id="message" class="updated notice notice-success is-dismissible"><p>' .
|
134 |
+
_n( 'Generated %s calendar.',
|
135 |
+
'Generated %s calendars.',
|
136 |
+
$count,
|
137 |
+
'sportspress'
|
138 |
+
) . ' <a href="' . admin_url('edit.php?post_type=sp_calendar') . '">' . __( 'View', 'sportspress' ) . '</a></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', $count );
|
139 |
+
} elseif ( ! empty( $_REQUEST['sp_bulk_postponed_events'] ) ) {
|
140 |
+
$count = intval( $_REQUEST['sp_bulk_postponed_events'] );
|
141 |
+
|
142 |
+
printf( '<div id="message" class="updated notice notice-success is-dismissible"><p>' .
|
143 |
+
_n( 'Postponed %s event.',
|
144 |
+
'Postponed %s events.',
|
145 |
+
$count,
|
146 |
+
'sportspress'
|
147 |
+
) . '</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', $count );
|
148 |
+
} elseif ( ! empty( $_REQUEST['sp_bulk_cancelled_events'] ) ) {
|
149 |
+
$count = intval( $_REQUEST['sp_bulk_cancelled_events'] );
|
150 |
+
|
151 |
+
printf( '<div id="message" class="updated notice notice-success is-dismissible"><p>' .
|
152 |
+
_n( 'Canceled %s event.',
|
153 |
+
'Canceled %s events.',
|
154 |
+
$count,
|
155 |
+
'sportspress'
|
156 |
+
) . '</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', $count );
|
157 |
+
}
|
158 |
+
}
|
159 |
}
|
160 |
|
161 |
endif;
|
modules/sportspress-countdowns.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Add countdown widgets 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_Countdowns' ) ) :
|
|
17 |
* Main SportsPress Countdowns Class
|
18 |
*
|
19 |
* @class SportsPress_Countdowns
|
20 |
-
* @version 2.
|
21 |
*/
|
22 |
class SportsPress_Countdowns {
|
23 |
|
@@ -34,6 +34,7 @@ class SportsPress_Countdowns {
|
|
34 |
// Filters
|
35 |
add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) );
|
36 |
add_filter( 'sportspress_event_settings', array( $this, 'add_settings' ) );
|
|
|
37 |
}
|
38 |
|
39 |
/**
|
@@ -41,7 +42,7 @@ class SportsPress_Countdowns {
|
|
41 |
*/
|
42 |
private function define_constants() {
|
43 |
if ( !defined( 'SP_COUNTDOWNS_VERSION' ) )
|
44 |
-
define( 'SP_COUNTDOWNS_VERSION', '2.
|
45 |
|
46 |
if ( !defined( 'SP_COUNTDOWNS_URL' ) )
|
47 |
define( 'SP_COUNTDOWNS_URL', plugin_dir_url( __FILE__ ) );
|
@@ -104,6 +105,18 @@ class SportsPress_Countdowns {
|
|
104 |
);
|
105 |
return $settings;
|
106 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
108 |
|
109 |
endif;
|
5 |
Description: Add countdown widgets to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.7
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress Countdowns Class
|
18 |
*
|
19 |
* @class SportsPress_Countdowns
|
20 |
+
* @version 2.7
|
21 |
*/
|
22 |
class SportsPress_Countdowns {
|
23 |
|
34 |
// Filters
|
35 |
add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) );
|
36 |
add_filter( 'sportspress_event_settings', array( $this, 'add_settings' ) );
|
37 |
+
add_filter( 'sportspress_text', array( $this, 'add_text_options' ) );
|
38 |
}
|
39 |
|
40 |
/**
|
42 |
*/
|
43 |
private function define_constants() {
|
44 |
if ( !defined( 'SP_COUNTDOWNS_VERSION' ) )
|
45 |
+
define( 'SP_COUNTDOWNS_VERSION', '2.7' );
|
46 |
|
47 |
if ( !defined( 'SP_COUNTDOWNS_URL' ) )
|
48 |
define( 'SP_COUNTDOWNS_URL', plugin_dir_url( __FILE__ ) );
|
105 |
);
|
106 |
return $settings;
|
107 |
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Add text options
|
111 |
+
*/
|
112 |
+
public function add_text_options( $options = array() ) {
|
113 |
+
return array_merge( $options, array(
|
114 |
+
__( 'days', 'sportspress' ),
|
115 |
+
__( 'hrs', 'sportspress' ),
|
116 |
+
__( 'mins', 'sportspress' ),
|
117 |
+
__( 'secs', 'sportspress' ),
|
118 |
+
) );
|
119 |
+
}
|
120 |
}
|
121 |
|
122 |
endif;
|
modules/sportspress-icons.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Add vector performance icons 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_Icons' ) ) :
|
|
17 |
* Main SportsPress Icons Class
|
18 |
*
|
19 |
* @class SportsPress_Icons
|
20 |
-
* @version 2.
|
21 |
*/
|
22 |
class SportsPress_Icons {
|
23 |
|
@@ -39,7 +39,7 @@ class SportsPress_Icons {
|
|
39 |
add_filter( 'sportspress_enqueue_styles', array( $this, 'add_styles' ) );
|
40 |
add_filter( 'sportspress_performance_icon', array( $this, 'icon' ), 10, 2 );
|
41 |
add_filter( 'sportspress_event_performance_icons', array( $this, 'replace_icons' ), 10, 3 );
|
42 |
-
add_filter( 'admin_post_thumbnail_html', array( $this, '
|
43 |
add_action( 'sportspress_process_sp_performance_meta', array( $this, 'save' ), 10, 2 );
|
44 |
add_action( 'sportspress_process_sp_statistic_meta', array( $this, 'save' ), 10, 2 );
|
45 |
}
|
@@ -49,7 +49,7 @@ class SportsPress_Icons {
|
|
49 |
*/
|
50 |
private function define_constants() {
|
51 |
if ( !defined( 'SP_ICONS_VERSION' ) )
|
52 |
-
define( 'SP_ICONS_VERSION', '2.
|
53 |
|
54 |
if ( !defined( 'SP_ICONS_URL' ) )
|
55 |
define( 'SP_ICONS_URL', plugin_dir_url( __FILE__ ) );
|
@@ -144,11 +144,11 @@ class SportsPress_Icons {
|
|
144 |
/**
|
145 |
* Post thumbnail HTML.
|
146 |
*/
|
147 |
-
public function
|
148 |
// Bypass if no ID
|
149 |
if ( ! $id ) return $content;
|
150 |
|
151 |
-
// Bypass if not performance post type
|
152 |
$post_type = get_post_type( $id );
|
153 |
if ( 'sp_performance' !== $post_type && 'sp_statistic' !== $post_type ) return $content;
|
154 |
|
@@ -175,7 +175,7 @@ class SportsPress_Icons {
|
|
175 |
$value = get_post_meta( $id, 'sp_color', true );
|
176 |
if ( empty( $value ) ) $value = '111111';
|
177 |
|
178 |
-
$color = '<div class="sp-
|
179 |
|
180 |
$content = '<p><strong>' . __( 'Select Icon', 'sportspress' ) . '</strong></p>
|
181 |
<p class="sp-icons">' . $icons . '</p>
|
5 |
Description: Add vector performance icons to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.7
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress Icons Class
|
18 |
*
|
19 |
* @class SportsPress_Icons
|
20 |
+
* @version 2.7
|
21 |
*/
|
22 |
class SportsPress_Icons {
|
23 |
|
39 |
add_filter( 'sportspress_enqueue_styles', array( $this, 'add_styles' ) );
|
40 |
add_filter( 'sportspress_performance_icon', array( $this, 'icon' ), 10, 2 );
|
41 |
add_filter( 'sportspress_event_performance_icons', array( $this, 'replace_icons' ), 10, 3 );
|
42 |
+
add_filter( 'admin_post_thumbnail_html', array( $this, 'sp_admin_post_thumbnail_html' ), 10, 2 );
|
43 |
add_action( 'sportspress_process_sp_performance_meta', array( $this, 'save' ), 10, 2 );
|
44 |
add_action( 'sportspress_process_sp_statistic_meta', array( $this, 'save' ), 10, 2 );
|
45 |
}
|
49 |
*/
|
50 |
private function define_constants() {
|
51 |
if ( !defined( 'SP_ICONS_VERSION' ) )
|
52 |
+
define( 'SP_ICONS_VERSION', '2.7' );
|
53 |
|
54 |
if ( !defined( 'SP_ICONS_URL' ) )
|
55 |
define( 'SP_ICONS_URL', plugin_dir_url( __FILE__ ) );
|
144 |
/**
|
145 |
* Post thumbnail HTML.
|
146 |
*/
|
147 |
+
public function sp_admin_post_thumbnail_html( $content = '', $id = 0 ) {
|
148 |
// Bypass if no ID
|
149 |
if ( ! $id ) return $content;
|
150 |
|
151 |
+
// Bypass if not performance or statistic post type
|
152 |
$post_type = get_post_type( $id );
|
153 |
if ( 'sp_performance' !== $post_type && 'sp_statistic' !== $post_type ) return $content;
|
154 |
|
175 |
$value = get_post_meta( $id, 'sp_color', true );
|
176 |
if ( empty( $value ) ) $value = '111111';
|
177 |
|
178 |
+
$color = '<div class="sp-color-box-for-icon"><input name="sp_color" id="sp_color" type="text" value="' . esc_attr( $value ) . '" size="7" class="colorpick" /> <div id="colorPickerDiv" class="colorpickdiv"></div></div>';
|
179 |
|
180 |
$content = '<p><strong>' . __( 'Select Icon', 'sportspress' ) . '</strong></p>
|
181 |
<p class="sp-icons">' . $icons . '</p>
|
modules/sportspress-openstreetmap.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Integrate OpenStreetMap 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_OpenStreetMap' ) ):
|
|
17 |
* Main SportsPress OpenStreetMap Class
|
18 |
*
|
19 |
* @class SportsPress_OpenStreetMap
|
20 |
-
* @version 2.
|
21 |
*/
|
22 |
|
23 |
class SportsPress_OpenStreetMap {
|
@@ -45,7 +45,7 @@ if ( ! class_exists( 'SportsPress_OpenStreetMap' ) ):
|
|
45 |
*/
|
46 |
private function define_constants() {
|
47 |
if ( !defined( 'SP_OPENSTREETMAP_VERSION' ) )
|
48 |
-
define( 'SP_OPENSTREETMAP_VERSION', '2.
|
49 |
|
50 |
if ( !defined( 'SP_OPENSTREETMAP_URL' ) )
|
51 |
define( 'SP_OPENSTREETMAP_URL', plugin_dir_url( __FILE__ ) );
|
@@ -96,7 +96,8 @@ if ( ! class_exists( 'SportsPress_OpenStreetMap' ) ):
|
|
96 |
* Enqueue frontend venue scripts
|
97 |
*/
|
98 |
public function frontend_venue_scripts() {
|
99 |
-
|
|
|
100 |
wp_enqueue_style( 'leaflet_stylesheet', SP()->plugin_url() . '/assets/css/leaflet.css', array(), '1.4.0' );
|
101 |
wp_enqueue_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.4.0' );
|
102 |
}
|
5 |
Description: Integrate OpenStreetMap to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.7
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress OpenStreetMap Class
|
18 |
*
|
19 |
* @class SportsPress_OpenStreetMap
|
20 |
+
* @version 2.7
|
21 |
*/
|
22 |
|
23 |
class SportsPress_OpenStreetMap {
|
45 |
*/
|
46 |
private function define_constants() {
|
47 |
if ( !defined( 'SP_OPENSTREETMAP_VERSION' ) )
|
48 |
+
define( 'SP_OPENSTREETMAP_VERSION', '2.7' );
|
49 |
|
50 |
if ( !defined( 'SP_OPENSTREETMAP_URL' ) )
|
51 |
define( 'SP_OPENSTREETMAP_URL', plugin_dir_url( __FILE__ ) );
|
96 |
* Enqueue frontend venue scripts
|
97 |
*/
|
98 |
public function frontend_venue_scripts() {
|
99 |
+
global $post;
|
100 |
+
if( ( ( is_single() || is_tax() ) && get_post_type()=='sp_event' ) || sp_has_shortcodes( $post->post_content, array('event_full', 'event_venue') ) ) {
|
101 |
wp_enqueue_style( 'leaflet_stylesheet', SP()->plugin_url() . '/assets/css/leaflet.css', array(), '1.4.0' );
|
102 |
wp_enqueue_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.4.0' );
|
103 |
}
|
modules/sportspress-styles.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Add frontend styles 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_Styles' ) ) :
|
|
17 |
* Main SportsPress Styles Class
|
18 |
*
|
19 |
* @class SportsPress_Styles
|
20 |
-
* @version 2.
|
21 |
*/
|
22 |
class SportsPress_Styles {
|
23 |
|
@@ -43,7 +43,7 @@ class SportsPress_Styles {
|
|
43 |
*/
|
44 |
private function define_constants() {
|
45 |
if ( !defined( 'SP_STYLES_VERSION' ) )
|
46 |
-
define( 'SP_STYLES_VERSION', '2.
|
47 |
|
48 |
if ( !defined( 'SP_STYLES_URL' ) )
|
49 |
define( 'SP_STYLES_URL', plugin_dir_url( __FILE__ ) );
|
@@ -113,8 +113,14 @@ class SportsPress_Styles {
|
|
113 |
* Output custom CSS.
|
114 |
*/
|
115 |
public function custom_css( $colors = array() ) {
|
116 |
-
|
117 |
-
if ( '
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
// Defaults
|
120 |
if ( empty( $colors['primary'] ) ) $colors['primary'] = '#2b353e';
|
5 |
Description: Add frontend styles to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.7
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress Styles Class
|
18 |
*
|
19 |
* @class SportsPress_Styles
|
20 |
+
* @version 2.7
|
21 |
*/
|
22 |
class SportsPress_Styles {
|
23 |
|
43 |
*/
|
44 |
private function define_constants() {
|
45 |
if ( !defined( 'SP_STYLES_VERSION' ) )
|
46 |
+
define( 'SP_STYLES_VERSION', '2.7' );
|
47 |
|
48 |
if ( !defined( 'SP_STYLES_URL' ) )
|
49 |
define( 'SP_STYLES_URL', plugin_dir_url( __FILE__ ) );
|
113 |
* Output custom CSS.
|
114 |
*/
|
115 |
public function custom_css( $colors = array() ) {
|
116 |
+
|
117 |
+
if ( current_theme_supports( 'sportspress' ) && ! current_theme_supports( 'sportspress-styles' ) ) {
|
118 |
+
return;
|
119 |
+
}
|
120 |
+
|
121 |
+
if ( 'no' === get_option( 'sportspress_styles', 'yes' ) ) {
|
122 |
+
return;
|
123 |
+
}
|
124 |
|
125 |
// Defaults
|
126 |
if ( empty( $colors['primary'] ) ) $colors['primary'] = '#2b353e';
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: ThemeBoy, brianmiyaji, aylaview, savvasha, nabil_kadimi
|
|
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: 5.
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -240,6 +240,20 @@ When you upgrade to one of the SportsPress Pro licenses, you can simply activate
|
|
240 |
|
241 |
== Changelog ==
|
242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
= 2.6.20 =
|
244 |
* Tweak - Improve compatibility with volleyball for checkbox performance.
|
245 |
* Preset - Update volleyball preset with additional options.
|
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: 5.3
|
7 |
+
Stable tag: 2.7
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
240 |
|
241 |
== Changelog ==
|
242 |
|
243 |
+
= 2.7 =
|
244 |
+
* Feature - New bulk actions to postpone and cancel multiple events.
|
245 |
+
* Feature - Add date of birth to player importer.
|
246 |
+
* Feature - Automatically select the home team's venue as the default venue when importing fixtures.
|
247 |
+
* Feature - Add ability to turn on comment for team profiles.
|
248 |
+
* Feature - Filter league tables by event status.
|
249 |
+
* Tweak - When an icon is used for player performance, display the icon in player lists and profiles.
|
250 |
+
* Tweak - Add title attribute for player statistic icons.
|
251 |
+
* Tweak - Default stylesheet sorting icon width.
|
252 |
+
* Fix - Icon color picker rendering issue.
|
253 |
+
* Fix - Image selector not working for player statistics.
|
254 |
+
* Fix - Enqueue scripts and styles for OpenStreetMap when used in shortcodes.
|
255 |
+
* Localization - Add translation options for countdown units.
|
256 |
+
|
257 |
= 2.6.20 =
|
258 |
* Tweak - Improve compatibility with volleyball for checkbox performance.
|
259 |
* Preset - Update volleyball preset with additional options.
|
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.
|
7 |
* Author: ThemeBoy
|
8 |
* Author URI: http://themeboy.com
|
9 |
* Requires at least: 3.8
|
10 |
-
* Tested up to: 5.
|
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.
|
30 |
*/
|
31 |
final class SportsPress {
|
32 |
|
33 |
/**
|
34 |
* @var string
|
35 |
*/
|
36 |
-
public $version = '2.
|
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.7
|
7 |
* Author: ThemeBoy
|
8 |
* Author URI: http://themeboy.com
|
9 |
* Requires at least: 3.8
|
10 |
+
* Tested up to: 5.3
|
11 |
*
|
12 |
* Text Domain: sportspress
|
13 |
* Domain Path: /languages/
|
26 |
* Main SportsPress Class
|
27 |
*
|
28 |
* @class SportsPress
|
29 |
+
* @version 2.7
|
30 |
*/
|
31 |
final class SportsPress {
|
32 |
|
33 |
/**
|
34 |
* @var string
|
35 |
*/
|
36 |
+
public $version = '2.7';
|
37 |
|
38 |
/**
|
39 |
* @var SportsPress The single instance of the class
|
templates/event-venue.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
|
@@ -29,9 +29,8 @@ foreach( $venues as $venue ):
|
|
29 |
if ( $link_venues )
|
30 |
$name = '<a href="' . get_term_link( $t_id, 'sp_venue' ) . '">' . $name . '</a>';
|
31 |
|
32 |
-
$address = sp_array_value( $meta, 'sp_address',
|
33 |
-
$
|
34 |
-
$longitude = sp_array_value( $meta, 'sp_longitude', 0 );
|
35 |
?>
|
36 |
<div class="sp-template sp-template-event-venue">
|
37 |
<h4 class="sp-table-caption"><?php _e( 'Venue', 'sportspress' ); ?></h4>
|
@@ -41,7 +40,7 @@ foreach( $venues as $venue ):
|
|
41 |
<th><?php echo $name; ?></th>
|
42 |
</tr>
|
43 |
</thead>
|
44 |
-
<?php if ( $show_maps
|
45 |
<tbody>
|
46 |
<tr class="sp-event-venue-map-row">
|
47 |
<td><?php sp_get_template( 'venue-map.php', array( 'meta' => $meta ) ); ?></td>
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.7
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
if ( $link_venues )
|
30 |
$name = '<a href="' . get_term_link( $t_id, 'sp_venue' ) . '">' . $name . '</a>';
|
31 |
|
32 |
+
$address = sp_array_value( $meta, 'sp_address', null );
|
33 |
+
$address = urlencode( $address );
|
|
|
34 |
?>
|
35 |
<div class="sp-template sp-template-event-venue">
|
36 |
<h4 class="sp-table-caption"><?php _e( 'Venue', 'sportspress' ); ?></h4>
|
40 |
<th><?php echo $name; ?></th>
|
41 |
</tr>
|
42 |
</thead>
|
43 |
+
<?php if ( $show_maps ): ?>
|
44 |
<tbody>
|
45 |
<tr class="sp-event-venue-map-row">
|
46 |
<td><?php sp_get_template( 'venue-map.php', array( 'meta' => $meta ) ); ?></td>
|
templates/league-table.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version 2.
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -48,6 +48,13 @@ if ( $show_title && false === $title && $id ):
|
|
48 |
$title = get_the_title( $id );
|
49 |
endif;
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
//Create a unique identifier based on the current time in microseconds
|
52 |
$identifier = uniqid( 'table_' );
|
53 |
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.7
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
48 |
$title = get_the_title( $id );
|
49 |
endif;
|
50 |
|
51 |
+
//Check if we have event status sent from shortcode
|
52 |
+
if ( isset( $show_published_events ) )
|
53 |
+
$table->show_published_events = $show_published_events ;
|
54 |
+
|
55 |
+
if ( isset( $show_future_events ) )
|
56 |
+
$table->show_future_events = $show_future_events ;
|
57 |
+
|
58 |
//Create a unique identifier based on the current time in microseconds
|
59 |
$identifier = uniqid( 'table_' );
|
60 |
|
templates/venue-map.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version 2.
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -27,7 +27,7 @@ if ( '' === $address ) $address = '+';
|
|
27 |
if ( 'satellite' !== $maptype ) $maptype = 'roadmap';
|
28 |
|
29 |
if ( $latitude != null && $longitude != null ){
|
30 |
-
|
31 |
}
|
32 |
if ( is_tax( 'sp_venue' ) )
|
33 |
do_action ( 'sportspress_after_venue_map' );
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.7
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
27 |
if ( 'satellite' !== $maptype ) $maptype = 'roadmap';
|
28 |
|
29 |
if ( $latitude != null && $longitude != null ){
|
30 |
+
do_action ( 'sp_venue_show_map', $latitude, $longitude, $address, $zoom, $maptype );
|
31 |
}
|
32 |
if ( is_tax( 'sp_venue' ) )
|
33 |
do_action ( 'sportspress_after_venue_map' );
|