SportsPress – Sports Club & League Manager - Version 2.7.2

Version Description

  • Tweak - Sanitize delimiter field in event settings.
Download this release

Release Info

Developer ThemeBoy
Plugin Icon 128x128 SportsPress – Sports Club & League Manager
Version 2.7.2
Comparing to
See all releases

Code changes from version 2.7.1 to 2.7.2

changelog.txt CHANGED
@@ -1,5 +1,8 @@
1
  == SportsPress Changelog ==
2
 
 
 
 
3
  = 2.7.1 =
4
  * Feature - Enable player list filtering by nationality.
5
  * Feature - Add option to display date of birth in player lists.
1
  == SportsPress Changelog ==
2
 
3
+ = 2.7.2 =
4
+ * Tweak - Sanitize delimiter field in event settings.
5
+
6
  = 2.7.1 =
7
  * Feature - Enable player list filtering by nationality.
8
  * Feature - Add option to display date of birth in player lists.
includes/admin/settings/class-sp-settings-events.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin
8
- * @version 2.6.15
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -469,7 +469,7 @@ class SP_Settings_Events extends SP_Settings_Page {
469
  parent::save();
470
 
471
  if ( isset( $_POST['sportspress_event_teams_delimiter'] ) )
472
- update_option( 'sportspress_event_teams_delimiter', $_POST['sportspress_event_teams_delimiter'] );
473
  }
474
 
