Merge branch 'master' into feature-league-tables-bypass-ordering

This commit is contained in:
Brian Miyaji
2021-09-30 17:32:50 +09:00
committed by GitHub
119 changed files with 4379 additions and 2238 deletions

View File

@@ -9,7 +9,7 @@ __Note:__
GitHub is for *bug reports and contributions only* - if you have a support question or a request for a customization don't post here. Use [WordPress.org](http://wordpress.org/support/plugin/sportspress) for community support, and for customizations we recommend one of the following services:
- [Elto](https://www.elto.com/)
- [Codeable](https://codeable.io/)
- [Codeable](https://codeable.io/ambassadors/themeboy/)
## Getting Started
@@ -34,4 +34,4 @@ At this point you're waiting on us to merge your pull request. We'll review all
* [General GitHub documentation](http://help.github.com/)
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
* [SportsPress plugin page on WordPress.org](http://wordpress.org/plugins/sportspress/)
* [SportsPress plugin page on WordPress.org](http://wordpress.org/plugins/sportspress/)

View File

@@ -0,0 +1,126 @@
.leaflet-control-geocoder {
border-radius: 4px;
background: white;
min-width: 26px;
min-height: 26px;
}
.leaflet-touch .leaflet-control-geocoder {
min-width: 30px;
min-height: 30px;
}
.leaflet-control-geocoder a,
.leaflet-control-geocoder .leaflet-control-geocoder-icon {
border-bottom: none;
display: inline-block;
}
.leaflet-control-geocoder .leaflet-control-geocoder-alternatives a {
width: inherit;
height: inherit;
line-height: inherit;
}
.leaflet-control-geocoder a:hover,
.leaflet-control-geocoder .leaflet-control-geocoder-icon:hover {
border-bottom: none;
display: inline-block;
}
.leaflet-control-geocoder-form {
display: none;
vertical-align: middle;
}
.leaflet-control-geocoder-expanded .leaflet-control-geocoder-form {
display: inline-block;
}
.leaflet-control-geocoder-form input {
font-size: 120%;
border: 0;
background-color: transparent;
width: 246px;
}
.leaflet-control-geocoder-icon {
border-radius: 4px;
width: 26px;
height: 26px;
border: none;
background-color: white;
background-image: url(images/geocoder.png);
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
}
.leaflet-touch .leaflet-control-geocoder-icon {
width: 30px;
height: 30px;
}
.leaflet-control-geocoder-throbber .leaflet-control-geocoder-icon {
background-image: url(images/throbber.gif);
}
.leaflet-control-geocoder-form-no-error {
display: none;
}
.leaflet-control-geocoder-form input:focus {
outline: none;
}
.leaflet-control-geocoder-form button {
display: none;
}
.leaflet-control-geocoder-error {
margin-top: 8px;
margin-left: 8px;
display: block;
color: #444;
}
.leaflet-control-geocoder-alternatives {
display: block;
width: 272px;
list-style: none;
padding: 0;
margin: 0;
}
.leaflet-control-geocoder-alternatives-minimized {
display: none;
height: 0;
}
.leaflet-control-geocoder-alternatives li {
white-space: nowrap;
display: block;
overflow: hidden;
padding: 5px 8px;
text-overflow: ellipsis;
border-bottom: 1px solid #ccc;
cursor: pointer;
}
.leaflet-control-geocoder-alternatives li a,
.leaflet-control-geocoder-alternatives li a:hover {
width: inherit;
height: inherit;
line-height: inherit;
background: inherit;
border-radius: inherit;
text-align: left;
}
.leaflet-control-geocoder-alternatives li:last-child {
border-bottom: none;
}
.leaflet-control-geocoder-alternatives li:hover,
.leaflet-control-geocoder-selected {
background-color: #f5f5f5;
}
.leaflet-control-geocoder-address-detail {
}
.leaflet-control-geocoder-address-context {
color: #666;
}

View File

@@ -1,12 +1,12 @@
/* SportsPress icons */
@font-face {
font-family: 'sportspress';
src:url('../fonts/sportspress.eot?ddphik');
src:url('../fonts/sportspress.eot?#iefixddphik') format('embedded-opentype'),
url('../fonts/sportspress.woff2?ddphik') format('woff2'),
url('../fonts/sportspress.ttf?ddphik') format('truetype'),
url('../fonts/sportspress.woff?ddphik') format('woff'),
url('../fonts/sportspress.svg?ddphik#sportspress') format('svg');
src:url('../fonts/sportspress.eot?ddphik2');
src:url('../fonts/sportspress.eot?#iefixddphik2') format('embedded-opentype'),
url('../fonts/sportspress.woff2?ddphik2') format('woff2'),
url('../fonts/sportspress.ttf?ddphik2') format('truetype'),
url('../fonts/sportspress.woff?ddphik2') format('woff'),
url('../fonts/sportspress.svg?ddphik2#sportspress') format('svg');
font-weight: normal;
font-style: normal;
}
@@ -93,6 +93,9 @@
.sp-icon-racing-flag:before {
content: "\e611";
}
.sp-icon-volleyball:before {
content: "\e612";
}
/* Performance Icons - Sports (Alt) */
.sp-icon-soccerball-alt:before {

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

640
assets/css/leaflet.css Normal file
View File

@@ -0,0 +1,640 @@
/* required styles */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
position: absolute;
left: 0;
top: 0;
}
.leaflet-container {
overflow: hidden;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
-webkit-user-drag: none;
}
/* Prevents IE11 from highlighting tiles in blue */
.leaflet-tile::selection {
background: transparent;
}
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
.leaflet-safari .leaflet-tile {
image-rendering: -webkit-optimize-contrast;
}
/* hack that prevents hw layers "stretching" when loading new tiles */
.leaflet-safari .leaflet-tile-container {
width: 1600px;
height: 1600px;
-webkit-transform-origin: 0 0;
}
.leaflet-marker-icon,
.leaflet-marker-shadow {
display: block;
}
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
.leaflet-container .leaflet-overlay-pane svg,
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer,
.leaflet-container .leaflet-tile {
max-width: none !important;
max-height: none !important;
}
.leaflet-container.leaflet-touch-zoom {
-ms-touch-action: pan-x pan-y;
touch-action: pan-x pan-y;
}
.leaflet-container.leaflet-touch-drag {
-ms-touch-action: pinch-zoom;
/* Fallback for FF which doesn't support pinch-zoom */
touch-action: none;
touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
-ms-touch-action: none;
touch-action: none;
}
.leaflet-container {
-webkit-tap-highlight-color: transparent;
}
.leaflet-container a {
-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
}
.leaflet-tile {
filter: inherit;
visibility: hidden;
}
.leaflet-tile-loaded {
visibility: inherit;
}
.leaflet-zoom-box {
width: 0;
height: 0;
-moz-box-sizing: border-box;
box-sizing: border-box;
z-index: 800;
}
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
.leaflet-overlay-pane svg {
-moz-user-select: none;
}
.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }
.leaflet-vml-shape {
width: 1px;
height: 1px;
}
.lvml {
behavior: url(#default#VML);
display: inline-block;
position: absolute;
}
/* control positioning */
.leaflet-control {
position: relative;
z-index: 800;
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
.leaflet-top,
.leaflet-bottom {
position: absolute;
z-index: 1000;
pointer-events: none;
}
.leaflet-top {
top: 0;
}
.leaflet-right {
right: 0;
}
.leaflet-bottom {
bottom: 0;
}
.leaflet-left {
left: 0;
}
.leaflet-control {
float: left;
clear: both;
}
.leaflet-right .leaflet-control {
float: right;
}
.leaflet-top .leaflet-control {
margin-top: 10px;
}
.leaflet-bottom .leaflet-control {
margin-bottom: 10px;
}
.leaflet-left .leaflet-control {
margin-left: 10px;
}
.leaflet-right .leaflet-control {
margin-right: 10px;
}
/* zoom and fade animations */
.leaflet-fade-anim .leaflet-tile {
will-change: opacity;
}
.leaflet-fade-anim .leaflet-popup {
opacity: 0;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
opacity: 1;
}
.leaflet-zoom-animated {
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
will-change: transform;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile {
-webkit-transition: none;
-moz-transition: none;
transition: none;
}
.leaflet-zoom-anim .leaflet-zoom-hide {
visibility: hidden;
}
/* cursors */
.leaflet-interactive {
cursor: pointer;
}
.leaflet-grab {
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.leaflet-crosshair,
.leaflet-crosshair .leaflet-interactive {
cursor: crosshair;
}
.leaflet-popup-pane,
.leaflet-control {
cursor: auto;
}
.leaflet-dragging .leaflet-grab,
.leaflet-dragging .leaflet-grab .leaflet-interactive,
.leaflet-dragging .leaflet-marker-draggable {
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
/* marker & overlays interactivity */
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg path,
.leaflet-tile-container {
pointer-events: none;
}
.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive,
svg.leaflet-image-layer.leaflet-interactive path {
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
/* visual tweaks */
.leaflet-container {
background: #ddd;
outline: 0;
}
.leaflet-container a {
color: #0078A8;
}
.leaflet-container a.leaflet-active {
outline: 2px solid orange;
}
.leaflet-zoom-box {
border: 2px dotted #38f;
background: rgba(255,255,255,0.5);
}
/* general typography */
.leaflet-container {
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
}
/* general toolbar styles */
.leaflet-bar {
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
border-radius: 4px;
}
.leaflet-bar a,
.leaflet-bar a:hover {
background-color: #fff;
border-bottom: 1px solid #ccc;
width: 26px;
height: 26px;
line-height: 26px;
display: block;
text-align: center;
text-decoration: none;
color: black;
}
.leaflet-bar a,
.leaflet-control-layers-toggle {
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
}
.leaflet-bar a:hover {
background-color: #f4f4f4;
}
.leaflet-bar a:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.leaflet-bar a:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom: none;
}
.leaflet-bar a.leaflet-disabled {
cursor: default;
background-color: #f4f4f4;
color: #bbb;
}
.leaflet-touch .leaflet-bar a {
width: 30px;
height: 30px;
line-height: 30px;
}
.leaflet-touch .leaflet-bar a:first-child {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
}
.leaflet-touch .leaflet-bar a:last-child {
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
}
/* zoom control */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
}
.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {
font-size: 22px;
}
/* layers control */
.leaflet-control-layers {
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
background: #fff;
border-radius: 5px;
}
.leaflet-control-layers-toggle {
background-image: url(images/layers.png);
width: 36px;
height: 36px;
}
.leaflet-retina .leaflet-control-layers-toggle {
background-image: url(images/layers-2x.png);
background-size: 26px 26px;
}
.leaflet-touch .leaflet-control-layers-toggle {
width: 44px;
height: 44px;
}
.leaflet-control-layers .leaflet-control-layers-list,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
display: none;
}
.leaflet-control-layers-expanded .leaflet-control-layers-list {
display: block;
position: relative;
}
.leaflet-control-layers-expanded {
padding: 6px 10px 6px 6px;
color: #333;
background: #fff;
}
.leaflet-control-layers-scrollbar {
overflow-y: scroll;
overflow-x: hidden;
padding-right: 5px;
}
.leaflet-control-layers-selector {
margin-top: 2px;
position: relative;
top: 1px;
}
.leaflet-control-layers label {
display: block;
}
.leaflet-control-layers-separator {
height: 0;
border-top: 1px solid #ddd;
margin: 5px -10px 5px -6px;
}
/* Default icon URLs */
.leaflet-default-icon-path {
background-image: url(images/marker-icon.png);
}
/* attribution and scale controls */
.leaflet-container .leaflet-control-attribution {
background: #fff;
background: rgba(255, 255, 255, 0.7);
margin: 0;
}
.leaflet-control-attribution,
.leaflet-control-scale-line {
padding: 0 5px;
color: #333;
}
.leaflet-control-attribution a {
text-decoration: none;
}
.leaflet-control-attribution a:hover {
text-decoration: underline;
}
.leaflet-container .leaflet-control-attribution,
.leaflet-container .leaflet-control-scale {
font-size: 11px;
}
.leaflet-left .leaflet-control-scale {
margin-left: 5px;
}
.leaflet-bottom .leaflet-control-scale {
margin-bottom: 5px;
}
.leaflet-control-scale-line {
border: 2px solid #777;
border-top: none;
line-height: 1.1;
padding: 2px 5px 1px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: #fff;
background: rgba(255, 255, 255, 0.5);
}
.leaflet-control-scale-line:not(:first-child) {
border-top: 2px solid #777;
border-bottom: none;
margin-top: -2px;
}
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
border-bottom: 2px solid #777;
}
.leaflet-touch .leaflet-control-attribution,
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
box-shadow: none;
}
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
border: 2px solid rgba(0,0,0,0.2);
background-clip: padding-box;
}
/* popup */
.leaflet-popup {
position: absolute;
text-align: center;
margin-bottom: 20px;
}
.leaflet-popup-content-wrapper {
padding: 1px;
text-align: left;
border-radius: 12px;
}
.leaflet-popup-content {
margin: 13px 19px;
line-height: 1.4;
}
.leaflet-popup-content p {
margin: 18px 0;
}
.leaflet-popup-tip-container {
width: 40px;
height: 20px;
position: absolute;
left: 50%;
margin-left: -20px;
overflow: hidden;
pointer-events: none;
}
.leaflet-popup-tip {
width: 17px;
height: 17px;
padding: 1px;
margin: -10px auto 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
background: white;
color: #333;
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}
.leaflet-container a.leaflet-popup-close-button {
position: absolute;
top: 0;
right: 0;
padding: 4px 4px 0 0;
border: none;
text-align: center;
width: 18px;
height: 14px;
font: 16px/14px Tahoma, Verdana, sans-serif;
color: #c3c3c3;
text-decoration: none;
font-weight: bold;
background: transparent;
}
.leaflet-container a.leaflet-popup-close-button:hover {
color: #999;
}
.leaflet-popup-scrolled {
overflow: auto;
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
}
.leaflet-oldie .leaflet-popup-content-wrapper {
-ms-zoom: 1;
}
.leaflet-oldie .leaflet-popup-tip {
width: 24px;
margin: 0 auto;
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
}
.leaflet-oldie .leaflet-popup-tip-container {
margin-top: -1px;
}
.leaflet-oldie .leaflet-control-zoom,
.leaflet-oldie .leaflet-control-layers,
.leaflet-oldie .leaflet-popup-content-wrapper,
.leaflet-oldie .leaflet-popup-tip {
border: 1px solid #999;
}
/* div icon */
.leaflet-div-icon {
background: #fff;
border: 1px solid #666;
}
/* Tooltip */
/* Base styles for the element that has a tooltip */
.leaflet-tooltip {
position: absolute;
padding: 6px;
background-color: #fff;
border: 1px solid #fff;
border-radius: 3px;
color: #222;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.leaflet-tooltip.leaflet-clickable {
cursor: pointer;
pointer-events: auto;
}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
position: absolute;
pointer-events: none;
border: 6px solid transparent;
background: transparent;
content: "";
}
/* Directions */
.leaflet-tooltip-bottom {
margin-top: 6px;
}
.leaflet-tooltip-top {
margin-top: -6px;
}
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-top:before {
left: 50%;
margin-left: -6px;
}
.leaflet-tooltip-top:before {
bottom: 0;
margin-bottom: -12px;
border-top-color: #fff;
}
.leaflet-tooltip-bottom:before {
top: 0;
margin-top: -12px;
margin-left: -6px;
border-bottom-color: #fff;
}
.leaflet-tooltip-left {
margin-left: -6px;
}
.leaflet-tooltip-right {
margin-left: 6px;
}
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
top: 50%;
margin-top: -6px;
}
.leaflet-tooltip-left:before {
right: 0;
margin-right: -12px;
border-left-color: #fff;
}
.leaflet-tooltip-right:before {
left: 0;
margin-left: -12px;
border-right-color: #fff;
}

View File

@@ -103,6 +103,9 @@
.sp-icon-list:before {
content: "\f163"
}
.sp-icon-location:before {
content: "\f231";
}
.sp-icon-matrix:before {
content: "\f314";
}
@@ -235,6 +238,9 @@
.sp-icon-racing-flag:before {
content: "\e611";
}
.sp-icon-volleyball:before {
content: "\e612";
}
/* Performance Icons - Sports (Alt) */
.sp-icon-soccerball-alt:before {
@@ -331,7 +337,7 @@
margin: 3px 0;
}
.sp-icon-color-box input[type=text] {
.sp-color-box-for-icon input[type=text] {
color: #fff;
}

View File

@@ -31,13 +31,27 @@
}
/* League Table and Player List */
.sp-league-table .data-name .team-logo,
.sp-player-list .data-name .player-photo,
.sp-player-list .data-name .player-flag {
margin-right: 0;
margin-left: 0.5em;
}
/* Event Performance (Icons) */
.sp-event-performance-teams .sp-template-event-performance-icons {
float: right;
clear: right;
padding-right: 0;
padding-left: 10px;
}
.sp-event-performance-teams .sp-template-event-performance-icons:nth-child(2n) {
float: left;
clear: left;
padding-left: 0;
padding-right: 10px;
}
/* Event Calendar */
.sp-event-calendar #next {
text-align: left;

View File

@@ -104,6 +104,7 @@
.sp-data-table thead .sorting_asc_disabled,
.sp-data-table thead .sorting_desc_disabled {
cursor: pointer;
position: relative;
}
.sp-data-table tbody a {
text-decoration: none;
@@ -112,6 +113,7 @@
.sp-data-table .sorting_asc:after,
.sp-data-table .sorting_desc:after {
font-family: dashicons;
margin: 0 -.2em;
}
.sp-data-table .sorting:after {
content: "\f156";
@@ -133,6 +135,10 @@
.sp-data-table .data-rank {
width: 1px;
}
.sp-data-table .sp-checkbox {
font-family: sportspress;
vertical-align: bottom;
}
/* Post Content */
.sp-post-content {
@@ -203,16 +209,21 @@
line-height: 2em;
}
.sp-player-list .data-name .player-photo,
.sp-player-list .data-name .player-flag {
.sp-player-list .data-name .player-flag,
.sp-player-list .data-team .team-logo {
width: 2em;
height: 2em;
margin-right: 0.5em;
display: inline-block;
vertical-align: middle;
text-align: center;
}
.sp-player-list .data-name .player-photo,
.sp-player-list .data-name .player-flag {
margin-right: 0.5em;
}
.sp-player-list .data-name .player-photo img,
.sp-player-list .data-name .player-flag img {
.sp-player-list .data-name .player-flag img,
.sp-player-list .data-team .team-logo img {
width: auto;
height: auto;
max-width: 2em;
@@ -448,6 +459,10 @@
clear: both;
}
span.sp_event_spec_label {
font-weight: bold;
}
/* Event Logos Block */
.sp-template-event-logos-block .team-logo {
float: none;

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/images/flags/glp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

BIN
assets/images/flags/grl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/images/flags/guf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

BIN
assets/images/flags/mtq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
assets/images/flags/pyf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/images/flags/reu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

BIN
assets/images/flags/sxm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

10
assets/js/Control.Geocoder.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -11,7 +11,7 @@
var p = g.split("[");
var label = p.shift();
var variations = p.shift();
var shortcodes = variations.split("|");
var shortcodes = typeof variations!== 'undefined' ? variations.split("|") : [];
var submenu = new Array();
shortcodes.forEach(function(s) {
submenu.push({

View File

@@ -23,14 +23,14 @@ jQuery(document).ready(function($){
})
.click(function(){
$('.iris-picker').hide();
$(this).closest('.sp-icon-color-box, td').find('.iris-picker').show();
$(this).closest('.sp-color-box-for-icon, td').find('.iris-picker').show();
});
$('body').click(function() {
$('.iris-picker').hide();
});
$('.sp-icon-color-box, .colorpick').click(function(event){
$('.sp-color-box-for-icon, .colorpick').click(function(event){
event.stopPropagation();
});

View File

@@ -1,16 +0,0 @@
jQuery(document).ready(function($){
$(".sp-location-picker").locationpicker({
location: {
latitude: Number($(".sp-latitude").val()),
longitude: Number($(".sp-longitude").val())
},
radius: 0,
inputBinding: {
latitudeInput: $(".sp-latitude"),
longitudeInput: $(".sp-longitude"),
locationNameInput: $(".sp-address")
},
addressFormat: null,
enableAutocomplete: true
});
});

View File

@@ -0,0 +1,54 @@
//Get variables form input values
latitude = document.getElementById('term_meta[sp_latitude]').value;
longitude = document.getElementById('term_meta[sp_longitude]').value;
//Initialize the map and add the Search control box
var map = L.map('sp-location-picker').setView([latitude, longitude], 15),
geocoder = L.Control.Geocoder.nominatim(),
control = L.Control.geocoder({
geocoder: geocoder,
collapsed: false,
defaultMarkGeocode: false
}).addTo(map),
//Add a marker to use from the begining
marker = L.marker([latitude, longitude],{draggable: true, autoPan: true}).addTo(map);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
//Pass the values to the fields after dragging
marker.on('dragend', function (e) {
document.getElementById('term_meta[sp_latitude]').value = marker.getLatLng().lat;
document.getElementById('term_meta[sp_longitude]').value = marker.getLatLng().lng;
geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) {
var r = results[0];
if (r) {
document.getElementById('term_meta[sp_address]').value = r.name;
}
})
});
//After searching
control.on('markgeocode', function(e) {
var center = e.geocode.center;
var address = e.geocode.name;
map.setView([center.lat, center.lng], 15); //Center map to the new place
map.removeLayer(marker); //Remove previous marker
marker = L.marker([center.lat, center.lng],{draggable: true, autoPan: true}).addTo(map); //Add new marker to use
//Pass the values to the fields after searching
document.getElementById('term_meta[sp_latitude]').value = center.lat;
document.getElementById('term_meta[sp_longitude]').value = center.lng;
document.getElementById('term_meta[sp_address]').value = address;
//Pass the values to the fields after dragging
marker.on('dragend', function (e) {
document.getElementById('term_meta[sp_latitude]').value = marker.getLatLng().lat;
document.getElementById('term_meta[sp_longitude]').value = marker.getLatLng().lng;
geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) {
var r = results[0];
if (r) {
document.getElementById('term_meta[sp_address]').value = r.name;
}
})
});
}).addTo(map);

View File

@@ -0,0 +1,54 @@
//Get variables form input values
latitude = document.getElementById('sp_latitude').value;
longitude = document.getElementById('sp_longitude').value;
//Initialize the map and add the Search control box
var map = L.map('sp-location-picker').setView([latitude, longitude], 15),
geocoder = L.Control.Geocoder.nominatim(),
control = L.Control.geocoder({
geocoder: geocoder,
collapsed: false,
defaultMarkGeocode: false
}).addTo(map),
//Add a marker to use from the begining
marker = L.marker([latitude, longitude],{draggable: true, autoPan: true}).addTo(map);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
//Pass the values to the fields after dragging
marker.on('dragend', function (e) {
document.getElementById('sp_latitude').value = marker.getLatLng().lat;
document.getElementById('sp_longitude').value = marker.getLatLng().lng;
geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) {
var r = results[0];
if (r) {
document.getElementById('sp_address').value = r.name;
}
})
});
//After searching
control.on('markgeocode', function(e) {
var center = e.geocode.center;
var address = e.geocode.name;
map.setView([center.lat, center.lng], 15); //Center map to the new place
map.removeLayer(marker); //Remove previous marker
marker = L.marker([center.lat, center.lng],{draggable: true, autoPan: true}).addTo(map); //Add new marker to use
//Pass the values to the fields after searching
document.getElementById('sp_latitude').value = center.lat;
document.getElementById('sp_longitude').value = center.lng;
document.getElementById('sp_address').value = address;
//Pass the values to the fields after dragging
marker.on('dragend', function (e) {
document.getElementById('sp_latitude').value = marker.getLatLng().lat;
document.getElementById('sp_longitude').value = marker.getLatLng().lng;
geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) {
var r = results[0];
if (r) {
document.getElementById('sp_address').value = r.name;
}
})
});
}).addTo(map);

View File

@@ -14,13 +14,16 @@ jQuery(document).ready(function($){
});
// Chosen select
$(".chosen-select").chosen({
allow_single_deselect: true,
search_contains: true,
single_backstroke_delete: false,
disable_search_threshold: 10,
placeholder_text_multiple: localized_strings.none
});
$(document).on("postbox-toggled", function() {
$(".chosen-select").filter(":visible").chosen({
allow_single_deselect: true,
search_contains: true,
single_backstroke_delete: false,
disable_search_threshold: 10,
placeholder_text_multiple: localized_strings.none
});
}).trigger("postbox-toggled");
// Auto key placeholder
$("#poststuff #title").on("keyup", function() {
@@ -37,7 +40,7 @@ jQuery(document).ready(function($){
// Radio input toggle
$(".sp-radio-toggle").click(function() {
if($(this).data("sp-checked")) {
$(this).attr("checked", false );
$(this).prop("checked", false );
$(this).data("sp-checked", false );
} else {
$(this).data("sp-checked", true );
@@ -255,7 +258,7 @@ jQuery(document).ready(function($){
});
// Activate total stats calculator
if($(".sp-data-table .sp-total").size()) {
if($(".sp-data-table .sp-total").length) {
$(".sp-data-table .sp-post td input").on("keyup", function() {
$(this).closest(".sp-data-table").find(".sp-total td").eq($(this).parent().index()).find("input[data-sp-format=number][data-sp-total-type!=average]").trigger("updateTotal");
});
@@ -488,11 +491,11 @@ jQuery(document).ready(function($){
});
// Event format affects data
$(".post-type-sp_event #post-formats-select input.post-format").change(function() {
$(".post-type-sp_event #post-formats-select").change(function() {
layout = $(".post-type-sp_event #post-formats-select input:checked").val();
if ( layout == "friendly" ) {
$(".sp_event-sp_league-field").show().find("select").prop("disabled", false);
$(".sp_event-sp_season-field").show().find("select").prop("disabled", false);
$(".sp_event-sp_league-field").hide().find("select").prop("disabled", true);
$(".sp_event-sp_season-field").hide().find("select").prop("disabled", true);
} else {
$(".sp_event-sp_league-field").show().find("select").prop("disabled", false);
$(".sp_event-sp_season-field").show().find("select").prop("disabled", false);
@@ -500,10 +503,10 @@ jQuery(document).ready(function($){
});
// Trigger event format change
$(".post-type-sp_event #post-formats-select input.post-format").trigger("change");
$(".post-type-sp_event #post-formats-select").trigger("change");
// Calendar layout affects data
$(".post-type-sp_calendar #post-formats-select input.post-format").change(function() {
$(".post-type-sp_calendar #post-formats-select").change(function() {
layout = $(".post-type-sp_calendar #post-formats-select input:checked").val();
$(".sp-calendar-table tr").each(function() {
if ( layout == "list" ) {
@@ -517,10 +520,10 @@ jQuery(document).ready(function($){
});
// Trigger calendar layout change
$(".post-type-sp_calendar #post-formats-select input.post-format").trigger("change");
$(".post-type-sp_calendar #post-formats-select").trigger("change");
// Player list layout affects data
$(".post-type-sp_list #post-formats-select input.post-format").change(function() {
$(".post-type-sp_list #post-formats-select").change(function() {
layout = $(".post-type-sp_list #post-formats-select input:checked").val();
$(".sp-player-list-table tr").each(function() {
if ( layout == "list" ) {
@@ -532,7 +535,7 @@ jQuery(document).ready(function($){
});
// Trigger player list layout change
$(".post-type-sp_list #post-formats-select input.post-format").trigger("change");
$(".post-type-sp_list #post-formats-select").trigger("change");
// Configure primary result option (Ajax)
$(".sp-admin-config-table").on("click", ".sp-primary-result-option", function() {

View File

@@ -0,0 +1,81 @@
import apiFetch from '@wordpress/api-fetch';
console.log(wp.api.collections.Posts());
wp.blocks.registerBlockType('sportspress/event-calendar', {
title: strings.event_calendar,
icon: 'calendar',
category: 'sportspress',
attributes: {
title: {
type: 'string'
},
id: {
type: 'number'
},
status: {
type: 'string'
},
date: {
type: 'string'
},
date_from: {
type: 'string'
},
date_to: {
type: 'string'
},
date_past: {
type: 'number'
},
date_future: {
type: 'number'
},
date_relative: {
type: 'number'
},
day: {
type: 'string'
},
show_all_events_link: {
type: 'number'
},
content: {type: 'string'},
color: {type: 'string'}
},
edit: function(props) {
function updateContent(event) {
props.setAttributes({content: event.target.value})
}
function updateColor(value) {
props.setAttributes({color: value.hex})
}
return React.createElement(
wp.components.Panel,
{header: strings.event_calendar},
React.createElement(
wp.components.PanelBody,
{title: strings.properties},
React.createElement(
wp.components.TextControl,
{label: strings.title, type: "text", value: props.attributes.title}
),
React.createElement(
wp.components.SelectControl,
{label: strings.select_calendar, options: [{label: strings.all, value: 0}].concat(posts.events.map(post => {
return {label: post.post_title, value: post.ID}
}))}
)
)
);
},
save: function(props) {
return wp.element.createElement(
"h3",
{ style: { border: "3px solid " + props.attributes.color } },
props.attributes.content
);
}
})

6
assets/js/leaflet.js Normal file

File diff suppressed because one or more lines are too long

1
assets/js/leaflet.js.map Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,400 +0,0 @@
/*! jquery-locationpicker - v0.1.16 - 2017-10-02 */
(function($) {
function GMapContext(domElement, options) {
var _map = new google.maps.Map(domElement, options);
var _marker = new google.maps.Marker({
position: new google.maps.LatLng(54.19335, -3.92695),
map: _map,
title: "Drag Me",
visible: options.markerVisible,
draggable: options.markerDraggable,
icon: options.markerIcon !== undefined ? options.markerIcon : undefined
});
return {
map: _map,
marker: _marker,
circle: null,
location: _marker.position,
radius: options.radius,
locationName: options.locationName,
addressComponents: {
formatted_address: null,
addressLine1: null,
addressLine2: null,
streetName: null,
streetNumber: null,
city: null,
district: null,
state: null,
stateOrProvince: null
},
settings: options.settings,
domContainer: domElement,
geodecoder: new google.maps.Geocoder()
};
}
var GmUtility = {
drawCircle: function(gmapContext, center, radius, options) {
if (gmapContext.circle != null) {
gmapContext.circle.setMap(null);
}
if (radius > 0) {
radius *= 1;
options = $.extend({
strokeColor: "#0000FF",
strokeOpacity: .35,
strokeWeight: 2,
fillColor: "#0000FF",
fillOpacity: .2
}, options);
options.map = gmapContext.map;
options.radius = radius;
options.center = center;
gmapContext.circle = new google.maps.Circle(options);
return gmapContext.circle;
}
return null;
},
setPosition: function(gMapContext, location, callback) {
gMapContext.location = location;
gMapContext.marker.setPosition(location);
gMapContext.map.panTo(location);
this.drawCircle(gMapContext, location, gMapContext.radius, {});
if (gMapContext.settings.enableReverseGeocode) {
this.updateLocationName(gMapContext, callback);
} else {
if (callback) {
callback.call(this, gMapContext);
}
}
},
locationFromLatLng: function(lnlg) {
return {
latitude: lnlg.lat(),
longitude: lnlg.lng()
};
},
addressByFormat: function(addresses, format) {
var result = null;
for (var i = addresses.length - 1; i >= 0; i--) {
if (addresses[i].types.indexOf(format) >= 0) {
result = addresses[i];
}
}
return result || addresses[0];
},
updateLocationName: function(gmapContext, callback) {
gmapContext.geodecoder.geocode({
latLng: gmapContext.marker.position
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length > 0) {
var address = GmUtility.addressByFormat(results, gmapContext.settings.addressFormat);
gmapContext.locationName = address.formatted_address;
gmapContext.addressComponents = GmUtility.address_component_from_google_geocode(address.address_components);
} else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
return setTimeout(function() {
GmUtility.updateLocationName(gmapContext, callback);
}, 1e3);
}
if (callback) {
callback.call(this, gmapContext);
}
});
},
address_component_from_google_geocode: function(address_components) {
var result = {};
for (var i = address_components.length - 1; i >= 0; i--) {
var component = address_components[i];
if (component.types.indexOf("postal_code") >= 0) {
result.postalCode = component.short_name;
} else if (component.types.indexOf("street_number") >= 0) {
result.streetNumber = component.short_name;
} else if (component.types.indexOf("route") >= 0) {
result.streetName = component.short_name;
} else if (component.types.indexOf("locality") >= 0) {
result.city = component.short_name;
} else if (component.types.indexOf("sublocality") >= 0) {
result.district = component.short_name;
} else if (component.types.indexOf("administrative_area_level_1") >= 0) {
result.stateOrProvince = component.short_name;
} else if (component.types.indexOf("country") >= 0) {
result.country = component.short_name;
}
}
result.addressLine1 = [ result.streetNumber, result.streetName ].join(" ").trim();
result.addressLine2 = "";
return result;
}
};
function isPluginApplied(domObj) {
return getContextForElement(domObj) != undefined;
}
function getContextForElement(domObj) {
return $(domObj).data("locationpicker");
}
function updateInputValues(inputBinding, gmapContext) {
if (!inputBinding) return;
var currentLocation = GmUtility.locationFromLatLng(gmapContext.marker.position);
if (inputBinding.latitudeInput) {
inputBinding.latitudeInput.val(currentLocation.latitude).change();
}
if (inputBinding.longitudeInput) {
inputBinding.longitudeInput.val(currentLocation.longitude).change();
}
if (inputBinding.radiusInput) {
inputBinding.radiusInput.val(gmapContext.radius).change();
}
if (inputBinding.locationNameInput) {
inputBinding.locationNameInput.val(gmapContext.locationName).change();
}
}
function setupInputListenersInput(inputBinding, gmapContext) {
if (inputBinding) {
if (inputBinding.radiusInput) {
inputBinding.radiusInput.on("change", function(e) {
var radiusInputValue = $(this).val();
if (!e.originalEvent || isNaN(radiusInputValue)) {
return;
}
gmapContext.radius = radiusInputValue;
GmUtility.setPosition(gmapContext, gmapContext.location, function(context) {
context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]);
});
});
}
if (inputBinding.locationNameInput && gmapContext.settings.enableAutocomplete) {
var blur = false;
gmapContext.autocomplete = new google.maps.places.Autocomplete(inputBinding.locationNameInput.get(0), gmapContext.settings.autocompleteOptions);
google.maps.event.addListener(gmapContext.autocomplete, "place_changed", function() {
blur = false;
var place = gmapContext.autocomplete.getPlace();
if (!place.geometry) {
gmapContext.settings.onlocationnotfound(place.name);
return;
}
GmUtility.setPosition(gmapContext, place.geometry.location, function(context) {
updateInputValues(inputBinding, context);
context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]);
});
});
if (gmapContext.settings.enableAutocompleteBlur) {
inputBinding.locationNameInput.on("change", function(e) {
if (!e.originalEvent) {
return;
}
blur = true;
});
inputBinding.locationNameInput.on("blur", function(e) {
if (!e.originalEvent) {
return;
}
setTimeout(function() {
var address = $(inputBinding.locationNameInput).val();
if (address.length > 5 && blur) {
blur = false;
gmapContext.geodecoder.geocode({
address: address
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results && results.length) {
GmUtility.setPosition(gmapContext, results[0].geometry.location, function(context) {
updateInputValues(inputBinding, context);
context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]);
});
}
});
}
}, 1e3);
});
}
}
if (inputBinding.latitudeInput) {
inputBinding.latitudeInput.on("change", function(e) {
var latitudeInputValue = $(this).val();
if (!e.originalEvent || isNaN(latitudeInputValue)) {
return;
}
GmUtility.setPosition(gmapContext, new google.maps.LatLng(latitudeInputValue, gmapContext.location.lng()), function(context) {
context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]);
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
});
});
}
if (inputBinding.longitudeInput) {
inputBinding.longitudeInput.on("change", function(e) {
var longitudeInputValue = $(this).val();
if (!e.originalEvent || isNaN(longitudeInputValue)) {
return;
}
GmUtility.setPosition(gmapContext, new google.maps.LatLng(gmapContext.location.lat(), longitudeInputValue), function(context) {
context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]);
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
});
});
}
}
}
function autosize(gmapContext) {
google.maps.event.trigger(gmapContext.map, "resize");
setTimeout(function() {
gmapContext.map.setCenter(gmapContext.marker.position);
}, 300);
}
function updateMap(gmapContext, $target, options) {
var settings = $.extend({}, $.fn.locationpicker.defaults, options), latNew = settings.location.latitude, lngNew = settings.location.longitude, radiusNew = settings.radius, latOld = gmapContext.settings.location.latitude, lngOld = gmapContext.settings.location.longitude, radiusOld = gmapContext.settings.radius;
if (latNew == latOld && lngNew == lngOld && radiusNew == radiusOld) return;
gmapContext.settings.location.latitude = latNew;
gmapContext.settings.location.longitude = lngNew;
gmapContext.radius = radiusNew;
GmUtility.setPosition(gmapContext, new google.maps.LatLng(gmapContext.settings.location.latitude, gmapContext.settings.location.longitude), function(context) {
setupInputListenersInput(gmapContext.settings.inputBinding, gmapContext);
context.settings.oninitialized($target);
});
}
$.fn.locationpicker = function(options, params) {
if (typeof options == "string") {
var _targetDomElement = this.get(0);
if (!isPluginApplied(_targetDomElement)) return;
var gmapContext = getContextForElement(_targetDomElement);
switch (options) {
case "location":
if (params == undefined) {
var location = GmUtility.locationFromLatLng(gmapContext.location);
location.radius = gmapContext.radius;
location.name = gmapContext.locationName;
return location;
} else {
if (params.radius) {
gmapContext.radius = params.radius;
}
GmUtility.setPosition(gmapContext, new google.maps.LatLng(params.latitude, params.longitude), function(gmapContext) {
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
});
}
break;
case "subscribe":
if (params == undefined) {
return null;
} else {
var event = params.event;
var callback = params.callback;
if (!event || !callback) {
console.error('LocationPicker: Invalid arguments for method "subscribe"');
return null;
}
google.maps.event.addListener(gmapContext.map, event, callback);
}
break;
case "map":
if (params == undefined) {
var locationObj = GmUtility.locationFromLatLng(gmapContext.location);
locationObj.formattedAddress = gmapContext.locationName;
locationObj.addressComponents = gmapContext.addressComponents;
return {
map: gmapContext.map,
marker: gmapContext.marker,
location: locationObj
};
} else {
return null;
}
case "autosize":
autosize(gmapContext);
return this;
}
return null;
}
return this.each(function() {
var $target = $(this);
if (isPluginApplied(this)) {
updateMap(getContextForElement(this), $(this), options);
return;
}
var settings = $.extend({}, $.fn.locationpicker.defaults, options);
var gmapContext = new GMapContext(this, $.extend({}, {
zoom: settings.zoom,
center: new google.maps.LatLng(settings.location.latitude, settings.location.longitude),
mapTypeId: settings.mapTypeId,
mapTypeControl: false,
styles: settings.styles,
disableDoubleClickZoom: false,
scrollwheel: settings.scrollwheel,
streetViewControl: false,
radius: settings.radius,
locationName: settings.locationName,
settings: settings,
autocompleteOptions: settings.autocompleteOptions,
addressFormat: settings.addressFormat,
draggable: settings.draggable,
markerIcon: settings.markerIcon,
markerDraggable: settings.markerDraggable,
markerVisible: settings.markerVisible
}, settings.mapOptions));
$target.data("locationpicker", gmapContext);
function displayMarkerWithSelectedArea() {
GmUtility.setPosition(gmapContext, gmapContext.marker.position, function(context) {
var currentLocation = GmUtility.locationFromLatLng(gmapContext.location);
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
context.settings.onchanged.apply(gmapContext.domContainer, [ currentLocation, context.radius, true ]);
});
}
if (settings.markerInCenter) {
gmapContext.map.addListener("bounds_changed", function() {
if (!gmapContext.marker.dragging) {
gmapContext.marker.setPosition(gmapContext.map.center);
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
}
});
gmapContext.map.addListener("idle", function() {
if (!gmapContext.marker.dragging) {
displayMarkerWithSelectedArea();
}
});
}
google.maps.event.addListener(gmapContext.marker, "drag", function(event) {
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
});
google.maps.event.addListener(gmapContext.marker, "dragend", function(event) {
displayMarkerWithSelectedArea();
});
GmUtility.setPosition(gmapContext, new google.maps.LatLng(settings.location.latitude, settings.location.longitude), function(context) {
updateInputValues(settings.inputBinding, gmapContext);
setupInputListenersInput(settings.inputBinding, gmapContext);
context.settings.oninitialized($target);
});
});
};
$.fn.locationpicker.defaults = {
location: {
latitude: 40.7324319,
longitude: -73.82480777777776
},
locationName: "",
radius: 500,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
styles: [],
mapOptions: {},
scrollwheel: true,
inputBinding: {
latitudeInput: null,
longitudeInput: null,
radiusInput: null,
locationNameInput: null
},
enableAutocomplete: false,
enableAutocompleteBlur: false,
autocompleteOptions: null,
addressFormat: "postal_code",
enableReverseGeocode: true,
draggable: true,
onchanged: function(currentLocation, radius, isMarkerDropped) {},
onlocationnotfound: function(locationName) {},
oninitialized: function(component) {},
markerIcon: undefined,
markerDraggable: true,
markerVisible: true
};
})(jQuery);

View File

@@ -10,7 +10,7 @@ function sp_viewport() {
(function($) {
/* Header */
if ( ! $('.sp-header').size() ) {
if ( ! $('.sp-header').length ) {
$('body').prepend( '<div class="sp-header sp-header-loaded"></div>' );
}
@@ -116,4 +116,4 @@ function sp_viewport() {
}
});
})(jQuery);
})(jQuery);

View File

@@ -1,5 +1,111 @@
== SportsPress Changelog ==
= 2.7.8 =
* Fix - Event results, box scores, and players stats not updating via REST API.
= 2.7.7 =
* Fix - Events not appearing due to filter malfunction.
= 2.7.6 =
* Feature - Add ability to bulk set events as on time.
* Fix - Players in events not being filtered by team.
= 2.7.5 =
* Tweak - Add ability to filter events by team and match day in one query.
* Tweak - Improve performance by updating leaflet script and only loading when required.
* Tweak - Add overtime notation compatibility for minutes played.
* Fix - Issue with event edit page where the scripts were not working.
* Fix - No records when format is default in event list shortcode.
= 2.7.4 =
* Tweak - Add option to display birthday, age, or both in birthdays widget.
* Fix - Player list data showing zeroes in some cases.
= 2.7.3 =
* Compatibility - Tested for compatibility with WordPress 5.5 with changes made where necessary.
* Tweak - Avoid showing minutes box for subs when not needed.
* Tweak - Improve filtering speed for queries without leagues or seasons.
* Tweak - Apply reverse order setting in event lists.
* Tweak - Enable filtering a player's events played on a specific team.
* Fix - Include future events in REST API for WordPress 5.5.
* Fix - Enable updating player metrics using the REST API.
* Fix - Deprecated code for PHP 7.4.
* Fix - Elementor compatibility.
* Localization - Update country names for Czechia, North Macedonia, Myanmar, and Eswatini.
* Localization - Adjust RTL stylesheet for event performance icons.
= 2.7.2 =
* Tweak - Sanitize delimiter field in event settings.
= 2.7.1 =
* Feature - Enable player list filtering by nationality.
* Feature - Add option to display date of birth in player lists.
* Tweak - Exclude postponed and canceled events from countdowns.
* Tweak - Apply reverse order option to event results.
* Tweak - When a team has more than one home venue, separate with commas.
* Fix - Venue address containing pluses in events.
* Fix - Event blocks showing the wrong dates when embedded within other event pages.
* Fix - Statistics not adding manual values when not based on equations.
* Fix - Event lists ignoring the format parameter.
* Fix - League table order when displaying multiple tables in team profiles.
* Fix - Error when deleting configuration columns.
* Fix - Player lists not including past players in some cases.
* Fix - Prevent error when viewing event calendar in some cases.
= 2.7 =
* Feature - New bulk actions to postpone and cancel multiple events.
* Feature - Add date of birth to player importer.
* Feature - Automatically select the home team's venue as the default venue when importing fixtures.
* Feature - Add ability to turn on comment for team profiles.
* Feature - Filter league tables by event status.
* Tweak - When an icon is used for player performance, display the icon in player lists and profiles.
* Tweak - Add title attribute for player statistic icons.
* Tweak - Default stylesheet sorting icon width.
* Fix - Icon color picker rendering issue.
* Fix - Image selector not working for player statistics.
* Fix - Enqueue scripts and styles for OpenStreetMap when used in shortcodes.
* Localization - Add translation options for countdown units.
= 2.6.20 =
* Tweak - Improve compatibility with volleyball for checkbox performance.
* Preset - Update volleyball preset with additional options.
= 2.6.19 =
* Feature - Enable filtering calendars base on players.
* Feature - Add checkbox type to event performance.
* Fix - Javascript error when columns are hidden in event list.
* Fix - Notice when displaying staff in event performance table.
* Fix - Notice when event results are empty.
* Fix - Uncaught error in player class.
* Preset - Update volleyball preset using checkbox performance type.
= 2.6.18 =
* Fix - Prevent OpenStreetMap scripts from loading when Google Maps is active via SportsPress Pro.
* Fix - Headers already sent error related to default nationality module.
= 2.6.17 =
* Tweak - Only show welcome screen on major version upgrade.
* Tweak - Add filters to enable career totals calculation with extensions.
* Fix - Countdowns not reflecting timezone setting.
= 2.6.16 =
* Tweak - Add support for updated baseball extension with partial innings.
* Fix - Error displaying staff in events when offense and defense are separate tables.
= 2.6.15 =
* Important - Using Google Maps will require a SportsPress Pro license after August 31, 2019.
* Refactor - Fallback to OpenStreetMap for venue maps without SportsPress Pro.
* Feature - Option to display team logos instead of team names in player lists.
* Feature - Option to display custom specs in event blocks and event lists.
* Tweak - Improve page load speed when creating new league tables.
* Tweak - Prevent displaying events other than published or scheduled.
* Fix - Icons only appearing in the first table when player lists are grouped.
* Fix - Character encoding and CRLF errors in calendar feeds.
* Fix - Missing field location Schema error.
* Fix - Dropdowns collapsing in admin when meta boxes are hidden.
* Fix - Timezone handling in countdowns.
* Fix - Error when using special characters in admin settings.
= 2.6.14 =
* Fix - API endpoints for secondary post types.

View File

@@ -1,5 +1,5 @@
Number,Name,Positions,Teams,Leagues,Seasons,Nationality
1,Joe Allen,Goalkeeper,Eagles,Primary League|Secondary League,2014,aus
3,Steven Gerrard,Defender,Kangaroos,Primary League,2014|2013,usa
5,Daniel Sturridge,Midfielder|Forward,Sharks,Primary League|Secondary League,2014|2013,eng
6,Gabrielle Gonzalez,Forward,Kangaroos|Sharks,Primary League,2014,esp
Number,Name,Positions,Teams,Leagues,Seasons,Nationality,DoB
1,Joe Allen,Goalkeeper,Eagles,Primary League|Secondary League,2014,aus,1983/05/05
3,Steven Gerrard,Defender,Kangaroos,Primary League,2014|2013,usa,1970/03/10
5,Daniel Sturridge,Midfielder|Forward,Sharks,Primary League|Secondary League,2014|2013,eng,1990/02/15
6,Gabrielle Gonzalez,Forward,Kangaroos|Sharks,Primary League,2014,esp,1987/01/20
1 Number Name Positions Teams Leagues Seasons Nationality DoB
2 1 Joe Allen Goalkeeper Eagles Primary League|Secondary League 2014 aus 1983/05/05
3 3 Steven Gerrard Defender Kangaroos Primary League 2014|2013 usa 1970/03/10
4 5 Daniel Sturridge Midfielder|Forward Sharks Primary League|Secondary League 2014|2013 eng 1990/02/15
5 6 Gabrielle Gonzalez Forward Kangaroos|Sharks Primary League 2014 esp 1987/01/20

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Feeds
* @package SportsPress/Feeds
* @version 2.6.9
* @version 2.7.5
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -29,24 +29,24 @@ $timezone = sanitize_option( 'timezone_string', get_option( 'timezone_string' )
// Get the URL
$url = add_query_arg( 'feed', 'sp-ical', get_post_permalink( $post ) );
$url = wordwrap( $url , 60, "\n\t", true );
$url = wordwrap( $url , 60, "\r\n\t", true );
$output =
"BEGIN:VCALENDAR\n" .
"VERSION:2.0\n" .
"PRODID:-//ThemeBoy//SportsPress//" . strtoupper( $locale ) . "\n" .
"CALSCALE:GREGORIAN\n" .
"METHOD:PUBLISH\n" .
"URL:" . $url . "\n" .
"X-FROM-URL:" . $url . "\n" .
"NAME:" . $post->post_title . "\n" .
"X-WR-CALNAME:" . $post->post_title . "\n" .
"DESCRIPTION:" . $post->post_title . "\n" .
"X-WR-CALDESC:" . $post->post_title . "\n" .
"REFRESH-INTERVAL;VALUE=DURATION:PT2M\n" .
"X-PUBLISHED-TTL:PT2M\n" .
"TZID:" . $timezone . "\n" .
"X-WR-TIMEZONE:" . $timezone . "\n";
"BEGIN:VCALENDAR\r\n" .
"VERSION:2.0\r\n" .
"PRODID:-//ThemeBoy//SportsPress//" . strtoupper( $locale ) . "\r\n" .
"CALSCALE:GREGORIAN\r\n" .
"METHOD:PUBLISH\r\n" .
"URL:" . $url . "\r\n" .
"X-FROM-URL:" . $url . "\r\n" .
"NAME:" . $post->post_title . "\r\n" .
"X-WR-CALNAME:" . $post->post_title . "\r\n" .
"DESCRIPTION:" . $post->post_title . "\r\n" .
"X-WR-CALDESC:" . $post->post_title . "\r\n" .
"REFRESH-INTERVAL;VALUE=DURATION:PT2M\r\n" .
"X-PUBLISHED-TTL:PT2M\r\n" .
"TZID:" . $timezone . "\r\n" .
"X-WR-TIMEZONE:" . $timezone . "\r\n";
// Loop through each event
foreach ( $events as $event):
@@ -96,7 +96,7 @@ foreach ( $events as $event):
$geo = false;
}
}
$location = wordwrap( $location , 60, "\n\t" );
$location = wordwrap( $location , 60, "\r\n\t" );
// Get title or write summary based on scores
$results = array();
@@ -134,31 +134,36 @@ foreach ( $events as $event):
} else {
$summary = $event->post_title;
}
//Convert &#[0-9]+ entities to UTF-8
$summary = preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $summary);
$summary = apply_filters( 'sportspress_ical_feed_summary', $summary, $event );
// Append to output string
$output .=
"BEGIN:VEVENT\n" .
"SUMMARY:" . preg_replace('/([\,;])/','\\\$1', $summary) . "\n" .
"UID:$event->ID\n" .
"STATUS:CONFIRMED\n" .
"DTSTAMP:19700101T000000\n".
"DTSTART:" . mysql2date( $date_format, $event->post_date ) . "\n" .
"DTEND:" . $end->format( $date_format ) . "\n" .
"LAST-MODIFIED:" . mysql2date( $date_format, $event->post_modified_gmt ) . "\n";
"BEGIN:VEVENT\r\n" .
"SUMMARY:" . preg_replace( '/([\,;])/','\\\$1', $summary ) . "\r\n" .
"UID:$event->ID\r\n" .
"STATUS:CONFIRMED\r\n" .
"DTSTAMP:19700101T000000\r\n".
"DTSTART:" . mysql2date( $date_format, $event->post_date ) . "\r\n" .
"DTEND:" . $end->format( $date_format ) . "\r\n" .
"LAST-MODIFIED:" . mysql2date( $date_format, $event->post_modified_gmt ) . "\r\n";
if ( $description ) {
$output .= "DESCRIPTION:" . $description . "\n";
$output .= "DESCRIPTION:" . $description . "\r\n";
}
if ( $location ) {
$output .= "LOCATION:" . $location . "\n";
$output .= "LOCATION:" . $location . "\r\n";
}
if ( $geo ) {
$output .= "GEO:" . $geo . "\n";
$output .= "GEO:" . $geo . "\r\n";
}
$output .= "END:VEVENT\n";
$output .= "END:VEVENT\r\n";
endforeach;
// End output

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin
* @version 2.6.8
* @version 2.6.15
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -84,12 +84,6 @@ class SP_Admin_Assets {
wp_register_script( 'jquery-fitvids', SP()->plugin_url() . '/assets/js/jquery.fitvids.js', array( 'jquery' ), '1.1', true );
wp_register_script( 'google-maps', '//tboy.co/maps_js' );
wp_register_script( 'jquery-locationpicker', SP()->plugin_url() . '/assets/js/locationpicker.jquery.js', array( 'jquery', 'google-maps' ), '0.1.6', true );
wp_register_script( 'sportspress-admin-locationpicker', SP()->plugin_url() . '/assets/js/admin/locationpicker.js', array( 'jquery', 'google-maps', 'jquery-locationpicker' ), SP_VERSION, true );
wp_register_script( 'sportspress-admin-equationbuilder', SP()->plugin_url() . '/assets/js/admin/equationbuilder.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable' ), SP_VERSION, true );
wp_register_script( 'sportspress-admin-colorpicker', SP()->plugin_url() . '/assets/js/admin/colorpicker.js', array( 'jquery', 'wp-color-picker', 'iris' ), SP_VERSION, true );
@@ -130,13 +124,6 @@ class SP_Admin_Assets {
wp_enqueue_script( 'sportspress-admin-widgets' );
}
// Edit venue pages
if ( in_array( $screen->id, array( 'edit-sp_venue' ) ) ) {
wp_enqueue_script( 'google-maps' );
wp_enqueue_script( 'jquery-locationpicker' );
wp_enqueue_script( 'sportspress-admin-locationpicker' );
}
// Edit color
if ( in_array( $screen->id, array( 'sp_outcome' ) ) ) {
wp_enqueue_script( 'sportspress-admin-colorpicker' );

View File

@@ -31,6 +31,7 @@ class SP_Admin_Dashboard {
* Init dashboard widgets
*/
public function init() {
wp_add_dashboard_widget( 'sportspress_dashboard_news', __( 'Sports News', 'sportspress' ), array( $this, 'news_widget' ), null, null, 'side' );
wp_add_dashboard_widget( 'sportspress_dashboard_status', __( 'SportsPress', 'sportspress' ), array( $this, 'status_widget' ) );
add_filter( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 );
}
@@ -63,37 +64,61 @@ class SP_Admin_Dashboard {
* Show status widget
*/
public function status_widget() {
?>
<ul class="sp_status_list">
<?php
$count = wp_count_posts( 'sp_event' );
$scheduled_count = isset( $count->future ) ? $count->future : 0;
$published_count = isset( $count->publish ) ? $count->publish : 0;
$next_event = sp_get_next_event();
if ( $next_event ):
$now = new DateTime( current_time( 'mysql', 0 ) );
$date = new DateTime( $next_event->post_date );
$interval = date_diff( $now, $date );
?>
<li class="countdown" data-countdown="<?php echo str_replace( '-', '/', get_gmt_from_date( $next_event->post_date ) ); ?>">
<a href="<?php echo get_edit_post_link( $next_event->ID ); ?>">
<?php printf( __( '<strong>%s</strong> until next event', 'sportspress' ), $interval->days . ' ' . __( 'days', 'sportspress' ) . ' ' . sprintf( '%02s:%02s:%02s', $interval->h, $interval->i, $interval->s ) ); ?>
(<?php echo $next_event->post_title; ?>)
</a>
</li>
<?php endif; ?>
<li class="events-scheduled">
<a href="<?php echo admin_url( 'edit.php?post_type=sp_event&post_status=future' ); ?>">
<?php printf( _n( '<strong>%s event</strong> scheduled', '<strong>%s events</strong> scheduled', $scheduled_count, 'sportspress' ), $scheduled_count ); ?>
</a>
</li>
<li class="events-published">
<a href="<?php echo admin_url( 'edit.php?post_type=sp_event&post_status=publish' ); ?>">
<?php printf( _n( '<strong>%s event</strong> published', '<strong>%s events</strong> published', $published_count, 'sportspress' ), $published_count ); ?>
</a>
</li>
?>
<ul class="sp_status_list">
<?php
$count = wp_count_posts( 'sp_event' );
$scheduled_count = isset( $count->future ) ? $count->future : 0;
$published_count = isset( $count->publish ) ? $count->publish : 0;
$next_event = sp_get_next_event();
if ( $next_event ):
$now = new DateTime( current_time( 'mysql', 0 ) );
$date = new DateTime( $next_event->post_date );
$interval = date_diff( $now, $date );
?>
<li class="countdown" data-countdown="<?php echo str_replace( '-', '/', get_gmt_from_date( $next_event->post_date ) ); ?>">
<a href="<?php echo get_edit_post_link( $next_event->ID ); ?>">
<?php printf( __( '<strong>%s</strong> until next event', 'sportspress' ), $interval->days . ' ' . __( 'days', 'sportspress' ) . ' ' . sprintf( '%02s:%02s:%02s', $interval->h, $interval->i, $interval->s ) ); ?>
(<?php echo $next_event->post_title; ?>)
</a>
</li>
<?php endif; ?>
<li class="events-scheduled">
<a href="<?php echo admin_url( 'edit.php?post_type=sp_event&post_status=future' ); ?>">
<?php printf( _n( '<strong>%s event</strong> scheduled', '<strong>%s events</strong> scheduled', $scheduled_count, 'sportspress' ), $scheduled_count ); ?>
</a>
</li>
<li class="events-published">
<a href="<?php echo admin_url( 'edit.php?post_type=sp_event&post_status=publish' ); ?>">
<?php printf( _n( '<strong>%s event</strong> published', '<strong>%s events</strong> published', $published_count, 'sportspress' ), $published_count ); ?>
</a>
</li>
</ul>
<?php
}
/**
* Show news widget
*/
public function news_widget() {
$rss = fetch_feed("https://tboy.co/sportsnews/");
if (!is_wp_error($rss)) { // Checks that the object is created correctly
// Figure out how many total items there are, but limit it to 2.
$maxitems = $rss->get_item_quantity(5);
// Build an array of all the items, starting with element 0 (first element).
$rss_items = $rss->get_items(0, $maxitems);
}
if (!empty($maxitems)) {
?>
<div class="rss-widget">
<ul>
<?php foreach ($rss_items as $item) { ?>
<li><a class="rsswidget" href="<?php echo $item->get_permalink(); ?>" target="_blank"><?php echo $item->get_title(); ?></a> <span class="rss-date"><?php echo $item->get_date('j F Y'); ?></span></li>
<?php } ?>
</ul>
<?php
</div>
<?php
}
}
}

View File

@@ -268,7 +268,7 @@ class SP_Admin_Menus {
$submenu_file = $s;
}
public static function sitemap_taxonomy_post_types( $post_types = array(), $taxonomy ) {
public static function sitemap_taxonomy_post_types( $post_types = array(), $taxonomy = 'sp_venue' ) {
$post_types = array_intersect( $post_types, sp_primary_post_types() );
// Remove teams from venues taxonomy post type array
if ( $taxonomy === 'sp_venue' && ( $key = array_search( 'sp_team', $post_types ) ) !== false ):

View File

@@ -171,7 +171,7 @@ class SP_Admin_Settings {
// Array value
if ( strstr( $option_name, '[' ) ) {
parse_str( $option_name, $option_array );
parse_str( html_entity_decode( $option_name ), $option_array );
// Option name is first key
$option_name = current( array_keys( $option_array ) );

View File

@@ -9,7 +9,7 @@
* @author WooThemes
* @category Admin
* @package SportsPress/Admin
* @version 2.6.7
* @version 2.6.15
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
@@ -101,11 +101,9 @@ class SP_Admin_Setup_Wizard {
wp_register_script( 'chosen', SP()->plugin_url() . '/assets/js/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true );
wp_register_script( 'jquery-tiptip', SP()->plugin_url() . '/assets/js/jquery.tipTip.min.js', array( 'jquery' ), '1.3', true );
wp_register_script( 'google-maps', '//tboy.co/maps_js' );
wp_register_script( 'sportspress-setup', SP()->plugin_url() . '/assets/js/admin/sportspress-setup.js', array( 'jquery', 'chosen', 'jquery-tiptip' ), SP_VERSION, true );
wp_register_script( 'jquery-locationpicker', SP()->plugin_url() . '/assets/js/locationpicker.jquery.js', array( 'jquery', 'google-maps' ), '0.1.6', true );
wp_register_script( 'sportspress-admin-locationpicker', SP()->plugin_url() . '/assets/js/admin/locationpicker.js', array( 'jquery', 'jquery-locationpicker' ), SP_VERSION, true );
do_action( 'sp_setup_geocoder_scripts' );
$strings = apply_filters( 'sportspress_localized_strings', array(
'none' => __( 'None', 'sportspress' ),
@@ -115,8 +113,6 @@ class SP_Admin_Setup_Wizard {
// Localize scripts
wp_localize_script( 'sportspress-setup', 'localized_strings', $strings );
wp_enqueue_script( 'google-maps' );
if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
call_user_func( $this->steps[ $this->step ]['handler'] );
}
@@ -517,6 +513,7 @@ class SP_Admin_Setup_Wizard {
* Venue Step.
*/
public function sp_setup_venue() {
do_action( 'sp_setup_venue_geocoder_scripts' );
?>
<h1><?php _e( 'Venue Setup', 'sportspress' ); ?></h1>
<form method="post">
@@ -531,11 +528,11 @@ class SP_Admin_Setup_Wizard {
<tr>
<th scope="row"><?php _e( 'Address', 'sportspress' ); ?></th>
<td>
<input name="address" class="sp-address" type="text">
<div class="sp-location-picker"></div>
<input name="address" id="sp_address" class="sp-address" type="text" value="Marvel Stadium, Melbourne">
<div id="sp-location-picker" class="sp-location-picker" style="width: 95%; height: 320px"></div>
<p class="description"><?php _e( "Drag the marker to the venue's location.", 'sportspress' ); ?></p>
<input name="latitude" class="sp-latitude" type="hidden" value="40.7324319">
<input name="longitude" class="sp-longitude" type="hidden" value="-73.82480799999996">
<input name="latitude" id="sp_latitude" class="sp-latitude" type="hidden" value="-37.8165647">
<input name="longitude" id="sp_longitude" class="sp-longitude" type="hidden" value="144.9475055">
</td>
</tr>
</table>
@@ -546,8 +543,8 @@ class SP_Admin_Setup_Wizard {
<?php wp_nonce_field( 'sp-setup' ); ?>
</p>
</form>
<?php wp_print_scripts( 'sportspress-admin-locationpicker' ); ?>
<?php
do_action( 'sp_admin_geocoder_scripts' );
}
/**

View File

@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) {
* Handles taxonomies in admin
*
* @class SP_Admin_Taxonomies
* @version 2.6.9
* @version 2.6.15
* @package SportsPress/Admin
* @category Class
* @author ThemeBoy
@@ -103,21 +103,24 @@ class SP_Admin_Taxonomies {
$term = reset( $terms );
$t_id = $term->term_id;
$term_meta = get_option( "taxonomy_$t_id" );
$latitude = sp_array_value( $term_meta, 'sp_latitude', '40.7324319' );
$longitude = sp_array_value( $term_meta, 'sp_longitude', '-73.82480799999996' );
$latitude = sp_array_value( $term_meta, 'sp_latitude', '-37.8165647' );
$longitude = sp_array_value( $term_meta, 'sp_longitude', '144.9475055' );
$address = sp_array_value( $term_meta, 'sp_address', '' );
endif;
// Sanitize latitude and longitude, fallback to default.
if( ! is_numeric( $latitude) || ! is_numeric( $longitude) ):
$latitude = '40.7324319';
$longitude = '-73.82480799999996';
$latitude = '-37.8165647';
$longitude = '144.9475055';
endif;
?>
<div class="form-field">
<label for="term_meta[sp_address]"><?php _e( 'Address', 'sportspress' ); ?></label>
<input type="text" class="sp-address" name="term_meta[sp_address]" id="term_meta[sp_address]" value="">
<p><div class="sp-location-picker"></div></p>
<div id="sp-location-picker" class="sp-location-picker" style="width: 95%; height: 320px"></div>
<p><?php _e( "Drag the marker to the venue's location.", 'sportspress' ); ?></p>
</div>
<div class="form-field">
<label for="term_meta[sp_address]"><?php _e( 'Address', 'sportspress' ); ?></label>
<input type="text" class="sp-address" name="term_meta[sp_address]" id="term_meta[sp_address]" value="<?php echo esc_attr( $address ); ?>">
</div>
<div class="form-field">
<label for="term_meta[sp_latitude]"><?php _e( 'Latitude', 'sportspress' ); ?></label>
<input type="text" class="sp-latitude" name="term_meta[sp_latitude]" id="term_meta[sp_latitude]" value="<?php echo esc_attr( $latitude ); ?>">
@@ -127,6 +130,7 @@ class SP_Admin_Taxonomies {
<input type="text" class="sp-longitude" name="term_meta[sp_longitude]" id="term_meta[sp_longitude]" value="<?php echo esc_attr( $longitude ); ?>">
</div>
<?php
do_action( 'sp_admin_geocoder_scripts' );
}
/**
@@ -137,28 +141,37 @@ class SP_Admin_Taxonomies {
*/
public function edit_venue_fields( $term ) {
$t_id = $term->term_id;
$term_meta = get_option( "taxonomy_$t_id" ); ?>
$term_meta = get_option( "taxonomy_$t_id" );
$latitude = is_numeric( esc_attr( $term_meta['sp_latitude'] ) ) ? esc_attr( $term_meta['sp_latitude'] ) : '';
$longitude = is_numeric( esc_attr( $term_meta['sp_longitude'] ) ) ? esc_attr( $term_meta['sp_longitude'] ) : '';
$address = esc_attr( $term_meta['sp_address'] ) ? esc_attr( $term_meta['sp_address'] ) : '';
?>
<tr class="form-field">
<td colspan="2">
<p><div id="sp-location-picker" class="sp-location-picker" style="width: 95%; height: 320px"></div></p>
<p class="description"><?php _e( "Drag the marker to the venue's location.", 'sportspress' ); ?></p>
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="term_meta[sp_address]"><?php _e( 'Address', 'sportspress' ); ?></label></th>
<td>
<input type="text" class="sp-address" name="term_meta[sp_address]" id="term_meta[sp_address]" value="<?php echo esc_attr( $term_meta['sp_address'] ) ? esc_attr( $term_meta['sp_address'] ) : ''; ?>">
<p><div class="sp-location-picker"></div></p>
<p class="description"><?php _e( "Drag the marker to the venue's location.", 'sportspress' ); ?></p>
<input type="text" class="sp-address" name="term_meta[sp_address]" id="term_meta[sp_address]" value="<?php echo $address; ?>">
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="term_meta[sp_latitude]"><?php _e( 'Latitude', 'sportspress' ); ?></label></th>
<td>
<input type="text" class="sp-latitude" name="term_meta[sp_latitude]" id="term_meta[sp_latitude]" value="<?php echo is_numeric( esc_attr( $term_meta['sp_latitude'] ) ) ? esc_attr( $term_meta['sp_latitude'] ) : ''; ?>">
<input type="text" class="sp-latitude" name="term_meta[sp_latitude]" id="term_meta[sp_latitude]" value="<?php echo $latitude; ?>">
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="term_meta[sp_longitude]"><?php _e( 'Longitude', 'sportspress' ); ?></label></th>
<td>
<input type="text" class="sp-longitude" name="term_meta[sp_longitude]" id="term_meta[sp_longitude]" value="<?php echo is_numeric( esc_attr( $term_meta['sp_longitude'] ) ) ? esc_attr( $term_meta['sp_longitude'] ) : ''; ?>">
<input type="text" class="sp-longitude" name="term_meta[sp_longitude]" id="term_meta[sp_longitude]" value="<?php echo $longitude; ?>">
</td>
</tr>
<?php
do_action( 'sp_admin_geocoder_scripts' );
}
/**

View File

@@ -9,7 +9,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin
* @version 2.6
* @version 2.6.17
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -383,7 +383,7 @@ class SP_Admin_Welcome {
public function welcome() {
// Bail if no activation redirect transient is set
if ( ! get_transient( '_sp_activation_redirect' ) )
if ( ! get_transient( '_sp_activation_redirect' ) )
return;
// Delete the redirect transient

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Importers
* @version 2.5
* @version 2.7.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -472,9 +472,14 @@ if ( class_exists( 'WP_Importer' ) ) {
<td class="forminp forminp-radio" id="sp_formatdiv">
<fieldset id="post-formats-select">
<ul>
<li><input type="radio" name="sp_format" class="post-format" id="post-format-league" value="league" checked="checked"> <label for="post-format-league" class="post-format-icon post-format-league"><?php _e( 'Competitive', 'sportspress' ); ?></label></li>
<li><input type="radio" name="sp_format" class="post-format" id="post-format-friendly" value="friendly"> <label for="post-format-friendly" class="post-format-icon post-format-friendly"><?php _e( 'Friendly', 'sportspress' ); ?></label></li>
<br>
<?php
foreach( (new SP_Formats)->event as $name => $title ) {
?>
<li><input type="radio" name="sp_format" class="post-format" id="post-format-<?php echo $name; ?>" value="<?php echo $name; ?>" checked="checked"> <label for="post-format-<?php echo $name; ?>" class="post-format-icon post-format-<?php echo $name; ?>"><?php echo $title; ?></label></li>
<?php
}
?>
</ul>
</fieldset>
</td>
</tr>

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Importers
* @version 2.5
* @version 2.7
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -138,6 +138,11 @@ if ( class_exists( 'WP_Importer' ) ) {
endif;
// Update venue
if ( $venue == '' ) {
$team = reset( $teams );
$team_object = get_page_by_title( stripslashes( $team ), OBJECT, 'sp_team' );
$venue = sp_get_the_term_id( $team_object->ID, 'sp_venue' );
}
wp_set_object_terms( $id, $venue, 'sp_venue', false );
// Update match day

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Importers
* @version 2.6.9
* @version 2.7
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -30,6 +30,7 @@ if ( class_exists( 'WP_Importer' ) ) {
'sp_league' => __( 'Leagues', 'sportspress' ),
'sp_season' => __( 'Seasons', 'sportspress' ),
'sp_nationality' => __( 'Nationality', 'sportspress' ),
'post_date' => __( 'Date of Birth', 'sportspress' ),
);
parent::__construct();
}
@@ -51,6 +52,9 @@ if ( class_exists( 'WP_Importer' ) ) {
endif;
$rows = array_chunk( $array, sizeof( $columns ) );
// Get Date of Birth format from post vars
$date_format = ( empty( $_POST['sp_date_format'] ) ? 'yyyy/mm/dd' : $_POST['sp_date_format'] );
foreach ( $rows as $row ):
@@ -69,7 +73,7 @@ if ( class_exists( 'WP_Importer' ) ) {
'sp_season',
);
foreach ( $preservable_metas_keys as $p ) {
$meta[ $key ] = '';
$meta[ $p ] = '';
}
foreach ( $columns as $index => $key ):
@@ -77,6 +81,27 @@ if ( class_exists( 'WP_Importer' ) ) {
endforeach;
$name = sp_array_value( $meta, 'post_title' );
$date = sp_array_value( $meta, 'post_date' );
// Format date of birth
$date = str_replace( '/', '-', trim( $date ) );
$date_array = explode( '-', $date );
switch ( $date_format ):
case 'dd/mm/yyyy':
$date = substr( str_pad( sp_array_value( $date_array, 2, '0000' ), 4, '0', STR_PAD_LEFT ), 0, 4 ) . '-' .
substr( str_pad( sp_array_value( $date_array, 1, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 ) . '-' .
substr( str_pad( sp_array_value( $date_array, 0, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 );
break;
case 'mm/dd/yyyy':
$date = substr( str_pad( sp_array_value( $date_array, 2, '0000' ), 4, '0', STR_PAD_LEFT ), 0, 4 ) . '-' .
substr( str_pad( sp_array_value( $date_array, 0, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 ) . '-' .
substr( str_pad( sp_array_value( $date_array, 1, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 );
break;
default:
$date = substr( str_pad( sp_array_value( $date_array, 0, '0000' ), 4, '0', STR_PAD_LEFT ), 0, 4 ) . '-' .
substr( str_pad( sp_array_value( $date_array, 1, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 ) . '-' .
substr( str_pad( sp_array_value( $date_array, 2, '00' ), 2, '0', STR_PAD_LEFT ), 0, 2 );
endswitch;
if ( ! $name ):
$this->skipped++;
@@ -97,6 +122,10 @@ if ( class_exists( 'WP_Importer' ) ) {
}
else:
$args = array( 'post_type' => 'sp_player', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $name ) );
// Check if a DoB was set
if( '0000-00-00' !== $date ){
$args['post_date'] = $date;
}
$id = wp_insert_post( $args );
// Flag as import
@@ -195,7 +224,7 @@ if ( class_exists( 'WP_Importer' ) ) {
function greet() {
echo '<div class="narrow">';
echo '<p>' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'</p>';
echo '<p>' . sprintf( __( 'Players need to be defined with columns in a specific order (7 columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/players-sample.csv' ) . '</p>';
echo '<p>' . sprintf( __( 'Players need to be defined with columns in a specific order (8 columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/players-sample.csv' ) . '</p>';
wp_import_upload_form( 'admin.php?import=sp_player_csv&step=1' );
echo '</div>';
}
@@ -210,6 +239,26 @@ if ( class_exists( 'WP_Importer' ) ) {
?>
<table class="form-table">
<tbody>
<tr>
<th scope="row" class="titledesc">
<?php _e( 'Date of Birth Format', 'sportspress' ); ?>
</th>
<td class="forminp forminp-radio">
<fieldset>
<ul>
<li>
<label><input name="sp_date_format" value="yyyy/mm/dd" type="radio" checked> yyyy/mm/dd</label>
</li>
<li>
<label><input name="sp_date_format" value="dd/mm/yyyy" type="radio"> dd/mm/yyyy</label>
</li>
<li>
<label><input name="sp_date_format" value="mm/dd/yyyy" type="radio"> mm/dd/yyyy</label>
</li>
</ul>
</fieldset>
</td>
</tr>
<tr>
<td>
<label>

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Post_Types
* @version 2.6.5
* @version 2.7.7
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -44,6 +44,9 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
// Filtering
add_action( 'restrict_manage_posts', array( $this, 'filters' ) );
add_filter( 'parse_query', array( $this, 'filters_query' ) );
// Post states
add_filter( 'display_post_states', array( $this, 'post_states' ), 10, 2 );
// Call SP_Admin_CPT constructor
parent::__construct();
@@ -259,7 +262,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
if ( $typenow != 'sp_event' )
return;
$selected = isset( $_REQUEST['team'] ) ? $_REQUEST['team'] : null;
$selected = isset( $_REQUEST['team'] ) ? esc_attr( $_REQUEST['team'] ) : null;
$args = array(
'post_type' => 'sp_team',
'name' => 'team',
@@ -269,7 +272,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
);
wp_dropdown_pages( $args );
$selected = isset( $_REQUEST['sp_league'] ) ? $_REQUEST['sp_league'] : null;
$selected = isset( $_REQUEST['sp_league'] ) ? esc_attr( $_REQUEST['sp_league'] ) : null;
$args = array(
'show_option_all' => __( 'Show all leagues', 'sportspress' ),
'taxonomy' => 'sp_league',
@@ -278,7 +281,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
);
sp_dropdown_taxonomies( $args );
$selected = isset( $_REQUEST['sp_season'] ) ? $_REQUEST['sp_season'] : null;
$selected = isset( $_REQUEST['sp_season'] ) ? esc_attr( $_REQUEST['sp_season'] ) : null;
$args = array(
'show_option_all' => __( 'Show all seasons', 'sportspress' ),
'taxonomy' => 'sp_season',
@@ -287,34 +290,61 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
);
sp_dropdown_taxonomies( $args );
$selected = isset( $_REQUEST['match_day'] ) ? $_REQUEST['match_day'] : null;
$selected = isset( $_REQUEST['match_day'] ) ? esc_attr( $_REQUEST['match_day'] ) : null;
echo '<input name="match_day" type="text" class="sp-tablenav-input" placeholder="' . __( 'Match Day', 'sportspress' ) . '" value="' . $selected . '">';
if ( current_user_can( 'edit_others_sp_events' ) )
wp_nonce_field( 'sp-save-inline-results', 'sp-inline-nonce', false );
}
/**
* Filter in admin based on options
*
* @param mixed $query
*/
public function filters_query( $query ) {
global $typenow, $wp_query;
/**
* Filter in admin based on options
*
* @param mixed $query
*/
public function filters_query( $query ) {
global $typenow, $wp_query;
if ( $typenow == 'sp_event' ) {
if ( $typenow == 'sp_event' ) {
//Avoid overriding relation operator if already set
if ( !isset( $query->query_vars['meta_query']['relation'] ) )
$query->query_vars['meta_query']['relation'] = 'AND';
if ( ! empty( $_GET['team'] ) ) {
$query->query_vars['meta_value'] = $_GET['team'];
$query->query_vars['meta_key'] = 'sp_team';
}
if ( ! empty( $_GET['match_day'] ) ) {
$query->query_vars['meta_value'] = $_GET['match_day'];
$query->query_vars['meta_key'] = 'sp_day';
}
if ( ! empty( $_GET['team'] ) ) {
$query->query_vars['meta_query'][] = array(
'key' => 'sp_team',
'value' => $_GET['team'],
);
}
}
if ( ! empty( $_GET['match_day'] ) ) {
$query->query_vars['meta_query'][] = array(
'key' => 'sp_day',
'value' => $_GET['match_day'],
);
}
}
}
/**
* Replace displayed post state for events
*
* @param array $post_states
* @param object $post
*/
public function post_states( $post_states, $post ) {
$status = get_post_meta( $post->ID, 'sp_status', true );
if ( 'postponed' == $status ) {
$post_states = array( __( 'Postponed', 'sportspress' ) );
} elseif ( 'cancelled' == $status ) {
$post_states = array( __( 'Canceled', 'sportspress' ) );
} elseif ( 'tbd' == $status ) {
$post_states = array( __( 'TBD', 'sportspress' ) );
}
return $post_states;
}
}
endif;

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 2.6.8
* @version 2.6.19
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -31,6 +31,7 @@ class SP_Meta_Box_Calendar_Details {
$event_format = get_post_meta( $post->ID, 'sp_event_format', true );
$day = get_post_meta( $post->ID, 'sp_day', true );
$teams = get_post_meta( $post->ID, 'sp_team', false );
$players = get_post_meta( $post->ID, 'sp_player', false );
$table_id = get_post_meta( $post->ID, 'sp_table', true );
$orderby = get_post_meta( $post->ID, 'sp_orderby', true );
$order = get_post_meta( $post->ID, 'sp_order', true );
@@ -125,6 +126,24 @@ class SP_Meta_Box_Calendar_Details {
endif;
?>
</p>
<p><strong><?php _e( 'Player', 'sportspress' ); ?></strong></p>
<p>
<?php
$args = array(
'post_type' => 'sp_player',
'name' => 'sp_player[]',
'selected' => $players,
'values' => 'ID',
'class' => 'widefat',
'property' => 'multiple',
'chosen' => true,
'placeholder' => __( 'All', 'sportspress' ),
);
if ( ! sp_dropdown_pages( $args ) ):
sp_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) );
endif;
?>
</p>
<p><strong><?php _e( 'Sort by', 'sportspress' ); ?></strong></p>
<p>
<select name="sp_orderby">
@@ -163,5 +182,6 @@ class SP_Meta_Box_Calendar_Details {
update_post_meta( $post_id, 'sp_orderby', sp_array_value( $_POST, 'sp_orderby', null ) );
update_post_meta( $post_id, 'sp_order', sp_array_value( $_POST, 'sp_order', null ) );
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) );
}
}

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 2.5.5
* @version 2.7.3
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -250,7 +250,7 @@ class SP_Meta_Box_Event_Performance {
/**
* Admin edit table
*/
public static function table( $labels = array(), $columns = array(), $data = array(), $team_id, $has_checkboxes = false, $positions = array(), $status = true, $section = -1, $formats = array(), $order = array(), $numbers = true, $team_timeline = array(), $timed = array(), $stars = array() ) {
public static function table( $labels = array(), $columns = array(), $data = array(), $team_id = null, $has_checkboxes = false, $positions = array(), $status = true, $section = -1, $formats = array(), $order = array(), $numbers = true, $team_timeline = array(), $timed = array(), $stars = array() ) {
?>
<div class="sp-data-table-container">
<table class="widefat sp-data-table sp-performance-table sp-sortable-table">
@@ -449,7 +449,8 @@ class SP_Meta_Box_Event_Performance {
$placeholder = sp_get_format_placeholder( sp_array_value( $formats, $column, 'number' ) );
?>
<td>
<?php if ( 'time' === sp_array_value( $formats, $column, 'number' ) ) { ?>
<?php $format = sp_array_value( $formats, $column, 'number' ); ?>
<?php if ( 'time' === $format ) { ?>
<?php
$intval = intval( $value );
$timeval = gmdate( 'i:s', $intval );
@@ -463,6 +464,9 @@ class SP_Meta_Box_Event_Performance {
<input class="sp-player-<?php echo $column; ?>-input sp-convert-time-input sp-sync-input" type="text" name="sp_times[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo esc_attr( $timeval ); ?>" placeholder="<?php echo $placeholder; ?>" />
<input class="sp-convert-time-output" type="hidden" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo esc_attr( $value ); ?>" />
<?php } elseif ( 'checkbox' === $format ) { ?>
<input type="hidden" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="0" />
<input class="sp-player-<?php echo $column; ?>-input sp-sync-input" type="checkbox" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="1" data-value="<?php echo $value; ?>" <?php checked( $value ); ?> />
<?php } else { ?>
<input class="sp-player-<?php echo $column; ?>-input sp-sync-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo esc_attr( $value ); ?>" placeholder="<?php echo $placeholder; ?>" />
<?php } ?>
@@ -499,8 +503,10 @@ class SP_Meta_Box_Event_Performance {
?>
<?php echo self::status_select( $team_id, $player_id, sp_array_value( $player_performance, 'status', null ) ); ?><br>
<?php echo self::sub_select( $team_id, $player_id, sp_array_value( $player_performance, 'sub', null ), $data ); ?><br>
<input class="sp-sync-input small-text" type="text" name="sp_timeline[<?php echo $team_id; ?>][<?php echo $player_id; ?>][sub][]" value="<?php echo esc_attr( sp_array_value( $times, 0, '' ) ); ?>" placeholder="-" />
<span class="description"><?php _e( 'mins', 'sportspress' ); ?></span>
<?php if ( is_array( $times ) ) { ?>
<input class="sp-sync-input small-text" type="text" name="sp_timeline[<?php echo $team_id; ?>][<?php echo $player_id; ?>][sub][]" value="<?php echo esc_attr( sp_array_value( $times, 0, '' ) ); ?>" placeholder="-" />
<span class="description"><?php _e( 'mins', 'sportspress' ); ?></span>
<?php } ?>
</td>
<?php } ?>
<?php if ( $stars_type ) { ?>

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 2.1
* @version 2.7.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -48,6 +48,7 @@ class SP_Meta_Box_List_Columns {
<?php _e( 'Position', 'sportspress' ); ?>
</label>
</li>
<?php do_action( 'sportspress_list_general_columns', $selected ); ?>
</ul>
<p><strong><?php _e( 'Data', 'sportspress' ); ?></strong></p>
<div class="sp-instance">

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 2.5.5
* @version 2.7.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -34,6 +34,9 @@ class SP_Meta_Box_List_Details {
$date_to = get_post_meta( $post->ID, 'sp_date_to', true );
$date_past = get_post_meta( $post->ID, 'sp_date_past', true );
$date_relative = get_post_meta( $post->ID, 'sp_date_relative', true );
$continents = SP()->countries->continents;
$nationalities = get_post_meta( $post->ID, 'sp_nationality', false );
$default_nationality = get_option( 'sportspress_default_nationality' , false );
?>
<div>
<p><strong><?php _e( 'Heading', 'sportspress' ); ?></strong></p>
@@ -98,6 +101,19 @@ class SP_Meta_Box_List_Details {
<option value="past" <?php selected( 'past', $era ); ?>><?php _e( 'Past', 'sportspress' ); ?></option>
</select>
</p>
<p><strong><?php _e( 'Nationality', 'sportspress' ); ?></strong></p>
<p>
<select id="sp_nationality" name="sp_nationality[]" data-placeholder="<?php printf( __( 'Select %s', 'sportspress' ), __( 'Nationality', 'sportspress' ) ); ?>" class="widefat chosen-select<?php if ( is_rtl() ): ?> chosen-rtl<?php endif; ?>" multiple="multiple">
<option value=""></option>
<?php foreach ( $continents as $continent => $countries ): ?>
<optgroup label="<?php echo $continent; ?>">
<?php foreach ( $countries as $code => $country ): ?>
<option value="<?php echo $code; ?>" <?php selected ( in_array( $code, $nationalities ) ); ?>><?php echo $country; ?></option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
</p>
<p><strong><?php _e( 'Grouping', 'sportspress' ); ?></strong></p>
<p>
<select name="sp_grouping">
@@ -143,7 +159,16 @@ class SP_Meta_Box_List_Details {
</p>
<?php
if ( 'manual' == $select ) {
sp_post_checklist( $post->ID, 'sp_player', ( 'auto' == $select ? 'none' : 'block' ), array( 'sp_league', 'sp_season', 'sp_current_team' ) );
$player_filters = array( 'sp_league', 'sp_season' );
if ( $team_id ) {
if ( in_array( $era, [ 'all', 'past' ] ) ) {
$player_filters[] = 'sp_past_team';
}
if ( in_array( $era, [ 'all', 'current' ] ) ) {
$player_filters[] = 'sp_current_team';
}
}
sp_post_checklist( $post->ID, 'sp_player', ( 'auto' == $select ? 'none' : 'block' ), $player_filters );
sp_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) );
} else {
?>
@@ -178,5 +203,6 @@ class SP_Meta_Box_List_Details {
update_post_meta( $post_id, 'sp_select', sp_array_value( $_POST, 'sp_select', array() ) );
update_post_meta( $post_id, 'sp_number', sp_array_value( $_POST, 'sp_number', array() ) );
sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) );
sp_update_post_meta_recursive( $post_id, 'sp_nationality', sp_array_value( $_POST, 'sp_nationality', array() ) );
}
}
}

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 2.6.3
* @version 2.6.15
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -65,9 +65,7 @@ class SP_Meta_Box_Outcome_Details extends SP_Meta_Box_Config {
'=' => sprintf( __( 'Equal %s', 'sportspress' ), $label ),
'else' => sprintf( __( 'Default', 'sportspress' ), $label ),
);
for( $i = 1; $i <= $count->publish; $i++ ):
$options[ $i ] = $i;
endfor;
foreach ( $options as $key => $value ):
printf( '<option value="%s" %s>%s</option>', $key, selected( true, $key == $condition, false ), $value );
endforeach;

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 2.3
* @version 2.6.19
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -77,7 +77,7 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config {
<p class="sp-format-selector">
<select name="sp_format">
<?php
$options = apply_filters( 'sportspress_performance_formats', array( 'number' => __( 'Number', 'sportspress' ), 'time' => __( 'Time', 'sportspress' ), 'text' => __( 'Text', 'sportspress' ), 'equation' => __( 'Equation', 'sportspress' ) ) );
$options = apply_filters( 'sportspress_performance_formats', array( 'number' => __( 'Number', 'sportspress' ), 'time' => __( 'Time', 'sportspress' ), 'text' => __( 'Text', 'sportspress' ), 'equation' => __( 'Equation', 'sportspress' ), 'checkbox' => __( 'Checkbox', 'sportspress' ) ) );
foreach ( $options as $key => $value ):
printf( '<option value="%s" %s>%s</option>', $key, selected( $key == $format, true, false ), $value );
endforeach;
@@ -157,6 +157,8 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config {
</ul>
<?php
}
do_action( 'sportspress_meta_box_performance_details', $post );
}
/**

View File

@@ -92,7 +92,7 @@ class SP_Meta_Box_Player_Statistics {
/**
* Admin edit table
*/
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() ) {
public static function table( $id = null, $league_id = null, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $leagues = array(), $has_checkboxes = false, $team_select = false, $formats = array(), $total_types = array() ) {
$readonly = false;
$teams = array_filter( get_post_meta( $id, 'sp_team', false ) );
$buffer = apply_filters( 'sportspress_meta_box_player_statistics_table_buffer', array( 'teams' => $teams, 'readonly' => $readonly ), $id );

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 2.5.5
* @version 2.6.15
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -19,11 +19,16 @@ class SP_Meta_Box_Table_Data {
* Output the metabox
*/
public static function output( $post ) {
$table = new SP_League_Table( $post );
list( $columns, $usecolumns, $data, $placeholders, $merged ) = $table->data( true );
$adjustments = $table->adjustments;
$highlight = get_post_meta( $table->ID, 'sp_highlight', true );
self::table( $table->ID, $columns, $usecolumns, $data, $placeholders, $adjustments, $highlight );
global $pagenow;
if ( is_admin() && in_array( $pagenow, array( 'post-new.php' ) ) && 'sp_table' == get_post_type() ) {
self::table( );
}else{
$table = new SP_League_Table( $post );
list( $columns, $usecolumns, $data, $placeholders, $merged ) = $table->data( true );
$adjustments = $table->adjustments;
$highlight = get_post_meta( $table->ID, 'sp_highlight', true );
self::table( $table->ID, $columns, $usecolumns, $data, $placeholders, $adjustments, $highlight );
}
}
/**
@@ -39,7 +44,7 @@ class SP_Meta_Box_Table_Data {
/**
* Admin edit table
*/
public static function table( $id, $columns = array(), $usecolumns = null, $data = array(), $placeholders = array(), $adjustments = array(), $highlight = null, $readonly = false ) {
public static function table( $id = 0, $columns = array(), $usecolumns = null, $data = array(), $placeholders = array(), $adjustments = array(), $highlight = null, $readonly = false ) {
if ( is_array( $usecolumns ) )
$usecolumns = array_filter( $usecolumns );

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 2.5.5
* @version 2.7
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -31,6 +31,10 @@ class SP_Meta_Box_Table_Details {
$date_relative = get_post_meta( $post->ID, 'sp_date_relative', true );
$orderby = get_post_meta( $post->ID, 'sp_orderby', true );
$order = get_post_meta( $post->ID, 'sp_order', true );
$event_status = get_post_meta( $post->ID, 'sp_event_status', true );
if ( empty( $event_status ) ) {
$event_status = array( 'publish', 'future' );
}
?>
<div>
<p><strong><?php _e( 'Heading', 'sportspress' ); ?></strong></p>
@@ -91,6 +95,11 @@ class SP_Meta_Box_Table_Details {
sp_post_adder( $post_type, __( 'Add New', 'sportspress' ) );
}
?>
<p><strong><?php _e( 'Event Status (with results)', 'sportspress' ); ?></strong></p>
<p>
<input type="checkbox" name="sp_event_status[]" value="publish" <?php echo ( in_array( "publish" , $event_status) ) ? 'checked' : false; ?>> Published/Played<br>
<input type="checkbox" name="sp_event_status[]" value="future" <?php echo ( in_array( "future" , $event_status) ) ? 'checked' : false; ?>> Scheduled/Future<br>
</p>
</div>
<p><strong><?php _e( 'Sort by', 'sportspress' ); ?></strong></p>
<p>
@@ -137,5 +146,6 @@ class SP_Meta_Box_Table_Details {
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
update_post_meta( $post_id, 'sp_orderby', sp_array_value( $_POST, 'sp_orderby', array() ) );
update_post_meta( $post_id, 'sp_order', sp_array_value( $_POST, 'sp_order', array() ) );
update_post_meta( $post_id, 'sp_event_status', sp_array_value( $_POST, 'sp_event_status', array() ) );
}
}

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin
* @version 2.6
* @version 2.7.1.2
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -181,8 +181,8 @@ class SP_Settings_Events extends SP_Settings_Page {
),
array(
'title' => __( 'Google Maps', 'sportspress' ),
'desc' => __( 'Display maps', 'sportspress' ),
'title' => __( 'Venue Map', 'sportspress' ),
'desc' => __( 'Display venue map', 'sportspress' ),
'id' => 'sportspress_event_show_maps',
'default' => 'yes',
'type' => 'checkbox',
@@ -469,7 +469,7 @@ class SP_Settings_Events extends SP_Settings_Page {
parent::save();
if ( isset( $_POST['sportspress_event_teams_delimiter'] ) )
update_option( 'sportspress_event_teams_delimiter', $_POST['sportspress_event_teams_delimiter'] );
update_option( 'sportspress_event_teams_delimiter', sanitize_text_field( $_POST['sportspress_event_teams_delimiter'] ) );
}
/**

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin
* @version 2.6
* @version 2.7
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -81,6 +81,14 @@ class SP_Settings_Teams extends SP_Settings_Page {
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Comments', 'sportspress' ),
'desc' => __( 'Allow people to post comments on Team page', 'sportspress' ),
'id' => 'sportspress_team_comment_status',
'default' => 'no',
'type' => 'checkbox',
),
)),
array(

View File

@@ -5,7 +5,7 @@
* The SportsPress REST API class handles all API-related hooks.
*
* @class SP_REST_API
* @version 2.6.1
* @version 2.7.8
* @package SportsPress/Classes
* @category Class
* @package SportsPress/API
@@ -120,21 +120,53 @@ class SP_REST_API {
)
);
register_rest_field( 'sp_event',
'day',
array(
'get_callback' => 'SP_REST_API::get_post_data',
'update_callback' => 'SP_REST_API::update_post_meta',
'schema' => array(
'description' => __( 'Match Day', 'sportspress' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
'arg_options' => array(
'sanitize_callback' => 'sanitize_text_field',
),
register_rest_field( 'sp_event',
'format',
array(
'get_callback' => 'SP_REST_API::get_post_data',
'update_callback' => 'SP_REST_API::update_post_meta',
'schema' => array(
'description' => __( 'Format', 'sportspress' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
'arg_options' => array(
'sanitize_callback' => 'sanitize_text_field',
),
)
);
),
)
);
register_rest_field( 'sp_event',
'mode',
array(
'get_callback' => 'SP_REST_API::get_post_data',
'update_callback' => 'SP_REST_API::update_post_meta',
'schema' => array(
'description' => __( 'Mode', 'sportspress' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
'arg_options' => array(
'sanitize_callback' => 'sanitize_text_field',
),
),
)
);
register_rest_field( 'sp_event',
'day',
array(
'get_callback' => 'SP_REST_API::get_post_data',
'update_callback' => 'SP_REST_API::update_post_meta',
'schema' => array(
'description' => __( 'Match Day', 'sportspress' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
'arg_options' => array(
'sanitize_callback' => 'sanitize_text_field',
),
),
)
);
register_rest_field( 'sp_event',
'minutes',
@@ -223,7 +255,7 @@ class SP_REST_API {
'update_callback' => 'SP_REST_API::update_post_meta_arrays',
'schema' => array(
'description' => __( 'Results', 'sportspress' ),
'type' => 'array',
'type' => 'object',
'context' => array( 'view', 'edit' ),
'arg_options' => array(
'sanitize_callback' => 'rest_sanitize_request_arg',
@@ -239,7 +271,7 @@ class SP_REST_API {
'update_callback' => 'SP_REST_API::update_post_meta_arrays_multi',
'schema' => array(
'description' => __( 'Box Score', 'sportspress' ),
'type' => 'array',
'type' => 'object',
'context' => array( 'view', 'edit' ),
'arg_options' => array(
'sanitize_callback' => 'rest_sanitize_request_arg',
@@ -430,7 +462,6 @@ class SP_REST_API {
'update_callback' => 'SP_REST_API::update_post_meta_array',
'schema' => array(
'description' => __( 'Metrics', 'sportspress' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'arg_options' => array(
'sanitize_callback' => 'rest_sanitize_request_arg',
@@ -446,7 +477,7 @@ class SP_REST_API {
'update_callback' => 'SP_REST_API::update_post_meta_arrays_multi',
'schema' => array(
'description' => __( 'Statistics', 'sportspress' ),
'type' => 'array',
'type' => 'object',
'context' => array( 'view', 'edit' ),
'arg_options' => array(
'sanitize_callback' => 'rest_sanitize_request_arg',
@@ -564,6 +595,11 @@ class SP_REST_API {
* @return bool|int
*/
public static function update_post_meta_array( $value, $object, $field_name ) {
// Convert PHP object to array
if ( is_object( $value ) ) {
$value = (array) $value;
}
if ( ! is_array( $value ) ) return false;
$type = $object->post_type;

View File

@@ -6,5 +6,15 @@ if ( class_exists( 'WP_REST_Posts_Controller' ) ) {
parent::__construct( $post_type );
$this->namespace = 'sportspress/v2';
}
}
public function check_read_permission( $post ) {
if ( 'sp_event' === $post->post_type ) {
if ( in_array( $post->post_status, array( 'publish', 'future' ) ) || current_user_can( 'read_post', $post->ID ) ) {
return true;
}
} else {
return WP_REST_Posts_Controller::check_read_permission( $post );
}
}
}
}

View File

@@ -8,7 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
* AJAX Event Handler
*
* @class SP_AJAX
* @version 2.6.12
* @version 2.7
* @package SportsPress/Classes
* @category Class
* @author ThemeBoy
@@ -628,6 +628,7 @@ class SP_AJAX {
'season' => __( 'Season', 'sportspress' ),
'venue' => __( 'Venue', 'sportspress' ),
'article' => __( 'Article', 'sportspress' ),
'event_specs' => __( 'Specs', 'sportspress' ),
);
$field_name = 'columns[]';
$field_id = 'columns';
@@ -912,6 +913,18 @@ class SP_AJAX {
<?php _e( 'Display link to view full table', 'sportspress' ); ?>
</label>
</p>
<p>
<?php _e( 'Event Status:', 'sportspress' ); ?><br/>
<label>
<input type="checkbox" name="show_published_events" id="show_published_events" checked>
<?php _e( 'Include Published/Played Events with results', 'sportspress' ); ?>
</label>
<br/>
<label>
<input type="checkbox" name="show_future_events" id="show_future_events" checked>
<?php _e( 'Include Scheduled/Future Events with results', 'sportspress' ); ?>
</label>
</p>
<?php do_action( 'sportspress_ajax_shortcode_form', 'league-table' ); ?>
<p class="submit">
<input type="button" class="button-primary" value="<?php _e( 'Insert Shortcode', 'sportspress' ); ?>" onclick="insertSportsPress('team_standings');" />
@@ -1348,6 +1361,8 @@ class SP_AJAX {
args.number = $div.find('[name=number]').val();
args.columns = $div.find('[name="columns[]"]:checked').map(function() { return this.value; }).get().join(',');
args.show_team_logo = $div.find('[name=show_team_logo]:checked').length;
args.show_published_events = $div.find('[name=show_published_events]:checked').length;
args.show_future_events = $div.find('[name=show_future_events]:checked').length;
args.show_full_table_link = $div.find('[name=show_full_table_link]:checked').length;
} else if ( 'team_gallery' == type ) {
args.title = $div.find('[name=title]').val();

View File

@@ -8,7 +8,7 @@
* https://wordpress.org/support/topic/timezone-issues-with-schedule-calendar-list/
*
* @class SP_Calendar
* @version 2.6.11
* @version 2.6.20
* @package SportsPress/Classes
* @category Class
* @author ThemeBoy
@@ -154,7 +154,6 @@ class SP_Calendar extends SP_Secondary_Post {
'posts_per_page' => $this->number,
'orderby' => $this->orderby,
'order' => $this->order,
'post_status' => $this->status,
'meta_query' => array(
'relation' => 'AND'
),
@@ -335,6 +334,7 @@ class SP_Calendar extends SP_Secondary_Post {
$seasons = get_the_terms( $this->ID, 'sp_season' );
$venues = get_the_terms( $this->ID, 'sp_venue' );
$teams = array_filter( get_post_meta( $this->ID, 'sp_team', false ) );
$players = array_filter( get_post_meta( $this->ID, 'sp_player', false ) );
$table = get_post_meta( $this->ID, 'sp_table', true );
if ( ! isset( $league_ids ) ) $league_ids = array();
@@ -388,17 +388,24 @@ class SP_Calendar extends SP_Secondary_Post {
}
if ( ! empty( $teams ) ) {
$args['meta_query'] = array(
array(
'key' => 'sp_team',
'value' => $teams,
'compare' => 'IN',
),
$args['meta_query'][] = array(
'key' => 'sp_team',
'value' => $teams,
'compare' => 'IN',
);
}
if ( ! empty( $players ) ) {
$args['meta_query'][] = array(
'key' => 'sp_player',
'value' => $players,
'compare' => 'IN',
);
}
if ( $this->event) {
$args['p'] = $this->event;
$args['post_status'] = array( 'publish', 'future' );
}
if ( 'auto' === $this->date && 'any' === $this->status ) {
@@ -415,23 +422,13 @@ class SP_Calendar extends SP_Secondary_Post {
$events = array_merge_recursive( $results, $fixtures );
} else {
$args['post_status'] = $this->status == 'any' ? array('publish', 'future') : explode ( ',', $this->status );
$events = get_posts( $args );
}
else:
$events = null;
endif;
// Filter out unessecary events if we are showing past meetings
if ( $this->teams_past ){
$events_past = array();
foreach ( $events as $single_event ) {
if ( sort( get_post_meta( $single_event->ID, 'sp_team' ) ) === sort( $this->teams_past ) ) {
$events_past[] = $single_event;
}
}
$events = $events_past;
}
// Remove any calendar selection filters
remove_filter( 'posts_where', array( $this, 'range' ) );

View File

@@ -5,7 +5,7 @@
* The SportsPress countries class stores continent/country data.
*
* @class SP_Countries
* @version 2.6.8
* @version 2.7.3
* @package SportsPress/Classes
* @category Class
* @author ThemeBoy
@@ -68,6 +68,7 @@ class SP_Countries {
'nam',
'nga',
'nig',
'reu',
'rsa',
'rwa',
'sdn',
@@ -207,6 +208,8 @@ class SP_Countries {
'cuw',
'dma',
'dom',
'glp',
'grl',
'grn',
'gua',
'hai',
@@ -214,12 +217,14 @@ class SP_Countries {
'jam',
'lca',
'mex',
'mtq',
'msr',
'nca',
'pan',
'pur',
'skn',
'slv',
'sxm',
'tca',
'usa',
'vgb',
@@ -242,6 +247,7 @@ class SP_Countries {
'nzl',
'plw',
'png',
'pyf',
'sam',
'sol',
'tah',
@@ -257,6 +263,7 @@ class SP_Countries {
'chi',
'col',
'ecu',
'guf',
'guy',
'par',
'per',
@@ -320,7 +327,7 @@ class SP_Countries {
'cub' => __( "Cuba", 'sportspress' ),
'cuw' => __( "Curacao", 'sportspress' ),
'cyp' => __( "Cyprus", 'sportspress' ),
'cze' => __( "Czech Republic", 'sportspress' ),
'cze' => __( "Czechia", 'sportspress' ),
'den' => __( "Denmark", 'sportspress' ),
'dji' => __( "Djibouti", 'sportspress' ),
'dma' => __( "Dominica", 'sportspress' ),
@@ -338,6 +345,8 @@ class SP_Countries {
'fin' => __( "Finland", 'sportspress' ),
'fra' => __( "France", 'sportspress' ),
'fro' => __( "Faroe Islands", 'sportspress' ),
'guf' => __( "French Guiana", 'sportspress' ),
'pyf' => __( "French Polynesia", 'sportspress' ),
'fsm' => __( "Micronesia", 'sportspress' ),
'gab' => __( "Gabon", 'sportspress' ),
'gam' => __( "Gambia", 'sportspress' ),
@@ -346,8 +355,10 @@ class SP_Countries {
'ger' => __( "Germany", 'sportspress' ),
'gha' => __( "Ghana", 'sportspress' ),
'gib' => __( "Gibraltar", 'sportspress' ),
'glp' => __( "Guadeloupe", 'sportspress' ),
'gnb' => __( "Guinea-Bissau", 'sportspress' ),
'gre' => __( "Greece", 'sportspress' ),
'grl' => __( "Greenland", 'sportspress' ),
'grn' => __( "Grenada", 'sportspress' ),
'gua' => __( "Guatemala", 'sportspress' ),
'gui' => __( "Guinea", 'sportspress' ),
@@ -373,6 +384,7 @@ class SP_Countries {
'kos' => __( "Kosovo", 'sportspress' ),
'kgz' => __( "Kyrgyzstan", 'sportspress' ),
'kir' => __( "Kiribati", 'sportspress' ),
'mtq' => __( "Martinique", 'sportspress' ),
'kor' => __( "South Korea", 'sportspress' ),
'ksa' => __( "Saudi Arabia", 'sportspress' ),
'kuw' => __( "Kuwait", 'sportspress' ),
@@ -395,7 +407,7 @@ class SP_Countries {
'mdv' => __( "Maldives", 'sportspress' ),
'mex' => __( "Mexico", 'sportspress' ),
'mhl' => __( "Marshall Islands", 'sportspress' ),
'mkd' => __( "Macedonia", 'sportspress' ),
'mkd' => __( "North Macedonia", 'sportspress' ),
'mli' => __( "Mali", 'sportspress' ),
'mlt' => __( "Malta", 'sportspress' ),
'mne' => __( "Montenegro", 'sportspress' ),
@@ -405,7 +417,7 @@ class SP_Countries {
'msr' => __( "Montserrat", 'sportspress' ),
'mtn' => __( "Mauritania", 'sportspress' ),
'mwi' => __( "Malawi", 'sportspress' ),
'mya' => __( "Burma", 'sportspress' ),
'mya' => __( "Myanmar", 'sportspress' ),
'nam' => __( "Namibia", 'sportspress' ),
'nca' => __( "Nicaragua", 'sportspress' ),
'ncl' => __( "New Caledonia", 'sportspress' ),
@@ -433,6 +445,7 @@ class SP_Countries {
'qat' => __( "Qatar", 'sportspress' ),
'rou' => __( "Romania", 'sportspress' ),
'rsa' => __( "South Africa", 'sportspress' ),
'reu' => __( "Reunion", 'sportspress' ),
'rus' => __( "Russia", 'sportspress' ),
'rwa' => __( "Rwanda", 'sportspress' ),
'sam' => __( "Samoa", 'sportspress' ),
@@ -456,7 +469,8 @@ class SP_Countries {
'svk' => __( "Slovakia", 'sportspress' ),
'svn' => __( "Slovenia", 'sportspress' ),
'swe' => __( "Sweden", 'sportspress' ),
'swz' => __( "Swaziland", 'sportspress' ),
'swz' => __( "Eswatini", 'sportspress' ),
'sxm' => __( "Sint Maarten", 'sportspress' ),
'syr' => __( "Syria", 'sportspress' ),
'tah' => __( "Tahiti", 'sportspress' ),
'tan' => __( "Tanzania", 'sportspress' ),

View File

@@ -26,10 +26,20 @@ class SP_Event extends SP_Custom_Post{
return $post_status;
}
public function format() {
$format = get_post_meta( $this->ID, 'sp_format', true );
return $format;
}
public function day() {
$day = get_post_meta( $this->ID, 'sp_day', true );
return $day;
}
}
public function mode() {
$mode = get_post_meta( $this->ID, 'sp_mode', true );
return $mode;
}
public function minutes() {
$minutes = get_post_meta( $this->ID, 'sp_minutes', true );

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Classes
* @version 2.3
* @version 2.6.17
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -85,8 +85,20 @@ class SP_Install {
// Flush rules after install
flush_rewrite_rules();
// Redirect to welcome screen
set_transient( '_sp_activation_redirect', 1, 60 * 60 );
// Get current major version
$version = explode( '.', $current_version, 3 );
unset( $version[2] );
$major_current_version = implode( '.', $version );
// Get new major version
$version = explode( '.', SP()->version, 3 );
unset( $version[2] );
$major_version = implode( '.', $version );
// Redirect to welcome screen if major version has changed
if ( $major_current_version !== $major_version ) {
set_transient( '_sp_activation_redirect', 1, 60 * 60 );
}
}
/**

View File

@@ -5,7 +5,7 @@
* The SportsPress league table class handles individual league table data.
*
* @class SP_League_Table
* @version 2.6.6
* @version 2.7
* @package SportsPress/Classes
* @category Class
* @author ThemeBoy
@@ -23,11 +23,17 @@ class SP_League_Table extends SP_Secondary_Post {
/** @var array Teams to check for tiebreakers. */
public $tiebreakers = array();
//** @var strings
public $orderby;
public $orderbyorder;
/** @var int Show Published events. */
public $show_published_events;
/** @var int Show Scheduled events. */
public $show_future_events;
/**
* Returns formatted data
*
@@ -231,10 +237,40 @@ class SP_League_Table extends SP_Secondary_Post {
endif;
endforeach;
// Get which event status to include
$event_status = get_post_meta( $this->ID, 'sp_event_status', true );
if ( empty( $event_status ) ) {
$event_status = array( 'publish', 'future' );
}
if ( isset( $this->show_published_events ) ) { // If an attribute was pass through shortcode
if ( $this->show_published_events == '1' ) {
$event_status[] = 'publish';
}else{
if ( ( $status_key = array_search( 'publish', $event_status ) ) !== false ) {
unset( $event_status[ $status_key ] );
}
}
}
if ( isset( $this->show_future_events ) ) { // If an attribute was pass through shortcode
if ( $this->show_future_events == '1' ) {
$event_status[] = 'future';
}else{
if ( ( $status_key = array_search('future', $event_status) ) !== false ) {
unset( $event_status[ $status_key ] );
}
}
}
// Make sure to have unique values in the array
$event_status = array_unique( $event_status );
$args = array(
'post_type' => 'sp_event',
'post_status' => array( 'publish', 'future' ),
'post_status' => $event_status,
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'post_date',
@@ -810,12 +846,12 @@ class SP_League_Table extends SP_Secondary_Post {
if ( sp_array_value( $a, $priority['column'], 0 ) != sp_array_value( $b, $priority['column'], 0 ) ):
// Compare column values
$output = sp_array_value( $a, $priority['column'], 0 ) - sp_array_value( $b, $priority['column'], 0 );
$output = (float) sp_array_value( $a, $priority['column'], 0 ) - (float) sp_array_value( $b, $priority['column'], 0 );
// Flip value if descending order
if ( $priority['order'] == 'DESC' ) $output = 0 - $output;
return ( $output > 0 );
return ( $output > 0 ? 1 : -1 );
endif;

View File

@@ -5,7 +5,7 @@
* The SportsPress modules class stores available modules.
*
* @class SP_Modules
* @version 2.6.9
* @version 2.6.15
* @package SportsPress/Classes
* @category Class
* @author ThemeBoy
@@ -43,6 +43,13 @@ class SP_Modules {
'link' => 'https://www.themeboy.com/sportspress-extensions/scoreboard/',
'desc' => __( 'Display multiple event results in a horizontal scoreboard.', 'sportspress' ),
),
'google_maps' => array(
'label' => __( 'Google Maps', 'sportspress' ),
'class' => 'SportsPress_Google_Maps',
'icon' => 'sp-icon-location',
'link' => 'https://www.themeboy.com/sportspress-extensions/google-maps/',
'desc' => __( 'Use Google Maps instead of OpenStreetMap for venues.', 'sportspress' ),
),
'user_scores' => array(
'label' => __( 'User Scores', 'sportspress' ),
'class' => 'SportsPress_User_Scores',

View File

@@ -5,7 +5,7 @@
* The SportsPress player list class handles individual player list data.
*
* @class SP_Player_List
* @version 2.6.9
* @version 2.7.5
* @package SportsPress/Classes
* @category Class
* @author ThemeBoy
@@ -59,6 +59,7 @@ class SP_Player_List extends SP_Secondary_Post {
$crop = get_post_meta( $this->ID, 'sp_crop', true );
$order = get_post_meta( $this->ID, 'sp_order', true );
$select = get_post_meta( $this->ID, 'sp_select', true );
$nationalities = get_post_meta( $this->ID, 'sp_nationality', false );
$this->date = $this->__get( 'date' );
@@ -86,6 +87,27 @@ class SP_Player_List extends SP_Secondary_Post {
}
}
$weekday = array (
0 => 'Sunday',
1 => 'Monday',
2 => 'Tuesday',
3 => 'Wednesday',
4 => 'Thursday',
5 => 'Friday',
6 => 'Saturday',
);
$start_of_week = get_option('start_of_week');
$firstday = $weekday[ $start_of_week ];
if ( $start_of_week != 0 ) {
$lastday = $weekday[ ( $start_of_week - 1 ) ];
}else{
$lastday = $weekday[6];
}
$today = date('l');
// Get labels from performance variables
$performance_labels = (array)sp_get_var_labels( 'sp_performance' );
@@ -110,6 +132,9 @@ class SP_Player_List extends SP_Secondary_Post {
'tax_query' => array(
'relation' => 'AND',
),
'meta_query' => array(
'relation' => 'AND',
),
);
if ( $league_ids ):
@@ -138,7 +163,7 @@ class SP_Player_List extends SP_Secondary_Post {
$team_key = 'sp_past_team';
break;
endswitch;
$args['meta_query'] = array(
$args['meta_query'][] = array(
array(
'key' => $team_key,
'value' => $team
@@ -153,6 +178,16 @@ class SP_Player_List extends SP_Secondary_Post {
'terms' => $position_ids
);
endif;
if ( $nationalities ):
$args['meta_query'][] = array(
array(
'key' => 'sp_nationality',
'value' => $nationalities,
'compare' => 'IN'
),
);
endif;
$args = apply_filters( 'sportspress_player_list_args', $args, $team );
@@ -229,9 +264,14 @@ class SP_Player_List extends SP_Secondary_Post {
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' && ( $stat->post_type == 'sp_performance' || $stat->post_type == 'sp_statistic' ) ) {
$icon = apply_filters( 'sportspress_event_performance_icons', '', $stat->ID, 1 );
if ( $icon != '' ) {
$columns[ $stat->post_name ] = apply_filters( 'sportspress_event_performance_icons', '', $stat->ID, 1 );
$columns[ $stat->post_name ] = $icon;
}else{
$columns[ $stat->post_name ] = $stat->post_title;
if ( has_post_thumbnail( $stat ) ) {
$icon = get_the_post_thumbnail( $stat, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $stat ) ) );
$columns[ $stat->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $stat->ID, 1 );
}else{
$columns[ $stat->post_name ] = $stat->post_title;
}
}
}else{
$columns[ $stat->post_name ] = $stat->post_title;
@@ -355,22 +395,117 @@ class SP_Player_List extends SP_Secondary_Post {
'terms' => $season_ids
);
endif;
$team_key = 'sp_team';
if ( $team ):
$args['meta_query'][] = array(
array(
'key' => $team_key,
'value' => $team,
'compare' => 'IN',
),
);
endif;
if ( $this->date !== 0 ):
if ( $this->date == 'w' ):
$args['year'] = date_i18n('Y');
$args['w'] = date_i18n('W');
elseif ( $this->date == 'day' ):
$args['year'] = date_i18n('Y');
$args['day'] = date_i18n('j');
$args['monthnum'] = date_i18n('n');
elseif ( $this->date == 'range' ):
if ( $this->relative ):
add_filter( 'posts_where', array( $this, 'relative' ) );
else:
add_filter( 'posts_where', array( $this, 'range' ) );
endif;
endif;
switch ( $this->date ):
case '-day':
$date = new DateTime( date_i18n('Y-m-d') );
$date->modify( '-1 day' );
$args['year'] = $date->format('Y');
$args['day'] = $date->format('j');
$args['monthnum'] = $date->format('n');
break;
case 'day':
$args['year'] = date_i18n('Y');
$args['day'] = date_i18n('j');
$args['monthnum'] = date_i18n('n');
break;
case '+day':
$date = new DateTime( date_i18n('Y-m-d') );
$date->modify( '+1 day' );
$args['year'] = $date->format('Y');
$args['day'] = $date->format('j');
$args['monthnum'] = $date->format('n');
break;
case '-w':
if ( $start_of_week != '1' ) { //If start of week is not Monday
if ( $today == $firstday ) { //If today is start of Week
$after = date_i18n('Y-m-d', strtotime("last $firstday"));
$before = date_i18n('Y-m-d', strtotime("last $lastday")).' 23:59:59';
}else{
$after = date_i18n('Y-m-d', strtotime("-2 $firstday"));
$before = date_i18n('Y-m-d', strtotime("last $lastday")).' 23:59:59';
}
$args['date_query'] = array(
array(
'after' => $after,
'before' => $before,
'inclusive' => true,
),
);
}else{
$date = new DateTime( date_i18n('Y-m-d') );
$date->modify( '-1 week' );
$args['year'] = $date->format('Y');
$args['w'] = $date->format('W');
}
break;
case 'w':
if ( $start_of_week != '1' ) { //If start of week is not Monday
if ( $today == $firstday ) { //If today is start of Week
$after = date_i18n('Y-m-d');
$before = date_i18n('Y-m-d', strtotime("next $lastday")).' 23:59:59';
}elseif ( $today == $lastday ) { //If today is the end of Week
$after = date_i18n('Y-m-d', strtotime("last $firstday"));
$before = date_i18n('Y-m-d').' 23:59:59';
}else{
$after = date_i18n('Y-m-d', strtotime("last $firstday"));
$before = date_i18n('Y-m-d', strtotime("next $lastday")).' 23:59:59';
}
$args['date_query'] = array(
array(
'after' => $after,
'before' => $before,
'inclusive' => true,
),
);
}else{
$args['year'] = date_i18n('Y');
$args['w'] = date_i18n('W');
}
break;
case '+w':
if ( $start_of_week != '1' ) { //If start of week is not Monday
if ( $today == $lastday ) { //If today is the end of Week
$after = date_i18n('Y-m-d', strtotime("next $firstday"));
$before = date_i18n('Y-m-d', strtotime("next $lastday")).' 23:59:59';
}else{
$after = date_i18n('Y-m-d', strtotime("next $firstday"));
$before = date_i18n('Y-m-d', strtotime("+2 $lastday")).' 23:59:59';
}
$args['date_query'] = array(
array(
'after' => $after,
'before' => $before,
'inclusive' => true,
),
);
}else{
$date = new DateTime( date_i18n('Y-m-d') );
$date->modify( '+1 week' );
$args['year'] = $date->format('Y');
$args['w'] = $date->format('W');
}
break;
case 'range':
if ( $this->relative ):
add_filter( 'posts_where', array( $this, 'relative' ) );
else:
add_filter( 'posts_where', array( $this, 'range' ) );
endif;
break;
endswitch;
endif;
$args = apply_filters( 'sportspress_list_data_event_args', $args );
@@ -387,10 +522,13 @@ class SP_Player_List extends SP_Secondary_Post {
$team_performance = get_post_meta( $event->ID, 'sp_players', true );
$timeline = (array)get_post_meta( $event->ID, 'sp_timeline', true );
$minutes = get_post_meta( $event->ID, 'sp_minutes', true );
$showdob = get_option( 'sportspress_player_show_birthday', 'no' );
$showage = get_option( 'sportspress_player_show_age', 'no' );
if ( $minutes === '' ) $minutes = get_option( 'sportspress_event_minutes', 90 );
// Add all team performance
if ( is_array( $team_performance ) ): foreach ( $team_performance as $team_id => $players ):
if ( $team && $team_id != $team ) continue;
if ( is_array( $players ) ): foreach ( $players as $player_id => $player_performance ):
if ( array_key_exists( $player_id, $totals ) && is_array( $totals[ $player_id ] ) ):
@@ -420,8 +558,8 @@ class SP_Player_List extends SP_Secondary_Post {
endif;
endforeach;
elseif ( array_key_exists( $key, $totals[ $player_id ] ) ):
$value = floatval( $value );
$totals[ $player_id ][ $key ] += $value;
$add = apply_filters( 'sportspress_player_performance_add_value', floatval( $value ), $key );
$totals[ $player_id ][ $key ] += $add;
endif;
endforeach;
@@ -499,6 +637,9 @@ class SP_Player_List extends SP_Secondary_Post {
endforeach;
endif;
//Make sure that is a number (i.e. convert 90+2' to 90')
$played_minutes = (float)$played_minutes;
$totals[ $player_id ]['eventminutes'] += max( 0, $played_minutes );
if ( sp_array_value( $player_performance, 'status' ) == 'lineup' ):
@@ -541,18 +682,19 @@ class SP_Player_List extends SP_Secondary_Post {
if ( sizeof( $results ) ):
foreach ( $results as $id => $team_results ):
if ( $team_id == $id ) continue;
$team_results['outcome'] = null;
unset( $team_results['outcome'] );
foreach ( $team_results as $result_slug => $team_result ):
if ( is_array( $team_results ) ):
unset( $team_results['outcome'] );
foreach ( $team_results as $result_slug => $team_result ):
// Add to total
$value = sp_array_value( $totals[ $player_id ], $result_slug . 'against', 0 );
$value += floatval( $team_result );
$totals[ $player_id ][ $result_slug . 'against' ] = $value;
// Add to total
$value = sp_array_value( $totals[ $player_id ], $result_slug . 'against', 0 );
$value += floatval( $team_result );
$totals[ $player_id ][ $result_slug . 'against' ] = $value;
// Add subset
$totals[ $player_id ][ $result_slug . 'against' . ( $i + 1 ) ] = $team_result;
endforeach;
// Add subset
$totals[ $player_id ][ $result_slug . 'against' . ( $i + 1 ) ] = $team_result;
endforeach;
endif;
endforeach;
endif;
endif;
@@ -591,23 +733,34 @@ class SP_Player_List extends SP_Secondary_Post {
endif;
endif;
if ( $placeholder !== '' && is_numeric( $placeholder ) ):
$placeholder = sp_array_value( $placeholders[ $player_id ], $stat->post_name, 0 ) + $placeholder;
else:
$placeholder = sp_array_value( $placeholders[ $player_id ], $stat->post_name, '-' );
endif;
if ( ! $stat->equation ) {
if ( $placeholder !== '' && is_numeric( $placeholder ) ):
$placeholder = sp_array_value( $placeholders[ $player_id ], $stat->post_name, 0 ) + $placeholder;
else:
$placeholder = sp_array_value( $placeholders[ $player_id ], $stat->post_name, '-' );
endif;
}
if ( is_numeric( $placeholder ) && $stat->precision ):
$placeholder = number_format( $placeholder, $stat->precision, '.', '' );
endif;
$placeholders[ $player_id ][ $stat->post_name ] = $placeholder;
$placeholders[ $player_id ][ $stat->post_name ] = apply_filters( 'sportspress_player_performance_table_placeholder', $placeholder, $stat->post_name );
endforeach;
endforeach;
// Merge the data and placeholders arrays
foreach( $placeholders as $player_id => $player_data ):
if ( in_array( 'dob', $this->columns ) ):
$player_data['dob'] = get_the_date( get_option( 'date_format') , $player_id );
endif;
if ( in_array( 'age', $this->columns ) ):
$birthdayclass = new SportsPress_Birthdays();
$player_data['age'] = $birthdayclass->get_age( get_the_date( 'm-d-Y', $player_id ) );
endif;
$player_data = array_merge( $column_order, $player_data );
$placeholders[ $player_id ] = $player_data;
@@ -695,6 +848,10 @@ class SP_Player_List extends SP_Secondary_Post {
$labels[ $key ] = __( 'Team', 'sportspress' );
elseif ( $key == 'position' ):
$labels[ $key ] = __( 'Position', 'sportspress' );
elseif ( $key == 'dob' && $showdob ):
$labels[ $key ] = __( 'Date of Birth', 'sportspress' );
elseif ( $key == 'age' && $showage ):
$labels[ $key ] = __( 'Age', 'sportspress' );
elseif ( array_key_exists( $key, $columns ) ):
$labels[ $key ] = $columns[ $key ];
endif;
@@ -744,6 +901,12 @@ class SP_Player_List extends SP_Secondary_Post {
if ( in_array( 'position', $this->columns ) ) {
$labels['position'] = __( 'Position', 'sportspress' );
}
if ( in_array( 'dob', $this->columns ) && $showdob ) {
$labels['dob'] = __( 'Date of Birth', 'sportspress' );
}
if ( in_array( 'age', $this->columns ) && $showage ) {
$labels['age'] = __( 'Age', 'sportspress' );
}
$merged[0] = array_merge( $labels, $columns );
return $merged;

View File

@@ -5,7 +5,7 @@
* The SportsPress player class handles individual player data.
*
* @class SP_Player
* @version 2.6.9
* @version 2.7.5
* @package SportsPress/Classes
* @category Class
* @author ThemeBoy
@@ -175,9 +175,14 @@ class SP_Player extends SP_Custom_Post {
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
if ( $icon != '' ) {
$performance_labels[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
$performance_labels[ $post->post_name ] = $icon;
}else{
$performance_labels[ $post->post_name ] = $post->post_title;
if ( has_post_thumbnail( $post ) ) {
$icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) );
$performance_labels[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 );
}else{
$performance_labels[ $post->post_name ] = $post->post_title;
}
}
}else{
$performance_labels[ $post->post_name ] = $post->post_title;
@@ -193,9 +198,14 @@ class SP_Player extends SP_Custom_Post {
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
if ( $icon != '' ) {
$performance_labels[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
$performance_labels[ $post->post_name ] = $icon;
}else{
$performance_labels[ $post->post_name ] = $post->post_title;
if ( has_post_thumbnail( $post ) ) {
$icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) );
$performance_labels[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 );
}else{
$performance_labels[ $post->post_name ] = $post->post_title;
}
}
}else{
$performance_labels[ $post->post_name ] = $post->post_title;
@@ -369,8 +379,8 @@ class SP_Player extends SP_Custom_Post {
foreach ( $player_performance as $key => $value ):
if ( array_key_exists( $key, $totals ) ):
$value = floatval( $value );
$totals[ $key ] += $value;
$add = apply_filters( 'sportspress_player_performance_add_value', floatval( $value ), $key );
$totals[ $key ] += $add;
endif;
endforeach;
@@ -446,6 +456,9 @@ class SP_Player extends SP_Custom_Post {
endforeach;
endif;
//Make sure that is a number (i.e. convert 90+2' to 90')
$played_minutes = (float)$played_minutes;
$totals['eventminutes'] += max( 0, $played_minutes );
if ( sp_array_value( $player_performance, 'status' ) == 'lineup' ):
@@ -504,17 +517,19 @@ class SP_Player extends SP_Custom_Post {
// Loop through away teams
if ( sizeof( $results ) ):
foreach ( $results as $team_results ):
unset( $team_results['outcome'] );
foreach ( $team_results as $result_slug => $team_result ):
if ( is_array( $team_results ) ):
unset( $team_results['outcome'] );
foreach ( $team_results as $result_slug => $team_result ):
// Add to total
$value = sp_array_value( $totals, $result_slug . 'against', 0 );
$value += floatval( $team_result );
$totals[ $result_slug . 'against' ] = $value;
// Add to total
$value = sp_array_value( $totals, $result_slug . 'against', 0 );
$value += floatval( $team_result );
$totals[ $result_slug . 'against' ] = $value;
// Add subset
$totals[ $result_slug . 'against' . ( $i + 1 ) ] = $team_result;
endforeach;
// Add subset
$totals[ $result_slug . 'against' . ( $i + 1 ) ] = $team_result;
endforeach;
endif;
endforeach;
endif;
endif;
@@ -552,7 +567,7 @@ class SP_Player extends SP_Custom_Post {
endforeach;
foreach ( $performance_labels as $key => $label ):
$placeholders[ $div_id ][ $key ] = sp_array_value( $totals, $key, 0 );
$placeholders[ $div_id ][ $key ] = apply_filters( 'sportspress_player_performance_table_placeholder', sp_array_value( $totals, $key, 0 ), $key );
endforeach;
endforeach;
@@ -575,9 +590,14 @@ class SP_Player extends SP_Custom_Post {
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
if ( $icon != '' ) {
$stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
$stats[ $post->post_name ] = $icon;
}else{
$stats[ $post->post_name ] = $post->post_title;
if ( has_post_thumbnail( $post ) ) {
$icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) );
$stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 );
}else{
$stats[ $post->post_name ] = $post->post_title;
}
}
}else{
$stats[ $post->post_name ] = $post->post_title;
@@ -595,9 +615,14 @@ class SP_Player extends SP_Custom_Post {
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
if ( $icon != '' ) {
$stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
} else {
$stats[ $post->post_name ] = $post->post_title;
$stats[ $post->post_name ] = $icon;
}else{
if ( has_post_thumbnail( $post ) ) {
$icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) );
$stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 );
}else{
$stats[ $post->post_name ] = $post->post_title;
}
}
} else {
$stats[ $post->post_name ] = $post->post_title;
@@ -608,9 +633,14 @@ class SP_Player extends SP_Custom_Post {
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
if ( $icon != '' ) {
$stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
} else {
$stats[ $post->post_name ] = $post->post_title;
$stats[ $post->post_name ] = $icon;
}else{
if ( has_post_thumbnail( $post ) ) {
$icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) );
$stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 );
}else{
$stats[ $post->post_name ] = $post->post_title;
}
}
} else {
$stats[ $post->post_name ] = $post->post_title;
@@ -621,7 +651,7 @@ class SP_Player extends SP_Custom_Post {
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) {
$icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
if ( $icon != '' ) {
$stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 );
$stats[ $post->post_name ] = $icon;
}else{
$stats[ $post->post_name ] = $post->post_title;
}
@@ -728,7 +758,8 @@ class SP_Player extends SP_Custom_Post {
foreach ( $stats as $key => $value ):
if ( in_array( $key, array( 'name', 'team' ) ) ) continue;
$value = floatval( $value );
$career[ $key ] = sp_array_value( $career, $key, 0 ) + $value;
$add = apply_filters( 'sportspress_player_performance_add_value', floatval( $value ), $key );
$career[ $key ] = sp_array_value( $career, $key, 0 ) + $add;
endforeach;
endforeach;
@@ -742,6 +773,9 @@ class SP_Player extends SP_Custom_Post {
$career[ $post->post_name ] = sp_solve( $value['equation'], $totals, $precision );
}
// Filter career total placeholders
$career = apply_filters( 'sportspress_player_performance_table_placeholders', $career );
// Get manually entered career totals
$manual_career = sp_array_value( $data, 0, array() );
$manual_career = array_filter( $manual_career, 'sp_filter_non_empty' );
@@ -771,13 +805,9 @@ class SP_Player extends SP_Custom_Post {
$labels = array();
if ( 'no' === get_option( 'sportspress_player_show_statistics', 'yes' ) ) {
$merged = array();
} else {
$labels['name'] = __( 'Season', 'sportspress' );
$labels['team'] = __( 'Team', 'sportspress' );
}
$labels['name'] = __( 'Season', 'sportspress' );
$labels['team'] = __( 'Team', 'sportspress' );
if ( 'no' === get_option( 'sportspress_player_show_total', 'no' ) ) {
unset( $merged[-1] );
}

View File

@@ -9,7 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) {
* Registers post types and taxonomies
*
* @class SP_Post_types
* @version 2.6.13
* @version 2.7.1
* @package SportsPress/Classes
* @category Class
* @author ThemeBoy
@@ -22,7 +22,7 @@ class SP_Post_types {
public function __construct() {
add_action( 'init', array( __CLASS__, 'register_post_types' ), 5 );
add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 10 );
add_action( 'wp_trash_post', array( $this, 'delete_config_post' ) );
add_action( 'trashed_post', array( $this, 'delete_config_post' ) );
add_filter( 'the_posts', array( $this, 'display_scheduled_events' ) );
}
@@ -392,6 +392,7 @@ class SP_Post_types {
'search_items' => __( 'Search', 'sportspress' ),
'not_found' => __( 'No results found.', 'sportspress' ),
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
'featured_image' => __( 'Icon', 'sportspress' ),
'set_featured_image' => __( 'Select Icon', 'sportspress' ),
'remove_featured_image' => __( 'Remove icon', 'sportspress' ),
'use_featured_image' => __( 'Add icon', 'sportspress' ),
@@ -403,7 +404,7 @@ class SP_Post_types {
'publicly_queryable' => false,
'exclude_from_search' => true,
'hierarchical' => false,
'supports' => array( 'title', 'page-attributes', 'excerpt' ),
'supports' => array( 'title', 'thumbnail', 'page-attributes', 'excerpt' ),
'has_archive' => false,
'show_in_nav_menus' => false,
'can_export' => false,
@@ -447,9 +448,7 @@ class SP_Post_types {
register_post_type( 'sp_event', apply_filters( 'sportspress_register_post_type_event', $args ) );
register_post_type( 'sp_team',
apply_filters( 'sportspress_register_post_type_team',
array(
$args = array(
'labels' => array(
'name' => __( 'Teams', 'sportspress' ),
'singular_name' => __( 'Team', 'sportspress' ),
@@ -480,9 +479,13 @@ class SP_Post_types {
'show_in_rest' => true,
'rest_controller_class' => 'SP_REST_Posts_Controller',
'rest_base' => 'teams',
)
)
);
);
if ( get_option( 'sportspress_team_comment_status', 'no' ) == 'yes' ):
$args[ 'supports' ][] = 'comments';
endif;
register_post_type( 'sp_team', apply_filters( 'sportspress_register_post_type_team', $args ) );
register_post_type( 'sp_player',
apply_filters( 'sportspress_register_post_type_player',

View File

@@ -5,7 +5,7 @@
* The SportsPress team class handles individual team data.
*
* @class SP_Team
* @version 2.6.3
* @version 2.7.1
* @package SportsPress/Classes
* @category Class
* @author ThemeBoy
@@ -488,7 +488,7 @@ class SP_Team extends SP_Custom_Post {
);
$tables_by_terms = get_posts( $args );
$tables = array_merge( $tables_by_id, $tables_by_terms );
$tables = array_merge( $tables_by_terms, $tables_by_id );
$checked = (array) get_post_meta( $this->ID, 'sp_table' );

View File

@@ -7,7 +7,7 @@
* @author ThemeBoy
* @category Core
* @package SportsPress/Functions
* @version 2.6.6
* @version 2.7
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -178,7 +178,7 @@ function sp_get_performance( $post = 0 ) {
function sp_get_singular_name( $post = 0 ) {
$singular = get_post_meta( $post, 'sp_singular', true );
if ( '' !== $singular ) {
if ( $singular && '' !== $singular ) {
return $singular;
} else {
return get_the_title( $post );
@@ -364,6 +364,25 @@ function sp_get_player_number( $post = 0 ) {
return get_post_meta( $post, 'sp_number', true );
}
function sp_get_player_number_in_event( $player_id, $team_id, $event_id ) {
$event_players = get_post_meta( $event_id, 'sp_players', true );
if ( ! array_key_exists( $team_id, $event_players ) ) {
return;
}
if ( ! array_key_exists( $player_id, $event_players[ $team_id ] ) ) {
return;
}
return $event_players[ $team_id ][ $player_id ][ 'number' ];
}
function sp_get_player_number_in_event_or_profile( $player_id, $team_id, $event_id ) {
$number = sp_get_player_number_in_event( $player_id, $team_id, $event_id );
if ( is_null( $number ) ) {
$number = sp_get_player_number( $player_id );
}
return $number;
}
function sp_get_player_name( $post = 0 ) {
return apply_filters( 'sportspress_player_name', get_the_title( $post ), $post );
}

View File

@@ -7,7 +7,7 @@
* @author ThemeBoy
* @category Core
* @package SportsPress/Functions
* @version 2.6.8
* @version 2.7
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -533,7 +533,7 @@ if ( !function_exists( 'sp_get_post_format' ) ) {
function sp_get_post_format( $post_id ) {
$format = get_post_meta ( $post_id, 'sp_format', true );
if ( isset( $format ) ):
$options = apply_filters( 'sportspress_performance_formats', array( 'number' => __( 'Number', 'sportspress' ), 'time' => __( 'Time', 'sportspress' ), 'text' => __( 'Text', 'sportspress' ), 'equation' => __( 'Equation', 'sportspress' ) ) );
$options = apply_filters( 'sportspress_performance_formats', array( 'number' => __( 'Number', 'sportspress' ), 'time' => __( 'Time', 'sportspress' ), 'text' => __( 'Text', 'sportspress' ), 'equation' => __( 'Equation', 'sportspress' ), 'checkbox' => __( 'Checkbox', 'sportspress' ) ) );
return sp_array_value( $options, $format, __( 'Number', 'sportspress' ) );
else:
return __( 'Number', 'sportspress' );
@@ -547,6 +547,7 @@ if ( !function_exists( 'sp_get_format_placeholder' ) ) {
'number' => 0,
'time' => '0:00',
'text' => '&nbsp;',
'checkbox' => '&nbsp;',
) );
return sp_array_value( $placeholders, $key, 0 );
}
@@ -1481,7 +1482,9 @@ if ( ! function_exists( 'sp_sort_terms' ) ) {
$b = intval( $b );
$b = get_term( $b );
}
return get_term_meta( $a->term_id, 'sp_order', true ) > get_term_meta( $b->term_id, 'sp_order', true );
$term_meta_a = get_term_meta( $a->term_id, 'sp_order', true );
$term_meta_b = get_term_meta( $b->term_id, 'sp_order', true );
return $term_meta_a == $term_meta_b ? 0 : ($term_meta_a > $term_meta_b ? 1 : -1);
}
}
@@ -1579,6 +1582,7 @@ function sp_get_text_options() {
__( 'Full Time', 'sportspress' ),
__( 'Home', 'sportspress' ),
__( 'League', 'sportspress' ),
__( 'Leagues', 'sportspress' ),
__( 'League Table', 'sportspress' ),
__( 'Match Day', 'sportspress' ),
__( 'Nationality', 'sportspress' ),
@@ -1598,6 +1602,7 @@ function sp_get_text_options() {
__( 'Recap', 'sportspress' ),
__( 'Results', 'sportspress' ),
__( 'Season', 'sportspress' ),
__( 'Seasons', 'sportspress' ),
__( 'Staff', 'sportspress' ),
__( 'Statistics', 'sportspress' ),
__( 'TBD', 'sportspress' ),
@@ -1683,3 +1688,51 @@ if( ! function_exists( 'array_replace' ) ) {
return $res;
}
}
/**
* Check if a shortcode is shown on content
* @return bool
*/
function sp_has_shortcodes( $content, $tags ) {
if( is_array( $tags ) ) {
foreach ( $tags as $tag ) {
preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
if ( empty( $matches ) )
return false;
foreach ( $matches as $shortcode ) {
if ( $tag === $shortcode[2] )
return true;
}
}
} else {
if ( shortcode_exists( $tags ) ) {
preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
if ( empty( $matches ) )
return false;
foreach ( $matches as $shortcode ) {
if ( $tags === $shortcode[2] )
return true;
}
}
}
return false;
}
/**
* Check if a custom flag was uploaded from the user
* @return bool
*/
function sp_flags( $nationality ) {
$nationality = strtolower( $nationality );
$flag = '';
global $wpdb;
$flag_post_id = intval( $wpdb->get_var( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_value LIKE '%/$nationality'" ) );
if ( $flag_post_id ) {
$flag_src = wp_get_attachment_image_url( $flag_post_id, array( 23,15), false );
$flag = '<img src="' . $flag_src . '" alt="' . $nationality . '">';
}else{
$flag = '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/images/flags/' . $nationality . '.png" alt="' . $nationality . '">';
}
return $flag;
}

View File

@@ -7,7 +7,7 @@
* @author ThemeBoy
* @category Core
* @package SportsPress/Functions
* @version 2.4
* @version 2.7.3
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -189,9 +189,9 @@ if ( ! function_exists( 'sp_rgb_from_hex' ) ) {
// Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF"
$color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color );
$rgb['R'] = hexdec( $color{0}.$color{1} );
$rgb['G'] = hexdec( $color{2}.$color{3} );
$rgb['B'] = hexdec( $color{4}.$color{5} );
$rgb['R'] = hexdec( $color[0].$color[1] );
$rgb['G'] = hexdec( $color[2].$color[3] );
$rgb['B'] = hexdec( $color[4].$color[5] );
return $rgb;
}
}

View File

@@ -8,8 +8,9 @@ class SP_Widget_Birthdays extends WP_Widget {
function widget( $args, $instance ) {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$date = empty($instance['date']) ? 'day' : strip_tags($instance['date']);
$title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base );
$date = empty( $instance['date']) ? 'day' : strip_tags($instance['date'] );
$birthday_format = empty( $instance['birthday_format']) ? 'birthday' : strip_tags( $instance['birthday_format'] );
do_action( 'sportspress_before_widget', $args, $instance, 'birthdays' );
echo $before_widget;
@@ -20,7 +21,7 @@ class SP_Widget_Birthdays extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'birthdays' );
sp_get_template( 'birthdays.php', array( 'date' => $date ) );
sp_get_template( 'birthdays.php', array( 'date' => $date, 'birthday_format' => $birthday_format ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'birthdays' );
@@ -31,8 +32,9 @@ class SP_Widget_Birthdays extends WP_Widget {
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['date'] = strip_tags($new_instance['date']);
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['date'] = strip_tags( $new_instance['date'] );
$instance['birthday_format'] = strip_tags( $new_instance['birthday_format'] );
// Filter to hook into
$instance = apply_filters( 'sportspress_widget_update', $instance, $new_instance, $old_instance, 'birthdays' );
@@ -41,14 +43,21 @@ class SP_Widget_Birthdays extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'date' => 'day' ) );
$title = strip_tags($instance['title']);
$date = strip_tags($instance['date']);
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'date' => 'day', 'birthday_format' => 'birthday' ) );
$title = strip_tags( $instance['title'] );
$date = strip_tags( $instance['date'] );
$options = array(
'day' => __( 'Today', 'sportspress' ),
'week' => __( 'This week', 'sportspress' ),
'month' => __( 'This month', 'sportspress' ),
);
$birthday_format = strip_tags( $instance['birthday_format'] );
$birthday_options = array(
'hide' => __( 'Hide', 'sportspress' ),
'birthday' => __( 'Birthday', 'sportspress' ),
'age' => __( 'Age', 'sportspress' ),
'birthdayage' => __( 'Birthday (Age)', 'sportspress' ),
);
// Action to hook into
do_action( 'sportspress_before_widget_template_form', $this, $instance, 'birthdays' );
@@ -64,6 +73,14 @@ class SP_Widget_Birthdays extends WP_Widget {
<?php } ?>
</select>
</p>
<p>
<label for="<?php echo $this->get_field_id('birthday_format'); ?>"><?php _e( 'Format:', 'sportspress' ); ?></label>
<select name="<?php echo $this->get_field_name('birthday_format'); ?>" id="<?php echo $this->get_field_id('birthday_format'); ?>" class="postform widefat">
<?php foreach ( $birthday_options as $value => $label ) { ?>
<option value="<?php echo $value; ?>" <?php selected( $value, $birthday_format ); ?>><?php echo $label; ?></option>
<?php } ?>
</select>
</p>
<?php
// Action to hook into
do_action( 'sportspress_after_widget_template_form', $this, $instance, 'birthdays' );

View File

@@ -16,6 +16,10 @@ class SP_Widget_Countdown extends WP_Widget {
$show_venue = empty($instance['show_venue']) ? false : $instance['show_venue'];
$show_league = empty($instance['show_league']) ? false : $instance['show_league'];
$show_date = empty($instance['show_date']) ? false : $instance['show_date'];
$show_excluded = empty($instance['show_excluded']) ? false : $instance['show_excluded'];
$order = empty($instance['order']) ? false : $instance['order'];
$orderby = empty($instance['orderby']) ? false : $instance['orderby'];
$show_status = empty($instance['show_status']) ? false : $instance['show_status'];
do_action( 'sportspress_before_widget', $args, $instance, 'countdown' );
echo $before_widget;
@@ -26,7 +30,7 @@ class SP_Widget_Countdown extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'countdown' );
sp_get_template( 'countdown.php', array( 'calendar' => $calendar, 'team' => $team, 'id' => $id, 'title' => $caption, 'show_venue' => $show_venue, 'show_league' => $show_league, 'show_date' => $show_date ) );
sp_get_template( 'countdown.php', array( 'calendar' => $calendar, 'team' => $team, 'id' => $id, 'title' => $caption, 'show_venue' => $show_venue, 'show_league' => $show_league, 'show_date' => $show_date, 'show_excluded' => $show_excluded, 'order' => $order, 'orderby' => $orderby, 'show_status' => $show_status ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'countdown' );
@@ -45,6 +49,10 @@ class SP_Widget_Countdown extends WP_Widget {
$instance['show_venue'] = intval($new_instance['show_venue']);
$instance['show_league'] = intval($new_instance['show_league']);
$instance['show_date'] = intval($new_instance['show_date']);
$instance['show_excluded'] = intval($new_instance['show_excluded']);
$instance['order'] = strip_tags($new_instance['order']);
$instance['orderby'] = strip_tags($new_instance['orderby']);
$instance['show_status'] = strip_tags($new_instance['show_status']);
// Filter to hook into
$instance = apply_filters( 'sportspress_widget_update', $instance, $new_instance, $old_instance, 'countdown' );
@@ -53,7 +61,7 @@ class SP_Widget_Countdown extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'calendar' => '', 'team' => '', 'id' => '', 'caption' => '', 'show_venue' => false, 'show_league' => false, 'show_date' => false ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'calendar' => '', 'team' => '', 'id' => '', 'caption' => '', 'show_venue' => false, 'show_league' => false, 'show_date' => false, 'show_excluded' => false, 'order' => '', 'orderby' => '', 'show_status' => true ) );
$title = strip_tags($instance['title']);
$caption = strip_tags($instance['caption']);
$calendar = intval($instance['calendar']);
@@ -62,6 +70,10 @@ class SP_Widget_Countdown extends WP_Widget {
$show_venue = intval($instance['show_venue']);
$show_league = intval($instance['show_league']);
$show_date = intval($instance['show_date']);
$show_excluded = intval($instance['show_excluded']);
$order = strip_tags($instance['order']);
$orderby = strip_tags($instance['orderby']);
$show_status = intval($instance['show_status']);
// Action to hook into
do_action( 'sportspress_before_widget_template_form', $this, $instance, 'countdown' );
@@ -88,6 +100,21 @@ class SP_Widget_Countdown extends WP_Widget {
endif;
?>
</p>
<p class="sp-dropdown-filter"><label for="<?php echo $this->get_field_id('orderby'); ?>"><?php printf( __( 'Sort by:', 'sportspress' ) ); ?></label>
<select name="<?php echo $this->get_field_name('orderby'); ?>" class="postform widefat">
<option value="" <?php selected( 'default', $orderby ); ?>><?php _e( 'Default', 'sportspress' ); ?></option>
<option value="date" <?php selected( 'date', $orderby ); ?>><?php _e( 'Date', 'sportspress' ); ?></option>
<option value="day" <?php selected( 'day', $orderby ); ?>><?php _e( 'Match Day', 'sportspress' ); ?></option>
</select>
</p>
<p class="sp-dropdown-filter"><label for="<?php echo $this->get_field_id('order'); ?>"><?php printf( __( 'Sort Order:', 'sportspress' ) ); ?></label>
<select name="<?php echo $this->get_field_name('order'); ?>" class="postform widefat">
<option value="ASC" <?php selected( 'ASC', $order ); ?>><?php _e( 'Ascending', 'sportspress' ); ?></option>
<option value="DESC" <?php selected( 'DESC', $order ); ?>><?php _e( 'Descending', 'sportspress' ); ?></option>
</select>
</p>
<p class="sp-dropdown-filter"><label for="<?php echo $this->get_field_id('team'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Team', 'sportspress' ) ); ?></label>
<?php
@@ -135,6 +162,12 @@ class SP_Widget_Countdown extends WP_Widget {
<p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_date'); ?>" name="<?php echo $this->get_field_name('show_date'); ?>" value="1" <?php checked( $show_date, 1 ); ?>>
<label for="<?php echo $this->get_field_id('show_date'); ?>"><?php _e( 'Display date', 'sportspress' ); ?></label></p>
<p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_excluded'); ?>" name="<?php echo $this->get_field_name('show_excluded'); ?>" value="1" <?php checked( $show_excluded, 1 ); ?>>
<label for="<?php echo $this->get_field_id('show_excluded'); ?>"><?php _e( 'Display excluded events', 'sportspress' ); ?></label></p>
<p><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_status'); ?>" name="<?php echo $this->get_field_name('show_status'); ?>" value="1" <?php checked( $show_status, 1 ); ?>>
<label for="<?php echo $this->get_field_id('show_status'); ?>"><?php _e( 'Display event status', 'sportspress' ); ?></label></p>
<?php
// Action to hook into
do_action( 'sportspress_after_widget_template_form', $this, $instance, 'countdown' );

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
SportsPress
Copyright 2018 by the contributors
Copyright 2021 by the contributors
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add birthdays to players and staff.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.5
Version: 2.7.1
*/
// Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Birthdays' ) ) :
* Main SportsPress Birthdays Class
*
* @class SportsPress_Birthdays
* @version 2.5
* @version 2.7.1
*/
class SportsPress_Birthdays {
@@ -36,6 +36,7 @@ class SportsPress_Birthdays {
add_filter( 'sportspress_staff_details', array( $this, 'add_staff_details' ), 20, 2 );
add_action( 'sportspress_widgets', array( $this, 'widgets' ) );
add_action( 'sportspress_list_general_columns', array( $this, 'columns' ), 10, 1 );
}
/**
@@ -43,7 +44,7 @@ class SportsPress_Birthdays {
*/
private function define_constants() {
if ( !defined( 'SP_BIRTHDAYS_VERSION' ) )
define( 'SP_BIRTHDAYS_VERSION', '2.5' );
define( 'SP_BIRTHDAYS_VERSION', '2.7.1' );
if ( !defined( 'SP_BIRTHDAYS_URL' ) )
define( 'SP_BIRTHDAYS_URL', plugin_dir_url( __FILE__ ) );
@@ -187,6 +188,26 @@ class SportsPress_Birthdays {
public static function widgets() {
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-birthdays.php' );
}
/**
* Add more General Columns at Player Lists
*/
public static function columns( $selected ) {
?>
<li>
<label class="selectit">
<input value="dob" type="checkbox" name="sp_columns[]" id="sp_columns_dob" <?php checked( in_array( 'dob', $selected ) ); ?>>
<?php _e( 'Date of Birth', 'sportspress' ); ?>
</label>
</li>
<li>
<label class="selectit">
<input value="age" type="checkbox" name="sp_columns[]" id="sp_columns_age" <?php checked( in_array( 'age', $selected ) ); ?>>
<?php _e( 'Age', 'sportspress' ); ?>
</label>
</li>
<?php
}
/**
* Get age from date.

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add bulk actions to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.2
Version: 2.7.6
*/
// Exit if accessed directly
@@ -17,89 +17,160 @@ if ( ! class_exists( 'SportsPress_Bulk_Actions' ) ) :
* Main SportsPress Bulk Actions Class
*
* @class SportsPress_Bulk_Actions
* @version 2.2
* @version 2.7.6
*/
class SportsPress_Bulk_Actions {
/**
* Constructor
*/
public function __construct() {
// Define constants
$this->define_constants();
/**
* Constructor
*/
public function __construct() {
// Define constants
$this->define_constants();
// Teams
add_filter( 'bulk_actions-edit-sp_team', array( $this, 'team_actions' ) );
add_filter( 'handle_bulk_actions-edit-sp_team', array( $this, 'team_actions_handler' ), 10, 3 );
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
}
// Teams
add_filter( 'bulk_actions-edit-sp_team', array( $this, 'team_actions' ) );
add_filter( 'handle_bulk_actions-edit-sp_team', array( $this, 'team_actions_handler' ), 10, 3 );
/**
* Define constants.
*/
private function define_constants() {
if ( !defined( 'SP_BULK_ACTIONS_VERSION' ) )
define( 'SP_BULK_ACTIONS_VERSION', '2.2' );
// Events
add_filter( 'bulk_actions-edit-sp_event', array( $this, 'event_actions' ) );
add_filter( 'handle_bulk_actions-edit-sp_event', array( $this, 'event_actions_handler' ), 10, 3 );
if ( !defined( 'SP_BULK_ACTIONS_URL' ) )
define( 'SP_BULK_ACTIONS_URL', plugin_dir_url( __FILE__ ) );
// Notices
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
}
if ( !defined( 'SP_BULK_ACTIONS_DIR' ) )
define( 'SP_BULK_ACTIONS_DIR', plugin_dir_path( __FILE__ ) );
}
/**
* Define constants.
*/
private function define_constants() {
if ( !defined( 'SP_BULK_ACTIONS_VERSION' ) )
define( 'SP_BULK_ACTIONS_VERSION', '2.7.6' );
/**
* Add option to the team bulk actions dropdown.
*/
public function team_actions( $bulk_actions ) {
$bulk_actions['sp_calendar'] = __( 'Generate Calendars', 'sportspress' );
return $bulk_actions;
}
if ( !defined( 'SP_BULK_ACTIONS_URL' ) )
define( 'SP_BULK_ACTIONS_URL', plugin_dir_url( __FILE__ ) );
/**
* Handle form submission for team bulk actions.
*/
public function team_actions_handler( $redirect_to, $doaction, $post_ids ) {
if ( $doaction !== 'sp_calendar' ) {
return $redirect_to;
}
if ( !defined( 'SP_BULK_ACTIONS_DIR' ) )
define( 'SP_BULK_ACTIONS_DIR', plugin_dir_path( __FILE__ ) );
}
/**
* Add option to the team bulk actions dropdown.
*/
public function team_actions( $bulk_actions ) {
$bulk_actions['sp_calendar'] = __( 'Generate Calendars', 'sportspress' );
return $bulk_actions;
}
/**
* Handle form submission for team bulk actions.
*/
public function team_actions_handler( $redirect_to, $doaction, $post_ids ) {
if ( $doaction !== 'sp_calendar' ) {
return $redirect_to;
}
foreach ( $post_ids as $post_id ) {
$post = array();
$post['post_title'] = get_the_title( $post_id ) . ' ' . __( 'Calendar', 'sportspress' );
$post['post_type'] = 'sp_calendar';
$post['post_status'] = 'publish';
// Insert post
$id = wp_insert_post( $post );
// Flag as bulk
update_post_meta( $id, '_sp_bulk', 1 );
// Update meta
update_post_meta( $id, 'sp_team', $post_id );
update_post_meta( $id, 'sp_format', 'calendar' );
}
$redirect_to = add_query_arg( 'sp_bulk_generated_calendars', count( $post_ids ), $redirect_to );
return $redirect_to;
}
/**
* Add option to the event bulk actions dropdown.
*/
public function event_actions( $bulk_actions ) {
$bulk_actions['sp_postpone'] = __( 'Postpone events', 'sportspress' );
$bulk_actions['sp_cancel'] = __( 'Cancel events', 'sportspress' );
$bulk_actions['sp_ok'] = __( 'Set events as on time', 'sportspress' );
return $bulk_actions;
}
/**
* Handle form submission for event bulk actions.
*/
public function event_actions_handler( $redirect_to, $doaction, $post_ids ) {
if ( ! in_array( $doaction, array( 'sp_postpone', 'sp_cancel', 'sp_ok' ) ) ) {
return $redirect_to;
}
if ( 'sp_postpone' == $doaction ) {
foreach ( $post_ids as $post_id ) {
$post = array();
$post['post_title'] = get_the_title( $post_id ) . ' ' . __( 'Calendar', 'sportspress' );
$post['post_type'] = 'sp_calendar';
$post['post_status'] = 'publish';
// Insert post
$id = wp_insert_post( $post );
// Flag as bulk
update_post_meta( $id, '_sp_bulk', 1 );
// Update meta
update_post_meta( $id, 'sp_team', $post_id );
update_post_meta( $id, 'sp_format', 'calendar' );
update_post_meta( $post_id, 'sp_status', 'postponed' );
}
$redirect_to = add_query_arg( 'sp_bulk_generated_calendars', count( $post_ids ), $redirect_to );
return $redirect_to;
$redirect_to = add_query_arg( 'sp_bulk_postponed_events', count( $post_ids ), $redirect_to );
} elseif ( 'sp_cancel' == $doaction ) {
foreach ( $post_ids as $post_id ) {
update_post_meta( $post_id, 'sp_status', 'cancelled' );
}
$redirect_to = add_query_arg( 'sp_bulk_cancelled_events', count( $post_ids ), $redirect_to );
} elseif ( 'sp_ok' == $doaction ) {
foreach ( $post_ids as $post_id ) {
update_post_meta( $post_id, 'sp_status', 'ok' );
}
$redirect_to = add_query_arg( 'sp_bulk_ok_events', count( $post_ids ), $redirect_to );
}
/**
* Display notices after form submission.
*/
public function admin_notices() {
if ( ! empty( $_REQUEST['sp_bulk_generated_calendars'] ) ) {
$count = intval( $_REQUEST['sp_bulk_generated_calendars'] );
return $redirect_to;
}
printf( '<div id="message" class="updated notice notice-success is-dismissible"><p>' .
_n( 'Generated %s calendar.',
'Generated %s calendars.',
$count,
'sportspress'
) . ' <a href="' . admin_url('edit.php?post_type=sp_calendar') . '">' . __( 'View', 'sportspress' ) . '</a></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', $count );
}
}
/**
* Display notices after form submission.
*/
public function admin_notices() {
if ( ! empty( $_REQUEST['sp_bulk_generated_calendars'] ) ) {
$count = intval( $_REQUEST['sp_bulk_generated_calendars'] );
printf( '<div id="message" class="updated notice notice-success is-dismissible"><p>' .
_n( 'Generated %s calendar.',
'Generated %s calendars.',
$count,
'sportspress'
) . ' <a href="' . admin_url('edit.php?post_type=sp_calendar') . '">' . __( 'View', 'sportspress' ) . '</a></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', $count );
} elseif ( ! empty( $_REQUEST['sp_bulk_postponed_events'] ) ) {
$count = intval( $_REQUEST['sp_bulk_postponed_events'] );
printf( '<div id="message" class="updated notice notice-success is-dismissible"><p>' .
_n( 'Postponed %s event.',
'Postponed %s events.',
$count,
'sportspress'
) . '</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', $count );
} elseif ( ! empty( $_REQUEST['sp_bulk_cancelled_events'] ) ) {
$count = intval( $_REQUEST['sp_bulk_cancelled_events'] );
printf( '<div id="message" class="updated notice notice-success is-dismissible"><p>' .
_n( 'Canceled %s event.',
'Canceled %s events.',
$count,
'sportspress'
) . '</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', $count );
} elseif ( ! empty( $_REQUEST['sp_bulk_ok_events'] ) ) {
$count = intval( $_REQUEST['sp_bulk_ok_events'] );
printf( '<div id="message" class="updated notice notice-success is-dismissible"><p>' .
_n( 'Set %s event as on time.',
'Set %s event as on time.',
$count,
'sportspress'
) . '</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>', $count );
}
}
}
endif;

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add event calendars to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.6.14
Version: 2.6.15
*/
// Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Calendars' ) ) :
* Main SportsPress Calendars Class
*
* @class SportsPress_Calendars
* @version 2.6.14
* @version 2.6.15
*/
class SportsPress_Calendars {
@@ -51,7 +51,7 @@ class SportsPress_Calendars {
*/
private function define_constants() {
if ( !defined( 'SP_CALENDARS_VERSION' ) )
define( 'SP_CALENDARS_VERSION', '2.6.14' );
define( 'SP_CALENDARS_VERSION', '2.6.15' );
if ( !defined( 'SP_CALENDARS_URL' ) )
define( 'SP_CALENDARS_URL', plugin_dir_url( __FILE__ ) );

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add countdown widgets to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.6
Version: 2.7
*/
// Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Countdowns' ) ) :
* Main SportsPress Countdowns Class
*
* @class SportsPress_Countdowns
* @version 2.6
* @version 2.7
*/
class SportsPress_Countdowns {
@@ -34,6 +34,7 @@ class SportsPress_Countdowns {
// Filters
add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) );
add_filter( 'sportspress_event_settings', array( $this, 'add_settings' ) );
add_filter( 'sportspress_text', array( $this, 'add_text_options' ) );
}
/**
@@ -41,7 +42,7 @@ class SportsPress_Countdowns {
*/
private function define_constants() {
if ( !defined( 'SP_COUNTDOWNS_VERSION' ) )
define( 'SP_COUNTDOWNS_VERSION', '2.6' );
define( 'SP_COUNTDOWNS_VERSION', '2.7' );
if ( !defined( 'SP_COUNTDOWNS_URL' ) )
define( 'SP_COUNTDOWNS_URL', plugin_dir_url( __FILE__ ) );
@@ -104,6 +105,18 @@ class SportsPress_Countdowns {
);
return $settings;
}
/**
* Add text options
*/
public function add_text_options( $options = array() ) {
return array_merge( $options, array(
__( 'days', 'sportspress' ),
__( 'hrs', 'sportspress' ),
__( 'mins', 'sportspress' ),
__( 'secs', 'sportspress' ),
) );
}
}
endif;

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add default nationality option to SportsPress Settings.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.6.9
Version: 2.6.18
*/
// Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Default_Nationality' ) ) :
* Main SportsPress Default Nationality Class
*
* @class SportsPress_Default_Nationality
* @version 2.6.9
* @version 2.6.18
*/
class SportsPress_Default_Nationality {
@@ -36,7 +36,7 @@ class SportsPress_Default_Nationality {
*/
private function define_constants() {
if ( !defined( 'SP_DEFAULT_NATIONALITY_VERSION' ) )
define( 'SP_DEFAULT_NATIONALITY_VERSION', '2.6.9' );
define( 'SP_DEFAULT_NATIONALITY_VERSION', '2.6.18' );
if ( !defined( 'SP_DEFAULT_NATIONALITY_URL' ) )
define( 'SP_DEFAULT_NATIONALITY_URL', plugin_dir_url( __FILE__ ) );
@@ -50,7 +50,9 @@ class SportsPress_Default_Nationality {
*/
public function add_general_options( $settings ) {
$countries[''] = __( '&mdash; None &mdash;', 'sportspress' );
$countries = array_merge ( $countries, SP()->countries->countries );
$sp_countries = new SP_Countries();
$countries = array_merge ( $countries, $sp_countries->countries );
$settings[]=array(
'title' => __( 'Default Nationality', 'sportspress' ),
'id' => 'sportspress_default_nationality',

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add event specs/stats to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.6
Version: 2.6.15
*/
// Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Event_Specs' ) ) :
* Main SportsPress Event Specs Class
*
* @class SportsPress_Event_Specs
* @version 2.6
* @version 2.6.15
*/
class SportsPress_Event_Specs {
@@ -34,6 +34,7 @@ class SportsPress_Event_Specs {
add_action( 'sportspress_include_post_type_handlers', array( $this, 'include_post_type_handler' ) );
add_action( 'sportspress_event_list_head_row', array( $this, 'event_list_head_row' ), 11 );
add_action( 'sportspress_event_list_row', array( $this, 'event_list_row' ), 11, 2 );
add_action( 'sportspress_event_blocks_after', array( $this, 'event_blocks_after' ), 11, 2 );
// Filters
add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
@@ -48,7 +49,7 @@ class SportsPress_Event_Specs {
*/
private function define_constants() {
if ( !defined( 'SP_EVENT_SPECS_VERSION' ) )
define( 'SP_EVENT_SPECS_VERSION', '2.6' );
define( 'SP_EVENT_SPECS_VERSION', '2.6.15' );
if ( !defined( 'SP_EVENT_SPECS_URL' ) )
define( 'SP_EVENT_SPECS_URL', plugin_dir_url( __FILE__ ) );
@@ -230,7 +231,7 @@ class SportsPress_Event_Specs {
* Event list head row.
*/
public function event_list_head_row( $usecolumns = array() ) {
if ( is_array( $usecolumns ) && in_array( 'event_specs', $usecolumns ) ) {
if ( sp_column_active( $usecolumns, 'event_specs' ) ) {
$spec_labels = (array)sp_get_var_labels( 'sp_spec', null, false );
if ( empty( $spec_labels ) ) return;
@@ -249,7 +250,7 @@ class SportsPress_Event_Specs {
* Event list row.
*/
public function event_list_row( $event, $usecolumns = array() ) {
if ( is_array( $usecolumns ) && in_array( 'event_specs', $usecolumns ) ) {
if ( sp_column_active( $usecolumns, 'event_specs' ) ) {
$event = new SP_Event( $event );
$specs = $event->specs( false );
$spec_labels = (array)sp_get_var_labels( 'sp_spec', null, false );
@@ -267,6 +268,20 @@ class SportsPress_Event_Specs {
}
}
}
/**
* Add Event Specs after default template of Event blocks is loaded.
*/
public function event_blocks_after( $event, $usecolumns = array() ) {
if ( sp_column_active( $usecolumns, 'event_specs' ) ) {
$event = new SP_Event( $event );
$specs = $event->specs( false );
$spec_labels = (array)sp_get_var_labels( 'sp_spec', null, false );
foreach ( $specs as $spec_label => $spec_value ) {
echo '<div class="sp_event_spec"><span class="sp_event_spec_label">'.$spec_label.':</span><span class="sp_event_spec_value"> '.$spec_value.'</span></div>';
}
}
}
}
endif;

View File

@@ -30,6 +30,8 @@ class SportsPress_Gutenberg {
add_filter( 'gutenberg_can_edit_post_type', array( $this, 'can_edit_post_type' ), 10, 2 );
add_filter( 'use_block_editor_for_post_type', array( $this, 'can_edit_post_type' ), 10, 2 );
//add_filter( 'block_categories', array( $this, 'add_category' ), 10, 2 );
//add_action( 'enqueue_block_editor_assets', array( $this, 'load_blocks' ) );
}
/**
@@ -52,6 +54,48 @@ class SportsPress_Gutenberg {
function can_edit_post_type( $enabled, $post_type ) {
return is_sp_post_type( $post_type ) ? false : $enabled;
}
/**
* Add SportsPress category to Gutenberg.
*/
function add_category( $categories, $post ) {
return array_merge(
$categories,
array(
array(
'slug' => 'sportspress',
'title' => __( 'SportsPress', 'sportspress' ),
),
)
);
}
/**
* Load Gutenberg blocks.
*/
function load_blocks() {
wp_enqueue_script( 'sp-block-event-calendar', plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/js/blocks/event-calendar.js', array( 'wp-blocks', 'wp-editor' ), true );
$strings = apply_filters( 'sportspress_localized_strings', array(
'event_calendar' => __( 'Event Calendar', 'sportspress' ),
'properties' => __( 'Properties', 'sportspress' ),
'title' => __( 'Title', 'sportspress' ),
'select_calendar' => sprintf( __( 'Select %s:', 'sportspress' ), __( 'Calendar', 'sportspress' ) ),
'all' => __( 'All', 'sportspress' ),
) );
$posts = array(
'events' => (array) get_posts(
array(
'post_type' => 'sp_event',
'posts_per_page' => -1,
)
),
);
wp_localize_script( 'sp-block-event-calendar', 'strings', $strings );
wp_localize_script( 'sp-block-event-calendar', 'posts', $posts );
}
}
endif;

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add vector performance icons to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.6.8
Version: 2.7
*/
// Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Icons' ) ) :
* Main SportsPress Icons Class
*
* @class SportsPress_Icons
* @version 2.6.8
* @version 2.7
*/
class SportsPress_Icons {
@@ -39,7 +39,7 @@ class SportsPress_Icons {
add_filter( 'sportspress_enqueue_styles', array( $this, 'add_styles' ) );
add_filter( 'sportspress_performance_icon', array( $this, 'icon' ), 10, 2 );
add_filter( 'sportspress_event_performance_icons', array( $this, 'replace_icons' ), 10, 3 );
add_filter( 'admin_post_thumbnail_html', array( $this, 'admin_post_thumbnail_html' ), 10, 2 );
add_filter( 'admin_post_thumbnail_html', array( $this, 'sp_admin_post_thumbnail_html' ), 10, 2 );
add_action( 'sportspress_process_sp_performance_meta', array( $this, 'save' ), 10, 2 );
add_action( 'sportspress_process_sp_statistic_meta', array( $this, 'save' ), 10, 2 );
}
@@ -49,7 +49,7 @@ class SportsPress_Icons {
*/
private function define_constants() {
if ( !defined( 'SP_ICONS_VERSION' ) )
define( 'SP_ICONS_VERSION', '2.6.8' );
define( 'SP_ICONS_VERSION', '2.7' );
if ( !defined( 'SP_ICONS_URL' ) )
define( 'SP_ICONS_URL', plugin_dir_url( __FILE__ ) );
@@ -144,11 +144,11 @@ class SportsPress_Icons {
/**
* Post thumbnail HTML.
*/
public function admin_post_thumbnail_html( $content = '', $id = 0 ) {
public function sp_admin_post_thumbnail_html( $content = '', $id = 0 ) {
// Bypass if no ID
if ( ! $id ) return $content;
// Bypass if not performance post type
// Bypass if not performance or statistic post type
$post_type = get_post_type( $id );
if ( 'sp_performance' !== $post_type && 'sp_statistic' !== $post_type ) return $content;
@@ -175,7 +175,7 @@ class SportsPress_Icons {
$value = get_post_meta( $id, 'sp_color', true );
if ( empty( $value ) ) $value = '111111';
$color = '<div class="sp-icon-color-box"><input name="sp_color" id="sp_color" type="text" value="' . esc_attr( $value ) . '" size="7" class="colorpick" /> <div id="colorPickerDiv" class="colorpickdiv"></div></div>';
$color = '<div class="sp-color-box-for-icon"><input name="sp_color" id="sp_color" type="text" value="' . esc_attr( $value ) . '" size="7" class="colorpick" /> <div id="colorPickerDiv" class="colorpickdiv"></div></div>';
$content = '<p><strong>' . __( 'Select Icon', 'sportspress' ) . '</strong></p>
<p class="sp-icons">' . $icons . '</p>

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add league tables to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.6.14
Version: 2.6.15
*/
// Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_League_Tables' ) ) :
* Main SportsPress League Tables Class
*
* @class SportsPress_League_Tables
* @version 2.6.14
* @version 2.6.15
*/
class SportsPress_League_Tables {
@@ -48,7 +48,7 @@ class SportsPress_League_Tables {
*/
private function define_constants() {
if ( !defined( 'SP_LEAGUE_TABLES_VERSION' ) )
define( 'SP_LEAGUE_TABLES_VERSION', '2.6.14' );
define( 'SP_LEAGUE_TABLES_VERSION', '2.6.15' );
if ( !defined( 'SP_LEAGUE_TABLES_URL' ) )
define( 'SP_LEAGUE_TABLES_URL', plugin_dir_url( __FILE__ ) );

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add officials to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.6.14
Version: 2.6.15
*/
// Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Officials' ) ) :
* Main SportsPress Officials Class
*
* @class SportsPress_Officials
* @version 2.6.14
* @version 2.6.15
*/
class SportsPress_Officials {
@@ -66,7 +66,7 @@ class SportsPress_Officials {
*/
private function define_constants() {
if ( !defined( 'SP_OFFICIALS_VERSION' ) )
define( 'SP_OFFICIALS_VERSION', '2.6.14' );
define( 'SP_OFFICIALS_VERSION', '2.6.15' );
if ( !defined( 'SP_OFFICIALS_URL' ) )
define( 'SP_OFFICIALS_URL', plugin_dir_url( __FILE__ ) );
@@ -332,94 +332,6 @@ class SportsPress_Officials {
return $columns;
}
/**
* Add settings.
*
* @return array
*/
public function add_settings( $settings ) {
return array_merge( $settings,
array(
array( 'title' => __( 'Officials', 'sportspress' ), 'type' => 'title', 'id' => 'table_options' ),
),
apply_filters( 'sportspress_table_options', array(
array(
'title' => __( 'Duty', 'sportspress' ),
'desc' => __( 'Display title', 'sportspress' ),
'id' => 'sportspress_table_show_title',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'title' => __( 'Teams', 'sportspress' ),
'desc' => __( 'Display logos', 'sportspress' ),
'id' => 'sportspress_table_show_logos',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'title' => __( 'Pagination', 'sportspress' ),
'desc' => __( 'Paginate', 'sportspress' ),
'id' => 'sportspress_table_paginated',
'default' => 'yes',
'type' => 'checkbox',
),
array(
'title' => __( 'Limit', 'sportspress' ),
'id' => 'sportspress_table_rows',
'class' => 'small-text',
'default' => '10',
'desc' => __( 'teams', 'sportspress' ),
'type' => 'number',
'custom_attributes' => array(
'min' => 1,
'step' => 1
),
),
array(
'title' => __( 'Form', 'sportspress' ),
'id' => 'sportspress_form_limit',
'class' => 'small-text',
'default' => '5',
'desc' => __( 'events', 'sportspress' ),
'type' => 'number',
'custom_attributes' => array(
'min' => 1,
'step' => 1
),
),
array(
'title' => __( 'Pos', 'sportspress' ),
'desc' => __( 'Always increment', 'sportspress' ),
'id' => 'sportspress_table_increment',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Tiebreaker', 'sportspress' ),
'id' => 'sportspress_table_tiebreaker',
'default' => 'none',
'type' => 'select',
'options' => array(
'none' => __( 'None', 'sportspress' ),
'h2h' => __( 'Head to head', 'sportspress' ),
),
),
) ),
array(
array( 'type' => 'sectionend', 'id' => 'table_options' ),
)
);
}
/**
* Add event template.
*

View File

@@ -0,0 +1,184 @@
<?php
/*
Plugin Name: SportsPress OpenStreetMap Integration
Plugin URI: http://themeboy.com/
Description: Integrate OpenStreetMap to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.7.5
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'SportsPress_OpenStreetMap' ) ):
/**
* Main SportsPress OpenStreetMap Class
*
* @class SportsPress_OpenStreetMap
* @version 2.7.5
*/
class SportsPress_OpenStreetMap {
/**
* Constructor
*/
public function __construct() {
// Define constants
$this->define_constants();
// Actions
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
add_action( 'sp_admin_venue_scripts', array( $this, 'admin_venue_scripts' ) );
add_action( 'sp_frontend_venue_scripts', array( $this, 'frontend_venue_scripts' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) );
add_action( 'sp_venue_show_map', array( $this, 'show_venue_map' ), 10, 5 );
add_action( 'sp_admin_geocoder_scripts', array( $this, 'admin_geocoder_scripts' ), 10 );
add_action( 'sp_setup_geocoder_scripts', array( $this, 'setup_geocoder_scripts' ), 10 );
add_action( 'sp_setup_venue_geocoder_scripts', array( $this, 'setup_venue_geocoder_scripts' ), 10 );
}
/**
* Define constants.
*/
private function define_constants() {
if ( !defined( 'SP_OPENSTREETMAP_VERSION' ) )
define( 'SP_OPENSTREETMAP_VERSION', '2.7.5' );
if ( !defined( 'SP_OPENSTREETMAP_URL' ) )
define( 'SP_OPENSTREETMAP_URL', plugin_dir_url( __FILE__ ) );
if ( !defined( 'SP_OPENSTREETMAP_DIR' ) )
define( 'SP_OPENSTREETMAP_DIR', plugin_dir_path( __FILE__ ) );
}
/**
* Enqueue admin scripts
*/
public function admin_scripts() {
do_action( 'sp_admin_venue_scripts' );
}
/**
* Enqueue admin venue scripts
*/
public function admin_venue_scripts() {
$screen = get_current_screen();
if ( in_array( $screen->id, sp_get_screen_ids() ) ) {
wp_enqueue_style( 'leaflet_stylesheet', SP()->plugin_url() . '/assets/css/leaflet.css', array(), '1.7.1' );
wp_enqueue_style( 'control-geocoder', SP()->plugin_url() . '/assets/css/Control.Geocoder.css', array(), '1.13.0' );
}
if ( in_array( $screen->id, sp_get_screen_ids() ) ) {
wp_register_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.7.1' );
wp_register_script( 'control-geocoder', SP()->plugin_url() . '/assets/js/Control.Geocoder.min.js', array( 'leaflet_js' ), '1.13.0' );
wp_register_script( 'sportspress-admin-geocoder', SP()->plugin_url() . '/assets/js/admin/sp-geocoder.js', array( 'leaflet_js', 'control-geocoder' ), SP_VERSION, true );
}
if ( in_array( $screen->id, array( 'edit-sp_venue' ) ) ) {
wp_enqueue_script( 'leaflet_js' );
wp_enqueue_script( 'control-geocoder' );
wp_enqueue_script( 'sportspress-admin-geocoder' );
}
}
/**
* Enqueue frontend scripts
*/
public function frontend_scripts() {
do_action( 'sp_frontend_venue_scripts' );
}
/**
* Enqueue frontend venue scripts
*/
public function frontend_venue_scripts() {
global $post;
if( is_tax('sp_venue') || is_singular('sp_event') || ( isset( $post->post_content ) && sp_has_shortcodes( $post->post_content, array('event_full', 'event_venue') ) ) ) {
wp_enqueue_style( 'leaflet_stylesheet', SP()->plugin_url() . '/assets/css/leaflet.css', array(), '1.7.1' );
wp_enqueue_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.7.1' );
}
}
/**
* Integrate OpenStreetMap (Show Venue)
*
* @return mix
*/
public function show_venue_map( $latitude, $longitude, $address, $zoom, $maptype ) {
$lat = abs($latitude);
$lat_deg = floor($lat);
$lat_sec = ($lat - $lat_deg) * 3600;
$lat_min = floor($lat_sec / 60);
$lat_sec = floor($lat_sec - ($lat_min * 60));
$lat_dir = $latitude > 0 ? 'N' : 'S';
$lon = abs($longitude);
$lon_deg = floor($lon);
$lon_sec = ($lon - $lon_deg) * 3600;
$lon_min = floor($lon_sec / 60);
$lon_sec = floor($lon_sec - ($lon_min * 60));
$lon_dir = $longitude > 0 ? 'E' : 'W';
?>
<a href="https://www.google.com/maps/place/<?php echo urlencode("{$lat_deg}°{$lat_min}'{$lat_sec}\"{$lat_dir}").'+'.urlencode("{$lon_deg}°{$lon_min}'{$lon_sec}\"{$lon_dir}"); ?>/@<?php echo $latitude; ?>,<?php echo $longitude; ?>,<?php echo $zoom; ?>z" target="_blank"><div id="sp_openstreetmaps_container" style="width: 100%; height: 320px"></div></a>
<script>
// position we will use later
var lat = <?php echo $latitude; ?>;
var lon = <?php echo $longitude; ?>;
// initialize map
map = L.map('sp_openstreetmaps_container', { zoomControl:false }).setView([lat, lon], <?php echo $zoom; ?>);
// set map tiles source
<?php if ( 'satellite' === $maptype ) { ?>
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
maxZoom: 18,
}).addTo(map);
<?php }else{ ?>
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors',
maxZoom: 18,
}).addTo(map);
<?php } ?>
// add marker to the map
marker = L.marker([lat, lon]).addTo(map);
map.dragging.disable();
map.touchZoom.disable();
map.doubleClickZoom.disable();
map.scrollWheelZoom.disable();
</script>
<?php
}
/**
* Print geocoder script in admin
*/
public function admin_geocoder_scripts() {
wp_print_scripts( 'sportspress-admin-setup-geocoder' );
}
/**
* Print geocoder script in setup
*/
public function setup_geocoder_scripts() {
wp_register_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.7.1' );
wp_register_script( 'control-geocoder', SP()->plugin_url() . '/assets/js/Control.Geocoder.min.js', array( 'leaflet_js' ), '1.13.0' );
wp_register_script( 'sportspress-admin-setup-geocoder', SP()->plugin_url() . '/assets/js/admin/sp-setup-geocoder.js', array( 'leaflet_js', 'control-geocoder' ), SP_VERSION, true );
wp_enqueue_style( 'control-geocoder', SP()->plugin_url() . '/assets/css/Control.Geocoder.css', array(), '1.13.0' );
wp_enqueue_style( 'leaflet_stylesheet', SP()->plugin_url() . '/assets/css/leaflet.css', array(), '1.7.1' );
}
/**
* Print geocoder script in setup venue step
*/
public function setup_venue_geocoder_scripts() {
wp_print_scripts( 'leaflet_js' );
wp_print_scripts( 'control-geocoder' );
}
}
endif;
new SportsPress_OpenStreetMap();

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add player assignments support to SportsPress.
Author: Savvas
Author URI: http://themeboy.com/
Version: 2.6.10
Version: 2.7.3
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
@@ -14,7 +14,7 @@ if ( ! class_exists( 'SportsPress_Player_Assignments' ) ) :
* Main SportsPress Player Assignments Class
*
* @class SportsPress_Player_Assignments
* @version 2.6.10
* @version 2.7.3
*/
class SportsPress_Player_Assignments {
/**
@@ -36,7 +36,7 @@ class SportsPress_Player_Assignments {
*/
private function define_constants() {
if ( !defined( 'SP_PLAYER_ASSIGNMENTS_VERSION' ) )
define( 'SP_PLAYER_ASSIGNMENTS_VERSION', '2.6.10' );
define( 'SP_PLAYER_ASSIGNMENTS_VERSION', '2.7.3' );
if ( !defined( 'SP_PLAYER_ASSIGNMENTS_URL' ) )
define( 'SP_PLAYER_ASSIGNMENTS_URL', plugin_dir_url( __FILE__ ) );
if ( !defined( 'SP_PLAYER_ASSIGNMENTS_DIR' ) )
@@ -78,7 +78,7 @@ class SportsPress_Player_Assignments {
if ( 'sp_season' === sp_array_value( $param, 'taxonomy' ) ) $season_ids = sp_array_value( $param, 'terms', array() );
}
if ( empty( $league_ids ) || empty( $season_ids ) ) return $args;
if ( empty( $league_ids ) && empty( $season_ids ) ) return $args;
$args['meta_query'][] = array(
'key' => 'sp_assignments',

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add player lists to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.6.14
Version: 2.6.15
*/
// Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Player_Lists' ) ) :
* Main SportsPress Player Lists Class
*
* @class SportsPress_Player_Lists
* @version 2.6.14
* @version 2.6.15
*/
class SportsPress_Player_Lists {
@@ -48,7 +48,7 @@ class SportsPress_Player_Lists {
*/
private function define_constants() {
if ( !defined( 'SP_PLAYER_LISTS_VERSION' ) )
define( 'SP_PLAYER_LISTS_VERSION', '2.6.14' );
define( 'SP_PLAYER_LISTS_VERSION', '2.6.15' );
if ( !defined( 'SP_PLAYER_LISTS_URL' ) )
define( 'SP_PLAYER_LISTS_URL', plugin_dir_url( __FILE__ ) );
@@ -266,6 +266,25 @@ class SportsPress_Player_Lists {
'type' => 'checkbox',
'checkboxgroup' => 'end',
),
array(
'title' => __( 'Teams', 'sportspress' ),
'desc' => __( 'Display logos', 'sportspress' ),
'id' => 'sportspress_list_show_logos',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Teams', 'sportspress' ),
'id' => 'sportspress_list_team_format',
'default' => 'name',
'type' => 'radio',
'options' => array(
'name' => __( 'Name', 'sportspress' ),
'logo' => __( 'Logo', 'sportspress' ),
),
),
array(
'title' => __( 'Pagination', 'sportspress' ),

View File

@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
Description: Add frontend styles to SportsPress.
Author: ThemeBoy
Author URI: http://themeboy.com/
Version: 2.3
Version: 2.7
*/
// Exit if accessed directly
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Styles' ) ) :
* Main SportsPress Styles Class
*
* @class SportsPress_Styles
* @version 2.3
* @version 2.7
*/
class SportsPress_Styles {
@@ -43,7 +43,7 @@ class SportsPress_Styles {
*/
private function define_constants() {
if ( !defined( 'SP_STYLES_VERSION' ) )
define( 'SP_STYLES_VERSION', '2.3' );
define( 'SP_STYLES_VERSION', '2.7' );
if ( !defined( 'SP_STYLES_URL' ) )
define( 'SP_STYLES_URL', plugin_dir_url( __FILE__ ) );
@@ -113,8 +113,14 @@ class SportsPress_Styles {
* Output custom CSS.
*/
public function custom_css( $colors = array() ) {
if ( current_theme_supports( 'sportspress' ) && ! current_theme_supports( 'sportspress-styles' ) ) return $styles;
if ( 'no' === get_option( 'sportspress_styles', 'yes' ) ) return $styles;
if ( current_theme_supports( 'sportspress' ) && ! current_theme_supports( 'sportspress-styles' ) ) {
return;
}
if ( 'no' === get_option( 'sportspress_styles', 'yes' ) ) {
return;
}
// Defaults
if ( empty( $colors['primary'] ) ) $colors['primary'] = '#2b353e';

View File

@@ -23,13 +23,16 @@
{ "name" : "T", "id" : "points", "description" : "Total points", "primary" : 1 }
],
"performance": [
{ "name" : "1", "format" : "checkbox", "description" : "1st set" },
{ "name" : "2", "format" : "checkbox", "description" : "2nd set" },
{ "name" : "3", "format" : "checkbox", "description" : "3rd set" },
{ "name" : "4", "format" : "checkbox", "description" : "4th set" },
{ "name" : "5", "format" : "checkbox", "description" : "5th set" },
{ "name" : "S", "id" : "sets", "description" : "Sets played" },
{ "name" : "K", "description" : "Kills" },
{ "name" : "E", "description" : "Attack errors" },
{ "name" : "TA", "description" : "Total attacks" },
{ "name" : "A", "description" : "Assists" },
{ "name" : "B", "description" : "Blocks" },
{ "name" : "DIG", "id" : "digs", "description" : "Digs" },
{ "name" : "PTS", "id" : "points", "description" : "Points" }
],
"columns": [
@@ -50,6 +53,13 @@
{ "name" : "A/S", "equation" : "$a / $sets", "type" : "average", "description" : "Assists per set" }
],
"options": {
"mode" : "team"
"mode" : "team",
"event_teams" : "2",
"event_teams_delimiter" : "-",
"event_show_full_time" : "no",
"event_reverse_teams" : "no",
"event_performance_mode" : "values",
"event_show_player_numbers" : "yes",
"event_show_position" : "no"
}
}

View File

@@ -1,10 +1,10 @@
=== SportsPress - Sports Club & League Manager ===
Contributors: ThemeBoy, brianmiyaji, aylaview, savvasha, nabil_kadimi
Contributors: ThemeBoy, brianmiyaji, aylaview, savvasha, nabil_kadimi, rochesterj
Tags: calendars, club, club management, esports, events, fixtures, leagues, league management, sports, sports club, sports data, team rosters
Donate link: http://tboy.co/donate
Requires at least: 3.8
Tested up to: 5.0
Stable tag: 2.6.14
Tested up to: 5.7
Stable tag: 2.7.8
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -52,6 +52,7 @@ More details about each feature are available on the [SportsPress Website](http:
* [SportsPress for Cricket](https://wordpress.org/plugins/sportspress-for-cricket/)
* [SportsPress for Football (Soccer)](https://wordpress.org/plugins/sportspress-for-soccer/)
* [SportsPress for Golf](https://wordpress.org/plugins/sportspress-for-golf/)
* [SportsPress for Volleyball](https://wordpress.org/plugins/sportspress-for-volleyball/)
= SportsPress Pro =
@@ -126,6 +127,8 @@ Looking for more advanced sports functionality? Upgrade to [SportsPress Pro](htt
* [Football Club](http://tboy.co/fc)
* [Marquee](http://tboy.co/marquee)
* [Premier](http://tboy.co/premier)
* [Rookie Plus](http://tboy.co/rp)
* [Varsity](http://tboy.co/varsity)
= Get Involved =
@@ -237,6 +240,112 @@ When you upgrade to one of the SportsPress Pro licenses, you can simply activate
== Changelog ==
= 2.7.8 =
* Fix - Event results, box scores, and players stats not updating via REST API.
= 2.7.7 =
* Fix - Events not appearing due to filter malfunction.
= 2.7.6 =
* Feature - Add ability to bulk set events as on time.
* Fix - Players in events not being filtered by team.
= 2.7.5 =
* Tweak - Add ability to filter events by team and match day in one query.
* Tweak - Improve performance by updating leaflet script and only loading when required.
* Tweak - Add overtime notation compatibility for minutes played.
* Fix - Issue with event edit page where the scripts were not working.
* Fix - No records when format is default in event list shortcode.
= 2.7.4 =
* Tweak - Add option to display birthday, age, or both in birthdays widget.
* Fix - Player list data showing zeroes in some cases.
= 2.7.3 =
* Compatibility - Tested for compatibility with WordPress 5.5 with changes made where necessary.
* Tweak - Avoid showing minutes box for subs when not needed.
* Tweak - Improve filtering speed for queries without leagues or seasons.
* Tweak - Apply reverse order setting in event lists.
* Tweak - Enable filtering a player's events played on a specific team.
* Fix - Include future events in REST API for WordPress 5.5.
* Fix - Enable updating player metrics using the REST API.
* Fix - Deprecated code for PHP 7.4.
* Fix - Elementor compatibility.
* Localization - Update country names for Czechia, North Macedonia, Myanmar, and Eswatini.
* Localization - Adjust RTL stylesheet for event performance icons.
= 2.7.2 =
* Tweak - Sanitize delimiter field in event settings.
= 2.7.1 =
* Feature - Enable player list filtering by nationality.
* Feature - Add option to display date of birth in player lists.
* Tweak - Exclude postponed and canceled events from countdowns.
* Tweak - Apply reverse order option to event results.
* Tweak - When a team has more than one home venue, separate with commas.
* Fix - Venue address containing pluses in events.
* Fix - Event blocks showing the wrong dates when embedded within other event pages.
* Fix - Statistics not adding manual values when not based on equations.
* Fix - Event lists ignoring the format parameter.
* Fix - League table order when displaying multiple tables in team profiles.
* Fix - Error when deleting configuration columns.
* Fix - Player lists not including past players in some cases.
* Fix - Prevent error when viewing event calendar in some cases.
= 2.7 =
* Feature - New bulk actions to postpone and cancel multiple events.
* Feature - Add date of birth to player importer.
* Feature - Automatically select the home team's venue as the default venue when importing fixtures.
* Feature - Add ability to turn on comment for team profiles.
* Feature - Filter league tables by event status.
* Tweak - When an icon is used for player performance, display the icon in player lists and profiles.
* Tweak - Add title attribute for player statistic icons.
* Tweak - Default stylesheet sorting icon width.
* Fix - Icon color picker rendering issue.
* Fix - Image selector not working for player statistics.
* Fix - Enqueue scripts and styles for OpenStreetMap when used in shortcodes.
* Localization - Add translation options for countdown units.
= 2.6.20 =
* Tweak - Improve compatibility with volleyball for checkbox performance.
* Preset - Update volleyball preset with additional options.
= 2.6.19 =
* Feature - Enable filtering calendars base on players.
* Feature - Add checkbox type to event performance.
* Fix - Javascript error when columns are hidden in event list.
* Fix - Notice when displaying staff in event performance table.
* Fix - Notice when event results are empty.
* Fix - Uncaught error in player class.
* Preset - Update volleyball preset using checkbox performance type.
= 2.6.18 =
* Fix - Prevent OpenStreetMap scripts from loading when Google Maps is active via SportsPress Pro.
* Fix - Headers already sent error related to default nationality module.
= 2.6.17 =
* Tweak - Only show welcome screen on major version upgrade.
* Tweak - Add filters to enable career totals calculation with extensions.
* Fix - Countdowns not reflecting timezone setting.
= 2.6.16 =
* Tweak - Add support for updated baseball extension with partial innings.
* Fix - Error displaying staff in events when offense and defense are separate tables.
= 2.6.15 =
* Important - Using Google Maps will require a SportsPress Pro license after August 31, 2019.
* Refactor - Fallback to OpenStreetMap for venue maps without SportsPress Pro.
* Feature - Option to display team logos instead of team names in player lists.
* Feature - Option to display custom specs in event blocks and event lists.
* Tweak - Improve page load speed when creating new league tables.
* Tweak - Prevent displaying events other than published or scheduled.
* Fix - Icons only appearing in the first table when player lists are grouped.
* Fix - Character encoding and CRLF errors in calendar feeds.
* Fix - Missing field location Schema error.
* Fix - Dropdowns collapsing in admin when meta boxes are hidden.
* Fix - Timezone handling in countdowns.
* Fix - Error when using special characters in admin settings.
= 2.6.14 =
* Fix - API endpoints for secondary post types.

Some files were not shown because too many files have changed in this diff Show More