SportsPress – Sports Club & League Manager - Version 2.6

Version Description

  • Feature - Add custom details to events using event specs.
  • Feature - Conditional equations for variables.
  • Feature - Display the next opponent in league tables.
  • Feature - Short name option added to teams.
  • Feature - Automatic event titles using short name when available.
  • Feature - Display featured image in countdown widget.
  • Tweak - Stronger connections between leagues, seasons, and teams for automatic player lists.
  • Tweak - Relative date option added to editor shortcodes.
  • Tweak - Display only current team in player list.
  • Tweak - Filter players dropdown by current team only.
  • Tweak - Allow 0 as a squad number when importing players.
  • Tweak - Prevent filtering through empty results.
  • Fix - Interpreting non-integer substitution times.
  • Fix - Warning when sorting terms without order.
  • Localization - Add WPML support to staff header.
  • Localization - Fix RTL not being applied in league tables.
Download this release

Release Info

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

Code changes from version 2.5.10 to 2.6

Files changed (76) hide show
  1. assets/css/menu.css +9 -6
  2. assets/css/sportspress-rtl.css +2 -2
  3. assets/css/sportspress.css +9 -3
  4. assets/fonts/sportspress.eot +0 -0
  5. assets/fonts/sportspress.svg +1 -0
  6. assets/fonts/sportspress.ttf +0 -0
  7. assets/fonts/sportspress.woff +0 -0
  8. assets/fonts/sportspress.woff2 +0 -0
  9. assets/images/welcome/screenshot-awards.png +0 -0
  10. assets/images/welcome/screenshot-conditional-equations.png +0 -0
  11. assets/images/welcome/screenshot-event-performance-importer.png +0 -0
  12. assets/images/welcome/screenshot-event-specs.png +0 -0
  13. assets/images/welcome/screenshot-group-stages.png +0 -0
  14. assets/images/welcome/screenshot-midseason-transfers.png +0 -0
  15. assets/images/welcome/screenshot-next-team.png +0 -0
  16. assets/images/welcome/screenshot-officials.png +0 -0
  17. assets/images/welcome/screenshot-performance-icons.png +0 -0
  18. assets/images/welcome/screenshot-results-matrix.png +0 -0
  19. assets/images/welcome/screenshot-sponsor-levels.png +0 -0
  20. assets/images/welcome/screenshot-vertical-timelines.png +0 -0
  21. changelog.txt +119 -0
  22. includes/admin/class-sp-admin-assets.php +6 -5
  23. includes/admin/class-sp-admin-sports.php +13 -2
  24. includes/admin/class-sp-admin-taxonomies.php +11 -3
  25. includes/admin/class-sp-admin-welcome.php +393 -410
  26. includes/admin/importers/class-sp-player-importer.php +2 -2
  27. includes/admin/post-types/class-sp-admin-cpt-event.php +2 -2
  28. includes/admin/post-types/class-sp-admin-cpt-player.php +9 -7
  29. includes/admin/post-types/class-sp-admin-cpt-spec.php +70 -0
  30. includes/admin/post-types/class-sp-admin-cpt-team.php +5 -4
  31. includes/admin/post-types/meta-boxes/class-sp-meta-box-event-specs.php +53 -0
  32. includes/admin/post-types/meta-boxes/class-sp-meta-box-outcome-details.php +2 -2
  33. includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php +30 -7
  34. includes/admin/post-types/meta-boxes/class-sp-meta-box-spec-details.php +62 -0
  35. includes/admin/post-types/meta-boxes/class-sp-meta-box-staff-details.php +3 -3
  36. includes/admin/post-types/meta-boxes/class-sp-meta-box-team-details.php +6 -1
  37. includes/admin/settings/class-sp-settings-events.php +3 -4
  38. includes/admin/settings/class-sp-settings-modules.php +1 -20
  39. includes/admin/settings/class-sp-settings-teams.php +8 -16
  40. includes/admin/views/html-admin-config.php +1 -1
  41. includes/class-sp-ajax.php +170 -24
  42. includes/class-sp-event.php +27 -4
  43. includes/class-sp-league-table.php +4 -5
  44. includes/class-sp-modules.php +16 -9
  45. includes/class-sp-player-list.php +16 -12
  46. includes/class-sp-player.php +31 -9
  47. includes/class-sp-post-types.php +2 -2
  48. includes/class-sp-team.php +2 -2
  49. includes/sp-api-functions.php +32 -12
  50. includes/sp-core-functions.php +10 -3
  51. includes/sp-deprecated-functions.php +28 -1
  52. includes/sp-template-hooks.php +7 -3
  53. modules/sportspress-conditional-equations.php +145 -0
  54. modules/sportspress-countdowns.php +13 -5
  55. modules/sportspress-event-specs.php +274 -0
  56. modules/sportspress-next-team-preset.php +136 -0
  57. modules/sportspress-officials.php +5 -3
  58. modules/sportspress-player-assignments.php +135 -0
  59. modules/sportspress-wordpay.php +4 -6
  60. readme.txt +19 -1
  61. sportspress.php +3 -3
  62. templates/countdown.php +9 -1
  63. templates/event-list.php +2 -3
  64. templates/event-logos-block.php +3 -3
  65. templates/event-logos-inline.php +3 -3
  66. templates/event-logos.php +1 -3
  67. templates/event-performance.php +3 -4
  68. templates/event-results.php +2 -3
  69. templates/official-details.php +3 -4
  70. templates/player-details.php +3 -4
  71. templates/player-list.php +3 -4
  72. templates/player-selector.php +2 -2
  73. templates/player-statistics.php +13 -2
  74. templates/staff-details.php +3 -4
  75. templates/staff-header.php +3 -3
  76. wpml-config.xml +2 -1
assets/css/menu.css CHANGED
@@ -1,12 +1,12 @@
1
  /* SportsPress menu styles */
2
  @font-face {
3
  font-family: 'sportspress';
4
- src:url('../fonts/sportspress.eot?ddphik');
5
- src:url('../fonts/sportspress.eot?#iefixddphik') format('embedded-opentype'),
6
- url('../fonts/sportspress.woff2?ddphik') format('woff2'),
7
- url('../fonts/sportspress.ttf?ddphik') format('truetype'),
8
- url('../fonts/sportspress.woff?ddphik') format('woff'),
9
- url('../fonts/sportspress.svg?ddphik#sportspress') format('svg');
10
  font-weight: normal;
11
  font-style: normal;
12
  }
@@ -100,6 +100,9 @@
100
  .sp-icon-list:before {
101
  content: "\f163"
102
  }
 
 
 
103
  .sp-icon-megaphone:before {
104
  content: "\f488";
105
  }
1
  /* SportsPress menu styles */
2
  @font-face {
3
  font-family: 'sportspress';
4
+ src:url('../fonts/sportspress.eot?p81i3r');
5
+ src:url('../fonts/sportspress.eot?#iefixp81i3r') format('embedded-opentype'),
6
+ url('../fonts/sportspress.woff2?p81i3r') format('woff2'),
7
+ url('../fonts/sportspress.ttf?p81i3r') format('truetype'),
8
+ url('../fonts/sportspress.woff?p81i3r') format('woff'),
9
+ url('../fonts/sportspress.svg?p81i3r#sportspress') format('svg');
10
  font-weight: normal;
11
  font-style: normal;
12
  }
100
  .sp-icon-list:before {
101
  content: "\f163"
102
  }
103
+ .sp-icon-matrix:before {
104
+ content: "\f314";
105
+ }
106
  .sp-icon-megaphone:before {
107
  content: "\f488";
108
  }
assets/css/sportspress-rtl.css CHANGED
@@ -15,7 +15,7 @@
15
 
16
  /* Data Tables */
17
  .sp-data-table .data-name {
18
- text-align: right;
19
  }
20
 
21
  /* Pagination */
@@ -80,4 +80,4 @@
80
  .sp-template-logo + .sp-post-content {
81
  clear: right;
82
  }
83
- }
15
 
16
  /* Data Tables */
17
  .sp-data-table .data-name {
18
+ text-align: right !important;
19
  }
20
 
21
  /* Pagination */
80
  .sp-template-logo + .sp-post-content {
81
  clear: right;
82
  }
83
+ }
assets/css/sportspress.css CHANGED
@@ -176,15 +176,17 @@
176
  .sp-league-table td.has-logo {
177
  line-height: 2em;
178
  }
179
- .sp-league-table .data-name .team-logo {
180
  width: 2em;
181
  height: 2em;
182
- margin-right: 0.5em;
183
  display: inline-block;
184
  vertical-align: middle;
185
  text-align: center;
186
  }
187
- .sp-league-table .data-name .team-logo img {
 
 
 
188
  width: auto;
189
  height: auto;
190
  max-width: 2em;
@@ -491,6 +493,10 @@
491
  }
492
 
493
  /* Countdowns */
 
 
 
 