475
  /**
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin
8
+ * @version 2.7.1.2
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
469
  parent::save();
470
 
471
  if ( isset( $_POST['sportspress_event_teams_delimiter'] ) )
472
+ update_option( 'sportspress_event_teams_delimiter', sanitize_text_field( $_POST['sportspress_event_teams_delimiter'] ) );
473
  }
474
 
475
  /**
includes/widgets/class-sp-widget-countdown.php CHANGED
@@ -16,6 +16,7 @@ class SP_Widget_Countdown extends WP_Widget {
16
  $show_venue = empty($instance['show_venue']) ? false : $instance['show_venue'];
17
  $show_league = empty($instance['show_league']) ? false : $instance['show_league'];
18
  $show_date = empty($instance['show_date']) ? false : $instance['show_date'];
 
19
 
20
  do_action( 'sportspress_before_widget', $args, $instance, 'countdown' );
21
  echo $before_widget;
@@ -26,7 +27,7 @@ class SP_Widget_Countdown extends WP_Widget {
26
  // Action to hook into
27
  do_action( 'sportspress_before_widget_template', $args, $instance, 'countdown' );
28
 
29
- sp_get_template( 'countdown.php', array( 'calendar' => $calendar, 'team' => $team, 'id' => $id, 'title' => $caption, 'show_venue' => $show_venue, 'show_league' => $show_league, 'show_date' => $show_date ) );
30
 
31
  // Action to hook into
32
  do_action( 'sportspress_after_widget_template', $args, $instance, 'countdown' );
@@ -45,6 +46,7 @@ class SP_Widget_Countdown extends WP_Widget {
45
  $instance['show_venue'] = intval($new_instance['show_venue']);
46
  $instance['show_league'] = intval($new_instance['show_league']);
47
  $instance['show_date'] = intval($new_instance['show_date']);
 
48
 
49
  // Filter to hook into
50
  $instance = apply_filters( 'sportspress_widget_update', $instance, $new_instance, $old_instance, 'countdown' );
@@ -53,7 +55,7 @@ class SP_Widget_Countdown extends WP_Widget {
53
  }
54
 
55
  function form( $instance ) {
56
- $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'calendar' => '', 'team' => '', 'id' => '', 'caption' => '', 'show_venue' => false, 'show_league' => false, 'show_date' => false ) );
57
  $title = strip_tags($instance['title']);
58
  $caption = strip_tags($instance['caption']);
59
  $calendar = intval($instance['calendar']);
@@ -62,6 +64,7 @@ class SP_Widget_Countdown extends WP_Widget {
62
  $show_venue = intval($instance['show_venue']);
63
  $show_league = intval($instance['show_league']);
64
  $show_date = intval($instance['show_date']);
 
65
 
66
  // Action to hook into
67
  do_action( 'sportspress_before_widget_template_form', $this, $instance, 'countdown' );
@@ -135,6 +138,9 @@ class SP_Widget_Countdown extends WP_Widget {
135
  <p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_date'); ?>" name="<?php echo $this->get_field_name('show_date'); ?>" value="1" <?php checked( $show_date, 1 ); ?>>
136
  <label for="<?php echo $this->get_field_id('show_date'); ?>"><?php _e( 'Display date', 'sportspress' ); ?></label></p>
137
 
 
 
 
138
  <?php
139
  // Action to hook into
140
  do_action( 'sportspress_after_widget_template_form', $this, $instance, 'countdown' );
16
  $show_venue = empty($instance['show_venue']) ? false : $instance['show_venue'];
17
  $show_league = empty($instance['show_league']) ? false : $instance['show_league'];
18
  $show_date = empty($instance['show_date']) ? false : $instance['show_date'];
19
+ $show_excluded = empty($instance['show_excluded']) ? false : $instance['show_excluded'];
20
 
21
  do_action( 'sportspress_before_widget', $args, $instance, 'countdown' );
22
  echo $before_widget;
27
  // Action to hook into
28
  do_action( 'sportspress_before_widget_template', $args, $instance, 'countdown' );
29
 
30
+ sp_get_template( 'countdown.php', array( 'calendar' => $calendar, 'team' => $team, 'id' => $id, 'title' => $caption, 'show_venue' => $show_venue, 'show_league' => $show_league, 'show_date' => $show_date, 'show_excluded' => $show_excluded ) );
31
 
32
  // Action to hook into
33
  do_action( 'sportspress_after_widget_template', $args, $instance, 'countdown' );
46
  $instance['show_venue'] = intval($new_instance['show_venue']);
47
  $instance['show_league'] = intval($new_instance['show_league']);
48
  $instance['show_date'] = intval($new_instance['show_date']);
49
+ $instance['show_excluded'] = intval($new_instance['show_excluded']);
50
 
51
  // Filter to hook into
52
  $instance = apply_filters( 'sportspress_widget_update', $instance, $new_instance, $old_instance, 'countdown' );
55
  }
56
 
57
  function form( $instance ) {
58
+ $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'calendar' => '', 'team' => '', 'id' => '', 'caption' => '', 'show_venue' => false, 'show_league' => false, 'show_date' => false, 'show_excluded' => false ) );
59
  $title = strip_tags($instance['title']);
60
  $caption = strip_tags($instance['caption']);
61
  $calendar = intval($instance['calendar']);
64
  $show_venue = intval($instance['show_venue']);
65
  $show_league = intval($instance['show_league']);
66
  $show_date = intval($instance['show_date']);
67
+ $show_excluded = intval($instance['show_excluded']);
68
 
69
  // Action to hook into
70
  do_action( 'sportspress_before_widget_template_form', $this, $instance, 'countdown' );
138
  <p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_date'); ?>" name="<?php echo $this->get_field_name('show_date'); ?>" value="1" <?php checked( $show_date, 1 ); ?>>
139
  <label for="<?php echo $this->get_field_id('show_date'); ?>"><?php _e( 'Display date', 'sportspress' ); ?></label></p>
140
 
141
+ <p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_excluded'); ?>" name="<?php echo $this->get_field_name('show_excluded'); ?>" value="1" <?php checked( $show_excluded, 1 ); ?>>
142
+ <label for="<?php echo $this->get_field_id('show_excluded'); ?>"><?php _e( 'Display excluded events', 'sportspress' ); ?></label></p>
143
+
144
  <?php
145
  // Action to hook into
146
  do_action( 'sportspress_after_widget_template_form', $this, $instance, 'countdown' );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: calendars, club, club management, esports, events, fixtures, leagues, leag
4
  Donate link: http://tboy.co/donate
5
  Requires at least: 3.8
6
  Tested up to: 5.3
7
- Stable tag: 2.7.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -240,6 +240,9 @@ When you upgrade to one of the SportsPress Pro licenses, you can simply activate
240
 
241
  == Changelog ==
242
 
 
 
 
243
  = 2.7.1 =
244
  * Feature - Enable player list filtering by nationality.
245
  * Feature - Add option to display date of birth in player lists.
4
  Donate link: http://tboy.co/donate
5
  Requires at least: 3.8
6
  Tested up to: 5.3
7
+ Stable tag: 2.7.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
240
 
241
  == Changelog ==
242
 
243
+ = 2.7.2 =
244
+ * Tweak - Sanitize delimiter field in event settings.
245
+
246
  = 2.7.1 =
247
  * Feature - Enable player list filtering by nationality.
248
  * Feature - Add option to display date of birth in player lists.
sportspress.php CHANGED
@@ -3,7 +3,7 @@
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.1
7
  * Author: ThemeBoy
8
  * Author URI: http://themeboy.com
9
  * Requires at least: 3.8
@@ -26,14 +26,14 @@ if ( ! class_exists( 'SportsPress' ) ) :
26
  * Main SportsPress Class
27
  *
28
  * @class SportsPress
29
- * @version 2.7.1
30
  */