494
  .sp-template-countdown .event-name {
495
  clear: both;
496
  overflow: hidden;
176
  .sp-league-table td.has-logo {
177
  line-height: 2em;
178
  }
179
+ .sp-league-table .team-logo {
180
  width: 2em;
181
  height: 2em;
 
182
  display: inline-block;
183
  vertical-align: middle;
184
  text-align: center;
185
  }
186
+ .sp-league-table .data-name .team-logo {
187
+ margin-right: 0.5em;
188
+ }
189
+ .sp-league-table .team-logo img {
190
  width: auto;
191
  height: auto;
192
  max-width: 2em;
493
  }
494
 
495
  /* Countdowns */
496
+ .sp-template-countdown .event-image img {
497
+ display: block;
498
+ margin: 0 auto;
499
+ }
500
  .sp-template-countdown .event-name {
501
  clear: both;
502
  overflow: hidden;
assets/fonts/sportspress.eot CHANGED
Binary file
assets/fonts/sportspress.svg CHANGED
@@ -51,6 +51,7 @@
51
  <glyph unicode="&#xf307;" glyph-name="tshirt" d="M459.6 307.2h-76.8v-179.2h-256v179.2h-76.8v102.4h132.4c10.56-29.84 38.96-51.2 72.4-51.2s61.84 21.36 72.4 51.2h132.4v-102.4zM382.8 102.4v-51.2h-256v51.2h256z" />
52
  <glyph unicode="&#xf309;" glyph-name="color" d="M435.2 204.8c0-98.96-80.24-179.2-179.2-179.2s-179.2 80.24-179.2 179.2c0 49.52 20.080 94.32 52.48 126.72v0l126.72 126.72 126.72-126.72c32.4-32.4 52.48-77.2 52.48-126.72zM343.28 298l-87.44 87.44-89.040-89.040c-23.84-23.28-38.8-55.6-38.8-91.6 0-70.72 57.28-128 128-128s128 57.28 128 128c0 36.88-15.76 69.84-40.72 93.2zM256 102.4l0.080 246.8 70.4-70.4c19.6-18.64 31.92-44.8 31.92-74 0-56.56-45.84-102.4-102.4-102.4z" />
53
  <glyph unicode="&#xf313;" glyph-name="tournament" d="M384 286v149.2h25.6c14.16 0 25.6-11.44 25.6-25.6v-51.2c0-33.44-21.36-61.84-51.2-72.4zM153.6 51.52h204.8v-51.52h-204.8v51.52zM179.2 76.8l25.6 25.6h25.6v25.6l25.6 25.6 25.6-25.6v-25.6h25.6l25.6-25.6h-153.6zM256 179.2c-56.56 0-102.4 45.84-102.4 102.4v179.2h204.8v-179.2c0-56.56-45.84-102.4-102.4-102.4zM76.8 358.4v51.2c0 14.16 11.44 25.6 25.6 25.6h25.6v-149.2c-29.84 10.56-51.2 38.96-51.2 72.4z" />
 
54
  <glyph unicode="&#xf316;" glyph-name="import" d="M435.2 256c-14.16 0-25.6-11.44-25.6-25.6v-153.6h-307.2v153.6c0 14.16-11.44 25.6-25.6 25.6s-25.6-11.44-25.6-25.6v-179.2c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v179.2c0 14.16-11.44 25.6-25.6 25.6zM281.6 256v156.72c0 12.4-11.44 22.48-25.6 22.48s-25.6-10.080-25.6-22.48v-156.72h-76.8l102.4-102.4 102.4 102.4h-76.8z" />
55
  <glyph unicode="&#xf317;" glyph-name="export" d="M435.2 256c-14.16 0-25.6-11.44-25.6-25.6v-153.6h-307.2v153.6c0 14.16-11.44 25.6-25.6 25.6s-25.6-11.44-25.6-25.6v-179.2c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v179.2c0 14.16-11.44 25.6-25.6 25.6zM230.4 179.2c0-14.16 11.44-25.6 25.6-25.6s25.6 11.44 25.6 25.6v153.6h76.8l-102.4 102.4-102.4-102.4h76.8v-153.6z" />
56
  <glyph unicode="&#xf319;" glyph-name="globe" d="M256 25.6c-113.12 0-204.8 91.68-204.8 204.8s91.68 204.8 204.8 204.8 204.8-91.68 204.8-204.8-91.68-204.8-204.8-204.8zM256 384c-84.8 0-153.6-68.8-153.6-153.6s68.8-153.6 153.6-153.6 153.6 68.8 153.6 153.6-68.8 153.6-153.6 153.6zM331.28 138.080l-4.48-2.64-12.96-7.92-7.68-5.6c-5.68-2.72-11.68-4.88-17.76-6.72v7.52l-2.16 17.36c0 0-1.040 10-2.72 12.64-1.6 2.64-5.44 6.32-9.2 7.92s-6.48 1.6-8.64 4.16c-2.16 2.64-3.84 7.36-6.48 11.6-2.72 4.24-6 8.48-6 10.56s0 23.76 0 23.76l2.72 20 5.92 4.24 7.040 7.92 4.88 1.6 16.8-3.12h11.84l4.88-10 11.36-8.96 7.040-11.040 9.2-3.12h10.32l7.040-8.48 4.32-8.96 1.6-6.32v-10.56l-1.12-6.24c-6.8-11.28-15.52-21.2-25.76-29.6v0 0zM289.36 319.92l-11.92-6.32-4.32-12.16-7.040-6.32h-23.36l-10.8-4.24-0.56-8.4-4.32-6.88-1.12-7.36 2.16-6.32 2.72-6.32c0 0 6.56-7.36 0-12.64 0 0-8.16 0-9.76 2.64s-13.52 10-15.76 12.16c-2.16 2.080-9.2 4.16-9.2 4.16l-8.64 3.2-8.16 0.56 0.56 11.040-0.56 9.44-3.28 6.88-9.2 6.88-0.56 7.36 1.12 4.080c21.92 21.2 52.16 34.4 85.6 34.4 18.88 0 36.48-4.56 52.4-12l-0.32-2.8-15.68-11.040z" />
51
  <glyph unicode="&#xf307;" glyph-name="tshirt" d="M459.6 307.2h-76.8v-179.2h-256v179.2h-76.8v102.4h132.4c10.56-29.84 38.96-51.2 72.4-51.2s61.84 21.36 72.4 51.2h132.4v-102.4zM382.8 102.4v-51.2h-256v51.2h256z" />
52
  <glyph unicode="&#xf309;" glyph-name="color" d="M435.2 204.8c0-98.96-80.24-179.2-179.2-179.2s-179.2 80.24-179.2 179.2c0 49.52 20.080 94.32 52.48 126.72v0l126.72 126.72 126.72-126.72c32.4-32.4 52.48-77.2 52.48-126.72zM343.28 298l-87.44 87.44-89.040-89.040c-23.84-23.28-38.8-55.6-38.8-91.6 0-70.72 57.28-128 128-128s128 57.28 128 128c0 36.88-15.76 69.84-40.72 93.2zM256 102.4l0.080 246.8 70.4-70.4c19.6-18.64 31.92-44.8 31.92-74 0-56.56-45.84-102.4-102.4-102.4z" />
53
  <glyph unicode="&#xf313;" glyph-name="tournament" d="M384 286v149.2h25.6c14.16 0 25.6-11.44 25.6-25.6v-51.2c0-33.44-21.36-61.84-51.2-72.4zM153.6 51.52h204.8v-51.52h-204.8v51.52zM179.2 76.8l25.6 25.6h25.6v25.6l25.6 25.6 25.6-25.6v-25.6h25.6l25.6-25.6h-153.6zM256 179.2c-56.56 0-102.4 45.84-102.4 102.4v179.2h204.8v-179.2c0-56.56-45.84-102.4-102.4-102.4zM76.8 358.4v51.2c0 14.16 11.44 25.6 25.6 25.6h25.6v-149.2c-29.84 10.56-51.2 38.96-51.2 72.4z" />
54
+ <glyph unicode="&#xf314;" glyph-name="matrix" d="M358.4 332.8h-51.2v-51.2h51.2v51.2zM204.8 256h-51.2v-51.2h51.2v51.2zM358.4 256h-51.2v-51.2h51.2v51.2zM435.2 435.2h-358.4c-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.2v307.2h307.2v-307.2zM281.6 332.8h-51.2v-51.2h51.2v51.2zM204.8 179.2h-51.2v-51.2h51.2v51.2zM281.6 179.2h-51.2v-51.2h51.2v51.2z" />
55
  <glyph unicode="&#xf316;" glyph-name="import" d="M435.2 256c-14.16 0-25.6-11.44-25.6-25.6v-153.6h-307.2v153.6c0 14.16-11.44 25.6-25.6 25.6s-25.6-11.44-25.6-25.6v-179.2c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v179.2c0 14.16-11.44 25.6-25.6 25.6zM281.6 256v156.72c0 12.4-11.44 22.48-25.6 22.48s-25.6-10.080-25.6-22.48v-156.72h-76.8l102.4-102.4 102.4 102.4h-76.8z" />
56
  <glyph unicode="&#xf317;" glyph-name="export" d="M435.2 256c-14.16 0-25.6-11.44-25.6-25.6v-153.6h-307.2v153.6c0 14.16-11.44 25.6-25.6 25.6s-25.6-11.44-25.6-25.6v-179.2c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v179.2c0 14.16-11.44 25.6-25.6 25.6zM230.4 179.2c0-14.16 11.44-25.6 25.6-25.6s25.6 11.44 25.6 25.6v153.6h76.8l-102.4 102.4-102.4-102.4h76.8v-153.6z" />
57
  <glyph unicode="&#xf319;" glyph-name="globe" d="M256 25.6c-113.12 0-204.8 91.68-204.8 204.8s91.68 204.8 204.8 204.8 204.8-91.68 204.8-204.8-91.68-204.8-204.8-204.8zM256 384c-84.8 0-153.6-68.8-153.6-153.6s68.8-153.6 153.6-153.6 153.6 68.8 153.6 153.6-68.8 153.6-153.6 153.6zM331.28 138.080l-4.48-2.64-12.96-7.92-7.68-5.6c-5.68-2.72-11.68-4.88-17.76-6.72v7.52l-2.16 17.36c0 0-1.040 10-2.72 12.64-1.6 2.64-5.44 6.32-9.2 7.92s-6.48 1.6-8.64 4.16c-2.16 2.64-3.84 7.36-6.48 11.6-2.72 4.24-6 8.48-6 10.56s0 23.76 0 23.76l2.72 20 5.92 4.24 7.040 7.92 4.88 1.6 16.8-3.12h11.84l4.88-10 11.36-8.96 7.040-11.040 9.2-3.12h10.32l7.040-8.48 4.32-8.96 1.6-6.32v-10.56l-1.12-6.24c-6.8-11.28-15.52-21.2-25.76-29.6v0 0zM289.36 319.92l-11.92-6.32-4.32-12.16-7.040-6.32h-23.36l-10.8-4.24-0.56-8.4-4.32-6.88-1.12-7.36 2.16-6.32 2.72-6.32c0 0 6.56-7.36 0-12.64 0 0-8.16 0-9.76 2.64s-13.52 10-15.76 12.16c-2.16 2.080-9.2 4.16-9.2 4.16l-8.64 3.2-8.16 0.56 0.56 11.040-0.56 9.44-3.28 6.88-9.2 6.88-0.56 7.36 1.12 4.080c21.92 21.2 52.16 34.4 85.6 34.4 18.88 0 36.48-4.56 52.4-12l-0.32-2.8-15.68-11.040z" />
assets/fonts/sportspress.ttf CHANGED
Binary file
assets/fonts/sportspress.woff CHANGED
Binary file
assets/fonts/sportspress.woff2 CHANGED
Binary file
assets/images/welcome/screenshot-awards.png DELETED
Binary file
assets/images/welcome/screenshot-conditional-equations.png ADDED
Binary file
assets/images/welcome/screenshot-event-performance-importer.png DELETED
Binary file
assets/images/welcome/screenshot-event-specs.png ADDED
Binary file
assets/images/welcome/screenshot-group-stages.png DELETED
Binary file
assets/images/welcome/screenshot-midseason-transfers.png ADDED
Binary file
assets/images/welcome/screenshot-next-team.png ADDED
Binary file
assets/images/welcome/screenshot-officials.png DELETED
Binary file
assets/images/welcome/screenshot-performance-icons.png DELETED
Binary file
assets/images/welcome/screenshot-results-matrix.png ADDED
Binary file
assets/images/welcome/screenshot-sponsor-levels.png DELETED
Binary file
assets/images/welcome/screenshot-vertical-timelines.png ADDED
Binary file
changelog.txt CHANGED
@@ -1,5 +1,124 @@
1
  == SportsPress Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 2.3.2 =
4
  * Fix - Team in player statistics total row displaying as zero.
5
  * Fix - Notice when no sendoffs are available during minutes played calculation.
1
  == SportsPress Changelog ==
2
 
3
+ = 2.6 =
4
+ * Feature - Add custom details to events using event specs.
5
+ * Feature - Conditional equations for variables.
6
+ * Feature - Display the next opponent in league tables.
7
+ * Feature - Short name option added to teams.
8
+ * Feature - Automatic event titles using short name when available.
9
+ * Feature - Display featured image in countdown widget.
10
+ * Tweak - Stronger connections between leagues, seasons, and teams for automatic player lists.
11
+ * Tweak - Relative date option added to editor shortcodes.
12
+ * Tweak - Display only current team in player list.
13
+ * Tweak - Filter players dropdown by current team only.
14
+ * Tweak - Allow 0 as a squad number when importing players.
15
+ * Tweak - Prevent filtering through empty results.
16
+ * Fix - Interpreting non-integer substitution times.
17
+ * Fix - Warning when sorting terms without order.
18
+ * Localization - Add WPML support to staff header.
19
+ * Localization - Fix RTL not being applied in league tables.
20
+
21
+ = 2.5.10 =
22
+ * Fix - Date ranges not being applied to calendars.
23
+
24
+ = 2.5.9 =
25
+ * Fix - Unpublished posts being displayed in some themes.
26
+
27
+ = 2.5.8 =
28
+ * Fix - Display scheduled events using default permalinks via archives and third-party widgets.
29
+
30
+ = 2.5.7 =
31
+ * Fix - Blank general settings screen on WordPress versions prior to 4.9.
32
+ * Fix - Revert responsive table behavior to prevent display issues on mobile.
33
+
34
+ = 2.5.6 =
35
+ * Tweak - Adjust player-related hooks.
36
+ * Fix - Turn off responsive tables by default.
37
+
38
+ = 2.5.5 =
39
+ * Feature - Main league and current season settings.
40
+ * Feature - New shortcode including full staff profile.
41
+ * Feature - Add code highlighting to custom CSS field.
42
+ * Feature - Add responsive layout option to tables.
43
+ * Feature - Add filters to REST API players endpoint.
44
+ * Feature - Option to merge duplicate teams, players, and staff.
45
+ * Feature - Option to display specific event in event blocks.
46
+ * Feature - Option to sort player checklist by name and squad number in events.
47
+ * Feature - Option to filter player lists by team.
48
+ * Feature - Option to link staff members.
49
+ * Feature - Filter countdown by calendar.
50
+ * Fix - Calculate column totals in box score.
51
+ * Fix - Mismatched encoding of included library.
52
+ * Localization - Fix translation function missing around string.
53
+
54
+ = 2.5.4 =
55
+ * Fix - Error when editing league table using older versions of WordPress.
56
+
57
+ = 2.5.3 =
58
+ * Fix - Calendar templates not loading when timezone setting is relative to UTC.
59
+
60
+ = 2.5.2 =
61
+ * Feature - Add match day to REST API.
62
+ * Tweak - Add order to positions during preset installation.
63
+ * Tweak - Display links to add new duties and officials if empty.
64
+ * Tweak - Add linebreaks to substitute dropdowns.
65
+ * Fix - Use default full time minutes in REST API.
66
+ * Fix - Uploading custom images as performance icons.
67
+ * Fix - Displaying timed performance with custom images.
68
+
69
+ = 2.5.1 =
70
+ * Feature - Officials importer.
71
+ * Feature - Officials added to dashboard glance items.
72
+ * Feature - Order setting added to staff jobs for custom sorting.
73
+ * Tweak - Display only the highest order job in staff profiles.
74
+ * Tweak - Require box score importer to be accessed from within an event.
75
+ * Tweak - Add hook to declare importable post types.
76
+ * Fix - Officials meta box in events when module is inactive.
77
+ * Fix - Issues when timezone is not set.
78
+
79
+ = 2.5 =
80
+ * Feature - Player of the match and star numbers added to box scores.
81
+ * Feature - Officials module for displaying referee appointments in matches.
82
+ * Feature - New player performance icons to choose from.
83
+ * Feature - Schema microdata added to event calendars, lists, and blocks.
84
+ * Feature - Box score importer for updating existing events.
85
+ * Feature - Order setting added to taxonomies for custom sorting.
86
+ * Feature - New relative date range options in event calendars.
87
+ * Feature - Date range options added to league tables and player lists.
88
+ * Feature - Option to hide players with zero statistics in player list.
89
+ * Tweak - Allow staff members to have multiple jobs.
90
+ * Tweak - Indicator dots added to calendars with events in frontend stylesheet.
91
+ * Tweak - Box score columns are now selected by default when adding new events.
92
+ * Tweak - Events made sortable by match day in admin.
93
+ * Tweak - Competitions renamed to leagues.
94
+ * Fix - Quick edit teams not showing when filtering players by team.
95
+ * Fix - Calendar feeds not updating without E-tag.
96
+ * Fix - Admin table cells wrapping.
97
+ * Fix - Timezone issues in calendars.
98
+
99
+ = 2.4.3 =
100
+ * Fix - Substitute Typo.
101
+ * Fix - WordPay image trailing slash.
102
+
103
+ = 2.4.2 =
104
+ * Feature - Add visibility option to player metrics.
105
+ * Fix - Remove protocol from default Gravatar images to prevent mix content warnings.
106
+
107
+ = 2.4.1 =
108
+ * Fix - Static function displaying notice in header.
109
+
110
+ = 2.4 =
111
+ * Feature - Integration with WordPay to allow paid team and player registrations.
112
+ * Feature - New team gallery shortcode and widget for displaying a gallery of team logos.
113
+ * Feature - Added support for player career totals based on calculated averages.
114
+ * Tweak - Allow competitions to be selected for friendly matches.
115
+ * Tweak - Added columns selector to gallery shortcodes.
116
+ * Fix - Full time defaulting to 90 minutes.
117
+ * Fix - Statistic format not reflected in meta box.
118
+ * Fix - Shortcode button hook timing conflicts.
119
+ * Preset - Swap par and score in golf preset.
120
+ * Preset - Update all presets to reflect new career total type.
121
+
122
  = 2.3.2 =
123
  * Fix - Team in player statistics total row displaying as zero.
124
  * Fix - Notice when no sendoffs are available during minutes played calculation.
includes/admin/class-sp-admin-assets.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin
8
- * @version 2.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -28,7 +28,7 @@ class SP_Admin_Assets {
28
  /**
29
  * Enqueue styles
30
  */
31
- public function admin_styles() {
32
  // Sitewide menu CSS
33
  wp_enqueue_style( 'sportspress-admin-menu-styles', SP()->plugin_url() . '/assets/css/menu.css', array(), SP_VERSION );
34
 
@@ -59,7 +59,7 @@ class SP_Admin_Assets {
59
  wp_enqueue_style( 'sportspress-admin-equation-styles', SP()->plugin_url() . '/assets/css/equation.css', array(), SP_VERSION );
60
  }
61
 
62
- if ( in_array( $screen->id, apply_filters( 'sportspress_admin_datepicker_screen_ids', array( 'sp_calendar', 'sp_table', 'sp_list', 'widgets' ) ) ) ) {
63
  wp_enqueue_style( 'jquery-ui-style' , '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' );
64
  wp_enqueue_style( 'sportspress-admin-datepicker-styles', SP()->plugin_url() . '/assets/css/datepicker.css', array( 'jquery-ui-style' ), SP_VERSION );
65
  }
@@ -70,7 +70,7 @@ class SP_Admin_Assets {
70
  /**
71
  * Enqueue scripts
72
  */
73
- public function admin_scripts() {
74
  global $wp_query, $post;
75
 
76
  $screen = get_current_screen();
@@ -101,7 +101,8 @@ class SP_Admin_Assets {
101
  wp_register_script( 'sportspress-admin-quickeditor', SP()->plugin_url() . '/assets/js/admin/quickeditor.js', array( 'jquery' ), SP_VERSION, true );
102
 
103
  // SportsPress admin pages
104
- if ( in_array( $screen->id, sp_get_screen_ids() ) || strpos( $screen->id, 'sportspress-config' )) {
 
105
  wp_enqueue_script( 'jquery' );
106
  wp_enqueue_script( 'chosen' );
107
  wp_enqueue_script( 'jquery-ui-core' );
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
28
  /**
29
  * Enqueue styles
30
  */
31
+ public function admin_styles( $hook ) {
32
  // Sitewide menu CSS
33
  wp_enqueue_style( 'sportspress-admin-menu-styles', SP()->plugin_url() . '/assets/css/menu.css', array(), SP_VERSION );
34
 
59
  wp_enqueue_style( 'sportspress-admin-equation-styles', SP()->plugin_url() . '/assets/css/equation.css', array(), SP_VERSION );
60
  }
61
 
62
+ if ( in_array( $screen->id, apply_filters( 'sportspress_admin_datepicker_screen_ids', array( 'sp_calendar', 'sp_table', 'sp_list', 'widgets' ) ) ) || in_array( $hook, array('post.php', 'post-new.php') ) ) {
63
  wp_enqueue_style( 'jquery-ui-style' , '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' );
64
  wp_enqueue_style( 'sportspress-admin-datepicker-styles', SP()->plugin_url() . '/assets/css/datepicker.css', array( 'jquery-ui-style' ), SP_VERSION );
65
  }
70
  /**
71
  * Enqueue scripts
72
  */
73
+ public function admin_scripts($hook) {
74
  global $wp_query, $post;
75
 
76
  $screen = get_current_screen();
101
  wp_register_script( 'sportspress-admin-quickeditor', SP()->plugin_url() . '/assets/js/admin/quickeditor.js', array( 'jquery' ), SP_VERSION, true );
102
 
103
  // SportsPress admin pages
104
+ if ( in_array( $screen->id, sp_get_screen_ids() ) || strpos( $screen->id, 'sportspress-config' ) || in_array($hook, array('post.php', 'post-new.php') ) ) {
105
+
106
  wp_enqueue_script( 'jquery' );
107
  wp_enqueue_script( 'chosen' );
108
  wp_enqueue_script( 'jquery-ui-core' );
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.5.2
9
  * @package SportsPress/Admin
10
  * @category Class
11
  * @author ThemeBoy
@@ -143,7 +143,7 @@ class SP_Admin_Sports {
143
  update_post_meta( $id, 'sp_equation', sp_array_value( $result, 'equation', null ) );
144
  }
145
 
146
- // Make sure statistics and metrics have greater menu order than performance
147
  $i = 0;
148
 
149
  // Performance
@@ -192,6 +192,17 @@ class SP_Admin_Sports {
192
  $id = self::insert_preset_post( $post, $i + $index );
193
  $i ++;
194
  }
 
 
 
 
 
 
 
 
 
 
 
195
 
196
  // Statistics
197
  $post_type = 'sp_statistic';
5
  * The SportsPress admin sports class stores preset sport data.
6
  *
7
  * @class SP_Admin_Sports
8
+ * @version 2.6
9
  * @package SportsPress/Admin
10
  * @category Class
11
  * @author ThemeBoy
143
  update_post_meta( $id, 'sp_equation', sp_array_value( $result, 'equation', null ) );
144
  }
145
 
146
+ // Make sure statistics, metrics and specs have greater menu order than performance
147
  $i = 0;
148
 
149
  // Performance
192
  $id = self::insert_preset_post( $post, $i + $index );
193
  $i ++;
194
  }
195
+
196
+ // Event Specs
197
+ $post_type = 'sp_spec';
198
+ $specs = sp_array_value( $preset, 'specs', array() );
199
+ self::delete_preset_posts( $post_type );
200
+ foreach ( $specs as $index => $spec ) {
201
+ $post = self::get_post_array( $spec, $post_type );
202
+ if ( empty( $post ) ) continue;
203
+ $id = self::insert_preset_post( $post, $i + $index );
204
+ $i ++;
205
+ }
206
 
207
  // Statistics
208
  $post_type = 'sp_statistic';
includes/admin/class-sp-admin-taxonomies.php CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) {
7
  * Handles taxonomies in admin
8
  *
9
  * @class SP_Admin_Taxonomies
10
- * @version 2.5.1
11
  * @package SportsPress/Admin
12
  * @category Class
13
  * @author ThemeBoy
@@ -251,9 +251,11 @@ class SP_Admin_Taxonomies {
251
 
252
  if ( function_exists( 'get_term_meta' ) ) $new_columns['sp_order'] = __( 'Order', 'sportspress' );
253
 
 
254
  $new_columns['posts'] = $columns['posts'];
255
 
256
  unset( $columns['posts'] );
 
257
 
258
  return array_merge( $columns, $new_columns );
259
  }
@@ -268,11 +270,14 @@ class SP_Admin_Taxonomies {
268
  public function venue_columns( $columns ) {
269
  $new_columns = array();
270
  $new_columns['sp_address'] = __( 'Address', 'sportspress' );
 
 
271
  $new_columns['posts'] = $columns['posts'];
 
 
272
 
273
  unset( $columns['description'] );
274
  unset( $columns['slug'] );
275
- unset( $columns['posts'] );
276
 
277
  return array_merge( $columns, $new_columns );
278
  }
@@ -289,11 +294,14 @@ class SP_Admin_Taxonomies {
289
  $new_columns['sp_sections'] = __( 'Statistics', 'sportspress' );
290
 
291
  if ( function_exists( 'get_term_meta' ) ) $new_columns['sp_order'] = __( 'Order', 'sportspress' );
 
 
292
  $new_columns['posts'] = $columns['posts'];
 
 
293
 
294
  unset( $columns['description'] );
295
  unset( $columns['slug'] );
296
- unset( $columns['posts'] );
297
 
298
  return array_merge( $columns, $new_columns );
299
  }
7
  * Handles taxonomies in admin
8
  *
9
  * @class SP_Admin_Taxonomies
10
+ * @version 2.6
11
  * @package SportsPress/Admin
12
  * @category Class
13
  * @author ThemeBoy
251
 
252
  if ( function_exists( 'get_term_meta' ) ) $new_columns['sp_order'] = __( 'Order', 'sportspress' );
253
 
254
+ if ( array_key_exists('posts', $columns) ) {
255
  $new_columns['posts'] = $columns['posts'];
256
 
257
  unset( $columns['posts'] );
258
+ }
259
 
260
  return array_merge( $columns, $new_columns );
261
  }
270
  public function venue_columns( $columns ) {
271
  $new_columns = array();
272
  $new_columns['sp_address'] = __( 'Address', 'sportspress' );
273
+
274
+ if ( array_key_exists('posts', $columns) ) {
275
  $new_columns['posts'] = $columns['posts'];
276
+ unset( $columns['posts'] );
277
+ }
278
 
279
  unset( $columns['description'] );
280
  unset( $columns['slug'] );
 
281
 
282
  return array_merge( $columns, $new_columns );
283
  }
294
  $new_columns['sp_sections'] = __( 'Statistics', 'sportspress' );
295
 
296
  if ( function_exists( 'get_term_meta' ) ) $new_columns['sp_order'] = __( 'Order', 'sportspress' );
297
+
298
+ if ( array_key_exists('posts', $columns) ) {
299
  $new_columns['posts'] = $columns['posts'];
300
+ unset( $columns['posts'] );
301
+ }
302
 
303
  unset( $columns['description'] );
304
  unset( $columns['slug'] );
 
305
 
306
  return array_merge( $columns, $new_columns );
307
  }
includes/admin/class-sp-admin-welcome.php CHANGED
@@ -6,10 +6,10 @@
6
  *
7
  * Adapted from code in EDD (Copyright (c) 2012, Pippin Williamson) and WP.
8
  *
9
- * @author ThemeBoy
10
- * @category Admin
11
- * @package SportsPress/Admin
12
- * @version 2.5
13
  */
14
 
15
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -19,412 +19,395 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
19
  */
20
  class SP_Admin_Welcome {
21
 
22
- private $plugin;
23
-
24
- /**
25
- * __construct function.
26
- *
27
- * @access public
28
- * @return void
29
- */
30
- public function __construct() {
31
- $this->plugin = 'sportspress/sportspress.php';
32
-
33
- add_action( 'admin_menu', array( $this, 'admin_menus') );
34
- add_action( 'admin_head', array( $this, 'admin_head' ) );
35
- add_action( 'admin_init', array( $this, 'welcome' ) );
36
- }
37
-
38
- /**
39
- * Add admin menus/screens
40
- *
41
- * @access public
42
- * @return void
43
- */
44
- public function admin_menus() {
45
- if ( empty( $_GET['page'] ) ) {
46
- return;
47
- }
48
-
49
- $welcome_page_name = __( 'About SportsPress', 'sportspress' );
50
- $welcome_page_title = __( 'Welcome to SportsPress', 'sportspress' );
51
-
52
- switch ( $_GET['page'] ) {
53
- case 'sp-about' :
54
- $page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sp-about', array( $this, 'about_screen' ) );
55
- add_action( 'admin_print_styles-'. $page, array( $this, 'admin_css' ) );
56
- break;
57
- case 'sp-credits' :
58
- $page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sp-credits', array( $this, 'credits_screen' ) );
59
- add_action( 'admin_print_styles-'. $page, array( $this, 'admin_css' ) );
60
- break;
61
- case 'sp-translators' :
62
- $page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sp-translators', array( $this, 'translators_screen' ) );
63
- add_action( 'admin_print_styles-'. $page, array( $this, 'admin_css' ) );
64
- break;
65
- }
66
- }
67
-
68
- /**
69
- * admin_css function.
70
- *
71
- * @access public
72
- * @return void
73
- */
74
- public function admin_css() {
75
- wp_enqueue_style( 'sportspress-activation', plugins_url( '/assets/css/activation.css', SP_PLUGIN_FILE ), array(), SP_VERSION );
76
- }
77
-
78
- /**
79
- * Add styles just for this page, and remove dashboard page links.
80
- *
81
- * @access public
82
- * @return void
83
- */
84
- public function admin_head() {
85
- remove_submenu_page( 'index.php', 'sp-about' );
86
- remove_submenu_page( 'index.php', 'sp-credits' );
87
- remove_submenu_page( 'index.php', 'sp-translators' );
88
- }
89
-
90
- /**
91
- * Into text/links shown on all about pages.
92
- *
93
- * @access private
94
- * @return void
95
- */
96
- private function intro() {
97
-
98
- // Flush after upgrades
99
- if ( ! empty( $_GET['sp-updated'] ) || ! empty( $_GET['sp-installed'] ) )
100
- flush_rewrite_rules();
101
-
102
- // Get major version number
103
- $version = explode( '.', SP()->version, 3 );
104
- unset( $version[2] );
105
- $display_version = implode( '.', $version );
106
- ?>
107
- <h1 class="sp-welcome-logo"><?php echo apply_filters( 'sportspress_logo', '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/images/welcome/sportspress' . ( class_exists( 'SportsPress_Pro' ) ? '-pro' : '' ) . '.png" alt="' . __( 'SportsPress', 'sportspress' ) . '">' ); ?></h1>
108
-
109
- <div class="sp-badge"><?php printf( __( 'Version %s', 'sportspress' ), SP()->version ); ?></div>
110
-
111
- <div class="about-text sp-about-text">
112
- <?php
113
- if ( ! empty( $_GET['sp-installed'] ) )
114
- $message = __( 'Thanks, all done!', 'sportspress' );
115
- elseif ( ! empty( $_GET['sp-updated'] ) )
116
- $message = __( 'Thank you for updating to the latest version!', 'sportspress' );
117
- else
118
- $message = __( 'Thanks for installing!', 'sportspress' );
119
-
120
- printf( __( '%s SportsPress %s has lots of refinements we think you&#8217;ll love.', 'sportspress' ), $message, $display_version );
121
- ?>
122
- </div>
123
-
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
-
131
- <h2 class="nav-tab-wrapper">
132
- <a class="nav-tab <?php if ( $_GET['page'] == 'sp-about' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sp-about' ), 'index.php' ) ) ); ?>">
133
- <?php _e( 'Welcome', 'sportspress' ); ?>
134
- </a><a class="nav-tab <?php if ( $_GET['page'] == 'sp-credits' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sp-credits' ), 'index.php' ) ) ); ?>">
135
- <?php _e( 'Credits', 'sportspress' ); ?>
136
- </a><a class="nav-tab <?php if ( $_GET['page'] == 'sp-translators' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sp-translators' ), 'index.php' ) ) ); ?>">
137
- <?php _e( 'Translators', 'sportspress' ); ?>
138
- </a>
139
- </h2>
140
- <?php
141
- }
142
-
143
- /**
144
- * Output the about screen.
145
- */
146
- public function about_screen() {
147
- include_once( 'class-sp-admin-settings.php' );
148
- $class = 'chosen-select' . ( is_rtl() ? ' chosen-rtl' : '' );
149
- ?>
150
- <div class="wrap about-wrap about-sportspress-wrap">
151
-
152
- <?php $this->intro(); ?>
153
-
154
- <?php
155
- // Save settings
156
- if ( isset( $_POST['timezone_string'] ) ):
157
- update_option( 'timezone_string', $_POST['timezone_string'] );
158
- update_option( 'sportspress_basic_setup', 1 );
159
- endif;
160
- if ( isset( $_POST['sportspress_sport'] ) && ! empty( $_POST['sportspress_sport'] ) ):
161
- $sport = $_POST['sportspress_sport'];
162
- SP_Admin_Sports::apply_preset( $sport );
163
- update_option( 'sportspress_sport', $_POST['sportspress_sport'] );
164
- delete_option( '_sp_needs_welcome' );
165
- update_option( 'sportspress_installed', 1 );
166
- ?>
167
- <div id="message" class="updated sportspress-message">
168
- <p><strong><?php _e( 'Your settings have been saved.', 'sportspress' ); ?></strong></p>
169
- </div>
170
- <?php
171
- endif;
172
- if ( isset( $_POST['add_sample_data'] ) ):
173
- SP_Admin_Sample_Data::delete_posts();
174
- SP_Admin_Sample_Data::insert_posts();
175
- endif;
176
-
177
- do_action( 'sportspress_before_welcome_features' );
178
- ?>
179
- <div class="feature-section one-col">
180
- <div class="col">
181
- <h2>New Features 🌟</h2>
182
- </div>
183
- </div>
184
-
185
- <div class="feature-section two-col">
186
- <div class="col">
187
- <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-officials.png" alt="Officials Module">
188
- <h3>Officials Module</h3>
189
- <p>Manage referees, umpires, judges, timekeepers, and other officials. Don't forget to enable the <strong>Officials</strong> module from <a href="<?php echo add_query_arg( array( 'page' => 'sportspress' ), admin_url( 'admin.php' ) ); ?>">SportsPress Settings</a> to start using this feature.</p>
190
- </div>
191
- <div class="col">
192
- <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-awards.png" alt="Player of the Match">
193
- <h3>Player of the Match</h3>
194
- <p>Select player(s) or a star number for certain players in events. Stars can be displayed as icons or with a number. To enable this feature, choose an <strong>Awards</strong> type from the <strong>Box Score</strong> section in <a href="<?php echo add_query_arg( array( 'page' => 'sportspress' ), admin_url( 'admin.php' ) ); ?>">Event Settings</a>.</p>
195
- </div>
196
- </div>
197
-
198
- <div class="feature-section two-col">
199
- <div class="col">
200
- <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-event-performance-importer.png" alt="Box Score Importer">
201
- <h3>Box Score Importer</h3>
202
- <p>A new importer has been added to each event. Upload a CSV file and instantly update the player performance for the selected team.</p>
203
- </div>
204
- <div class="col">
205
- <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-performance-icons.png" alt="New Performance Icons">
206
- <h3>New Performance Icons</h3>
207
- <p>A set of new icons have been added to <strong>Player Performance</strong>, giving you more options to choose from.<p>
208
- </div>
209
- </div>
210
-
211
- <?php if ( ! class_exists( 'SportsPress_Pro' ) ) { ?>
212
- <hr>
213
-
214
- <div class="feature-section one-col">
215
- <div class="col">
216
- <h2>SportsPress Pro Updates 🏆</h2>
217
- </div>
218
- </div>
219
-
220
- <div class="feature-section two-col">
221
- <div class="col">
222
- <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-group-stages.png" alt="Tournament Group Stages">
223
- <h3>Tournament Group Stages</h3>
224
- <p>Support for group stages have been added natively to tournaments, allowing you to create and attach league tables to be displayed directly below tournament brackets.</p>
225
- </div>
226
- <div class="col">
227
- <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-sponsor-levels.png" alt="Sponsorship Levels">
228
- <h3>Sponsorship Levels</h3>
229
- <p>Assign levels to sponsors based on their contribution or other factors. Sponsors can now be filtered based on their sponsorship level within widgets, allowing for level-specific sponsor treament.<p>
230
- </div>
231
- </div>
232
-
233
- <a class="button button-primary button-hero" href="<?php echo esc_url( apply_filters( 'sportspress_pro_url', 'http://tboy.co/pro' ) ); ?>"><?php _e( 'Upgrade to Pro', 'sportspress' ); ?></a>
234
-
235
- <p><?php _e( 'Get SportsPress Pro to get access to all modules. You can upgrade any time without losing any of your data.','sportspress' ); ?></p>
236
- <?php } ?>
237
-
238
- <hr>
239
-
240
- <div class="feature-section one-col">
241
- <div class="col">
242
- <h2>Improved Usability and Control</h2>
243
- </div>
244
- </div>
245
-
246
- <div class="feature-section three-col">
247
- <div class="col">
248
- <h3>Custom Taxonomy Order</h3>
249
- <p>A new setting has been added to leagues, seasons, and positions, allowing you to define a customer order of terms.</p>
250
- </div>
251
- <div class="col">
252
- <h3>Filtering Player Lists</h3>
253
- <p>Player lists can now be configured to skip players that don't have a particular statistic, allowing you to create more specific lists.</p>
254
- </div>
255
- <div class="col">
256
- <h3>Multiple Jobs</h3>
257
- <p>Staff members can now be assigned multiple jobs, which are displayed consecutively in their profiles.</p>
258
- </div>
259
- <div class="col">
260
- <h3>Event Calendar Indicators</h3>
261
- <p>With the frontend stylesheet enabled, days with events will now be displayed with a filled circle to indicate an event on that day.</p>
262
- </div>
263
- <div class="col">
264
- <h3>Relative Ranges</h3>
265
- <p>Additional options now allow you to select events within a particular range, from last week, next week, yesterday, or tomorrow.</p>
266
- </div>
267
- <div class="col">
268
- <h3>Sort by Match Day</h3>
269
- <p>Use the columns in the admin to sort events by match day. A search bar has also been added to filter events by match day.</p>
270
- </div>
271
- </div>
272
-
273
- <hr>
274
-
275
- <div class="feature-section one-col">
276
- <div class="col">
277
- <h2>Other Notes</h2>
278
- </div>
279
- </div>
280
-
281
- <div class="feature-section three-col">
282
- <div class="col">
283
- <h3>Schema Microdata</h3>
284
- <p>We've complied with schema.org's microdata formats by adding these attributes to event calendars, blocks, and lists throughout.</p>
285
- </div>
286
- <div class="col">
287
- <h3>Competitions Are Now Leagues</h3>
288
- <p>The competitions taxonomy has been renamed to leagues, which still work in the exact same way.</p>
289
- </div>
290
- <div class="col">
291
- <h3>Calendar Caching</h3>
292
- <p>To prevent event calendars from caching in third-party apps, an E-Tag header has been added to these feeds.</p>
293
- </div>
294
- </div>
295
-
296
- <?php do_action( 'sportspress_after_welcome_features' ); ?>
297
-
298
- <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ) ); ?>"><?php _e( 'Go to SportsPress Settings', 'sportspress' ); ?></a>
299
- </div>
300
- <?php
301
- }
302
-
303
- /**
304
- * Output the credits.
305
- */
306
- public function credits_screen() {
307
- ?>
308
- <div class="wrap about-wrap about-sportspress-wrap">
309
- <?php $this->intro(); ?>
310
-
311
- <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>
312
-
313
- <div class="sp-feature feature-section col one-col">
314
- <?php echo $this->contributors(); ?>
315
- </div>
316
- </div>
317
- <?php
318
- }
319
-
320
- /**
321
- * Output the translators screen
322
- */
323
- public function translators_screen() {
324
- ?>
325
- <div class="wrap about-wrap about-sportspress-wrap">
326
-
327
- <?php $this->intro(); ?>
328
-
329
- <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>
330
- </div>
331
- <?php
332
- }
333
-
334
- /**
335
- * Render Contributors List
336
- *
337
- * @access public
338
- * @return string $contributor_list HTML formatted list of contributors.
339
- */
340
- public function contributors() {
341
- $contributors = $this->get_contributors();
342
-
343
- if ( empty( $contributors ) ) {
344
- return '';
345
- }
346
-
347
- $contributor_list = '<ul class="wp-people-group">';
348
-
349
- foreach ( $contributors as $contributor ) {
350
- $contributor_list .= '<li class="wp-person">';
351
- $contributor_list .= sprintf( '<a href="%s" title="%s">',
352
- esc_url( 'https://github.com/' . $contributor->login ),
353
- esc_html( sprintf( __( 'View %s', 'sportspress' ), $contributor->login ) )
354
- );
355
- $contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
356
- $contributor_list .= '</a>';
357
- $contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
358
- $contributor_list .= '</a>';
359
- $contributor_list .= '</li>';
360
- }
361
-
362
- $contributor_list .= '</ul>';
363
-
364
- return $contributor_list;
365
- }
366
-
367
- /**
368
- * Retrieve list of contributors from GitHub.
369
- *
370
- * @access public
371
- * @return mixed
372
- */
373
- public function get_contributors() {
374
- $contributors = get_transient( 'sportspress_contributors' );
375
-
376
- if ( false !== $contributors ) {
377
- return $contributors;
378
- }
379
-
380
- $response = wp_remote_get( 'https://api.github.com/repos/ThemeBoy/SportsPress/contributors', array( 'sslverify' => false ) );
381
-
382
- if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
383
- return array();
384
- }
385
-
386
- $contributors = json_decode( wp_remote_retrieve_body( $response ) );
387
-
388
- if ( ! is_array( $contributors ) ) {
389
- return array();
390
- }
391
-
392
- set_transient( 'sportspress_contributors', $contributors, HOUR_IN_SECONDS );
393
-
394
- return $contributors;
395
- }
396
-
397
- /**
398
- * Sends user to the welcome page on first activation
399
- */
400
- public function welcome() {
401
-
402
- // Bail if no activation redirect transient is set
403
- if ( ! get_transient( '_sp_activation_redirect' ) )
404
- return;
405
-
406
- // Delete the redirect transient
407
- delete_transient( '_sp_activation_redirect' );
408
-
409
- // Bail if we are waiting to install or update via the interface update/install links
410
- if ( get_option( '_sp_needs_update' ) == 1 || get_option( '_sp_needs_pages' ) == 1 )
411
- return;
412
-
413
- // Bail if activating from network, or bulk, or within an iFrame
414
- if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) )
415
- return;
416
-
417
- if ( ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] ) && ( isset( $_GET['plugin'] ) && strstr( $_GET['plugin'], 'sportspress.php' ) ) )
418
- return;
419
-
420
- if ( ! get_option( 'sportspress_completed_setup' ) ) {
421
- wp_redirect( admin_url( 'admin.php?page=sp-setup' ) );
422
- exit;
423
- }
424
-
425
- wp_redirect( admin_url( 'index.php?page=sp-about' ) );
426
- exit;
427
- }
428
  }
429
 
430
  new SP_Admin_Welcome();
6
  *
7
  * Adapted from code in EDD (Copyright (c) 2012, Pippin Williamson) and WP.
8
  *
9
+ * @author ThemeBoy
10
+ * @category Admin
11
+ * @package SportsPress/Admin
12
+ * @version 2.6
13
  */
14
 
15
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
19
  */
20
  class SP_Admin_Welcome {
21
 
22
+ private $plugin;
23
+
24
+ /**
25
+ * __construct function.
26
+ *
27
+ * @access public
28
+ * @return void
29
+ */
30
+ public function __construct() {
31
+ $this->plugin = 'sportspress/sportspress.php';
32
+
33
+ add_action( 'admin_menu', array( $this, 'admin_menus') );
34
+ add_action( 'admin_head', array( $this, 'admin_head' ) );
35
+ add_action( 'admin_init', array( $this, 'welcome' ) );
36
+ }
37
+
38
+ /**
39
+ * Add admin menus/screens
40
+ *
41
+ * @access public
42
+ * @return void
43
+ */
44
+ public function admin_menus() {
45
+ if ( empty( $_GET['page'] ) ) {
46
+ return;
47
+ }
48
+
49
+ $welcome_page_name = __( 'About SportsPress', 'sportspress' );
50
+ $welcome_page_title = __( 'Welcome to SportsPress', 'sportspress' );
51
+
52
+ switch ( $_GET['page'] ) {
53
+ case 'sp-about' :
54
+ $page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sp-about', array( $this, 'about_screen' ) );
55
+ add_action( 'admin_print_styles-'. $page, array( $this, 'admin_css' ) );
56
+ break;
57
+ case 'sp-credits' :
58
+ $page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sp-credits', array( $this, 'credits_screen' ) );
59
+ add_action( 'admin_print_styles-'. $page, array( $this, 'admin_css' ) );
60
+ break;
61
+ case 'sp-translators' :
62
+ $page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'sp-translators', array( $this, 'translators_screen' ) );
63
+ add_action( 'admin_print_styles-'. $page, array( $this, 'admin_css' ) );
64
+ break;
65
+ }
66
+ }
67
+
68
+ /**
69
+ * admin_css function.
70
+ *
71
+ * @access public
72
+ * @return void
73
+ */
74
+ public function admin_css() {
75
+ wp_enqueue_style( 'sportspress-activation', plugins_url( '/assets/css/activation.css', SP_PLUGIN_FILE ), array(), SP_VERSION );
76
+ }
77
+
78
+ /**
79
+ * Add styles just for this page, and remove dashboard page links.
80
+ *
81
+ * @access public
82
+ * @return void
83
+ */
84
+ public function admin_head() {
85
+ remove_submenu_page( 'index.php', 'sp-about' );
86
+ remove_submenu_page( 'index.php', 'sp-credits' );
87
+ remove_submenu_page( 'index.php', 'sp-translators' );
88
+ }
89
+
90
+ /**
91
+ * Into text/links shown on all about pages.
92
+ *
93
+ * @access private
94
+ * @return void
95
+ */
96
+ private function intro() {
97
+
98
+ // Flush after upgrades
99
+ if ( ! empty( $_GET['sp-updated'] ) || ! empty( $_GET['sp-installed'] ) )
100
+ flush_rewrite_rules();
101
+
102
+ // Get major version number
103
+ $version = explode( '.', SP()->version, 3 );
104
+ unset( $version[2] );
105
+ $display_version = implode( '.', $version );
106
+ ?>
107
+ <h1 class="sp-welcome-logo"><?php echo apply_filters( 'sportspress_logo', '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/images/welcome/sportspress' . ( class_exists( 'SportsPress_Pro' ) ? '-pro' : '' ) . '.png" alt="' . __( 'SportsPress', 'sportspress' ) . '">' ); ?></h1>
108
+
109
+ <div class="sp-badge"><?php printf( __( 'Version %s', 'sportspress' ), SP()->version ); ?></div>
110
+
111
+ <div class="about-text sp-about-text">
112
+ <?php
113
+ if ( ! empty( $_GET['sp-installed'] ) )
114
+ $message = __( 'Thanks, all done!', 'sportspress' );
115
+ elseif ( ! empty( $_GET['sp-updated'] ) )
116
+ $message = __( 'Thank you for updating to the latest version!', 'sportspress' );
117
+ else
118
+ $message = __( 'Thanks for installing!', 'sportspress' );
119
+
120
+ printf( __( '%s SportsPress %s has lots of refinements we think you&#8217;ll love.', 'sportspress' ), $message, $display_version );
121
+ ?>
122
+ </div>
123
+
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
+
131
+ <h2 class="nav-tab-wrapper">
132
+ <a class="nav-tab <?php if ( $_GET['page'] == 'sp-about' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sp-about' ), 'index.php' ) ) ); ?>">
133
+ <?php _e( 'Welcome', 'sportspress' ); ?>
134
+ </a><a class="nav-tab <?php if ( $_GET['page'] == 'sp-credits' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sp-credits' ), 'index.php' ) ) ); ?>">
135
+ <?php _e( 'Credits', 'sportspress' ); ?>
136
+ </a>
137
+ </h2>
138
+ <?php
139
+ }
140
+
141
+ /**
142
+ * Output the about screen.
143
+ */
144
+ public function about_screen() {
145
+ include_once( 'class-sp-admin-settings.php' );
146
+ $class = 'chosen-select' . ( is_rtl() ? ' chosen-rtl' : '' );
147
+ ?>
148
+ <div class="wrap about-wrap about-sportspress-wrap">
149
+
150
+ <?php $this->intro(); ?>
151
+
152
+ <?php
153
+ // Save settings
154
+ if ( isset( $_POST['timezone_string'] ) ):
155
+ update_option( 'timezone_string', $_POST['timezone_string'] );
156
+ update_option( 'sportspress_basic_setup', 1 );
157
+ endif;
158
+ if ( isset( $_POST['sportspress_sport'] ) && ! empty( $_POST['sportspress_sport'] ) ):
159
+ $sport = $_POST['sportspress_sport'];
160
+ SP_Admin_Sports::apply_preset( $sport );
161
+ update_option( 'sportspress_sport', $_POST['sportspress_sport'] );
162
+ delete_option( '_sp_needs_welcome' );
163
+ update_option( 'sportspress_installed', 1 );
164
+ ?>
165
+ <div id="message" class="updated sportspress-message">
166
+ <p><strong><?php _e( 'Your settings have been saved.', 'sportspress' ); ?></strong></p>
167
+ </div>
168
+ <?php
169
+ endif;
170
+ if ( isset( $_POST['add_sample_data'] ) ):
171
+ SP_Admin_Sample_Data::delete_posts();
172
+ SP_Admin_Sample_Data::insert_posts();
173
+ endif;
174
+
175
+ do_action( 'sportspress_before_welcome_features' );
176
+ ?>
177
+ <div class="feature-section one-col">
178
+ <div class="col">
179
+ <h2>New Features 🌟</h2>
180
+ </div>
181
+ </div>
182
+
183
+ <div class="feature-section three-col">
184
+ <div class="col">
185
+ <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-conditional-equations.png" alt="Screenshot">
186
+ <h3>Conditional Equations</h3>
187
+ <p>Use the newly introduced conditional operators <strong>&gt;</strong>, <strong>&lt;</strong>, <strong>&equiv;</strong>, <strong>&ne;</strong>, <strong>&ge;</strong>, and <strong>&le;</strong> to calculate the relationship between variables, then insert that calculation into more complex equations. Visit the <a href="<?php echo add_query_arg( array( 'page' => 'sportspress-config' ), admin_url( 'admin.php' ) ); ?>">Configure</a> page to edit variables and equations.</p>
188
+ </div>
189
+ <div class="col">
190
+ <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-event-specs.png" alt="Screenshot">
191
+ <h3>Event Specs</h3>
192
+ <p>Measure and display additional details per event using the new <strong>Event Specs</strong> variables. They are customizable and can be useful for keeping track of information like player of the match, attendance, and venue weather.
193
+ </div>
194
+ <div class="col">
195
+ <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-next-team.png" alt="Screenshot">
196
+ <h3>Next Team Column</h3>
197
+ <p>Provide a quick overview of who each team is playing next using the new <strong>Next Team</strong> preset for <a href="<?php echo add_query_arg( array( 'post_type' => 'sp_column' ), admin_url( 'edit.php' ) ); ?>">league table columns</a>. This will automatically display the next team's name or logo that links to the next match for each team in the table.<p>
198
+ </div>
199
+ </div>
200
+
201
+ <?php if ( ! class_exists( 'SportsPress_Pro' ) ) { ?>
202
+ <hr>
203
+
204
+ <div class="feature-section one-col">
205
+ <div class="col">
206
+ <h2>SportsPress Pro Updates 🏆</h2>
207
+ </div>
208
+ </div>
209
+
210
+ <div class="feature-section three-col">
211
+ <div class="col">
212
+ <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-results-matrix.png" alt="Results Matrix">
213
+ <h3>Results Matrix</h3>
214
+ <p>Display matches between home and away team in a grid. Create or select an existing calendar and select the <strong>Matrix</strong> layout to convert the calendar to an interactive results matrix!</p>
215
+ </div>
216
+ <div class="col">
217
+ <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-midseason-transfers.png" alt="Midseason Transfers">
218
+ <h3>Midseason Transfers</h3>
219
+ <p>Keep track of players that switched teams during a season by adding one or more extra rows to their statistics table. Display the team and partial statistics before and after the transfer.<p>
220
+ </div>
221
+ <div class="col">
222
+ <img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>assets/images/welcome/screenshot-vertical-timelines.png" alt="Vertical Timelines">
223
+ <h3>Vertical Timelines</h3>
224
+ <p>Display a match commentary style play-by-play timeline within events. <a href="<?php echo esc_url( apply_filters( 'sportspress_pro_url', 'http://tboy.co/pro' ) ); ?>">Upgrade to SportsPress Pro</a> to get access to <strong>Timelines</strong> and other pro features.<p>
225
+ </div>
226
+ </div>
227
+
228
+ <a class="button button-primary button-hero" href="<?php echo esc_url( apply_filters( 'sportspress_pro_url', 'http://tboy.co/pro' ) ); ?>"><?php _e( 'Upgrade to Pro', 'sportspress' ); ?></a>
229
+
230
+ <p><?php _e( 'Get SportsPress Pro to get access to all modules. You can upgrade any time without losing any of your data.','sportspress' ); ?></p>
231
+ <?php } ?>
232
+
233
+ <hr>
234
+
235
+ <div class="feature-section one-col">
236
+ <div class="col">
237
+ <h2>Player Data Improvements</h2>
238
+ </div>
239
+ </div>
240
+
241
+ <div class="feature-section three-col">
242
+ <div class="col">
243
+ <h3>Player Assignments</h3>
244
+ <p>Players will now be saved using a new data format that allows them to belong to multiple leagues, seasons, and teams and be accurately selected in <a href="<?php echo add_query_arg( array( 'post_type' => 'sp_list' ), admin_url( 'edit.php' ) ); ?>">player lists</a>.</p>
245
+ </div>
246
+ <div class="col">
247
+ <h3>Current Team Column</h3>
248
+ <p>The <strong>Team</strong> column in player lists will now display only the current team that player belongs to, determined by the <strong>Current Team</strong> setting of each player.</p>
249
+ </div>
250
+ <div class="col">
251
+ <h3>Squad Number Zero</h3>
252
+ <p>It's now possible to import players with the squad number <strong>0 (zero)</strong> or any other value that would previously be interpreted as empty.</p>
253
+ </div>
254
+ </div>
255
+
256
+ <hr>
257
+
258
+ <div class="feature-section one-col">
259
+ <div class="col">
260
+ <h2>Other Notes</h2>
261
+ </div>
262
+ </div>
263
+
264
+ <div class="feature-section three-col">
265
+ <div class="col">
266
+ <h3>Countdown Images</h3>
267
+ <p>A new option has been added to the <strong>Countdown</strong> widget, allowing you to display a featured image from the next event.</p>
268
+ </div>
269
+ <div class="col">
270
+ <h3>Relative Date in Shortcodes</h3>
271
+ <p>You'll now be able to select a relative date range when inserting calendar-related shortcodes from the visual editor.</p>
272
+ </div>
273
+ <div class="col">
274
+ <h3>Short Names</h3>
275
+ <p>Teams have been given a <strong>Short Name</strong> setting in addition to the existing <strong>Abbreviation</strong> for added customizability.</p>
276
+ </div>
277
+ </div>
278
+
279
+ <?php do_action( 'sportspress_after_welcome_features' ); ?>
280
+
281
+ <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ) ); ?>"><?php _e( 'Go to SportsPress Settings', 'sportspress' ); ?></a>
282
+ </div>
283
+ <?php
284
+ }
285
+
286
+ /**
287
+ * Output the credits.
288
+ */
289
+ public function credits_screen() {
290
+ ?>
291
+ <div class="wrap about-wrap about-sportspress-wrap">
292
+ <?php $this->intro(); ?>
293
+
294
+ <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>
295
+
296
+ <div class="sp-feature feature-section col one-col">
297
+ <?php echo $this->contributors(); ?>
298
+ </div>
299
+ </div>
300
+ <?php
301
+ }
302
+
303
+ /**
304
+ * Output the translators screen
305
+ */
306
+ public function translators_screen() {
307
+ ?>
308
+ <div class="wrap about-wrap about-sportspress-wrap">
309
+
310
+ <?php $this->intro(); ?>
311
+
312
+ <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>
313
+ </div>
314
+ <?php
315
+ }
316
+
317
+ /**
318
+ * Render Contributors List
319
+ *
320
+ * @access public
321
+ * @return string $contributor_list HTML formatted list of contributors.
322
+ */
323
+ public function contributors() {
324
+ $contributors = $this->get_contributors();
325
+
326
+ if ( empty( $contributors ) ) {
327
+ return '';
328
+ }
329
+
330
+ $contributor_list = '<ul class="wp-people-group">';
331
+
332
+ foreach ( $contributors as $contributor ) {
333
+ $contributor_list .= '<li class="wp-person">';
334
+ $contributor_list .= sprintf( '<a href="%s" title="%s">',
335
+ esc_url( 'https://github.com/' . $contributor->login ),
336
+ esc_html( sprintf( __( 'View %s', 'sportspress' ), $contributor->login ) )
337
+ );
338
+ $contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
339
+ $contributor_list .= '</a>';
340
+ $contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
341
+ $contributor_list .= '</a>';
342
+ $contributor_list .= '</li>';
343
+ }
344
+
345
+ $contributor_list .= '</ul>';
346
+
347
+ return $contributor_list;
348
+ }
349
+
350
+ /**
351
+ * Retrieve list of contributors from GitHub.
352
+ *
353
+ * @access public
354
+ * @return mixed
355
+ */
356
+ public function get_contributors() {
357
+ $contributors = get_transient( 'sportspress_contributors' );
358
+
359
+ if ( false !== $contributors ) {
360
+ return $contributors;
361
+ }
362
+
363
+ $response = wp_remote_get( 'https://api.github.com/repos/ThemeBoy/SportsPress/contributors', array( 'sslverify' => false ) );
364
+
365
+ if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
366
+ return array();
367
+ }
368
+
369
+ $contributors = json_decode( wp_remote_retrieve_body( $response ) );
370
+
371
+ if ( ! is_array( $contributors ) ) {
372
+ return array();
373
+ }
374
+
375
+ set_transient( 'sportspress_contributors', $contributors, HOUR_IN_SECONDS );
376
+
377
+ return $contributors;
378
+ }
379
+
380
+ /**
381
+ * Sends user to the welcome page on first activation
382
+ */
383
+ public function welcome() {
384
+
385
+ // Bail if no activation redirect transient is set
386
+ if ( ! get_transient( '_sp_activation_redirect' ) )
387
+ return;
388
+
389
+ // Delete the redirect transient
390
+ delete_transient( '_sp_activation_redirect' );
391
+
392
+ // Bail if we are waiting to install or update via the interface update/install links
393
+ if ( get_option( '_sp_needs_update' ) == 1 || get_option( '_sp_needs_pages' ) == 1 )
394
+ return;
395
+
396
+ // Bail if activating from network, or bulk, or within an iFrame
397
+ if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) )
398
+ return;
399
+
400
+ if ( ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] ) && ( isset( $_GET['plugin'] ) && strstr( $_GET['plugin'], 'sportspress.php' ) ) )
401
+ return;
402
+
403
+ if ( ! get_option( 'sportspress_completed_setup' ) ) {
404
+ wp_redirect( admin_url( 'admin.php?page=sp-setup' ) );
405
+ exit;
406
+ }
407
+
408
+ wp_redirect( admin_url( 'index.php?page=sp-about' ) );
409
+ exit;
410
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
411
  }
412
 