31
  final class SportsPress {
32
 
33
  /**
34
  * @var string
35
  */
36
- public $version = '2.7.1';
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.2
7
  * Author: ThemeBoy
8
  * Author URI: http://themeboy.com
9
  * Requires at least: 3.8
26
  * Main SportsPress Class
27
  *
28
  * @class SportsPress
29
+ * @version 2.7.2
30
  */
31
  final class SportsPress {
32
 
33
  /**
34
  * @var string
35
  */
36
+ public $version = '2.7.2';
37
 
38
  /**
39
  * @var SportsPress The single instance of the class
templates/countdown.php CHANGED
@@ -23,6 +23,16 @@ $defaults = array(
23
  'show_logos' => get_option( 'sportspress_countdown_show_logos', 'no' ) == 'yes' ? true : false,
24
  'show_thumbnail' => get_option( 'sportspress_countdown_show_thumbnail', 'no' ) == 'yes' ? true : false,
25
  );
 
 
 
 
 
 
 
 
 
 
26
  if ( isset( $id ) ):
27
  $post = get_post( $id );
28
  elseif ( $calendar ):
@@ -36,10 +46,6 @@ elseif ( $calendar ):
36
  /**
37
  * Exclude postponed or cancelled events.
38
  */
39
- $excluded_statuses = apply_filters( 'sp_countdown_excluded_statuses', array(
40
- 'postponed',
41
- 'cancelled',
42
- ) );
43
  while ( $post = array_shift( $data ) ) {
44
  $sp_status = get_post_meta($post->ID, 'sp_status', true);
45
  if( ! in_array( $sp_status, $excluded_statuses ) ) {
@@ -80,10 +86,7 @@ else:
80
  $args['meta_query'][] = [
81
  'key' => 'sp_status',
82
  'compare' => 'NOT IN',
83
- 'value' => apply_filters( 'sp_countdown_excluded_statuses', array(
84
- 'postponed',
85
- 'cancelled',
86
- ) ),
87
  ];
88
 
89
  $post = sp_get_next_event( $args );
@@ -98,6 +101,13 @@ if ( $title )
98
 
99
  $title = $post->post_title;
100
  if ( $link_events ) $title = '<a href="' . get_post_permalink( $post->ID, false, true ) . '">' . $title . '</a>';
 
 
 
 
 
 
 
101
  ?>
102
  <div class="sp-template sp-template-countdown">
103
  <div class="sp-countdown-wrapper">
@@ -128,7 +138,7 @@ if ( $link_events ) $title = '<a href="' . get_post_permalink( $post->ID, false,
128
  }
129
  }
130
  ?>
131
- <?php echo $title; ?>
132
  </h3>
133
  <?php
134
  if ( isset( $show_date ) && $show_date ):
23
  'show_logos' => get_option( 'sportspress_countdown_show_logos', 'no' ) == 'yes' ? true : false,
24
  'show_thumbnail' => get_option( 'sportspress_countdown_show_thumbnail', 'no' ) == 'yes' ? true : false,
25
  );
26
+
27
+ if ( isset( $show_excluded ) && $show_excluded ){
28
+ $excluded_statuses = array();
29
+ }else{
30
+ $excluded_statuses = apply_filters( 'sp_countdown_excluded_statuses', array(
31
+ 'postponed',
32
+ 'cancelled',
33
+ ) );
34
+ }
35
+
36
  if ( isset( $id ) ):
37
  $post = get_post( $id );
38
  elseif ( $calendar ):
46
  /**
47
  * Exclude postponed or cancelled events.
48
  */
 
 
 
 
49
  while ( $post = array_shift( $data ) ) {
50
  $sp_status = get_post_meta($post->ID, 'sp_status', true);
51
  if( ! in_array( $sp_status, $excluded_statuses ) ) {
86
  $args['meta_query'][] = [
87
  'key' => 'sp_status',
88
  'compare' => 'NOT IN',
89
+ 'value' => $excluded_statuses,
 
 
 
90
  ];
91
 
92
  $post = sp_get_next_event( $args );
101
 
102
  $title = $post->post_title;
103
  if ( $link_events ) $title = '<a href="' . get_post_permalink( $post->ID, false, true ) . '">' . $title . '</a>';
104
+ $sp_status = get_post_meta($post->ID, 'sp_status', true);
105
+ $statuses = apply_filters( 'sportspress_event_statuses', array(
106
+ 'ok' => __( 'On time', 'sportspress' ),
107
+ 'tbd' => __( 'TBD', 'sportspress' ),
108
+ 'postponed' => __( 'Postponed', 'sportspress' ),
109
+ 'cancelled' => __( 'Canceled', 'sportspress' ),
110
+ ) );
111
  ?>
112
  <div class="sp-template sp-template-countdown">
113
  <div class="sp-countdown-wrapper">
138
  }
139
  }
140
  ?>
141
+ <?php echo $title.' ('.$statuses[ $sp_status ].')'; ?>
142
  </h3>
143
  <?php
144
  if ( isset( $show_date ) && $show_date ):