413
  new SP_Admin_Welcome();
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.5.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -54,7 +54,7 @@ if ( class_exists( 'WP_Importer' ) ) {
54
 
55
  foreach ( $rows as $row ):
56
 
57
- $row = array_filter( $row );
58
 
59
  if ( empty( $row ) ) continue;
60
 
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Importers
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
54
 
55
  foreach ( $rows as $row ):
56
 
57
+ $row = array_filter( $row, 'strlen' );
58
 
59
  if ( empty( $row ) ) continue;
60
 
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.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -97,7 +97,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
97
  while ( is_array( $team ) ) {
98
  $team = array_shift( array_filter( $team ) );
99
  }
100
- if ( $team > 0 ) $team_names[] = get_the_title( $team );
101
  endforeach;
102
 
103
  $team_names = array_unique( $team_names );
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Post_Types
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
97
  while ( is_array( $team ) ) {
98
  $team = array_shift( array_filter( $team ) );
99
  }
100
+ if ( $team > 0 ) $team_names[] = sp_team_short_name( $team );
101
  endforeach;
102
 
103
  $team_names = array_unique( $team_names );
includes/admin/post-types/class-sp-admin-cpt-player.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Post_Types
8
- * @version 2.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -190,15 +190,17 @@ class SP_Admin_CPT_Player extends SP_Admin_CPT {
190
  * @param mixed $query
191
  */
192
  public function filters_query( $query ) {
193
- if ( $query->query_vars['post_type'] !== 'sp_player' ) return $query;
 
 
194
  global $typenow, $wp_query;
195
 
196
- if ( $typenow == 'sp_player' ) {
197
 
198
- if ( ! empty( $_GET['team'] ) ) {
199
- $query->query_vars['meta_value'] = $_GET['team'];
200
- $query->query_vars['meta_key'] = 'sp_team';
201
- }
202
  }
203
 
204
  return $query;
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Post_Types
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
190
  * @param mixed $query
191
  */
192
  public function filters_query( $query ) {
193
+
194
+ if ( empty ( $query->query_vars['post_type'] ) || $query->query_vars['post_type'] !== 'sp_player' ) return $query;
195
+
196
  global $typenow, $wp_query;
197
 
198
+ if ( $typenow == 'sp_player' ) {
199
 
200
+ if ( ! empty( $_GET['team'] ) ) {
201
+ $query->query_vars['meta_value'] = $_GET['team'];
202
+ $query->query_vars['meta_key'] = 'sp_team';
203
+ }
204
  }
205
 
206
  return $query;
includes/admin/post-types/class-sp-admin-cpt-spec.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin functions for the columns post type
4
+ *
5
+ * @author ThemeBoy
6
+ * @category Admin
7
+ * @package SportsPress/Admin/Post_Types
8
+ * @version 2.6
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
+
13
+ if ( ! class_exists( 'SP_Admin_CPT' ) )
14
+ include( 'class-sp-admin-cpt.php' );
15
+
16
+ if ( ! class_exists( 'SP_Admin_CPT_Spec' ) ) :
17
+
18
+ /**
19
+ * SP_Admin_CPT_Spec Class
20
+ */
21
+ class SP_Admin_CPT_Spec extends SP_Admin_CPT {
22
+
23
+ /**
24
+ * Constructor
25
+ */
26
+ public function __construct() {
27
+ $this->type = 'sp_spec';
28
+
29
+ // Admin Columns
30
+ add_filter( 'manage_edit-sp_spec_columns', array( $this, 'edit_columns' ) );
31
+ add_action( 'manage_sp_spec_posts_custom_column', array( $this, 'custom_columns' ), 2, 2 );
32
+
33
+ // Call SP_Admin_CPT constructor
34
+ parent::__construct();
35
+ }
36
+
37
+ /**
38
+ * Change the columns shown in admin.
39
+ */
40
+ public function edit_columns( $existing_columns ) {
41
+ $columns = array(
42
+ 'cb' => '<input type="checkbox" />',
43
+ 'title' => __( 'Label', 'sportspress' ),
44
+ 'sp_key' => __( 'Variable', 'sportspress' ),
45
+ 'sp_description' => __( 'Description', 'sportspress' ),
46
+ );
47
+ return apply_filters( 'sportspress_spec_admin_columns', $columns );
48
+ }
49
+
50
+ /**
51
+ * Define our custom columns shown in admin.
52
+ * @param string $column
53
+ */
54
+ public function custom_columns( $column, $post_id ) {
55
+ switch ( $column ):
56
+ case 'sp_key':
57
+ global $post;
58
+ echo $post->post_name;
59
+ break;
60
+ case 'sp_description':
61
+ global $post;
62
+ echo '<span class="description">' . $post->post_excerpt . '</span>';
63
+ break;
64
+ endswitch;
65
+ }
66
+ }
67
+
68
+ endif;
69
+
70
+ return new SP_Admin_CPT_Spec();
includes/admin/post-types/class-sp-admin-cpt-team.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Post_Types
8
- * @version 2.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -62,7 +62,7 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT {
62
  'cb' => '<input type="checkbox" />',
63
  'sp_icon' => '<span class="dashicons sp-icon-shield sp-tip" title="' . __( 'Logo', 'sportspress' ) . '"></span>',
64
  'title' => null,
65
- 'sp_url' => __( 'URL', 'sportspress' ),
66
  'sp_abbreviation' => __( 'Abbreviation', 'sportspress' ),
67
  'sp_league' => __( 'Leagues', 'sportspress' ),
68
  'sp_season' => __( 'Seasons', 'sportspress' ),
@@ -81,8 +81,9 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT {
81
  case 'sp_icon':
82
  echo has_post_thumbnail( $post_id ) ? edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-fit-mini' ), '', '', $post_id ) : '';
83
  break;
84
- case 'sp_url':
85
- echo strip_tags( sp_get_url( $post_id ), '<a>' );
 
86
  break;
87
  case 'sp_abbreviation':
88
  $abbreviation = get_post_meta ( $post_id, 'sp_abbreviation', true );
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Post_Types
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
62
  'cb' => '<input type="checkbox" />',
63
  'sp_icon' => '<span class="dashicons sp-icon-shield sp-tip" title="' . __( 'Logo', 'sportspress' ) . '"></span>',
64
  'title' => null,
65
+ 'sp_short_name' => __( 'Short Name', 'sportspress' ),
66
  'sp_abbreviation' => __( 'Abbreviation', 'sportspress' ),
67
  'sp_league' => __( 'Leagues', 'sportspress' ),
68
  'sp_season' => __( 'Seasons', 'sportspress' ),
81
  case 'sp_icon':
82
  echo has_post_thumbnail( $post_id ) ? edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-fit-mini' ), '', '', $post_id ) : '';
83
  break;
84
+ case 'sp_short_name':
85
+ $short_name = get_post_meta ( $post_id, 'sp_short_name', true );
86
+ echo $short_name ? esc_html( $short_name ) : '&mdash;';
87
  break;
88
  case 'sp_abbreviation':
89
  $abbreviation = get_post_meta ( $post_id, 'sp_abbreviation', true );
includes/admin/post-types/meta-boxes/class-sp-meta-box-event-specs.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Event Specs
4
+ *
5
+ * @author ThemeBoy
6
+ * @category Admin
7
+ * @package SportsPress/Admin/Meta_Boxes
8
+ * @version 2.6
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
+
13
+ /**
14
+ * SP_Meta_Box_Event_Specs
15
+ */
16
+ class SP_Meta_Box_Event_Specs {
17
+
18
+ /**
19
+ * Output the metabox
20
+ */
21
+ public static function output( $post ) {
22
+
23
+ $metrics = get_post_meta( $post->ID, 'sp_specs', true );
24
+
25
+ $args = array(
26
+ 'post_type' => 'sp_spec',
27
+ 'numberposts' => -1,
28
+ 'posts_per_page' => -1,
29
+ 'orderby' => 'menu_order',
30
+ 'order' => 'ASC',
31
+ );
32
+
33
+ $vars = get_posts( $args );
34
+
35
+ if ( $vars ):
36
+ foreach ( $vars as $var ):
37
+ ?>
38
+ <p><strong><?php echo $var->post_title; ?></strong></p>
39
+ <p><input type="text" name="sp_specs[<?php echo $var->post_name; ?>]" value="<?php echo esc_attr( sp_array_value( $metrics, $var->post_name, '' ) ); ?>" /></p>
40
+ <?php
41
+ endforeach;
42
+ else:
43
+ sp_post_adder( 'sp_spec', __( 'Add New', 'sportspress' ) );
44
+ endif;
45
+ }
46
+
47
+ /**
48
+ * Save meta box data
49
+ */
50
+ public static function save( $post_id, $post ) {
51
+ update_post_meta( $post_id, 'sp_specs', sp_array_value( $_POST, 'sp_specs', array() ) );
52
+ }
53
+ }
includes/admin/post-types/meta-boxes/class-sp-meta-box-outcome-details.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Meta_Boxes
8
- * @version 2.2
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -45,7 +45,7 @@ class SP_Meta_Box_Outcome_Details extends SP_Meta_Box_Config {
45
  </p>
46
  <p><strong><?php _e( 'Abbreviation', 'sportspress' ); ?></strong></p>
47
  <p>
48
- <input name="sp_abbreviation" type="text" id="sp_abbreviation" value="<?php echo $abbreviation; ?>" placeholder="<?php echo substr( $post->post_title, 0, 1 ); ?>">
49
  </p>
50
  <p><strong><?php _e( 'Color', 'sportspress' ); ?></strong></p>
51
  <p>
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Meta_Boxes
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
45
  </p>
46
  <p><strong><?php _e( 'Abbreviation', 'sportspress' ); ?></strong></p>
47
  <p>
48
+ <input name="sp_abbreviation" type="text" id="sp_abbreviation" value="<?php echo $abbreviation; ?>" placeholder="<?php echo mb_substr( $post->post_title, 0, 1 ); ?>">
49
  </p>
50
  <p><strong><?php _e( 'Color', 'sportspress' ); ?></strong></p>
51
  <p>
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 2.4
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -20,7 +20,20 @@ class SP_Meta_Box_Player_Statistics {
20
  */
21
  public static function output( $post ) {
22
  $player = new SP_Player( $post );
23
- $leagues = get_the_terms( $post->ID, 'sp_league' );
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  $league_num = sizeof( $leagues );
25
  $sections = get_option( 'sportspress_player_performance_sections', -1 );
26
  $show_career_totals = 'yes' === get_option( 'sportspress_player_show_career_total', 'no' ) ? true : false;
@@ -91,9 +104,10 @@ class SP_Meta_Box_Player_Statistics {
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
  ?>
95
  <div class="sp-data-table-container">
96
- <table class="widefat sp-data-table">
97
  <thead>
98
  <tr>
99
  <th><?php _e( 'Season', 'sportspress' ); ?></th>
@@ -105,6 +119,7 @@ class SP_Meta_Box_Player_Statistics {
105
  <?php foreach ( $columns as $key => $label ): if ( $key == 'team' ) continue; ?>
106
  <th><?php echo $label; ?></th>
107
  <?php endforeach; ?>
 
108
  </tr>
109
  </thead>
110
  <tfoot>
@@ -140,6 +155,7 @@ class SP_Meta_Box_Player_Statistics {
140
  }
141
  ?></td>
142
  <?php endforeach; ?>
 
143
  </tr>
144
  </tfoot>
145
  <tbody>
@@ -150,7 +166,7 @@ class SP_Meta_Box_Player_Statistics {
150
  if ( $div_id === 0 ) continue;
151
  $div = get_term( $div_id, 'sp_season' );
152
  ?>
153
- <tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
154
  <td>
155
  <label>
156
  <?php if ( ! apply_filters( 'sportspress_player_team_statistics', $league_id ) ): ?>
@@ -160,7 +176,7 @@ class SP_Meta_Box_Player_Statistics {
160
  <?php endif; ?>
161
  <?php
162
  if ( 0 === $div_id ) _e( 'Total', 'sportspress' );
163
- elseif ( 'WP_Error' != get_class( $div ) ) echo $div->name;
164
  ?>
165
  </label>
166
  </td>
@@ -201,6 +217,10 @@ class SP_Meta_Box_Player_Statistics {
201
  </td>
202
  <?php endif; ?>
203
  <?php endif; ?>
 
 
 
 
204
  <?php foreach ( $columns as $column => $label ): if ( $column == 'team' ) continue;
205
  ?>
206
  <td><?php
@@ -217,18 +237,21 @@ class SP_Meta_Box_Player_Statistics {
217
  echo $timeval ? $timeval : $placeholder;
218
  } else {
219
  if ( 'time' === sp_array_value( $formats, $column, 'number' ) ) {
220
- echo '<input class="sp-convert-time-input" type="text" name="sp_times[' . $league_id . '][' . $div_id . '][' . $column . ']" value="' . ( '' === $value ? '' : esc_attr( $timeval ) ) . '" placeholder="' . esc_attr( $placeholder ) . '"' . ( $readonly ? ' disabled="disabled"' : '' ) . ' />';
221
  echo '<input class="sp-convert-time-output" type="hidden" name="sp_statistics[' . $league_id . '][' . $div_id . '][' . $column . ']" value="' . esc_attr( $value ) . '" />';
222
  } else {
223
- echo '<input type="text" name="sp_statistics[' . $league_id . '][' . $div_id . '][' . $column . ']" value="' . esc_attr( $value ) . '" placeholder="' . esc_attr( $placeholder ) . '"' . ( $readonly ? ' disabled="disabled"' : '' ) . ' />';
224
  }
225
  }
226
  ?></td>
227
  <?php endforeach; ?>
 
228
  </tr>
229
  <?php
230
  $i++;
 
231
  endforeach;
 
232
  ?>
233
  </tbody>
234
  </table>
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Meta_Boxes
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
20
  */
21
  public static function output( $post ) {
22
  $player = new SP_Player( $post );
23
+ $args = array(
24
+ 'meta_query' => array(
25
+ 'relation' => 'OR',
26
+ array(
27
+ 'key' => 'sp_order',
28
+ 'compare' => 'NOT EXISTS',
29
+ ),
30
+ array(
31
+ 'key' => 'sp_order',
32
+ 'compare' => 'EXISTS',
33
+ ),
34
+ ),
35
+ );
36
+ $leagues = get_the_terms( $post->ID, 'sp_league', $args );
37
  $league_num = sizeof( $leagues );
38
  $sections = get_option( 'sportspress_player_performance_sections', -1 );
39
  $show_career_totals = 'yes' === get_option( 'sportspress_player_show_career_total', 'no' ) ? true : false;
104
  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() ) {
105
  $readonly = false;
106
  $teams = array_filter( get_post_meta( $id, 'sp_team', false ) );
107
+ $buffer = apply_filters( 'sportspress_meta_box_player_statistics_table_buffer', array( 'teams' => $teams, 'readonly' => $readonly ), $id );
108
  ?>
109
  <div class="sp-data-table-container">
110
+ <table class="widefat sp-data-table sp-player-statistics-table">
111
  <thead>
112
  <tr>
113
  <th><?php _e( 'Season', 'sportspress' ); ?></th>
119
  <?php foreach ( $columns as $key => $label ): if ( $key == 'team' ) continue; ?>
120
  <th><?php echo $label; ?></th>
121
  <?php endforeach; ?>
122
+ <?php do_action( 'sportspress_meta_box_player_statistics_table_header_row', $id, $league_id ); ?>
123
  </tr>
124
  </thead>
125
  <tfoot>
155
  }
156
  ?></td>
157
  <?php endforeach; ?>
158
+ <?php do_action( 'sportspress_meta_box_player_statistics_table_footer_row', $id, $league_id ); ?>
159
  </tr>
160
  </tfoot>
161
  <tbody>
166
  if ( $div_id === 0 ) continue;
167
  $div = get_term( $div_id, 'sp_season' );
168
  ?>
169
+ <tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?> <?php echo implode( ' ', apply_filters( 'sportspress_meta_box_player_statistics_row_classes', array(), $league_id, $div_id ) ); ?>" data-league="<?php echo (int) $league_id; ?>" data-season="<?php echo (int) $div_id; ?>">
170
  <td>
171
  <label>
172
  <?php if ( ! apply_filters( 'sportspress_player_team_statistics', $league_id ) ): ?>
176
  <?php endif; ?>
177
  <?php
178
  if ( 0 === $div_id ) _e( 'Total', 'sportspress' );
179
+ elseif ( 'WP_Error' != get_class( $div ) ) echo apply_filters( 'sportspress_meta_box_player_statistics_season_name', $div->name, $league_id, $div_id, $div_stats );
180
  ?>
181
  </label>
182
  </td>
217
  </td>
218
  <?php endif; ?>
219
  <?php endif; ?>
220
+ <?php
221
+ $collection = array( 'columns' => $columns, 'data' => $data, 'placeholders' => $placeholders, 'merged' => $merged, 'seasons_teams' => array(), 'has_checkboxes' => $has_checkboxes, 'formats' => $formats, 'total_types' => $total_types, 'buffer' => $buffer );
222
+ list( $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes, $formats, $total_types, $buffer ) = array_values( apply_filters( 'sportspress_meta_box_player_statistics_collection', $collection, $id, $league_id, $div_id, $value ) );
223
+ ?>
224
  <?php foreach ( $columns as $column => $label ): if ( $column == 'team' ) continue;
225
  ?>
226
  <td><?php
237
  echo $timeval ? $timeval : $placeholder;
238
  } else {
239
  if ( 'time' === sp_array_value( $formats, $column, 'number' ) ) {
240
+ echo '<input class="sp-convert-time-input" type="text" name="sp_times[' . $league_id . '][' . $div_id . '][' . $column . ']" value="' . ( '' === $value ? '' : esc_attr( $timeval ) ) . '" placeholder="' . esc_attr( $placeholder ) . '"' . ( $readonly ? ' disabled="disabled"' : '' ) . ' data-column="' . $column . '" />';
241
  echo '<input class="sp-convert-time-output" type="hidden" name="sp_statistics[' . $league_id . '][' . $div_id . '][' . $column . ']" value="' . esc_attr( $value ) . '" />';
242
  } else {
243
+ echo '<input type="text" name="sp_statistics[' . $league_id . '][' . $div_id . '][' . $column . ']" value="' . esc_attr( $value ) . '" placeholder="' . esc_attr( $placeholder ) . '"' . ( $readonly ? ' disabled="disabled"' : '' ) . ' data-column="' . $column . '" />';
244
  }
245
  }
246
  ?></td>
247
  <?php endforeach; ?>
248
+ <?php do_action( 'sportspress_meta_box_player_statistics_table_row', $id, $league_id, $div_id, $team_select, $buffer, $i ); ?>
249
  </tr>
250
  <?php
251
  $i++;
252
+ do_action( 'sportspress_meta_box_player_statistics_table_after_row', $id, $league_id, $div_id, $team_select, $buffer, $i );
253
  endforeach;
254
+ do_action( 'sportspress_meta_box_player_statistics_table_tbody', $id, $league_id, $div_id, $team_select, $buffer );
255
  ?>
256
  </tbody>
257
  </table>
includes/admin/post-types/meta-boxes/class-sp-meta-box-spec-details.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Spec Details
4
+ *
5
+ * @author ThemeBoy
6
+ * @category Admin
7
+ * @package SportsPress/Admin/Meta_Boxes
8
+ * @version 2.6
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
+
13
+ if ( ! class_exists( 'SP_Meta_Box_Config' ) )
14
+ include( 'class-sp-meta-box-config.php' );
15
+
16
+ /**
17
+ * SP_Meta_Box_Spec_Details
18
+ */
19
+ class SP_Meta_Box_Spec_Details extends SP_Meta_Box_Config {
20
+
21
+ /**
22
+ * Output the metabox
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 event pages?', '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-staff-details.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Meta_Boxes
8
- * @version 2.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -49,7 +49,7 @@ class SP_Meta_Box_Staff_Details {
49
  endif;
50
 
51
  $roles = get_the_terms( $post->ID, 'sp_role' );
52
- $role_ids = wp_list_pluck( $roles, 'term_id' );
53
 
54
  $teams = get_posts( array( 'post_type' => 'sp_team', 'posts_per_page' => -1 ) );
55
  $past_teams = array_filter( get_post_meta( $post->ID, 'sp_past_team', false ) );
@@ -155,4 +155,4 @@ class SP_Meta_Box_Staff_Details {
155
  sp_update_post_meta_recursive( $post_id, 'sp_past_team', sp_array_value( $_POST, 'sp_past_team', array() ) );
156
  sp_update_post_meta_recursive( $post_id, 'sp_team', array_merge( array( sp_array_value( $_POST, 'sp_current_team', array() ) ), sp_array_value( $_POST, 'sp_past_team', array() ) ) );
157
  }
158
- }
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Meta_Boxes
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
49
  endif;
50
 
51
  $roles = get_the_terms( $post->ID, 'sp_role' );
52
+ $role_ids = is_array( $roles ) ? wp_list_pluck( $roles, 'term_id' ) : array();
53
 
54
  $teams = get_posts( array( 'post_type' => 'sp_team', 'posts_per_page' => -1 ) );
55
  $past_teams = array_filter( get_post_meta( $post->ID, 'sp_past_team', false ) );
155
  sp_update_post_meta_recursive( $post_id, 'sp_past_team', sp_array_value( $_POST, 'sp_past_team', array() ) );
156
  sp_update_post_meta_recursive( $post_id, 'sp_team', array_merge( array( sp_array_value( $_POST, 'sp_current_team', array() ) ), sp_array_value( $_POST, 'sp_past_team', array() ) ) );
157
  }
158
+ }
includes/admin/post-types/meta-boxes/class-sp-meta-box-team-details.php CHANGED
@@ -5,7 +5,7 @@
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Meta_Boxes
8
- * @version 2.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -51,6 +51,7 @@ class SP_Meta_Box_Team_Details {
51
  endif;
52
  endif;
53
 
 
54
  $abbreviation = get_post_meta( $post->ID, 'sp_abbreviation', true );
55
  $redirect = get_post_meta( $post->ID, 'sp_redirect', true );
56
  $url = get_post_meta( $post->ID, 'sp_url', true );
@@ -111,6 +112,9 @@ class SP_Meta_Box_Team_Details {
111
  <p><input type="text" class="widefat" id="sp_url" name="sp_url" value="<?php echo esc_url( $url ); ?>"></p>
112
  <p><label class="selectit"><input type="checkbox" name="sp_redirect" value="1" <?php checked( $redirect ); ?>> <?php _e( 'Redirect', 'sportspress' ); ?></label></p>
113
 
 
 
 
114
  <p><strong><?php _e( 'Abbreviation', 'sportspress' ); ?></strong></p>
115
  <p><input type="text" id="sp_abbreviation" name="sp_abbreviation" value="<?php echo esc_attr( $abbreviation ); ?>"></p>
116
  <?php
@@ -122,6 +126,7 @@ class SP_Meta_Box_Team_Details {
122
  public static function save( $post_id, $post ) {
123
  update_post_meta( $post_id, 'sp_url', esc_url( sp_array_value( $_POST, 'sp_url', '' ) ) );
124
  update_post_meta( $post_id, 'sp_redirect', sp_array_value( $_POST, 'sp_redirect', 0 ) );
 
125
  update_post_meta( $post_id, 'sp_abbreviation', esc_attr( sp_array_value( $_POST, 'sp_abbreviation', '' ) ) );
126
  }
127
  }
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin/Meta_Boxes
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
51
  endif;
52
  endif;
53
 
54
+ $short_name = get_post_meta( $post->ID, 'sp_short_name', true );
55
  $abbreviation = get_post_meta( $post->ID, 'sp_abbreviation', true );
56
  $redirect = get_post_meta( $post->ID, 'sp_redirect', true );
57
  $url = get_post_meta( $post->ID, 'sp_url', true );
112
  <p><input type="text" class="widefat" id="sp_url" name="sp_url" value="<?php echo esc_url( $url ); ?>"></p>
113
  <p><label class="selectit"><input type="checkbox" name="sp_redirect" value="1" <?php checked( $redirect ); ?>> <?php _e( 'Redirect', 'sportspress' ); ?></label></p>
114
 
115
+ <p><strong><?php _e( 'Short Name', 'sportspress' ); ?></strong></p>
116
+ <p><input type="text" id="sp_short_name" name="sp_short_name" value="<?php echo esc_attr( $short_name ); ?>"></p>
117
+
118
  <p><strong><?php _e( 'Abbreviation', 'sportspress' ); ?></strong></p>
119
  <p><input type="text" id="sp_abbreviation" name="sp_abbreviation" value="<?php echo esc_attr( $abbreviation ); ?>"></p>
120
  <?php
126
  public static function save( $post_id, $post ) {
127
  update_post_meta( $post_id, 'sp_url', esc_url( sp_array_value( $_POST, 'sp_url', '' ) ) );
128
  update_post_meta( $post_id, 'sp_redirect', sp_array_value( $_POST, 'sp_redirect', 0 ) );
129
+ update_post_meta( $post_id, 'sp_short_name', esc_attr( sp_array_value( $_POST, 'sp_short_name', '' ) ) );
130
  update_post_meta( $post_id, 'sp_abbreviation', esc_attr( sp_array_value( $_POST, 'sp_abbreviation', '' ) ) );
131
  }
132
  }
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.5.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -278,7 +278,7 @@ class SP_Settings_Events extends SP_Settings_Page {
278
 
279
  apply_filters( 'sportspress_eventplayer_options', array(
280
  array(
281
- 'title' => __( 'Player Sorting', 'sportspress' ),
282
  'id' => 'sportspress_event_player_sort',
283
  'default' => 'jersey',
284
  'type' => 'radio',
@@ -286,8 +286,7 @@ class SP_Settings_Events extends SP_Settings_Page {
286
  'jersey'=> __( 'Jersey (e.g. "33. John Doe")', 'sportspress' ),
287
  'name' => __( 'Name (e.g. "John Doe (33)")', 'sportspress' ),
288
  ),
289
- 'desc_tip' => _x( 'When editing an event, this determines how the checklist of players are sorted in the Teams metabox. This does not affect the Box Score section.', 'event player sort setting description', 'sportspress' ),
290
-
291
  ),
292
 
293
  ) ),
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
278
 
279
  apply_filters( 'sportspress_eventplayer_options', array(
280
  array(
281
+ 'title' => __( 'Order', 'sportspress' ),
282
  'id' => 'sportspress_event_player_sort',
283
  'default' => 'jersey',
284
  'type' => 'radio',
286
  'jersey'=> __( 'Jersey (e.g. "33. John Doe")', 'sportspress' ),
287
  'name' => __( 'Name (e.g. "John Doe (33)")', 'sportspress' ),
288
  ),
289
+ 'desc_tip' => 'When editing an event, this determines how the checklist of players are sorted in the Teams metabox. This does not affect the Box Score section.',
 
290
  ),
291
 
292
  ) ),
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 2.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -74,25 +74,6 @@ class SP_Settings_Modules extends SP_Settings_Page {
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>
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
74
  </table>
75
  <?php } ?>
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  <?php if ( ! class_exists( 'SportsPress_Twitter' ) || ! class_exists( 'SportsPress_Facebook' ) ) { ?>
78
  <table class="widefat" cellspacing="0">
79
  <thead>
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.5.5
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -58,27 +58,19 @@ class SP_Settings_Teams extends SP_Settings_Page {
58
  'type' => 'checkbox',
59
  ),
60
 
61
- array(
62
- 'title' => __( 'Link', 'sportspress' ),
63
- 'desc' => __( 'Link teams', 'sportspress' ),
64
- 'id' => 'sportspress_link_teams',
65
- 'default' => 'no',
66
- 'type' => 'checkbox',
67
- ),
68
-
69
  array(
70
- 'title' => __( 'Venue', 'sportspress' ),
71
- 'desc' => __( 'Link venues', 'sportspress' ),
72
- 'id' => 'sportspress_team_link_venues',
73
  'default' => 'no',
74
  'type' => 'checkbox',
75
  ),
76
 
77
  array(
78
- 'title' => __( 'Abbreviation', 'sportspress' ),
79
- 'desc' => __( 'Abbreviate team names', 'sportspress' ),
80
- 'id' => 'sportspress_abbreviate_teams',
81
- 'default' => 'yes',
82
  'type' => 'checkbox',
83
  ),
84
 
5
  * @author ThemeBoy
6
  * @category Admin
7
  * @package SportsPress/Admin
8
+ * @version 2.6
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
58
  'type' => 'checkbox',
59
  ),
60
 
 
 
 
 
 
 
 
 
61
  array(
62
+ 'title' => __( 'Link', 'sportspress' ),
63
+ 'desc' => __( 'Link teams', 'sportspress' ),
64
+ 'id' => 'sportspress_link_teams',
65
  'default' => 'no',
66
  'type' => 'checkbox',
67
  ),
68
 
69
  array(
70
+ 'title' => __( 'Venue', 'sportspress' ),
71
+ 'desc' => __( 'Link venues', 'sportspress' ),
72
+ 'id' => 'sportspress_team_link_venues',
73
+ 'default' => 'no',
74
  'type' => 'checkbox',
75
  ),
76
 
includes/admin/views/html-admin-config.php CHANGED
@@ -295,7 +295,7 @@ $columns = get_option( 'sportspress_player_columns', 'auto' );
295
  </td>
296
  </tr>
297
  </tbody>
298
- </table>
299
  <table class="form-table">
300
  <tbody>
301
  <?php
295
  </td>
296
  </tr>
297
  </tbody>
298
+ </table>
299
  <table class="form-table">
300
  <tbody>
301
  <?php
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.5.5
12
  * @package SportsPress/Classes
13
  * @category Class
14
  * @author ThemeBoy
@@ -270,6 +270,42 @@ class SP_AJAX {
270
  ?>
271
  </label>
272
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  <p>
274
  <label>
275
  <?php _e( 'Match Day:', 'sportspress' ); ?>
@@ -387,17 +423,42 @@ class SP_AJAX {
387
  ?>
388
  </label>
389
  </p>
390
- <p>
391
- <label>
392
- <?php _e( 'Date:', 'sportspress' ); ?>
393
- <select id="date" name="date">
394
- <option value="default"><?php _e( 'Default', 'sportspress' ); ?></option>
395
- <option value=""><?php _e( 'All', 'sportspress' ); ?></option>
396
- <option value="w"><?php _e( 'This week', 'sportspress' ); ?></option>
397
- <option value="day"><?php _e( 'Today', 'sportspress' ); ?></option>
398
- </select>
399
- </label>
400
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
  <p>
402
  <label>
403
  <?php _e( 'Match Day:', 'sportspress' ); ?>
@@ -556,17 +617,42 @@ class SP_AJAX {
556
  ?>
557
  </label>
558
  </p>
559
- <p>
560
- <label>
561
- <?php _e( 'Date:', 'sportspress' ); ?>
562
- <select id="date" name="date">
563
- <option value="default"><?php _e( 'Default', 'sportspress' ); ?></option>
564
- <option value=""><?php _e( 'All', 'sportspress' ); ?></option>
565
- <option value="w"><?php _e( 'This week', 'sportspress' ); ?></option>
566
- <option value="day"><?php _e( 'Today', 'sportspress' ); ?></option>
567
- </select>
568
- </label>
569
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  <p>
571
  <label>
572
  <?php _e( 'Match Day:', 'sportspress' ); ?>
@@ -1020,6 +1106,12 @@ class SP_AJAX {
1020
  args.season = $div.find('[name=season]').val();
1021
  args.venue = $div.find('[name=venue]').val();
1022
  args.status = $div.find('[name=status]').val();
 
 
 
 
 
 
1023
  args.day = $div.find('[name=day]').val();
1024
  args.show_all_events_link = $div.find('[name=show_all_events_link]:checked').length;
1025
  } else if ( 'event_list' == type ) {
@@ -1030,6 +1122,11 @@ class SP_AJAX {
1030
  args.venue = $div.find('[name=venue]').val();
1031
  args.status = $div.find('[name=status]').val();
1032
  args.date = $div.find('[name=date]').val();
 
 
 
 
 
1033
  args.day = $div.find('[name=day]').val();
1034
  args.number = $div.find('[name=number]').val();
1035
  args.order = $div.find('[name=order]').val();
@@ -1044,6 +1141,11 @@ class SP_AJAX {
1044
  args.venue = $div.find('[name=venue]').val();
1045
  args.status = $div.find('[name=status]').val();
1046
  args.date = $div.find('[name=date]').val();
 
 
 
 
 
1047
  args.day = $div.find('[name=day]').val();
1048
  args.number = $div.find('[name=number]').val();
1049
  args.orderby = $div.find('[name=orderby]').val();
@@ -1092,9 +1194,53 @@ class SP_AJAX {
1092
  window.send_to_editor( shortcode );
1093
  }
1094
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1095
  <?php
1096
  }
1097
  }
1098
 
1099
  new SP_AJAX();
1100
-
8
  * AJAX Event Handler
9
  *
10
  * @class SP_AJAX
11
+ * @version 2.6
12
  * @package SportsPress/Classes
13
  * @category Class
14
  * @author ThemeBoy
270
  ?>
271
  </label>
272
  </p>
273
+ <div class="sp-date-selector">
274
+ <p><?php _e( 'Date:', 'sportspress' ); ?>
275
+ <?php
276
+ $args = array(
277
+ 'name' => 'date',
278
+ 'id' => 'date',
279
+ 'selected' => $date,
280
+ );
281
+ sp_dropdown_dates( $args );
282
+ ?>
283
+ </p>
284
+ <div class="sp-date-range">
285
+ <p class="sp-date-range-absolute">
286
+ <input type="text" class="sp-datepicker-from" name="date_from" value="default" size="10">
287
+ :
288
+ <input type="text" class="sp-datepicker-to" name="date_to" value="default" size="10">
289
+ </p>
290
+
291
+ <p class="sp-date-range-relative">
292
+ <?php _e( 'Past', 'sportspress' ); ?>
293
+ <input type="number" min="0" step="1" class="tiny-text" name="date_past" value="default">
294
+ <?php _e( 'days', 'sportspress' ); ?>
295
+ &rarr;
296
+ <?php _e( 'Next', 'sportspress' ); ?>
297
+ <input type="number" min="0" step="1" class="tiny-text" name="date_future" value="default">
298
+ <?php _e( 'days', 'sportspress' ); ?>
299
+ </p>
300
+
301
+ <p class="sp-date-relative">
302
+ <label>
303
+ <input type="checkbox" name="date_relative" value="0" id="date_relative">
304
+ <?php _e( 'Relative', 'sportspress' ); ?>
305
+ </label>
306
+ </p>
307
+ </div>
308
+ </div>
309
  <p>
310
  <label>
311
  <?php _e( 'Match Day:', 'sportspress' ); ?>
423
  ?>
424
  </label>
425
  </p>
426
+ <div class="sp-date-selector">
427
+ <p><?php _e( 'Date:', 'sportspress' ); ?>
428
+ <?php
429
+ $args = array(
430
+ 'name' => 'date',
431
+ 'id' => 'date',
432
+ 'selected' => $date,
433
+ );
434
+ sp_dropdown_dates( $args );
435
+ ?>
436
+ </p>
437
+ <div class="sp-date-range">
438
+ <p class="sp-date-range-absolute">
439
+ <input type="text" class="sp-datepicker-from" name="date_from" value="default" size="10">
440
+ :
441
+ <input type="text" class="sp-datepicker-to" name="date_to" value="default" size="10">
442
+ </p>
443
+
444
+ <p class="sp-date-range-relative">
445
+ <?php _e( 'Past', 'sportspress' ); ?>
446
+ <input type="number" min="0" step="1" class="tiny-text" name="date_past" value="default">
447
+ <?php _e( 'days', 'sportspress' ); ?>
448
+ &rarr;
449
+ <?php _e( 'Next', 'sportspress' ); ?>
450
+ <input type="number" min="0" step="1" class="tiny-text" name="date_future" value="default">
451
+ <?php _e( 'days', 'sportspress' ); ?>
452
+ </p>
453
+
454
+ <p class="sp-date-relative">
455
+ <label>
456
+ <input type="checkbox" name="date_relative" value="0" id="date_relative">
457
+ <?php _e( 'Relative', 'sportspress' ); ?>
458
+ </label>
459
+ </p>
460
+ </div>
461
+ </div>
462
  <p>
463
  <label>
464
  <?php _e( 'Match Day:', 'sportspress' ); ?>
617
  ?>
618
  </label>
619
  </p>
620
+ <div class="sp-date-selector">
621
+ <p><?php _e( 'Date:', 'sportspress' ); ?>
622
+ <?php
623
+ $args = array(
624
+ 'name' => 'date',
625
+ 'id' => 'date',
626
+ 'selected' => $date,
627
+ );
628
+ sp_dropdown_dates( $args );
629
+ ?>
630
+ </p>
631
+ <div class="sp-date-range">
632
+ <p class="sp-date-range-absolute">
633
+ <input type="text" class="sp-datepicker-from" name="date_from" value="default" size="10">
634
+ :
635
+ <input type="text" class="sp-datepicker-to" name="date_to" value="default" size="10">
636
+ </p>
637
+
638
+ <p class="sp-date-range-relative">
639
+ <?php _e( 'Past', 'sportspress' ); ?>
640
+ <input type="number" min="0" step="1" class="tiny-text" name="date_past" value="default">
641
+ <?php _e( 'days', 'sportspress' ); ?>
642
+ &rarr;
643
+ <?php _e( 'Next', 'sportspress' ); ?>
644
+ <input type="number" min="0" step="1" class="tiny-text" name="date_future" value="default">
645
+ <?php _e( 'days', 'sportspress' ); ?>
646
+ </p>
647
+
648
+ <p class="sp-date-relative">
649
+ <label>
650
+ <input type="checkbox" name="date_relative" value="0" id="date_relative">
651
+ <?php _e( 'Relative', 'sportspress' ); ?>
652
+ </label>
653
+ </p>
654
+ </div>
655
+ </div>
656
  <p>
657
  <label>
658
  <?php _e( 'Match Day:', 'sportspress' ); ?>
1106
  args.season = $div.find('[name=season]').val();
1107
  args.venue = $div.find('[name=venue]').val();
1108
  args.status = $div.find('[name=status]').val();
1109
+ args.date = $div.find('[name=date]').val();
1110
+ args.date_from = $div.find('[name=date_from]').val();
1111
+ args.date_to = $div.find('[name=date_to]').val();
1112
+ args.date_past = $div.find('[name=date_past]').val();
1113
+ args.date_future = $div.find('[name=date_future]').val();
1114
+ args.date_relative = $div.find('[name=date_relative]:checked').length;
1115
  args.day = $div.find('[name=day]').val();
1116
  args.show_all_events_link = $div.find('[name=show_all_events_link]:checked').length;
1117
  } else if ( 'event_list' == type ) {
1122
  args.venue = $div.find('[name=venue]').val();
1123
  args.status = $div.find('[name=status]').val();
1124
  args.date = $div.find('[name=date]').val();
1125
+ args.date_from = $div.find('[name=date_from]').val();
1126
+ args.date_to = $div.find('[name=date_to]').val();
1127
+ args.date_past = $div.find('[name=date_past]').val();
1128
+ args.date_future = $div.find('[name=date_future]').val();
1129
+ args.date_relative = $div.find('[name=date_relative]:checked').length;
1130
  args.day = $div.find('[name=day]').val();
1131
  args.number = $div.find('[name=number]').val();
1132
  args.order = $div.find('[name=order]').val();
1141
  args.venue = $div.find('[name=venue]').val();
1142
  args.status = $div.find('[name=status]').val();
1143
  args.date = $div.find('[name=date]').val();
1144
+ args.date_from = $div.find('[name=date_from]').val();
1145
+ args.date_to = $div.find('[name=date_to]').val();
1146
+ args.date_past = $div.find('[name=date_past]').val();
1147
+ args.date_future = $div.find('[name=date_future]').val();
1148
+ args.date_relative = $div.find('[name=date_relative]:checked').length;
1149
  args.day = $div.find('[name=day]').val();
1150
  args.number = $div.find('[name=number]').val();
1151
  args.orderby = $div.find('[name=orderby]').val();
1194
  window.send_to_editor( shortcode );
1195
  }
1196
  </script>
1197
+ <script type="text/javascript">
1198
+ jQuery(document).ready(function($){
1199
+ // Datepicker
1200
+ $(".sp-datepicker").datepicker({
1201
+ dateFormat : "yy-mm-dd"
1202
+ });
1203
+ $(".sp-datepicker-from").datepicker({
1204
+ dateFormat : "yy-mm-dd",
1205
+ onClose: function( selectedDate ) {
1206
+ $(this).closest(".sp-date-selector").find(".sp-datepicker-to").datepicker("option", "minDate", selectedDate);
1207
+ }
1208
+ });
1209
+ $(".sp-datepicker-to").datepicker({
1210
+ dateFormat : "yy-mm-dd",
1211
+ onClose: function( selectedDate ) {
1212
+ $(this).closest(".sp-date-selector").find(".sp-datepicker-from").datepicker("option", "maxDate", selectedDate);
1213
+ }
1214
+ });
1215
+
1216
+ // Show or hide datepicker
1217
+ $(".sp-date-selector select").change(function() {
1218
+ if ( $(this).val() == "range" ) {
1219
+ $(this).closest(".sp-date-selector").find(".sp-date-range").show();
1220
+ } else {
1221
+ $(this).closest(".sp-date-selector").find(".sp-date-range").hide();
1222
+ }
1223
+ });
1224
+ $(".sp-date-selector select").trigger("change");
1225
+
1226
+ // Toggle date range selectors
1227
+ $(".sp-date-relative input").change(function() {
1228
+ $relative = $(this).closest(".sp-date-relative").siblings(".sp-date-range-relative").toggle(0, $(this).attr("checked"));
1229
+ $absolute = $(this).closest(".sp-date-relative").siblings(".sp-date-range-absolute").toggle(0, $(this).attr("checked"));
1230
+
1231
+ if ($(this).attr("checked")) {
1232
+ $relative.show();
1233
+ $absolute.hide();
1234
+ } else {
1235
+ $absolute.show();
1236
+ $relative.hide();
1237
+ }
1238
+ });
1239
+ $(".sp-date-selector input").trigger("change");
1240
+ });
1241
+ </script>
1242
  <?php
1243
  }
1244
  }
1245
 
1246
  new SP_AJAX();
 
includes/class-sp-event.php CHANGED
@@ -5,7 +5,7 @@
5
  * The SportsPress event class handles individual event data.
6
  *
7
  * @class SP_Event
8
- * @version 2.5.2
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
@@ -17,7 +17,7 @@ class SP_Event extends SP_Custom_Post{
17
  $results = get_post_meta( $this->ID, 'sp_results', true );
18
  if ( is_array( $results ) ) {
19
  foreach( $results as $result ) {
20
- $result = array_filter( $result );
21
  if ( count( $result ) > 0 ) {
22
  return 'results';
23
  }
@@ -393,7 +393,7 @@ class SP_Event extends SP_Custom_Post{
393
  $stats[ $index ]['number'] = sp_array_value( $player_numbers, $details['id'] );
394
 
395
  if ( 'team' === $details['key'] ) {
396
- $name = sp_get_team_name( $details['team'] );
397
  $stats[ $index ]['name'] = $name;
398
  $stats[ $index ]['label'] = $name;
399
  $stats[ $index ]['icon'] = sp_get_logo( $details['team'] );
@@ -629,6 +629,9 @@ class SP_Event extends SP_Custom_Post{
629
  $outcomes = get_posts( $args );
630
  foreach ( $meta as $team => $team_results ) {
631
  if ( $outcomes ) {
 
 
 
632
  $meta[ $team ][ 'outcome' ] = array();
633
  foreach ( $outcomes as $outcome ) {
634
  $meta[ $team ][ 'outcome' ][] = $outcome->post_name;
@@ -705,6 +708,26 @@ class SP_Event extends SP_Custom_Post{
705
  }
706
 
707
  public function sort_timeline( $a, $b ) {
708
- return $a['time'] - $b['time'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
709
  }
710
  }
5
  * The SportsPress event class handles individual event data.
6
  *
7
  * @class SP_Event
8
+ * @version 2.6
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
17
  $results = get_post_meta( $this->ID, 'sp_results', true );
18
  if ( is_array( $results ) ) {
19
  foreach( $results as $result ) {
20
+ $result = is_array( $result ) ? array_filter( $result ) : array();
21
  if ( count( $result ) > 0 ) {
22
  return 'results';
23
  }
393
  $stats[ $index ]['number'] = sp_array_value( $player_numbers, $details['id'] );
394
 
395
  if ( 'team' === $details['key'] ) {
396
+ $name = sp_team_short_name( $details['team'] );
397
  $stats[ $index ]['name'] = $name;
398
  $stats[ $index ]['label'] = $name;
399
  $stats[ $index ]['icon'] = sp_get_logo( $details['team'] );
629
  $outcomes = get_posts( $args );
630
  foreach ( $meta as $team => $team_results ) {
631
  if ( $outcomes ) {
632
+ if ( empty( $meta[ $team ] ) ) {
633
+ $meta[ $team ] = array();
634
+ }
635
  $meta[ $team ][ 'outcome' ] = array();
636
  foreach ( $outcomes as $outcome ) {
637
  $meta[ $team ][ 'outcome' ][] = $outcome->post_name;
708
  }
709
 
710
  public function sort_timeline( $a, $b ) {
711
+ return (float) $a['time'] - (float) $b['time'];
712
+ }
713
+
714
+ /**
715
+ * Returns formatted event specs
716
+ *
717
+ * @access public
718
+ * @return array
719
+ */
720
+ public function specs( $neg = null ) {
721
+ $specs = (array)get_post_meta( $this->ID, 'sp_specs', true );
722
+ $spec_labels = (array)sp_get_var_labels( 'sp_spec', $neg, false );
723
+ $data = array();
724
+
725
+ foreach ( $spec_labels as $key => $value ):
726
+ $spec = sp_array_value( $specs, $key, null );
727
+ if ( $spec == null )
728
+ continue;
729
+ $data[ $value ] = sp_array_value( $specs, $key, '&nbsp;' );
730
+ endforeach;
731
+ return $data;
732
  }
733
  }
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.5
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
@@ -38,7 +38,6 @@ class SP_League_Table extends SP_Secondary_Post {
38
  $usecolumns = get_post_meta( $this->ID, 'sp_columns', true );
39
  $adjustments = get_post_meta( $this->ID, 'sp_adjustments', true );
40
  $select = get_post_meta( $this->ID, 'sp_select', true );
41
- $abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
42
  $link_events = get_option( 'sportspress_link_events', 'yes' ) === 'yes' ? true : false;
43
  $form_limit = (int) get_option( 'sportspress_form_limit', 5 );
44
 
@@ -619,12 +618,12 @@ class SP_League_Table extends SP_Secondary_Post {
619
  endif;
620
  else:
621
  // Solve
622
- $placeholder = sp_solve( $stat->equation, sp_array_value( $totals, $team_id, array() ), $stat->precision );
623
 
624
  if ( '$gamesback' == $stat->equation )
625
  $gb_column = $stat->post_name;
626
 
627
- if ( ! in_array( $stat->equation, array( '$gamesback', '$streak', '$form', '$last5', '$last10', '$homerecord', '$awayrecord' ) ) ):
628
  // Adjustments
629
  $adjustment = sp_array_value( $adjustments, $team_id, array() );
630
 
@@ -702,7 +701,7 @@ class SP_League_Table extends SP_Secondary_Post {
702
  // Add team name to row
703
  $merged[ $team_id ] = array();
704
 
705
- $team_data['name'] = sp_get_team_name( $team_id, $abbreviate_teams );
706
 
707
  foreach ( $team_data as $key => $value ):
708
 
5
  * The SportsPress league table class handles individual league table data.
6
  *
7
  * @class SP_League_Table
8
+ * @version 2.6
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
38
  $usecolumns = get_post_meta( $this->ID, 'sp_columns', true );
39
  $adjustments = get_post_meta( $this->ID, 'sp_adjustments', true );
40
  $select = get_post_meta( $this->ID, 'sp_select', true );
 
41
  $link_events = get_option( 'sportspress_link_events', 'yes' ) === 'yes' ? true : false;
42
  $form_limit = (int) get_option( 'sportspress_form_limit', 5 );
43
 
618
  endif;
619
  else:
620
  // Solve
621
+ $placeholder = sp_solve( $stat->equation, sp_array_value( $totals, $team_id, array() ), $stat->precision, 0, $team_id );
622
 
623
  if ( '$gamesback' == $stat->equation )
624
  $gb_column = $stat->post_name;
625
 
626
+ if ( ! in_array( $stat->equation, apply_filters( 'sportspress_equation_presets', array( '$gamesback', '$streak', '$form', '$last5', '$last10', '$homerecord', '$awayrecord' ) ) ) ):
627
  // Adjustments
628
  $adjustment = sp_array_value( $adjustments, $team_id, array() );
629
 
701
  // Add team name to row
702
  $merged[ $team_id ] = array();
703
 
704
+ $team_data['name'] = sp_team_short_name( $team_id );
705
 
706
  foreach ( $team_data as $key => $value ):
707
 
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.5
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
@@ -29,6 +29,13 @@ class SP_Modules {
29
  'icon' => 'sp-icon-calendar',
30
  'desc' => __( 'Organize and publish calendars using different layouts.', 'sportspress' ),
31
  ),
 
 
 
 
 
 
 
32
  'scoreboard' => array(
33
  'label' => __( 'Scoreboard', 'sportspress' ),
34
  'class' => 'SportsPress_Scoreboard',
@@ -99,6 +106,14 @@ class SP_Modules {
99
  'icon' => 'sp-icon-list',
100
  'desc' => __( 'Create team rosters, player galleries, and ranking charts.', 'sportspress' ),
101
  ),
 
 
 
 
 
 
 
 
102
  'staff_directories' => array(
103
  'label' => __( 'Directories', 'sportspress' ),
104
  'class' => 'SportsPress_Staff_Directories',
@@ -158,14 +173,6 @@ class SP_Modules {
158
  'link' => 'https://www.themeboy.com/sportspress-extensions/sponsors/',
159
  'desc' => __( 'Attract sponsors by offering them advertising space on your website.', 'sportspress' ),
160
  ),
161
- 'wordpay' => array(
162
- 'label' => __( 'WordPay', 'sportspress' ),
163
- 'class' => 'WordPay',
164
- 'icon' => 'sp-icon-wordpay',
165
- 'link' => 'https://wordpay.org/sportspress/',
166
- 'desc' => __( 'Start collecting club membership payments with WordPay.', 'sportspress' ),
167
- 'tip' => __( 'Get WordPay', 'sportspress' ),
168
- ),
169
  ),
170
  ));
171
 
5
  * The SportsPress modules class stores available modules.
6
  *
7
  * @class SP_Modules
8
+ * @version 2.6
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
29
  'icon' => 'sp-icon-calendar',
30
  'desc' => __( 'Organize and publish calendars using different layouts.', 'sportspress' ),
31
  ),
32
+ 'results_matrix' => array(
33
+ 'label' => __( 'Results Matrix', 'sportspress' ),
34
+ 'class' => 'SportsPress_Results_Matrix',
35
+ 'icon' => 'sp-icon-matrix',
36
+ 'link' => 'https://www.themeboy.com/sportspress-extensions/results-matrix/',
37
+ 'desc' => __( 'Display fixtures and results between teams in a grid layout.', 'sportspress' ),
38
+ ),
39
  'scoreboard' => array(
40
  'label' => __( 'Scoreboard', 'sportspress' ),
41
  'class' => 'SportsPress_Scoreboard',
106
  'icon' => 'sp-icon-list',
107
  'desc' => __( 'Create team rosters, player galleries, and ranking charts.', 'sportspress' ),
108
  ),
109
+ 'midseason_transfers' => array(
110
+ 'label' => __( 'Midseason Transfers', 'sportspress' ),
111
+ 'class' => 'SportsPress_Midseason_Transfers',
112
+ 'icon' => 'sp-icon-sub',
113
+ 'link' => 'https://www.themeboy.com/sportspress-extensions/midseason-transfers/',
114
+ 'desc' => __( 'Statistics for players who transferred between teams during a season.', 'sportspress' ),
115
+ 'default' => 'yes',
116
+ ),
117
  'staff_directories' => array(
118
  'label' => __( 'Directories', 'sportspress' ),
119
  'class' => 'SportsPress_Staff_Directories',
173
  'link' => 'https://www.themeboy.com/sportspress-extensions/sponsors/',
174
  'desc' => __( 'Attract sponsors by offering them advertising space on your website.', 'sportspress' ),
175
  ),
 
 
 
 
 
 
 
 
176
  ),
177
  ));
178
 
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.5.5
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
@@ -115,15 +115,7 @@ class SP_Player_List extends SP_Secondary_Post {
115
  'terms' => $season_ids
116
  );
117
  endif;
118
-
119
- if ( $position_ids ):
120
- $args['tax_query'][] = array(
121
- 'taxonomy' => 'sp_position',
122
- 'field' => 'term_id',
123
- 'terms' => $position_ids
124
- );
125
- endif;
126
-
127
  if ( $team ):
128
  $team_key = 'sp_team';
129
  switch ( $era ):
@@ -142,7 +134,19 @@ class SP_Player_List extends SP_Secondary_Post {
142
  );
143
  endif;
144
 
145
- $players = get_posts( $args );
 
 
 
 
 
 
 
 
 
 
 
 
146
 
147
  if ( $players && is_array( $players ) ) {
148
  foreach ( $players as $player ) {
@@ -434,7 +438,7 @@ class SP_Player_List extends SP_Secondary_Post {
434
  endforeach;
435
 
436
  // Subtract minutes prior to substitution
437
- $substitution_time = sp_array_value( sp_array_value( sp_array_value( sp_array_value( $timeline, $team_id ), $player_id ), 'sub' ), 0, 0 );
438
  $played_minutes -= $substitution_time;
439
  else:
440
 
5
  * The SportsPress player list class handles individual player list data.
6
  *
7
  * @class SP_Player_List
8
+ * @version 2.6
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
115
  'terms' => $season_ids
116
  );
117
  endif;
118
+
 
 
 
 
 
 
 
 
119
  if ( $team ):
120
  $team_key = 'sp_team';
121
  switch ( $era ):
134
  );
135
  endif;
136
 
137
+ if ( $position_ids ):
138
+ $args['tax_query'][] = array(
139
+ 'taxonomy' => 'sp_position',
140
+ 'field' => 'term_id',
141
+ 'terms' => $position_ids
142
+ );
143
+ endif;
144
+
145
+ $args = apply_filters( 'sportspress_player_list_args', $args, $team );
146
+
147
+ $players = (array) get_posts( $args );
148
+
149
+ $players = apply_filters( 'sportspress_player_list_players', $players, $args, $team );
150
 
151
  if ( $players && is_array( $players ) ) {
152
  foreach ( $players as $player ) {
438
  endforeach;
439
 
440
  // Subtract minutes prior to substitution
441
+ $substitution_time = ( int ) sp_array_value( sp_array_value( sp_array_value( sp_array_value( $timeline, $team_id ), $player_id ), 'sub' ), 0, 0 );
442
  $played_minutes -= $substitution_time;
443
  else:
444
 
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.5
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
@@ -110,13 +110,32 @@ class SP_Player extends SP_Custom_Post {
110
  * @return array
111
  */
112
  public function data( $league_id, $admin = false, $section = -1 ) {
113
-
114
- $seasons = (array)get_the_terms( $this->ID, 'sp_season' );
 
 
 
 
 
 
 
 
 
 
 
 
115
  $metrics = (array)get_post_meta( $this->ID, 'sp_metrics', true );
116
  $stats = (array)get_post_meta( $this->ID, 'sp_statistics', true );
117
  $leagues = sp_array_value( (array)get_post_meta( $this->ID, 'sp_leagues', true ), $league_id, array() );
118
- $abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
119
  $manual_columns = 'manual' == get_option( 'sportspress_player_columns', 'auto' ) ? true : false;
 
 
 
 
 
 
 
 
120
 
121
  // Get performance labels
122
  $args = array(
@@ -237,8 +256,11 @@ class SP_Player extends SP_Custom_Post {
237
 
238
  $data = array();
239
 
 
 
 
240
  // Get all seasons populated with data where available
241
- $data = sp_array_combine( $div_ids, sp_array_value( $stats, $league_id, array() ) );
242
 
243
  // Get equations from statistic variables
244
  $equations = sp_get_var_equations( 'sp_statistic' );
@@ -321,7 +343,7 @@ class SP_Player extends SP_Custom_Post {
321
  );
322
  endif;
323
 
324
- $args = apply_filters( 'sportspress_player_data_event_args', $args );
325
 
326
  $events = get_posts( $args );
327
 
@@ -506,7 +528,7 @@ class SP_Player extends SP_Custom_Post {
506
  if ( $outcomes ):
507
  $outcome = reset( $outcomes );
508
  $abbreviation = sp_get_abbreviation( $outcome->ID );
509
- if ( empty( $abbreviation ) ) $abbreviation = strtoupper( substr( $outcome->post_title, 0, 1 ) );
510
  $totals['streak'] = $abbreviation . $streak['count'];
511
  endif;
512
 
@@ -578,10 +600,10 @@ class SP_Player extends SP_Custom_Post {
578
  if ( -1 == $team_id )
579
  continue;
580
 
581
- $season_name = sp_array_value( $season_names, $season_id, '&nbsp;' );
582
 
583
  if ( $team_id ):
584
- $team_name = sp_get_team_name( $team_id, $abbreviate_teams );
585
 
586
  if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false ):
587
  $team_permalink = get_permalink( $team_id );
5
  * The SportsPress player class handles individual player data.
6
  *
7
  * @class SP_Player
8
+ * @version 2.6
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
110
  * @return array
111
  */
112
  public function data( $league_id, $admin = false, $section = -1 ) {
113
+ $args = array(
114
+ 'meta_query' => array(
115
+ 'relation' => 'OR',
116
+ array(
117
+ 'key' => 'sp_order',
118
+ 'compare' => 'NOT EXISTS',
119
+ ),
120
+ array(
121
+ 'key' => 'sp_order',
122
+ 'compare' => 'EXISTS',
123
+ ),
124
+ ),
125
+ );
126
+ $seasons = (array)get_the_terms( $this->ID, 'sp_season', $args );
127
  $metrics = (array)get_post_meta( $this->ID, 'sp_metrics', true );
128
  $stats = (array)get_post_meta( $this->ID, 'sp_statistics', true );
129
  $leagues = sp_array_value( (array)get_post_meta( $this->ID, 'sp_leagues', true ), $league_id, array() );
 
130
  $manual_columns = 'manual' == get_option( 'sportspress_player_columns', 'auto' ) ? true : false;
131
+
132
+ $season_ids = wp_list_pluck( $seasons, 'term_id' );
133
+ $season_order = array_flip( $season_ids );
134
+ foreach ( $season_order as $season_id => $val ) {
135
+ $season_order[ $season_id ] = null;
136
+ }
137
+
138
+ $leagues = array_replace( $season_order, $leagues );
139
 
140
  // Get performance labels
141
  $args = array(
256
 
257
  $data = array();
258
 
259
+ $league_stats = sp_array_value( $stats, $league_id, array() );
260
+ $div_ids = apply_filters( 'sportspress_player_data_season_ids', $div_ids, $league_stats );
261
+
262
  // Get all seasons populated with data where available
263
+ $data = sp_array_combine( $div_ids, $league_stats, true );
264
 
265
  // Get equations from statistic variables
266
  $equations = sp_get_var_equations( 'sp_statistic' );
343
  );
344
  endif;
345
 
346
+ $args = apply_filters( 'sportspress_player_data_event_args', $args, $data, $div_id );
347
 
348
  $events = get_posts( $args );
349
 
528
  if ( $outcomes ):
529
  $outcome = reset( $outcomes );
530
  $abbreviation = sp_get_abbreviation( $outcome->ID );
531
+ if ( empty( $abbreviation ) ) $abbreviation = mb_strtoupper( mb_substr( $outcome->post_title, 0, 1 ) );
532
  $totals['streak'] = $abbreviation . $streak['count'];
533
  endif;
534
 
600
  if ( -1 == $team_id )
601
  continue;
602
 
603
+ $season_name = sp_array_value( $season_names, (int) $season_id, '&nbsp;' );
604
 
605
  if ( $team_id ):
606
+ $team_name = sp_team_short_name( $team_id );
607
 
608
  if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false ):
609
  $team_permalink = get_permalink( $team_id );
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.5.5
13
  * @package SportsPress/Classes
14
  * @category Class
15
  * @author ThemeBoy
@@ -342,7 +342,7 @@ class SP_Post_types {
342
  )
343
  )
344
  );
345
-
346
  register_post_type( 'sp_performance',
347
  apply_filters( 'sportspress_register_post_type_performance',
348
  array(
9
  * Registers post types and taxonomies
10
  *
11
  * @class SP_Post_types
12
+ * @version 2.6
13
  * @package SportsPress/Classes
14
  * @category Class
15
  * @author ThemeBoy
342
  )
343
  )
344
  );
345
+
346
  register_post_type( 'sp_performance',
347
  apply_filters( 'sportspress_register_post_type_performance',
348
  array(
includes/class-sp-team.php CHANGED
@@ -5,7 +5,7 @@
5
  * The SportsPress team class handles individual team data.
6
  *
7
  * @class SP_Team
8
- * @version 2.2.4
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
@@ -323,7 +323,7 @@ class SP_Team extends SP_Custom_Post {
323
  $outcome = reset( $outcomes );
324
  $abbreviation = get_post_meta( $outcome->ID, 'sp_abbreviation', true );
325
  if ( ! $abbreviation )
326
- $abbreviation = substr( $outcome->post_title, 0, 1 );
327
  $totals['streak'] = $abbreviation . $streak['count'];
328
  endif;
329
 
5
  * The SportsPress team class handles individual team data.
6
  *
7
  * @class SP_Team
8
+ * @version 2.6
9
  * @package SportsPress/Classes
10
  * @category Class
11
  * @author ThemeBoy
323
  $outcome = reset( $outcomes );
324
  $abbreviation = get_post_meta( $outcome->ID, 'sp_abbreviation', true );
325
  if ( ! $abbreviation )
326
+ $abbreviation = mb_substr( $outcome->post_title, 0, 1 );
327
  $totals['streak'] = $abbreviation . $streak['count'];
328
  endif;
329
 
includes/sp-api-functions.php CHANGED
@@ -7,7 +7,7 @@
7
  * @author ThemeBoy
8
  * @category Core
9
  * @package SportsPress/Functions
10
- * @version 2.5.5
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -137,6 +137,15 @@ function sp_the_main_results_or_time( $post = 0, $delimiter = '-' ) {
137
  echo implode( $delimiter, sp_get_main_results_or_time( $post ) );
138
  }
139
 
 
 
 
 
 
 
 
 
 
140
  function sp_get_outcome( $post = 0 ) {
141
  $event = new SP_Event( $post );
142
  return $event->outcome( true );
@@ -274,10 +283,6 @@ function sp_is_home_venue( $post = 0, $event = 0 ) {
274
  }
275
  }
276
 
277
- function sp_the_abbreviation( $post = 0 ) {
278
- echo sp_get_abbreviation( $post );
279
- }
280
-
281
  function sp_the_logo( $post = 0, $size = 'icon', $attr = array() ) {
282
  echo sp_get_logo( $post, $size, $attr );
283
  }
@@ -286,22 +291,37 @@ function sp_team_logo( $post = 0 ) {
286
  sp_get_template( 'team-logo.php', array( 'id' => $post ) );
287
  }
288
 
289
- function sp_get_short_name( $post = 0 ) {
290
- $abbreviation = sp_get_abbreviation( $post, 'sp_abbreviation', true );
291
  if ( $abbreviation ) {
292
  return $abbreviation;
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  } else {
294
  return get_the_title( $post );
295
  }
296
  }
297
 
298
- function sp_short_name( $post = 0 ) {
299
- echo sp_get_short_name( $post );
300
  }
301
 
302
- function sp_get_team_name( $post = 0, $short = true ) {
303
- if ( $short ) {
304
- return sp_get_short_name( $post );
 
 
305
  } else {
306
  return get_the_title( $post );
307
  }
7
  * @author ThemeBoy
8
  * @category Core
9
  * @package SportsPress/Functions
10
+ * @version 2.6
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
137
  echo implode( $delimiter, sp_get_main_results_or_time( $post ) );
138
  }
139
 
140
+ function sp_get_main_results_or_date( $post = 0, $format = null ) {
141
+ $results = sp_get_main_results( $post );
142
+ if ( sizeof( $results ) ) {
143
+ return $results;
144
+ } else {
145
+ return array( sp_get_date( $post, $format ) );
146
+ }
147
+ }
148
+
149
  function sp_get_outcome( $post = 0 ) {
150
  $event = new SP_Event( $post );
151
  return $event->outcome( true );
283
  }
284
  }
285
 
 
 
 
 
286
  function sp_the_logo( $post = 0, $size = 'icon', $attr = array() ) {
287
  echo sp_get_logo( $post, $size, $attr );
288
  }
291
  sp_get_template( 'team-logo.php', array( 'id' => $post ) );
292
  }
293
 
294
+ function sp_team_abbreviation( $post = 0, $forced = false ) {
295
+ $abbreviation = get_post_meta( $post, 'sp_abbreviation', true );
296
  if ( $abbreviation ) {
297
  return $abbreviation;
298
+ } else {
299
+ return $forced ? mb_substr( mb_strtoupper( sp_team_short_name( $post ) ), 0, 3 ) : sp_team_short_name( $post );
300
+ }
301
+ }
302
+
303
+ function sp_the_abbreviation( $post = 0, $forced = false ) {
304
+ echo sp_team_abbreviation( $post, $forced );
305
+ }
306
+
307
+ function sp_team_short_name( $post = 0 ) {
308
+ $short_name = get_post_meta( $post, 'sp_short_name', true );
309
+ if ( $short_name ) {
310
+ return $short_name;
311
  } else {
312
  return get_the_title( $post );
313
  }
314
  }
315
 
316
+ function sp_the_short_name( $post = 0 ) {
317
+ echo sp_team_short_name( $post );
318
  }
319
 
320
+ function sp_team_name( $post = 0, $length = 'full' ) {
321
+ if ( 'abbreviation' == $length ) {
322
+ return sp_team_abbreviation( $post );
323
+ } elseif ( 'short' == $length ) {
324
+ return sp_team_short_name( $post );
325
  } else {
326
  return get_the_title( $post );
327
  }
includes/sp-core-functions.php CHANGED
@@ -7,7 +7,7 @@
7
  * @author ThemeBoy
8
  * @category Core
9
  * @package SportsPress/Functions
10
- * @version 2.5.5
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -418,7 +418,7 @@ if ( !function_exists( 'sp_get_post_abbreviation' ) ) {
418
  if ( $abbreviation ):
419
  return $abbreviation;
420
  else:
421
- return substr( get_the_title( $post_id ), 0, 1 );
422
  endif;
423
  }
424
  }
@@ -1290,8 +1290,11 @@ if ( !function_exists( 'sp_get_eos_safe_slug' ) ) {
1290
  }
1291
 
1292
  if ( !function_exists( 'sp_solve' ) ) {
1293
- function sp_solve( $equation, $vars, $precision = 0, $default = 0 ) {
1294
 
 
 
 
1295
  if ( $equation == null )
1296
  return $default;
1297
 
@@ -1344,6 +1347,10 @@ if ( !function_exists( 'sp_solve' ) ) {
1344
 
1345
  endif;
1346
 
 
 
 
 
1347
  // Remove unnecessary variables from vars before calculating
1348
  unset( $vars['gamesback'] );
1349
  unset( $vars['streak'] );
7
  * @author ThemeBoy
8
  * @category Core
9
  * @package SportsPress/Functions
10
+ * @version 2.6
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
418
  if ( $abbreviation ):
419
  return $abbreviation;
420
  else:
421
+ return mb_substr( get_the_title( $post_id ), 0, 1 );
422
  endif;
423
  }
424
  }
1290
  }
1291
 
1292
  if ( !function_exists( 'sp_solve' ) ) {
1293
+ function sp_solve( $equation, $vars, $precision = 0, $default = 0, $post_id = 0 ) {
1294
 
1295
+ // Add a hook to alter $equation
1296
+ $equation = apply_filters( 'sportspress_equation_alter', $equation, $vars, $precision, $default );
1297
+
1298
  if ( $equation == null )
1299
  return $default;
1300
 
1347
 
1348
  endif;
1349
 
1350
+ if ( $solution = apply_filters( 'sportspress_equation_solve_for_presets', null, $equation, $post_id ) ):
1351
+ return $solution;
1352
+ endif;
1353
+
1354
  // Remove unnecessary variables from vars before calculating
1355
  unset( $vars['gamesback'] );
1356
  unset( $vars['streak'] );
includes/sp-deprecated-functions.php CHANGED
@@ -7,7 +7,7 @@
7
  * @author ThemeBoy
8
  * @category Core
9
  * @package ThemeBoy/Functions
10
- * @version 1.6.1
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -203,3 +203,30 @@ if ( !function_exists( 'sp_get_player_list_data' ) ) {
203
  return $list->data( $admin );
204
  }
205
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  * @author ThemeBoy
8
  * @category Core
9
  * @package ThemeBoy/Functions
10
+ * @version 2.6
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
203
  return $list->data( $admin );
204
  }
205
  }
206
+
207
+ if ( !function_exists( 'sp_get_short_name' ) ) {
208
+ function sp_get_short_name( $post = 0 ) {
209
+ $abbreviation = sp_get_abbreviation( $post, 'sp_abbreviation', true );
210
+ if ( $abbreviation ) {
211
+ return $abbreviation;
212
+ } else {
213
+ return get_the_title( $post );
214
+ }
215
+ }
216
+ }
217
+
218
+ if ( !function_exists( 'sp_short_name' ) ) {
219
+ function sp_short_name( $post = 0 ) {
220
+ echo sp_get_short_name( $post );
221
+ }
222
+ }
223
+
224
+ if ( !function_exists( 'sp_get_team_name' ) ) {
225
+ function sp_get_team_name( $post = 0, $short = true ) {
226
+ if ( $short ) {
227
+ return sp_team_abbreviation( $post );
228
+ } else {
229
+ return get_the_title( $post );
230
+ }
231
+ }
232
+ }
includes/sp-template-hooks.php CHANGED
@@ -7,7 +7,7 @@
7
  * @author ThemeBoy
8
  * @category Core
9
  * @package SportsPress/Functions
10
- * @version 2.5.10
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -141,6 +141,10 @@ function sportspress_strcmp_term_slug( $a, $b ) {
141
 
142
  function sportspress_term_order( $terms, $post_id, $taxonomy ) {
143
 
 
 
 
 
144
  if ( is_sp_taxonomy( $taxonomy ) ) {
145
  uasort( $terms, 'sportspress_strcmp_term_slug' );
146
  }
@@ -253,7 +257,7 @@ function sportspress_post_updated_messages( $messages ) {
253
 
254
  global $typenow, $post;
255
 
256
- if ( in_array( $typenow, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_metric', 'sp_performance' ) ) ):
257
  $obj = get_post_type_object( $typenow );
258
 
259
  for ( $i = 0; $i <= 10; $i++ ):
@@ -309,4 +313,4 @@ function sportspress_remove_page_parent_class( $classes, $item ) {
309
  return $classes;
310
  }
311
 
312
- add_filter( 'nav_menu_css_class', 'sportspress_remove_page_parent_class', 10, 2 );
7
  * @author ThemeBoy
8
  * @category Core
9
  * @package SportsPress/Functions
10
+ * @version 2.6
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
141
 
142
  function sportspress_term_order( $terms, $post_id, $taxonomy ) {
143
 
144
+ if ( ! is_array( $terms ) ) {
145
+ return array();
146
+ }
147
+
148
  if ( is_sp_taxonomy( $taxonomy ) ) {
149
  uasort( $terms, 'sportspress_strcmp_term_slug' );
150
  }
257
 
258
  global $typenow, $post;
259
 
260
+ if ( in_array( $typenow, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_metric', 'sp_spec', 'sp_performance' ) ) ):
261
  $obj = get_post_type_object( $typenow );
262
 
263
  for ( $i = 0; $i <= 10; $i++ ):
313
  return $classes;
314
  }
315
 
316
+ add_filter( 'nav_menu_css_class', 'sportspress_remove_page_parent_class', 10, 2 );
modules/sportspress-conditional-equations.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: SportsPress Conditional Equations
4
+ Plugin URI: http://themeboy.com/
5
+ Description: Add conditional equations to SportsPress.
6
+ Author: ThemeBoy
7
+ Author URI: http://themeboy.com/
8
+ Version: 2.6
9
+ */
10
+
11
+ // Exit if accessed directly
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ if ( ! class_exists( 'SportsPress_Conditional_Equations' ) ) :
15
+
16
+ /**
17
+ * Main SportsPress Conditional Equations Class
18
+ *
19
+ * @class SportsPress_Conditional_Equations
20
+ * @version 2.6
21
+ */
22
+
23
+ class SportsPress_Conditional_Equations {
24
+
25
+ /**
26
+ * Constructor
27
+ */
28
+ public function __construct() {
29
+ // Define constants
30
+ $this->define_constants();
31
+
32
+ // Actions
33
+
34
+ // Filters
35
+ add_filter( 'sportspress_equation_options', array( $this, 'add_options' ) );
36
+ add_filter( 'sportspress_equation_alter', array( $this, 'alter_equation' ), 10, 2 );
37
+
38
+ }
39
+
40
+ /**
41
+ * Define constants.
42
+ */
43
+ private function define_constants() {
44
+ if ( !defined( 'SP_CONDITIONAL_EQUATIONS_VERSION' ) )
45
+ define( 'SP_CONDITIONAL_EQUATIONS_VERSION', '2.6' );
46
+
47
+ if ( !defined( 'SP_CONDITIONAL_EQUATIONS_URL' ) )
48
+ define( 'SP_CONDITIONAL_EQUATIONS_URL', plugin_dir_url( __FILE__ ) );
49
+
50
+ if ( !defined( 'SP_CONDITIONAL_EQUATIONS_DIR' ) )
51
+ define( 'SP_CONDITIONAL_EQUATIONS_DIR', plugin_dir_path( __FILE__ ) );
52
+ }
53
+
54
+ /**
55
+ * Add additional options.
56
+ *
57
+ * @return array
58
+ */
59
+ public function add_options( $options ) {
60
+ $options[ 'Operators' ]['>'] = '&gt;';
61
+ $options[ 'Operators' ]['<'] = '&lt;';
62
+ $options[ 'Operators' ]['=='] = '&equiv;';
63
+ $options[ 'Operators' ]['!='] = '&ne;';
64
+ $options[ 'Operators' ]['>='] = '&ge;';
65
+ $options[ 'Operators' ]['<='] = '&le;';
66
+ return $options;
67
+ }
68
+
69
+ /**
70
+ * Alter.
71
+ *
72
+ * @return array
73
+ */
74
+ public function alter_equation( $equation, $vars ) {
75
+
76
+ // Remove space between equation parts
77
+ $equation = str_replace( ' ', '', $equation );
78
+
79
+ // Find all parentheses with conditional operators
80
+ $re = '/([^[\(|\)]*[<=>][^[\(|\)]*)/';
81
+ if ( preg_match_all( $re, $equation, $matches ) ) {
82
+
83
+ foreach ( $matches[1] as $match ) {
84
+
85
+ // Find which Conditional Operator is used
86
+ preg_match ( '/[\!\>\=\<]+/' ,$match, $conop );
87
+ $conop = $conop[0];
88
+
89
+ //preg_match ( '/.+?(?=[\>\=\<])/' ,$match, $leftvar );
90
+ preg_match ( '/.+?(?='.$conop.')/' ,$match, $leftvar );
91
+
92
+ //preg_match ( '/(?<=[\>\=\<]).*/' ,$match, $rightvar );
93
+ preg_match ( '/(?<='.$conop.').*/' ,$match, $rightvar );
94
+
95
+ // Check if it is a variable or a number
96
+ if ( strpos ( $leftvar[0], '$' ) !== FALSE ) {
97
+ $leftvar = str_replace ( '$', '', $leftvar[0] );
98
+ $leftvar = $vars[$leftvar];
99
+ } else {
100
+ $leftvar = $leftvar[0];
101
+ }
102
+
103
+ // Check if it is a variable or a number
104
+ if ( strpos ( $rightvar[0], '$' ) !== FALSE ) {
105
+ $rightvar = str_replace ( '$', '', $rightvar[0] );
106
+ $rightvar = $vars[$rightvar];
107
+ } else {
108
+ $rightvar = $rightvar[0];
109
+ }
110
+
111
+ // Select the correct conditional operator
112
+ switch ( $conop ) {
113
+ case '>':
114
+ $solution = (int) ( $leftvar > $rightvar );
115
+ break;
116
+ case '<':
117
+ $solution = (int) ( $leftvar < $rightvar );
118
+ break;
119
+ case '==':
120
+ $solution = (int) ( $leftvar == $rightvar );
121
+ break;
122
+ case '!=':
123
+ $solution = (int) ( $leftvar != $rightvar );
124
+ break;
125
+ case '>=':
126
+ $solution = (int) ( $leftvar >= $rightvar );
127
+ break;
128
+ case '<=':
129
+ $solution = (int) ( $leftvar <= $rightvar );
130
+ break;
131
+ }
132
+
133
+ // Replace the result of the conditional sub-equation to the equation
134
+ $equation = str_replace ( $match, $solution, $equation );
135
+ }
136
+
137
+ }
138
+ return $equation;
139
+ }
140
+
141
+ }
142
+
143
+ endif;
144
+
145
+ new SportsPress_Conditional_Equations();
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.0
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.0
21
  */
22
  class SportsPress_Countdowns {
23
 
@@ -41,7 +41,7 @@ class SportsPress_Countdowns {
41
  */
42
  private function define_constants() {
43
  if ( !defined( 'SP_COUNTDOWNS_VERSION' ) )
44
- define( 'SP_COUNTDOWNS_VERSION', '2.0' );
45
 
46
  if ( !defined( 'SP_COUNTDOWNS_URL' ) )
47
  define( 'SP_COUNTDOWNS_URL', plugin_dir_url( __FILE__ ) );
@@ -82,11 +82,19 @@ class SportsPress_Countdowns {
82
 
83
  apply_filters( 'sportspress_countdown_options', array(
84
  array(
85
- 'title' => __( 'Teams', 'sportspress' ),
86
- 'desc' => __( 'Display logos', 'sportspress' ),
87
  'id' => 'sportspress_countdown_show_logos',
88
  'default' => 'no',
89
  'type' => 'checkbox',
 
 
 
 
 
 
 
 
90
  ),
91
  )),
92
 
5
  Description: Add countdown widgets to SportsPress.
6
  Author: ThemeBoy
7
  Author URI: http://themeboy.com/
8
+ Version: 2.6
9
  */
10
 
11
  // Exit if accessed directly
17
  * Main SportsPress Countdowns Class
18
  *
19
  * @class SportsPress_Countdowns
20
+ * @version 2.6
21
  */
22
  class SportsPress_Countdowns {
23
 
41
  */
42
  private function define_constants() {
43
  if ( !defined( 'SP_COUNTDOWNS_VERSION' ) )
44
+ define( 'SP_COUNTDOWNS_VERSION', '2.6' );
45
 
46
  if ( !defined( 'SP_COUNTDOWNS_URL' ) )
47
  define( 'SP_COUNTDOWNS_URL', plugin_dir_url( __FILE__ ) );
82
 
83
  apply_filters( 'sportspress_countdown_options', array(
84
  array(
85
+ 'title' => __( 'Display', 'sportspress' ),
86
+ 'desc' => __( 'Logos', 'sportspress' ),
87
  'id' => 'sportspress_countdown_show_logos',
88
  'default' => 'no',
89
  'type' => 'checkbox',
90
+ 'checkboxgroup' => 'start',
91
+ ),
92
+ array(
93
+ 'desc' => __( 'Featured Image', 'sportspress' ),
94
+ 'id' => 'sportspress_countdown_show_thumbnail',
95
+ 'default' => 'no',
96
+ 'type' => 'checkbox',
97
+ 'checkboxgroup' => 'end',
98
  ),
99
  )),
100
 
modules/sportspress-event-specs.php ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: SportsPress Event Specs
4
+ Plugin URI: http://themeboy.com/
5
+ Description: Add event specs/stats to SportsPress.
6
+ Author: ThemeBoy
7
+ Author URI: http://themeboy.com/
8
+ Version: 2.6
9
+ */
10
+
11
+ // Exit if accessed directly
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ if ( ! class_exists( 'SportsPress_Event_Specs' ) ) :
15
+
16
+ /**
17
+ * Main SportsPress Event Specs Class
18
+ *
19
+ * @class SportsPress_Event_Specs
20
+ * @version 2.6
21
+ */
22
+ class SportsPress_Event_Specs {
23
+
24
+ /**
25
+ * Constructor
26
+ */
27
+ public function __construct() {
28
+ // Define constants
29
+ $this->define_constants();
30
+
31
+ // Actions
32
+ add_action( 'init', array( $this, 'register_post_type' ) );
33
+ add_action( 'sportspress_config_page', array( $this, 'sp_specs_config' ), 9 );
34
+ add_action( 'sportspress_include_post_type_handlers', array( $this, 'include_post_type_handler' ) );
35
+ add_action( 'sportspress_event_list_head_row', array( $this, 'event_list_head_row' ), 11 );
36
+ add_action( 'sportspress_event_list_row', array( $this, 'event_list_row' ), 11, 2 );
37
+
38
+ // Filters
39
+ add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
40
+ add_filter( 'sportspress_screen_ids', array( $this, 'screen_ids' ) );
41
+ add_filter( 'sportspress_config_types', array( $this, 'add_post_type' ) );
42
+ add_filter( 'sportspress_event_details', array( $this, 'event_details' ), 10, 2 );
43
+ add_filter( 'sportspress_calendar_columns', array( $this, 'calendar_columns' ) );
44
+ }
45
+
46
+ /**
47
+ * Define constants.
48
+ */
49
+ private function define_constants() {
50
+ if ( !defined( 'SP_EVENT_SPECS_VERSION' ) )
51
+ define( 'SP_EVENT_SPECS_VERSION', '2.6' );
52
+
53
+ if ( !defined( 'SP_EVENT_SPECS_URL' ) )
54
+ define( 'SP_EVENT_SPECS_URL', plugin_dir_url( __FILE__ ) );
55
+
56
+ if ( !defined( 'SP_EVENT_SPECS_DIR' ) )
57
+ define( 'SP_EVENT_SPECS_DIR', plugin_dir_path( __FILE__ ) );
58
+ }
59
+
60
+ /**
61
+ * Register event specs post type
62
+ */
63
+ public static function register_post_type() {
64
+ register_post_type( 'sp_spec',
65
+ apply_filters( 'sportspress_register_post_type_spec',
66
+ array(
67
+ 'labels' => array(
68
+ 'name' => __( 'Event Specs', 'sportspress' ),
69
+ 'singular_name' => __( 'Event Spec', 'sportspress' ),
70
+ 'add_new_item' => __( 'Add New Event Spec', 'sportspress' ),
71
+ 'edit_item' => __( 'Edit Event Spec', 'sportspress' ),
72
+ 'new_item' => __( 'New', 'sportspress' ),
73
+ 'view_item' => __( 'View', 'sportspress' ),
74
+ 'search_items' => __( 'Search', 'sportspress' ),
75
+ 'not_found' => __( 'No results found.', 'sportspress' ),
76
+ 'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
77
+ ),
78
+ 'public' => false,
79
+ 'show_ui' => true,
80
+ 'capability_type' => 'sp_config',
81
+ 'map_meta_cap' => true,
82
+ 'publicly_queryable' => false,
83
+ 'exclude_from_search' => true,
84
+ 'hierarchical' => false,
85
+ 'supports' => array( 'title', 'page-attributes', 'excerpt' ),
86
+ 'has_archive' => false,
87
+ 'show_in_nav_menus' => false,
88
+ 'can_export' => false,
89
+ 'show_in_menu' => false,
90
+ )
91
+ )
92
+ );
93
+ }
94
+
95
+ /**
96
+ * Add screen ids.
97
+ *
98
+ * @return array
99
+ */
100
+ public function screen_ids( $ids ) {
101
+ return array_merge( $ids, array(
102
+ 'edit-sp_spec',
103
+ 'sp_spec',
104
+ ) );
105
+ }
106
+
107
+ public static function add_post_type( $post_types = array() ) {
108
+ $post_types[] = 'sp_spec';
109
+ return $post_types;
110
+ }
111
+
112
+ /**
113
+ * Conditonally load the class and functions only needed when viewing this post type.
114
+ */
115
+ public function include_post_type_handler() {
116
+ include_once( SP()->plugin_path() . '/includes/admin/post-types/class-sp-admin-cpt-spec.php' );
117
+ }
118
+
119
+ /**
120
+ * Display Event Specs Table at Config Page
121
+ * @return null
122
+ */
123
+ public function sp_specs_config() {
124
+ ?>
125
+ <table class="form-table">
126
+ <tbody>
127
+ <?php
128
+ $args = array(
129
+ 'post_type' => 'sp_spec',
130
+ 'numberposts' => -1,
131
+ 'posts_per_page' => -1,
132
+ 'orderby' => 'menu_order',
133
+ 'order' => 'ASC'
134
+ );
135
+ $data = get_posts( $args );
136
+ ?>
137
+ <tr valign="top">
138
+ <th scope="row" class="titledesc">
139
+ <?php _e( 'Event Specs', 'sportspress' ) ?>
140
+ <p class="description"><?php _e( 'Add more details to an event.', 'sportspress' ); ?></p>
141
+ </th>
142
+ <td class="forminp">
143
+ <table class="widefat sp-admin-config-table">
144
+ <thead>
145
+ <tr>
146
+ <th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
147
+ <th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
148
+ <th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
149
+ <th scope="col" class="edit"></th>
150
+ </tr>
151
+ </thead>
152
+ <?php if ( $data ): $i = 0; foreach ( $data as $row ): ?>
153
+ <tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
154
+ <td class="row-title"><?php echo $row->post_title; ?></td>
155
+ <td><code><?php echo $row->post_name; ?></code></td>
156
+ <td><p class="description"><?php echo $row->post_excerpt; ?></p></td>
157
+ <td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
158
+ </tr>
159
+ <?php $i++; endforeach; else: ?>
160
+ <tr class="alternate">
161
+ <td colspan="4"><?php _e( 'No results found.', 'sportspress' ); ?></td>
162
+ </tr>
163
+ <?php endif; ?>
164
+ </table>
165
+ <div class="tablenav bottom">
166
+ <a class="button alignleft" href="<?php echo admin_url( 'edit.php?post_type=sp_spec' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
167
+ <a class="button button-primary alignright" href="<?php echo admin_url( 'post-new.php?post_type=sp_spec' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
168
+ <br class="clear">
169
+ </div>
170
+ </td>
171
+ </tr>
172
+ </tbody>
173
+ </table>
174
+ <?php
175
+ }
176
+
177
+ /**
178
+ * Add meta boxes.
179
+ *
180
+ * @return array
181
+ */
182
+ public function add_meta_boxes( $meta_boxes ) {
183
+ $meta_boxes['sp_spec'] = array(
184
+ 'details' => array(
185
+ 'title' => __( 'Specs', 'sportspress' ),
186
+ 'save' => 'SP_Meta_Box_Spec_Details::save',
187
+ 'output' => 'SP_Meta_Box_Spec_Details::output',
188
+ 'context' => 'normal',
189
+ 'priority' => 'high',
190
+ ),
191
+ );
192
+ $meta_boxes['sp_event']['specs'] = array(
193
+ 'title' => __( 'Specs', 'sportspress' ),
194
+ 'save' => 'SP_Meta_Box_Event_Specs::save',
195
+ 'output' => 'SP_Meta_Box_Event_Specs::output',
196
+ 'context' => 'side',
197
+ 'priority' => 'default',
198
+ );
199
+ return $meta_boxes;
200
+ }
201
+
202
+ /**
203
+ * Add event details.
204
+ *
205
+ * @return array
206
+ */
207
+ public function event_details ( $data, $id ) {
208
+
209
+ $event = new SP_Event( $id );
210
+
211
+ $specs_before = $event->specs( true );
212
+ $specs_after = $event->specs( false );
213
+
214
+ $data = array_merge( $specs_before, $data, $specs_after );
215
+
216
+ return $data;
217
+ }
218
+
219
+ /**
220
+ * Add calendar columns.
221
+ *
222
+ * @return array
223
+ */
224
+ public function calendar_columns( $columns = array() ) {
225
+ $columns['event_specs'] = __( 'Event Specs', 'sportspress' );
226
+ return $columns;
227
+ }
228
+
229
+ /**
230
+ * Event list head row.
231
+ */
232
+ public function event_list_head_row( $usecolumns = array() ) {
233
+ if ( is_array( $usecolumns ) && in_array( 'event_specs', $usecolumns ) ) {
234
+ $spec_labels = (array)sp_get_var_labels( 'sp_spec', null, false );
235
+
236
+ if ( empty( $spec_labels ) ) return;
237
+
238
+ foreach ( $spec_labels as $spec_label ) {
239
+ ?>
240
+ <th class="data-specs">
241
+ <?php echo $spec_label; ?>
242
+ </th>
243
+ <?php
244
+ }
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Event list row.
250
+ */
251
+ public function event_list_row( $event, $usecolumns = array() ) {
252
+ if ( is_array( $usecolumns ) && in_array( 'event_specs', $usecolumns ) ) {
253
+ $event = new SP_Event( $event );
254
+ $specs = $event->specs( false );
255
+ $spec_labels = (array)sp_get_var_labels( 'sp_spec', null, false );
256
+
257
+ foreach ( $spec_labels as $spec_label ) {
258
+ ?>
259
+ <td class="data-spec">
260
+ <?php if ( isset( $specs[$spec_label] ) ) {
261
+ echo $specs[$spec_label];
262
+ }else{
263
+ echo '-';
264
+ }?>
265
+ </td>
266
+ <?php
267
+ }
268
+ }
269
+ }
270
+ }
271
+
272
+ endif;
273
+
274
+ new SportsPress_Event_Specs();
modules/sportspress-next-team-preset.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: SportsPress Next Team Preset
4
+ Plugin URI: http://themeboy.com/
5
+ Description: Add a Next preset to SportsPress league table column equations.
6
+ Author: ThemeBoy
7
+ Author URI: http://themeboy.com/
8
+ Version: 2.6
9
+ */
10
+
11
+ // Exit if accessed directly
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ if ( ! class_exists( 'SportsPress_Next_Team_Preset' ) ) :
15
+
16
+ /**
17
+ * Main SportsPress Next Team Preset Class
18
+ *
19
+ * @class SportsPress_Next_Team_Preset
20
+ * @version 2.6
21
+ */
22
+
23
+ class SportsPress_Next_Team_Preset {
24
+
25
+ /** @var bool The link events setting. */
26
+ public $link_events = true;
27
+
28
+ /**
29
+ * Constructor
30
+ */
31
+ public function __construct() {
32
+ // Define constants
33
+ $this->define_constants();
34
+
35
+ $this->link_events = get_option( 'sportspress_link_events', 'yes' ) === 'yes' ? true : false;
36
+
37
+ // Filters
38
+ add_filter( 'sportspress_equation_options', array( $this, 'add_options' ) );
39
+ add_filter( 'sportspress_equation_presets', array( $this, 'presets' ) );
40
+ add_filter( 'sportspress_equation_solve_for_presets', array( $this, 'solve' ), 10, 3 );
41
+
42
+ }
43
+
44
+ /**
45
+ * Define constants.
46
+ */
47
+ private function define_constants() {
48
+ if ( !defined( 'SP_NEXT_TEAM_PRESET_VERSION' ) )
49
+ define( 'SP_NEXT_TEAM_PRESET_VERSION', '2.6' );
50
+
51
+ if ( !defined( 'SP_NEXT_TEAM_PRESET_URL' ) )
52
+ define( 'SP_NEXT_TEAM_PRESET_URL', plugin_dir_url( __FILE__ ) );
53
+
54
+ if ( !defined( 'SP_NEXT_TEAM_PRESET_DIR' ) )
55
+ define( 'SP_NEXT_TEAM_PRESET_DIR', plugin_dir_path( __FILE__ ) );
56
+ }
57
+
58
+ /**
59
+ * Add additional options.
60
+ *
61
+ * @return array
62
+ */
63
+ public function add_options( $options ) {
64
+ $options[ 'Presets' ]['$nextteam'] = __( 'Next Team', 'sportspress' );
65
+ return $options;
66
+ }
67
+
68
+ /**
69
+ * Add preset
70
+ *
71
+ * @return array
72
+ */
73
+ public function presets( $presets ) {
74
+ $presets[] = '$nextteam';
75
+ return $presets;
76
+ }
77
+
78
+ /**
79
+ * Solve preset
80
+ *
81
+ * @return mixed
82
+ */
83
+ public function solve( $input, $equation, $post_id ) {
84
+ if ( strpos( $equation, '$nextteam' ) !== false ) {
85
+ $args = array(
86
+ 'post_type' => 'sp_event',
87
+ 'numberposts' => 1,
88
+ 'posts_per_page' => 1,
89
+ 'post_status' => 'future',
90
+ 'meta_query' => array(
91
+ array(
92
+ 'key' => 'sp_team',
93
+ 'value' => $post_id,
94
+ 'compare' => 'IN',
95
+ ),
96
+ ),
97
+ );
98
+ $events = get_posts( $args );
99
+
100
+ if ( $events ) {
101
+ $event = reset( $events );
102
+ $teams = array_filter( (array) get_post_meta( $event->ID, 'sp_team', false ) );
103
+ if ( ( $key = array_search( $post_id, $teams ) ) !== false ) {
104
+ unset( $teams[ $key ] );
105
+ } else {
106
+ return '-';
107
+ }
108
+
109
+ $team_id = reset( $teams );
110
+
111
+ if ( ! $team_id ) return '-';
112
+
113
+ if ( has_post_thumbnail( $team_id ) ) {
114
+ $logo = get_the_post_thumbnail( $team_id, 'sportspress-fit-icon' );
115
+ $icon = '<span class="team-logo">' . $logo . '</span>';
116
+ } else {
117
+ $icon = sp_team_abbreviation( $team_id, true );
118
+ }
119
+
120
+ if ( $this->link_events ) {
121
+ return '<a title="' . $event->post_title . '" href="' . get_post_permalink( $event->ID, false, true ) . '">' . $icon . '</a>';
122
+ } else {
123
+ return '<span title="' . $event->post_title . '">' . $icon . '</a>';
124
+ }
125
+ } else {
126
+ return '-';
127
+ }
128
+ } else {
129
+ return $input;
130
+ }
131
+ }
132
+ }
133
+
134
+ endif;
135
+
136
+ new SportsPress_Next_Team_Preset();
modules/sportspress-officials.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
5
  Description: Add officials to SportsPress.
6
  Author: ThemeBoy
7
  Author URI: http://themeboy.com/
8
- Version: 2.5.1
9
  */
10
 
11
  // Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Officials' ) ) :
17
  * Main SportsPress Officials Class
18
  *
19
  * @class SportsPress_Officials
20
- * @version 2.5.1
21
  */
22
  class SportsPress_Officials {
23
 
@@ -66,7 +66,7 @@ class SportsPress_Officials {
66
  */
67
  private function define_constants() {
68
  if ( !defined( 'SP_OFFICIALS_VERSION' ) )
69
- define( 'SP_OFFICIALS_VERSION', '2.5.1' );
70
 
71
  if ( !defined( 'SP_OFFICIALS_URL' ) )
72
  define( 'SP_OFFICIALS_URL', plugin_dir_url( __FILE__ ) );
@@ -541,9 +541,11 @@ class SportsPress_Officials {
541
 
542
  if ( function_exists( 'get_term_meta' ) ) $new_columns['sp_order'] = __( 'Order', 'sportspress' );
543
 
 
544
  $new_columns['posts'] = $columns['posts'];
545
 
546
  unset( $columns['posts'] );
 
547
 
548
  return array_merge( $columns, $new_columns );
549
  }
5
  Description: Add officials to SportsPress.
6
  Author: ThemeBoy
7
  Author URI: http://themeboy.com/
8
+ Version: 2.6
9
  */
10
 
11
  // Exit if accessed directly
17
  * Main SportsPress Officials Class
18
  *
19
  * @class SportsPress_Officials
20
+ * @version 2.6
21
  */
22
  class SportsPress_Officials {
23
 
66
  */
67
  private function define_constants() {
68
  if ( !defined( 'SP_OFFICIALS_VERSION' ) )
69
+ define( 'SP_OFFICIALS_VERSION', '2.6' );
70
 
71
  if ( !defined( 'SP_OFFICIALS_URL' ) )
72
  define( 'SP_OFFICIALS_URL', plugin_dir_url( __FILE__ ) );
541
 
542
  if ( function_exists( 'get_term_meta' ) ) $new_columns['sp_order'] = __( 'Order', 'sportspress' );
543
 
544
+ if ( array_key_exists('posts', $columns) ) {
545
  $new_columns['posts'] = $columns['posts'];
546
 
547
  unset( $columns['posts'] );
548
+ }
549
 
550
  return array_merge( $columns, $new_columns );
551
  }
modules/sportspress-player-assignments.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: SportsPress Player Assignments
4
+ Plugin URI: http://themeboy.com/
5
+ Description: Add player assignments support to SportsPress.
6
+ Author: Savvas
7
+ Author URI: http://themeboy.com/
8
+ Version: 2.6
9
+ */
10
+ // Exit if accessed directly
11
+ if ( ! defined( 'ABSPATH' ) ) exit;
12
+ if ( ! class_exists( 'SportsPress_Player_Assignments' ) ) :
13
+ /**
14
+ * Main SportsPress Player Assignments Class
15
+ *
16
+ * @class SportsPress_Player_Assignments
17
+ * @version 2.6
18
+ */
19
+ class SportsPress_Player_Assignments {
20
+ /**
21
+ * Constructor
22
+ */
23
+ public function __construct() {
24
+ // Define constants
25
+ $this->define_constants();
26
+
27
+ // Actions
28
+ add_action( 'sportspress_process_sp_player_meta', array( $this, 'save' ) );
29
+
30
+ // Filters
31
+ add_filter( 'sportspress_player_list_args', array( $this, 'add_args' ), 10 );
32
+ add_filter( 'sportspress_player_list_players', array( $this, 'add_players' ), 10, 3 );
33
+ }
34
+ /**
35
+ * Define constants.
36
+ */
37
+ private function define_constants() {
38
+ if ( !defined( 'SP_PLAYER_ASSIGNMENTS_VERSION' ) )
39
+ define( 'SP_PLAYER_ASSIGNMENTS_VERSION', '2.6' );
40
+ if ( !defined( 'SP_PLAYER_ASSIGNMENTS_URL' ) )
41
+ define( 'SP_PLAYER_ASSIGNMENTS_URL', plugin_dir_url( __FILE__ ) );
42
+ if ( !defined( 'SP_PLAYER_ASSIGNMENTS_DIR' ) )
43
+ define( 'SP_PLAYER_ASSIGNMENTS_DIR', plugin_dir_path( __FILE__ ) );
44
+ }
45
+
46
+ /**
47
+ * Save Additional Statistics
48
+ */
49
+ public function save( $post_id ) {
50
+ delete_post_meta( $post_id, 'sp_assignments' );
51
+
52
+ $leagues = sp_array_value( $_POST, 'sp_leagues', array() );
53
+
54
+ if ( ! is_array( $leagues ) ) return;
55
+
56
+ foreach ( $leagues as $l_id => $season ) {
57
+ if ( 0 === $l_id ) continue;
58
+ foreach ( $season as $s_id => $team_id ) {
59
+ if ( 0 >= $team_id ) continue;
60
+ $serialized = intval($l_id).'_'.intval($s_id).'_'.intval($team_id);
61
+ add_post_meta( $post_id, 'sp_assignments', $serialized, false );
62
+ }
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Add args to filter out assigned players
68
+ */
69
+ public function add_args( $args = array() ) {
70
+ $args['meta_query'][] = array(
71
+ 'key' => 'sp_assignments',
72
+ 'value' => '',
73
+ 'compare' => 'NOT EXISTS',
74
+ );
75
+
76
+ $args['meta_query'][] = array(
77
+ 'relation' => 'OR',
78
+ );
79
+
80
+ return $args;
81
+ }
82
+
83
+ /**
84
+ * Add assigned players to player list
85
+ */
86
+ public function add_players( $players = array(), $args = array(), $team = false ) {
87
+ $tax_query = (array) sp_array_value( $args, 'tax_query', array() );
88
+ $league_ids = array();
89
+ $season_ids = array();
90
+
91
+ foreach ( $tax_query as $param ) {
92
+ if ( 'sp_league' === sp_array_value( $param, 'taxonomy' ) ) $league_ids = sp_array_value( $param, 'terms', array() );
93
+ if ( 'sp_season' === sp_array_value( $param, 'taxonomy' ) ) $season_ids = sp_array_value( $param, 'terms', array() );
94
+ }
95
+
96
+ $assignments = array();
97
+ foreach ( $league_ids as $l_id ) {
98
+ foreach ( $season_ids as $s_id ) {
99
+ if ( $team && $team != '0' ) {
100
+ $assignments[] = $l_id.'_'.$s_id.'_'.$team;
101
+ }
102
+ }
103
+ }
104
+
105
+ $args['meta_query'] = array(
106
+ array(
107
+ 'key' => 'sp_assignments',
108
+ 'value' => $assignments,
109
+ 'compare' => 'IN'
110
+ ),
111
+ );
112
+
113
+ $assigned_players = (array) get_posts( $args );
114
+
115
+ $players = array_merge( $assigned_players, $players );
116
+
117
+ foreach ( $players as $i => $player ) {
118
+ $player->sp_number = get_post_meta( $player->ID, 'sp_number', true );
119
+ }
120
+
121
+ uasort( $players, array( $this, 'sort' ) );
122
+
123
+ return $players;
124
+ }
125
+
126
+ public function sort( $a, $b ) {
127
+ if ($a->sp_number == $b->sp_number) {
128
+ return 0;
129
+ }
130
+ return ($a->sp_number < $b->sp_number) ? -1 : 1;
131
+ }
132
+ }
133
+ endif;
134
+
135
+ new SportsPress_Player_Assignments();
modules/sportspress-wordpay.php CHANGED
@@ -5,7 +5,7 @@ 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
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_WordPay' ) ) :
17
  * Main SportsPress WordPay Class
18
  *
19
  * @class SportsPress_WordPay
20
- * @version 2.4.1
21
  */
22
  class SportsPress_WordPay {
23
 
@@ -47,7 +47,7 @@ class SportsPress_WordPay {
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__ ) );
@@ -232,6 +232,4 @@ class SportsPress_WordPay {
232
 
233
  endif;
234
 
235
- if ( get_option( 'sportspress_load_wordpay_module', 'yes' ) == 'yes' ) {
236
- new SportsPress_WordPay();
237
- }
5
  Description: Add team and player registration shortcodes to WordPay.
6
  Author: ThemeBoy
7
  Author URI: http://themeboy.com/
8
+ Version: 2.6
9
  */
10
 
11
  // Exit if accessed directly
17
  * Main SportsPress WordPay Class
18
  *
19
  * @class SportsPress_WordPay
20
+ * @version 2.6
21
  */
22
  class SportsPress_WordPay {
23
 
47
  */
48
  private function define_constants() {
49
  if ( !defined( 'SP_WORDPAY_VERSION' ) )
50
+ define( 'SP_WORDPAY_VERSION', '2.6' );
51
 
52
  if ( !defined( 'SP_WORDPAY_URL' ) )
53
  define( 'SP_WORDPAY_URL', plugin_dir_url( __FILE__ ) );
232
 
233
  endif;
234
 
235
+ new SportsPress_WordPay();
 
 
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: 4.9
7
- Stable tag: 2.5.10
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -237,6 +237,24 @@ When you upgrade to one of the SportsPress Pro licenses, you can simply activate
237
 
238
  == Changelog ==
239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  = 2.5.10 =
241
  * Fix - Date ranges not being applied to calendars.
242
 
4
  Donate link: http://tboy.co/donate
5
  Requires at least: 3.8
6
  Tested up to: 4.9
7
+ Stable tag: 2.6
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
237
 
238
  == Changelog ==
239
 
240
+ = 2.6 =
241
+ * Feature - Add custom details to events using event specs.
242
+ * Feature - Conditional equations for variables.
243
+ * Feature - Display the next opponent in league tables.
244
+ * Feature - Short name option added to teams.
245
+ * Feature - Automatic event titles using short name when available.
246
+ * Feature - Display featured image in countdown widget.
247
+ * Tweak - Stronger connections between leagues, seasons, and teams for automatic player lists.
248
+ * Tweak - Relative date option added to editor shortcodes.
249
+ * Tweak - Display only current team in player list.
250
+ * Tweak - Filter players dropdown by current team only.
251
+ * Tweak - Allow 0 as a squad number when importing players.
252
+ * Tweak - Prevent filtering through empty results.
253
+ * Fix - Interpreting non-integer substitution times.
254
+ * Fix - Warning when sorting terms without order.
255
+ * Localization - Add WPML support to staff header.
256
+ * Localization - Fix RTL not being applied in league tables.
257
+
258
  = 2.5.10 =
259
  * Fix - Date ranges not being applied to calendars.
260
 
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.5.10
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.5.10
30
  */
31
  final class SportsPress {
32
 
33
  /**
34
  * @var string
35
  */
36
- public $version = '2.5.10';
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.6
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.6
30
  */
31
  final class SportsPress {
32
 
33
  /**
34
  * @var string
35
  */
36
+ public $version = '2.6';
37
 
38
  /**
39
  * @var SportsPress The single instance of the class
templates/countdown.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.5.5
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -21,6 +21,7 @@ $defaults = array(
21
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
22
  'link_venues' => get_option( 'sportspress_link_venues', 'no' ) == 'yes' ? true : false,
23
  'show_logos' => get_option( 'sportspress_countdown_show_logos', 'no' ) == 'yes' ? true : false,
 
24
  );
25
  if ( isset( $id ) ):
26
  $post = get_post( $id );
@@ -75,6 +76,13 @@ if ( $link_events ) $title = '<a href="' . get_post_permalink( $post->ID, false,
75
  ?>
76
  <div class="sp-template sp-template-countdown">
77
  <div class="sp-countdown-wrapper">
 
 
 
 
 
 
 
78
  <h3 class="event-name sp-event-name">
79
  <?php
80
  if ( $show_logos ) {
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
21
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
22
  'link_venues' => get_option( 'sportspress_link_venues', 'no' ) == 'yes' ? true : false,
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 );
76
  ?>
77
  <div class="sp-template sp-template-countdown">
78
  <div class="sp-countdown-wrapper">
79
+ <?php
80
+ if ( $show_thumbnail && has_post_thumbnail( $post ) ) {
81
+ ?>
82
+ <div class="event-image sp-event-image">
83
+ <?php echo get_the_post_thumbnail( $post ); ?>
84
+ </h2>
85
+ <?php } ?>
86
  <h3 class="event-name sp-event-name">
87
  <?php
88
  if ( $show_logos ) {
templates/event-list.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.5.5
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -30,7 +30,6 @@ $defaults = array(
30
  'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
31
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
32
  'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false,
33
- 'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
34
  'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
35
  'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
36
  'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
@@ -199,7 +198,7 @@ $identifier = uniqid( 'eventlist_' );
199
 
200
  if ( $teams ):
201
  foreach ( $teams as $t => $team ):
202
- $name = sp_get_team_name( $team, $abbreviate_teams );
203
  if ( $name ):
204
 
205
  $name = '<meta itemprop="name" content="' . $name . '">' . $name;
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
30
  'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
31
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
32
  'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false,
 
33
  'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
34
  'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
35
  'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
198
 
199
  if ( $teams ):
200
  foreach ( $teams as $t => $team ):
201
+ $name = sp_team_short_name( $team );
202
  if ( $name ):
203
 
204
  $name = '<meta itemprop="name" content="' . $name . '">' . $name;
templates/event-logos-block.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.2
8
  */
9
  ?>
10
  <div class="sp-template sp-template-event-logos sp-template-event-blocks sp-template-event-logos-block">
@@ -27,9 +27,9 @@
27
 
28
  if ( $show_team_names ) {
29
  if ( $j % 2 ) {
30
- $logo .= ' <strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong>';
31
  } else {
32
- $logo = '<strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong> ' . $logo;
33
  }
34
  }
35
 
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
  ?>
10
  <div class="sp-template sp-template-event-logos sp-template-event-blocks sp-template-event-logos-block">
27
 
28
  if ( $show_team_names ) {
29
  if ( $j % 2 ) {
30
+ $logo .= ' <strong class="sp-team-name">' . sp_team_short_name( $team ) . '</strong>';
31
  } else {
32
+ $logo = '<strong class="sp-team-name">' . sp_team_short_name( $team ) . '</strong> ' . $logo;
33
  }
34
  }
35
 
templates/event-logos-inline.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.2
8
  */
9
 
10
  $team_logos = array();
@@ -21,9 +21,9 @@ foreach ( $teams as $team ):
21
  // Add team name
22
  if ( $show_team_names ) {
23
  if ( $alt ) {
24
- $logo .= ' <strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong>';
25
  } else {
26
- $logo = '<strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong> ' . $logo;
27
  }
28
  }
29
 
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  $team_logos = array();
21
  // Add team name
22
  if ( $show_team_names ) {
23
  if ( $alt ) {
24
+ $logo .= ' <strong class="sp-team-name">' . sp_team_short_name( $team ) . '</strong>';
25
  } else {
26
+ $logo = '<strong class="sp-team-name">' . sp_team_short_name( $team ) . '</strong> ' . $logo;
27
  }
28
  }
29
 
templates/event-logos.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.2
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -23,7 +23,6 @@ $layout = get_option( 'sportspress_event_logos_format', 'inline' );
23
  $show_team_names = get_option( 'sportspress_event_logos_show_team_names', 'yes' ) === 'yes' ? true : false;
24
  $show_time = get_option( 'sportspress_event_logos_show_time', 'no' ) === 'yes' ? true : false;
25
  $show_results = get_option( 'sportspress_event_logos_show_results', 'no' ) === 'yes' ? true : false;
26
- $abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
27
  $link_teams = get_option( 'sportspress_link_teams', 'no' ) === 'yes' ? true : false;
28
 
29
  if ( $show_results ) {
@@ -44,7 +43,6 @@ sp_get_template( 'event-logos-' . $layout . '.php', array(
44
  'show_team_names' => $show_team_names,
45
  'show_time' => $show_time,
46
  'show_results' => $show_results,
47
- 'abbreviate_teams' => $abbreviate_teams,
48
  'link_teams' => $link_teams,
49
  ) );
50
 
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
23
  $show_team_names = get_option( 'sportspress_event_logos_show_team_names', 'yes' ) === 'yes' ? true : false;
24
  $show_time = get_option( 'sportspress_event_logos_show_time', 'no' ) === 'yes' ? true : false;
25
  $show_results = get_option( 'sportspress_event_logos_show_results', 'no' ) === 'yes' ? true : false;
 
26
  $link_teams = get_option( 'sportspress_link_teams', 'no' ) === 'yes' ? true : false;
27
 
28
  if ( $show_results ) {
43
  'show_team_names' => $show_team_names,
44
  'show_time' => $show_time,
45
  'show_results' => $show_results,
 
46
  'link_teams' => $link_teams,
47
  ) );
48
 
templates/event-performance.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.5
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -16,7 +16,6 @@ $show_numbers = get_option( 'sportspress_event_show_player_numbers', 'yes' ) ===
16
  $show_position = get_option( 'sportspress_event_show_position', 'yes' ) === 'yes' ? true : false;
17
  $show_minutes = get_option( 'sportspress_event_performance_show_minutes', 'no' ) === 'yes' ? true : false;
18
  $sections = get_option( 'sportspress_event_performance_sections', -1 );
19
- $abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
20
  $reverse_teams = get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ? true : false;
21
  $primary = sp_get_main_performance_option();
22
  $total = get_option( 'sportspress_event_total_performance', 'all');
@@ -226,7 +225,7 @@ if ( is_array( $teams ) ):
226
  'show_numbers' => $show_numbers,
227
  'show_minutes' => $show_minutes,
228
  'show_total' => $show_total,
229
- 'caption' => 0 == $s && $team_id ? sp_get_team_name( $team_id, $abbreviate_teams ) : null,
230
  'labels' => $labels[ $section_id ],
231
  'formats' => $formats,
232
  'mode' => $mode,
@@ -263,7 +262,7 @@ if ( is_array( $teams ) ):
263
  'show_numbers' => $show_numbers,
264
  'show_minutes' => $show_minutes,
265
  'show_total' => $show_total,
266
- 'caption' => $team_id ? sp_get_team_name( $team_id, $abbreviate_teams ) : null,
267
  'labels' => $labels,
268
  'formats' => $formats,
269
  'mode' => $mode,
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
16
  $show_position = get_option( 'sportspress_event_show_position', 'yes' ) === 'yes' ? true : false;
17
  $show_minutes = get_option( 'sportspress_event_performance_show_minutes', 'no' ) === 'yes' ? true : false;
18
  $sections = get_option( 'sportspress_event_performance_sections', -1 );
 
19
  $reverse_teams = get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ? true : false;
20
  $primary = sp_get_main_performance_option();
21
  $total = get_option( 'sportspress_event_total_performance', 'all');
225
  'show_numbers' => $show_numbers,
226
  'show_minutes' => $show_minutes,
227
  'show_total' => $show_total,
228
+ 'caption' => 0 == $s && $team_id ? sp_team_short_name( $team_id ) : null,
229
  'labels' => $labels[ $section_id ],
230
  'formats' => $formats,
231
  'mode' => $mode,
262
  'show_numbers' => $show_numbers,
263
  'show_minutes' => $show_minutes,
264
  'show_total' => $show_total,
265
+ 'caption' => $team_id ? sp_team_short_name( $team_id ) : null,
266
  'labels' => $labels,
267
  'formats' => $formats,
268
  'mode' => $mode,
templates/event-results.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.5
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -36,7 +36,6 @@ if ( empty( $data ) )
36
 
37
  $scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
38
  $link_teams = get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false;
39
- $abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
40
  $show_outcomes = array_key_exists( 'outcome', $labels );
41
 
42
  // Initialize
@@ -64,7 +63,7 @@ foreach( $data as $team_id => $result ):
64
 
65
  $table_rows .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
66
 
67
- $team_name = sp_get_team_name( $team_id, $abbreviate_teams );
68
 
69
  if ( $link_teams && sp_post_exists( $team_id ) ):
70
  $team_name = '<a href="' . get_post_permalink( $team_id ) . '">' . $team_name . '</a>';
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
36
 
37
  $scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
38
  $link_teams = get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false;
 
39
  $show_outcomes = array_key_exists( 'outcome', $labels );
40
 
41
  // Initialize
63
 
64
  $table_rows .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
65
 
66
+ $team_name = sp_team_short_name( $team_id );
67
 
68
  if ( $link_teams && sp_post_exists( $team_id ) ):
69
  $team_name = '<a href="' . get_post_permalink( $team_id ) . '">' . $team_name . '</a>';
templates/official-details.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.5
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -23,7 +23,6 @@ $defaults = array(
23
  'show_leagues' => get_option( 'sportspress_official_show_leagues', 'no' ) == 'yes' ? true : false,
24
  'show_seasons' => get_option( 'sportspress_official_show_seasons', 'no' ) == 'yes' ? true : false,
25
  'show_nationality_flags' => get_option( 'sportspress_official_show_flags', 'yes' ) == 'yes' ? true : false,
26
- 'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
27
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
28
  );
29
 
@@ -76,7 +75,7 @@ if ( $show_current_teams ):
76
  if ( $current_teams ):
77
  $teams = array();
78
  foreach ( $current_teams as $team ):
79
- $team_name = sp_get_team_name( $team, $abbreviate_teams );
80
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
81
  $teams[] = $team_name;
82
  endforeach;
@@ -89,7 +88,7 @@ if ( $show_past_teams ):
89
  if ( $past_teams ):
90
  $teams = array();
91
  foreach ( $past_teams as $team ):
92
- $team_name = sp_get_team_name( $team, $abbreviate_teams );
93
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
94
  $teams[] = $team_name;
95
  endforeach;
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
23
  'show_leagues' => get_option( 'sportspress_official_show_leagues', 'no' ) == 'yes' ? true : false,
24
  'show_seasons' => get_option( 'sportspress_official_show_seasons', 'no' ) == 'yes' ? true : false,
25
  'show_nationality_flags' => get_option( 'sportspress_official_show_flags', 'yes' ) == 'yes' ? true : false,
 
26
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
27
  );
28
 
75
  if ( $current_teams ):
76
  $teams = array();
77
  foreach ( $current_teams as $team ):
78
+ $team_name = sp_team_short_name( $team );
79
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
80
  $teams[] = $team_name;
81
  endforeach;
88
  if ( $past_teams ):
89
  $teams = array();
90
  foreach ( $past_teams as $team ):
91
+ $team_name = sp_team_short_name( $team );
92
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
93
  $teams[] = $team_name;
94
  endforeach;
templates/player-details.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.5
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -23,7 +23,6 @@ $defaults = array(
23
  'show_leagues' => get_option( 'sportspress_player_show_leagues', 'no' ) == 'yes' ? true : false,
24
  'show_seasons' => get_option( 'sportspress_player_show_seasons', 'no' ) == 'yes' ? true : false,
25
  'show_nationality_flags' => get_option( 'sportspress_player_show_flags', 'yes' ) == 'yes' ? true : false,
26
- 'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
27
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
28
  );
29
 
@@ -76,7 +75,7 @@ if ( $show_current_teams ):
76
  if ( $current_teams ):
77
  $teams = array();
78
  foreach ( $current_teams as $team ):
79
- $team_name = sp_get_team_name( $team, $abbreviate_teams );
80
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
81
  $teams[] = $team_name;
82
  endforeach;
@@ -89,7 +88,7 @@ if ( $show_past_teams ):
89
  if ( $past_teams ):
90
  $teams = array();
91
  foreach ( $past_teams as $team ):
92
- $team_name = sp_get_team_name( $team, $abbreviate_teams );
93
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
94
  $teams[] = $team_name;
95
  endforeach;
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
23
  'show_leagues' => get_option( 'sportspress_player_show_leagues', 'no' ) == 'yes' ? true : false,
24
  'show_seasons' => get_option( 'sportspress_player_show_seasons', 'no' ) == 'yes' ? true : false,
25
  'show_nationality_flags' => get_option( 'sportspress_player_show_flags', 'yes' ) == 'yes' ? true : false,
 
26
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
27
  );
28
 
75
  if ( $current_teams ):
76
  $teams = array();
77
  foreach ( $current_teams as $team ):
78
+ $team_name = sp_team_short_name( $team );
79
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
80
  $teams[] = $team_name;
81
  endforeach;
88
  if ( $past_teams ):
89
  $teams = array();
90
  foreach ( $past_teams as $team ):
91
+ $team_name = sp_team_short_name( $team );
92
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
93
  $teams[] = $team_name;
94
  endforeach;
templates/player-list.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.5.5
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -24,7 +24,6 @@ $defaults = array(
24
  'show_player_flag' => get_option( 'sportspress_list_show_flags', 'no' ) == 'yes' ? true : false,
25
  'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
26
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
27
- 'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
28
  'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
29
  'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
30
  'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
@@ -172,8 +171,8 @@ foreach ( $groups as $group ):
172
  $tbody .= '<td class="data-name' . $name_class . '" data-label="'.$labels['name'].'">' . $name . '</td>';
173
 
174
  if ( array_key_exists( 'team', $labels ) ):
175
- $team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_team', true ) );
176
- $team_name = sp_get_team_name( $team, $abbreviate_teams );
177
  if ( $link_teams && false !== get_post_status( $team ) ):
178
  $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
179
  endif;
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
24
  'show_player_flag' => get_option( 'sportspress_list_show_flags', 'no' ) == 'yes' ? true : false,
25
  'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
26
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
 
27
  'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
28
  'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
29
  'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
171
  $tbody .= '<td class="data-name' . $name_class . '" data-label="'.$labels['name'].'">' . $name . '</td>';
172
 
173
  if ( array_key_exists( 'team', $labels ) ):
174
+ $team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_current_team', true ) );
175
+ $team_name = sp_team_short_name( $team );
176
  if ( $link_teams && false !== get_post_status( $team ) ):
177
  $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
178
  endif;
templates/player-selector.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.3
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -48,7 +48,7 @@ endif;
48
  if ( $team ):
49
  $args['meta_query'] = array(
50
  array(
51
- 'key' => 'sp_team',
52
  'value' => $team
53
  ),
54
  );
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
48
  if ( $team ):
49
  $args['meta_query'] = array(
50
  array(
51
+ 'key' => 'sp_current_team',
52
  'value' => $team
53
  ),
54
  );
templates/player-statistics.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.2.4
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -20,6 +20,16 @@ $show_career_totals = 'yes' === get_option( 'sportspress_player_show_career_tota
20
  $sections = get_option( 'sportspress_player_performance_sections', -1 );
21
  $show_teams = apply_filters( 'sportspress_player_team_statistics', true );
22
  $leagues = get_the_terms( $id, 'sp_league' );
 
 
 
 
 
 
 
 
 
 
23
  $positions = $player->positions();
24
  $player_sections = array();
25
  if ( $positions ) {
@@ -59,6 +69,7 @@ if ( is_array( $leagues ) ):
59
  'data' => $player->data( $league->term_id, false, $section_id ),
60
  'caption' => $caption,
61
  'scrollable' => $scrollable,
 
62
  );
63
  if ( ! $show_teams ) {
64
  $args['hide_teams'] = true;
@@ -75,4 +86,4 @@ if ( is_array( $leagues ) ):
75
  ) );
76
  }
77
  }
78
- endif;
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
20
  $sections = get_option( 'sportspress_player_performance_sections', -1 );
21
  $show_teams = apply_filters( 'sportspress_player_team_statistics', true );
22
  $leagues = get_the_terms( $id, 'sp_league' );
23
+
24
+ // Sort Leagues by User Defined Order (PHP5.2 supported)
25
+ foreach ( $leagues as $key => $league ) {
26
+ $leagues[ $key ]->sp_order = get_term_meta ( $league->term_id , 'sp_order', true );
27
+ }
28
+ function sortByOrder($a, $b) {
29
+ return (int) $a->sp_order - (int) $b->sp_order;
30
+ }
31
+ usort($leagues, 'sortByOrder');
32
+
33
  $positions = $player->positions();
34
  $player_sections = array();
35
  if ( $positions ) {
69
  'data' => $player->data( $league->term_id, false, $section_id ),
70
  'caption' => $caption,
71
  'scrollable' => $scrollable,
72
+ 'league_id' => $league->term_id,
73
  );
74
  if ( ! $show_teams ) {
75
  $args['hide_teams'] = true;
86
  ) );
87
  }
88
  }
89
+ endif;
templates/staff-details.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -19,7 +19,6 @@ $defaults = array(
19
  'show_past_teams' => get_option( 'sportspress_staff_show_past_teams', 'yes' ) == 'yes' ? true : false,
20
  'show_nationality_flags' => get_option( 'sportspress_staff_show_flags', 'yes' ) == 'yes' ? true : false,
21
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
22
- 'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
23
  );
24
 
25
  extract( $defaults, EXTR_SKIP );
@@ -50,7 +49,7 @@ endif;
50
  if ( $show_current_teams && $current_teams ):
51
  $teams = array();
52
  foreach ( $current_teams as $team ):
53
- $team_name = sp_get_team_name( $team, $abbreviate_teams );
54
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
55
  $teams[] = $team_name;
56
  endforeach;
@@ -60,7 +59,7 @@ endif;
60
  if ( $show_past_teams && $past_teams ):
61
  $teams = array();
62
  foreach ( $past_teams as $team ):
63
- $team_name = sp_get_team_name( $team, $abbreviate_teams );
64
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
65
  $teams[] = $team_name;
66
  endforeach;
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
19
  'show_past_teams' => get_option( 'sportspress_staff_show_past_teams', 'yes' ) == 'yes' ? true : false,
20
  'show_nationality_flags' => get_option( 'sportspress_staff_show_flags', 'yes' ) == 'yes' ? true : false,
21
  'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
 
22
  );
23
 
24
  extract( $defaults, EXTR_SKIP );
49
  if ( $show_current_teams && $current_teams ):
50
  $teams = array();
51
  foreach ( $current_teams as $team ):
52
+ $team_name = sp_team_short_name( $team );
53
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
54
  $teams[] = $team_name;
55
  endforeach;
59
  if ( $show_past_teams && $past_teams ):
60
  $teams = array();
61
  foreach ( $past_teams as $team ):
62
+ $team_name = sp_team_short_name( $team );
63
  if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
64
  $teams[] = $team_name;
65
  endforeach;
templates/staff-header.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
- * @version 2.5.5
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
  if ( ! isset( $id ) )
13
  $id = get_the_ID();
14
 
15
- $post = get_post( $id );
16
  $title = $post->post_title;
17
  if ( $title ) {
18
  $staff = new SP_Staff( $id );
@@ -22,4 +22,4 @@ if ( $title ) {
22
  ?>
23
  <h3 class="sp-staff-name"><?php echo $title ?></h3>
24
  <?php
25
- }
4
  *
5
  * @author ThemeBoy
6
  * @package SportsPress/Templates
7
+ * @version 2.6
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
  if ( ! isset( $id ) )
13
  $id = get_the_ID();
14
 
15
+ $post = function_exists( 'icl_object_id' ) ? get_post( icl_object_id( $id, 'sp_staff', true ) ) : get_post( $id );
16
  $title = $post->post_title;
17
  if ( $title ) {
18
  $staff = new SP_Staff( $id );
22
  ?>
23
  <h3 class="sp-staff-name"><?php echo $title ?></h3>
24
  <?php
25
+ }
wpml-config.xml CHANGED
@@ -1,5 +1,6 @@
1
  <wpml-config>
2
  <admin-texts>
 
3
  <key name="sportspress_text">
4
  <key name="Age"/>
5
  <key name="Article"/>
@@ -55,4 +56,4 @@
55
  <key name="Visit Site"/>
56
  </key>
57
  </admin-texts>
58
- </wpml-config>
1
  <wpml-config>
2
  <admin-texts>
3
+ <key name="sportspress_footer_sponsors_title"></key>
4
  <key name="sportspress_text">
5
  <key name="Age"/>
6
  <key name="Article"/>
56
  <key name="Visit Site"/>
57
  </key>
58
  </admin-texts>
59
+ </wpml-config>