Version Description
- Tweak - Add shortcode parameter to override global date in event calendar.
Download this release
Release Info
Developer | brianmiyaji |
Plugin | SportsPress – Sports Club & League Manager |
Version | 2.0.16 |
Comparing to | |
See all releases |
Code changes from version 1.9.20 to 2.0.16
- assets/css/admin.css +123 -0
- assets/css/menu.css +10 -2
- assets/css/sportspress-rtl.css +3 -4
- assets/css/sportspress.css +19 -0
- assets/fonts/sportspress.eot +0 -0
- assets/fonts/sportspress.svg +2 -0
- assets/fonts/sportspress.ttf +0 -0
- assets/fonts/sportspress.woff +0 -0
- assets/fonts/sportspress.woff2 +0 -0
- assets/js/admin/editor-lang.php +1 -1
- assets/js/admin/sportspress-admin.js +26 -0
- assets/js/google-maps.js +0 -23
- assets/js/sp-maps.js +0 -27
- assets/js/sportspress.js +1 -1
- includes/admin/class-sp-admin-assets.php +2 -2
- includes/admin/class-sp-admin-notices.php +15 -1
- includes/admin/class-sp-admin-post-types.php +12 -1
- includes/admin/class-sp-admin-sports.php +14 -21
- includes/admin/class-sp-admin-taxonomies.php +42 -16
- includes/admin/class-sp-admin-welcome.php +69 -70
- includes/admin/importers/class-sp-event-importer.php +8 -5
- includes/admin/post-types/class-sp-admin-cpt-event.php +22 -1
- includes/admin/post-types/class-sp-admin-meta-boxes.php +2 -26
- includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-editor.php +0 -24
- includes/admin/post-types/meta-boxes/class-sp-meta-box-event-editor.php +0 -24
- includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php +13 -14
- includes/admin/post-types/meta-boxes/class-sp-meta-box-event-shortcode.php +2 -2
- includes/admin/post-types/meta-boxes/class-sp-meta-box-list-editor.php +0 -24
- includes/admin/post-types/meta-boxes/class-sp-meta-box-performance-details.php +32 -1
- includes/admin/post-types/meta-boxes/class-sp-meta-box-player-columns.php +2 -2
- includes/admin/post-types/meta-boxes/class-sp-meta-box-player-editor.php +0 -24
- includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php +85 -45
- includes/admin/post-types/meta-boxes/class-sp-meta-box-staff-editor.php +0 -24
- includes/admin/post-types/meta-boxes/class-sp-meta-box-statistic-details.php +37 -2
- includes/admin/post-types/meta-boxes/class-sp-meta-box-table-editor.php +0 -24
- includes/admin/post-types/meta-boxes/class-sp-meta-box-team-editor.php +0 -24
- includes/admin/settings/class-sp-settings-events.php +28 -60
- includes/admin/settings/class-sp-settings-general.php +9 -4
- includes/admin/settings/class-sp-settings-page.php +67 -4
- includes/admin/settings/class-sp-settings-players.php +38 -27
- includes/admin/settings/class-sp-settings-staff.php +7 -18
- includes/admin/settings/class-sp-settings-teams.php +7 -26
- includes/admin/views/html-admin-config.php +66 -15
- includes/admin/views/html-notice-no-access.php +6 -0
- includes/api/class-sp-rest-api.php +757 -0
- includes/api/class-sp-rest-posts-controller.php +64 -0
- includes/api/class-sp-rest-teams-controller.php +0 -301
- includes/class-sp-ajax.php +185 -1
- includes/class-sp-calendar.php +95 -37
- includes/class-sp-event.php +12 -2
- includes/class-sp-frontend-scripts.php +1 -7
- includes/class-sp-install.php +26 -15
- includes/class-sp-league-table.php +11 -11
- includes/class-sp-modules.php +9 -2
- includes/class-sp-player-list.php +9 -10
- includes/class-sp-player.php +187 -31
- includes/class-sp-post-types.php +50 -21
- includes/class-sp-rest-api.php +0 -42
- includes/class-sp-team.php +14 -5
- includes/class-sp-template-loader.php +54 -24
- includes/class-sp-templates.php +276 -0
- includes/sp-api-functions.php +67 -4
- includes/sp-conditional-functions.php +20 -2
- includes/sp-core-functions.php +33 -17
- includes/sp-template-functions.php +22 -4
- includes/sp-template-hooks.php +18 -19
- languages/sportspress.pot +1 -1
- modules/sportspress-birthdays.php +14 -3
- modules/sportspress-calendars.php +106 -17
- modules/sportspress-countdowns.php +4 -4
- modules/sportspress-lazy-loading.php +6 -6
- modules/sportspress-league-tables.php +61 -10
- modules/sportspress-player-lists.php +77 -10
- modules/sportspress-tutorials.php +4 -4
- presets/team-sports/baseball.json +21 -22
- presets/team-sports/cricket.json +3 -3
- presets/team-sports/floorball.json +3 -3
- presets/team-sports/handball.json +7 -7
- presets/team-sports/ice-hockey.json +2 -2
- presets/team-sports/softball.json +15 -19
- readme.txt +94 -7
- sportspress.php +21 -6
- templates/countdown.php +44 -6
- templates/event-blocks.php +28 -18
- templates/event-calendar.php +36 -27
- templates/event-fixtures-results.php +84 -0
- templates/event-list.php +12 -2
- templates/event-logos.php +21 -7
- templates/event-performance-table.php +4 -4
- templates/event-performance.php +6 -5
- templates/event-results.php +7 -10
- templates/player-details.php +4 -3
- templates/player-list.php +3 -2
- templates/player-statistics-league.php +55 -0
- templates/player-statistics.php +53 -96
- templates/staff-details.php +4 -3
- templates/team-events.php +19 -0
- templates/venue-map.php +18 -7
- wpml-config.xml +4 -1
assets/css/admin.css
CHANGED
@@ -587,6 +587,129 @@ table.widefat.sp-sortable-table tbody tr .icon {
|
|
587 |
border-left-color: #464646;
|
588 |
}
|
589 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
590 |
.sp-modules-wrapper {
|
591 |
margin-top: 20px;
|
592 |
margin-right: 300px;
|
587 |
border-left-color: #464646;
|
588 |
}
|
589 |
|
590 |
+
/* Toggle switches */
|
591 |
+
.sp-toggle-switch {
|
592 |
+
display: none !important;
|
593 |
+
}
|
594 |
+
|
595 |
+
.sp-toggle-switch + label {
|
596 |
+
width: 32px;
|
597 |
+
height: 16px;
|
598 |
+
border-radius: 16px;
|
599 |
+
position: absolute;
|
600 |
+
right: 12px;
|
601 |
+
top: 13px;
|
602 |
+
}
|
603 |
+
|
604 |
+
.sp-toggle-switch + label:before,
|
605 |
+
.sp-toggle-switch + label:after {
|
606 |
+
display: block;
|
607 |
+
position: absolute;
|
608 |
+
top: 0;
|
609 |
+
left: 0;
|
610 |
+
bottom: 0;
|
611 |
+
content: "";
|
612 |
+
}
|
613 |
+
|
614 |
+
.sp-toggle-switch + label:before {
|
615 |
+
right: 1px;
|
616 |
+
background-color: #e4e4e4;
|
617 |
+
border-radius: 16px;
|
618 |
+
transition: background 0.4s;
|
619 |
+
}
|
620 |
+
|
621 |
+
.sp-toggle-switch + label:after {
|
622 |
+
width: 16px;
|
623 |
+
background-color: #fff;
|
624 |
+
border-radius: 100%;
|
625 |
+
-webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
626 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
627 |
+
transition: margin 0.4s;
|
628 |
+
}
|
629 |
+
|
630 |
+
.sp-toggle-switch:checked + label:before {
|
631 |
+
background-color: #00a0d2;
|
632 |
+
}
|
633 |
+
|
634 |
+
.sp-toggle-switch:checked + label:after {
|
635 |
+
margin-left: 16px;
|
636 |
+
}
|
637 |
+
|
638 |
+
.sp-toggle-switch:checked + label:hover:before {
|
639 |
+
background-color: #00b9eb;
|
640 |
+
}
|
641 |
+
|
642 |
+
/* Sortable lists */
|
643 |
+
.sp-sortable-list li {
|
644 |
+
float: left;
|
645 |
+
clear: both;
|
646 |
+
max-width: 382px;
|
647 |
+
width: 100%;
|
648 |
+
box-sizing: border-box;
|
649 |
+
}
|
650 |
+
|
651 |
+
.sp-sortable-list .sp-item-float + .sp-item-float {
|
652 |
+
padding-right: 0;
|
653 |
+
}
|
654 |
+
|
655 |
+
.sp-item-bar {
|
656 |
+
clear: both;
|
657 |
+
line-height: 1.5em;
|
658 |
+
position: relative;
|
659 |
+
margin: 9px 0 0;
|
660 |
+
}
|
661 |
+
|
662 |
+
.sp-item-bar .sp-item-handle {
|
663 |
+
background: #fafafa;
|
664 |
+
color: #23282d;
|
665 |
+
border: 1px solid #dfdfdf;
|
666 |
+
position: relative;
|
667 |
+
padding: 10px 15px;
|
668 |
+
height: auto;
|
669 |
+
min-height: 20px;
|
670 |
+
line-height: 30px;
|
671 |
+
overflow: hidden;
|
672 |
+
word-wrap: break-word;
|
673 |
+
}
|
674 |
+
|
675 |
+
.sp-item-bar .sp-item-handle:hover {
|
676 |
+
border-color: #999;
|
677 |
+
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1);
|
678 |
+
box-shadow: 0 1px 2px rgba(0,0,0,.1);
|
679 |
+
}
|
680 |
+
|
681 |
+
.sp-item-bar .sp-item-title {
|
682 |
+
font-size: 13px;
|
683 |
+
font-weight: 600;
|
684 |
+
line-height: 20px;
|
685 |
+
display: block;
|
686 |
+
margin-right: 13em;
|
687 |
+
}
|
688 |
+
|
689 |
+
.sp-item-settings {
|
690 |
+
display: block;
|
691 |
+
padding: 10px 0 10px 15px;
|
692 |
+
position: relative;
|
693 |
+
z-index: 10;
|
694 |
+
background: #fff;
|
695 |
+
border: 1px solid #e5e5e5;
|
696 |
+
border-top: none;
|
697 |
+
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
698 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
699 |
+
}
|
700 |
+
|
701 |
+
.js .sp-item-handle {
|
702 |
+
cursor: move;
|
703 |
+
}
|
704 |
+
|
705 |
+
.sp-sortable-list .sp-item-placeholder {
|
706 |
+
border: 1px dashed #b4b9be;
|
707 |
+
margin: 9px auto 6px;
|
708 |
+
height: 42px;
|
709 |
+
}
|
710 |
+
|
711 |
+
/* Modules */
|
712 |
+
|
713 |
.sp-modules-wrapper {
|
714 |
margin-top: 20px;
|
715 |
margin-right: 300px;
|
assets/css/menu.css
CHANGED
@@ -30,6 +30,9 @@
|
|
30 |
-moz-osx-font-smoothing: grayscale;
|
31 |
}
|
32 |
|
|
|
|
|
|
|
33 |
.sp-icon-archive:before {
|
34 |
content: "\f322";
|
35 |
}
|
@@ -51,7 +54,8 @@
|
|
51 |
.sp-icon-calculator:before {
|
52 |
content: "\f108";
|
53 |
}
|
54 |
-
.sp-icon-calendar:before
|
|
|
55 |
content: "\f145";
|
56 |
}
|
57 |
.sp-icon-cake:before {
|
@@ -129,7 +133,11 @@
|
|
129 |
.sp-icon-tournament:before {
|
130 |
content: "\f313";
|
131 |
}
|
132 |
-
.sp-icon-
|
|
|
|
|
|
|
|
|
133 |
content: "\f307";
|
134 |
}
|
135 |
.sp-icon-trash:before {
|
30 |
-moz-osx-font-smoothing: grayscale;
|
31 |
}
|
32 |
|
33 |
+
.sp-icon-api:before {
|
34 |
+
content: "\f237";
|
35 |
+
}
|
36 |
.sp-icon-archive:before {
|
37 |
content: "\f322";
|
38 |
}
|
54 |
.sp-icon-calculator:before {
|
55 |
content: "\f108";
|
56 |
}
|
57 |
+
.sp-icon-calendar:before,
|
58 |
+
.sp-icon-sp_event:before {
|
59 |
content: "\f145";
|
60 |
}
|
61 |
.sp-icon-cake:before {
|
133 |
.sp-icon-tournament:before {
|
134 |
content: "\f313";
|
135 |
}
|
136 |
+
.sp-icon-scoreboard:before {
|
137 |
+
content: "\f509";
|
138 |
+
}
|
139 |
+
.sp-icon-tshirt:before,
|
140 |
+
.sp-icon-sp_player:before {
|
141 |
content: "\f307";
|
142 |
}
|
143 |
.sp-icon-trash:before {
|
assets/css/sportspress-rtl.css
CHANGED
@@ -56,9 +56,8 @@
|
|
56 |
float: left;
|
57 |
}
|
58 |
|
59 |
-
@media only screen and (
|
60 |
-
.sp-
|
61 |
-
|
62 |
-
right: 0;
|
63 |
}
|
64 |
}
|
56 |
float: left;
|
57 |
}
|
58 |
|
59 |
+
@media only screen and (min-width: 601px) {
|
60 |
+
.sp-template-logo + .sp-post-content {
|
61 |
+
clear: right;
|
|
|
62 |
}
|
63 |
}
|
assets/css/sportspress.css
CHANGED
@@ -16,6 +16,7 @@
|
|
16 |
.sp-header {
|
17 |
position: relative;
|
18 |
overflow: visible;
|
|
|
19 |
}
|
20 |
|
21 |
/* Templates */
|
@@ -92,6 +93,11 @@
|
|
92 |
width: 1px;
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
95 |
/* Pagination */
|
96 |
.sp-table-wrapper .dataTables_paginate {
|
97 |
text-align: center;
|
@@ -318,6 +324,9 @@
|
|
318 |
width: auto;
|
319 |
height: auto;
|
320 |
}
|
|
|
|
|
|
|
321 |
.widget .sp-event-blocks .sp-event-title {
|
322 |
margin: 10px;
|
323 |
padding: 0;
|
@@ -326,6 +335,7 @@
|
|
326 |
|
327 |
/* Countdowns */
|
328 |
.sp-template-countdown .event-name {
|
|
|
329 |
overflow: hidden;
|
330 |
}
|
331 |
.sp-template-countdown .team-logo {
|
@@ -353,6 +363,7 @@
|
|
353 |
|
354 |
/* Google Maps */
|
355 |
.sp-google-map {
|
|
|
356 |
height: 320px;
|
357 |
}
|
358 |
.sp-google-map img {
|
@@ -437,4 +448,12 @@
|
|
437 |
display: inline-block;
|
438 |
margin: 0 0.25em;
|
439 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
}
|
16 |
.sp-header {
|
17 |
position: relative;
|
18 |
overflow: visible;
|
19 |
+
z-index: 10000;
|
20 |
}
|
21 |
|
22 |
/* Templates */
|
93 |
width: 1px;
|
94 |
}
|
95 |
|
96 |
+
/* Post Content */
|
97 |
+
.sp-post-content {
|
98 |
+
clear: both;
|
99 |
+
}
|
100 |
+
|
101 |
/* Pagination */
|
102 |
.sp-table-wrapper .dataTables_paginate {
|
103 |
text-align: center;
|
324 |
width: auto;
|
325 |
height: auto;
|
326 |
}
|
327 |
+
.sp-fixtures-results {
|
328 |
+
clear: both;
|
329 |
+
}
|
330 |
.widget .sp-event-blocks .sp-event-title {
|
331 |
margin: 10px;
|
332 |
padding: 0;
|
335 |
|
336 |
/* Countdowns */
|
337 |
.sp-template-countdown .event-name {
|
338 |
+
clear: both;
|
339 |
overflow: hidden;
|
340 |
}
|
341 |
.sp-template-countdown .team-logo {
|
363 |
|
364 |
/* Google Maps */
|
365 |
.sp-google-map {
|
366 |
+
width: 100%;
|
367 |
height: 320px;
|
368 |
}
|
369 |
.sp-google-map img {
|
448 |
display: inline-block;
|
449 |
margin: 0 0.25em;
|
450 |
}
|
451 |
+
|
452 |
+
.sp-template-logo + .sp-post-content {
|
453 |
+
clear: left;
|
454 |
+
}
|
455 |
+
|
456 |
+
.sp-template-photo + .sp-post-content {
|
457 |
+
clear: none;
|
458 |
+
}
|
459 |
}
|
assets/fonts/sportspress.eot
CHANGED
Binary file
|
assets/fonts/sportspress.svg
CHANGED
@@ -32,6 +32,7 @@
|
|
32 |
<glyph unicode="" glyph-name="trash" d="M288 256h64v-160h-64zM480 384h-128v64c0 17.688-14.312 32-32 32h-128c-17.688 0-32-14.312-32-32v-64h-128c-17.688 0-32-14.312-32-32v-32h32v-320c0-17.688 14.312-32 32-32h384c17.688 0 32 14.312 32 32v320h32v32c0 17.688-14.312 32-32 32zM224 416h64v-32h-64v32zM416 32h-320v288h320v-288zM160 256h64v-160h-64z" />
|
33 |
<glyph unicode="" glyph-name="chart" d="M76.8 102.4h102.4v204.8h-102.4v-204.8zM204.8 102.4h102.4v307.2h-102.4v-307.2zM332.8 307.2v-204.8h102.4v204.8h-102.4z" />
|
34 |
<glyph unicode="" glyph-name="whistle" d="M301.84 256c3.44-12.24 5.36-25.12 5.36-38.4 0-77.76-63.040-140.8-140.8-140.8s-140.8 63.040-140.8 140.8 63.040 140.8 140.8 140.8h89.6v-25.6c0-14.16 11.44-25.6 25.6-25.6s25.6 11.44 25.6 25.6v25.6h179.2v-102.4h-184.56z" />
|
|
|
35 |
<glyph unicode="" glyph-name="tshirt" d="M459.6 307.2h-76.8v-179.2h-256v179.2h-76.8v102.4h132.4c10.56-29.84 38.96-51.2 72.4-51.2s61.84 21.36 72.4 51.2h132.4v-102.4zM382.8 102.4v-51.2h-256v51.2h256z" />
|
36 |
<glyph unicode="" glyph-name="color" d="M435.2 204.8c0-98.96-80.24-179.2-179.2-179.2s-179.2 80.24-179.2 179.2c0 49.52 20.080 94.32 52.48 126.72v0l126.72 126.72 126.72-126.72c32.4-32.4 52.48-77.2 52.48-126.72zM343.28 298l-87.44 87.44-89.040-89.040c-23.84-23.28-38.8-55.6-38.8-91.6 0-70.72 57.28-128 128-128s128 57.28 128 128c0 36.88-15.76 69.84-40.72 93.2zM256 102.4l0.080 246.8 70.4-70.4c19.6-18.64 31.92-44.8 31.92-74 0-56.56-45.84-102.4-102.4-102.4z" />
|
37 |
<glyph unicode="" glyph-name="tournament" d="M384 286v149.2h25.6c14.16 0 25.6-11.44 25.6-25.6v-51.2c0-33.44-21.36-61.84-51.2-72.4zM153.6 51.52h204.8v-51.52h-204.8v51.52zM179.2 76.8l25.6 25.6h25.6v25.6l25.6 25.6 25.6-25.6v-25.6h25.6l25.6-25.6h-153.6zM256 179.2c-56.56 0-102.4 45.84-102.4 102.4v179.2h204.8v-179.2c0-56.56-45.84-102.4-102.4-102.4zM76.8 358.4v51.2c0 14.16 11.44 25.6 25.6 25.6h25.6v-149.2c-29.84 10.56-51.2 38.96-51.2 72.4z" />
|
@@ -55,5 +56,6 @@
|
|
55 |
<glyph unicode="" glyph-name="moon" d="M351.207 440.32c17.562-9.856 34.099-22.195 49.050-37.094 87.552-87.603 87.552-229.53 0-317.082s-229.504-87.552-317.082 0c-14.925 14.95-27.264 31.514-37.094 49.050 85.376-47.795 195.405-35.507 268.007 37.094 72.627 72.627 84.941 182.631 37.12 268.032z" />
|
56 |
<glyph unicode="" glyph-name="popup" d="M435.2 435.2h-204.8c-14.16 0-25.6-11.44-25.6-25.6v-204.8c0-14.16 11.44-25.6 25.6-25.6h204.8c14.16 0 25.6 11.44 25.6 25.6v204.8c0 14.16-11.44 25.6-25.6 25.6zM409.6 230.4h-153.6v153.6h153.6v-153.6zM256 76.8h-153.6v153.6h51.2v51.2h-76.8c-14.16 0-25.6-11.44-25.6-25.6v-204.8c0-14.16 11.44-25.6 25.6-25.6h204.8c14.16 0 25.6 11.44 25.6 25.6v76.8h-51.2v-51.2z" />
|
57 |
<glyph unicode="" glyph-name="availability" d="M384 435.2h-51.2v-51.2h51.2v51.2zM435.2 435.2h-25.6v-76.8h-102.4v76.8h-102.4v-76.8h-102.4v76.8h-25.6c-14.16 0-25.6-11.44-25.6-25.6v-358.4c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v358.4c0 14.16-11.44 25.6-25.6 25.6zM409.6 76.8h-307.2v230.4h307.2v-230.4zM179.2 435.2h-51.2v-51.2h51.2v51.2zM230.4 115.2l-76.4 76.4 29.12 29.12 47.28-47.28 98.8 98.8 29.2-29.040-128-128z" />
|
|
|
58 |
<glyph unicode="" glyph-name="ticket" d="M125.6 190.96l90.96-90.96 166.8 166.88-90.96 90.88-166.8-166.8zM489.12 315.84l-38.72 38.64c-7.36-4-15.76-6.32-24.8-6.32-28.56 0-51.76 23.2-51.76 51.84 0 8.96 2.24 17.44 6.32 24.8l-38.72 38.72c-10.080 10.080-26.56 10.080-36.64 0l-281.92-281.84c-10.080-10.080-10.080-26.56 0-36.64l38.72-38.72c7.36 4 15.84 6.32 24.8 6.32 28.64 0 51.84-23.2 51.84-51.76 0-8.96-2.24-17.44-6.32-24.8l38.72-38.72c10.080-10.080 26.56-10.080 36.64 0l281.84 281.76c10 10.16 10 26.64 0 36.72v0zM216.56 58.4l-132.56 132.56 208.48 208.4 132.48-132.48-208.4-208.48z" />
|
59 |
</font></defs></svg>
|
32 |
<glyph unicode="" glyph-name="trash" d="M288 256h64v-160h-64zM480 384h-128v64c0 17.688-14.312 32-32 32h-128c-17.688 0-32-14.312-32-32v-64h-128c-17.688 0-32-14.312-32-32v-32h32v-320c0-17.688 14.312-32 32-32h384c17.688 0 32 14.312 32 32v320h32v32c0 17.688-14.312 32-32 32zM224 416h64v-32h-64v32zM416 32h-320v288h320v-288zM160 256h64v-160h-64z" />
|
33 |
<glyph unicode="" glyph-name="chart" d="M76.8 102.4h102.4v204.8h-102.4v-204.8zM204.8 102.4h102.4v307.2h-102.4v-307.2zM332.8 307.2v-204.8h102.4v204.8h-102.4z" />
|
34 |
<glyph unicode="" glyph-name="whistle" d="M301.84 256c3.44-12.24 5.36-25.12 5.36-38.4 0-77.76-63.040-140.8-140.8-140.8s-140.8 63.040-140.8 140.8 63.040 140.8 140.8 140.8h89.6v-25.6c0-14.16 11.44-25.6 25.6-25.6s25.6 11.44 25.6 25.6v25.6h179.2v-102.4h-184.56z" />
|
35 |
+
<glyph unicode="" glyph-name="api" d="M448 357.44c-7.36 0-14.16 2.080-20 5.6l-111.68-111.68c10.32-13.040 16.48-29.6 16.48-47.52 0-14.72-4.16-28.48-11.28-40.16l64.96-51.040c20.4 18.96 52.16 20.72 74.72 2.96 25.040-19.68 29.36-55.84 9.68-80.88s-55.84-29.36-80.88-9.68c-22.56 17.76-28.32 49.040-14.72 73.36l-64.96 51.040c-13.92-13.84-33.040-22.48-54.24-22.48-42.4 0-76.8 34.4-76.8 76.8 0 5.28 0.56 10.48 1.6 15.52l-90.56 30.16c-5.76-8.24-15.36-13.6-26.16-13.6-17.68 0-32 14.32-32 32s14.32 32 32 32 32-14.32 32-32c0-0.48 0-0.96 0-1.44l90.4-30.080c12.24 26.16 38.8 44.32 69.6 44.32 17.92 0 34.4-6.16 47.52-16.48l111.52 111.76c-3.52 5.84-5.6 12.64-5.6 20 0 21.2 17.2 38.4 38.4 38.4s38.4-17.2 38.4-38.4-17.2-38.48-38.4-38.48z" />
|
36 |
<glyph unicode="" glyph-name="tshirt" d="M459.6 307.2h-76.8v-179.2h-256v179.2h-76.8v102.4h132.4c10.56-29.84 38.96-51.2 72.4-51.2s61.84 21.36 72.4 51.2h132.4v-102.4zM382.8 102.4v-51.2h-256v51.2h256z" />
|
37 |
<glyph unicode="" glyph-name="color" d="M435.2 204.8c0-98.96-80.24-179.2-179.2-179.2s-179.2 80.24-179.2 179.2c0 49.52 20.080 94.32 52.48 126.72v0l126.72 126.72 126.72-126.72c32.4-32.4 52.48-77.2 52.48-126.72zM343.28 298l-87.44 87.44-89.040-89.040c-23.84-23.28-38.8-55.6-38.8-91.6 0-70.72 57.28-128 128-128s128 57.28 128 128c0 36.88-15.76 69.84-40.72 93.2zM256 102.4l0.080 246.8 70.4-70.4c19.6-18.64 31.92-44.8 31.92-74 0-56.56-45.84-102.4-102.4-102.4z" />
|
38 |
<glyph unicode="" glyph-name="tournament" d="M384 286v149.2h25.6c14.16 0 25.6-11.44 25.6-25.6v-51.2c0-33.44-21.36-61.84-51.2-72.4zM153.6 51.52h204.8v-51.52h-204.8v51.52zM179.2 76.8l25.6 25.6h25.6v25.6l25.6 25.6 25.6-25.6v-25.6h25.6l25.6-25.6h-153.6zM256 179.2c-56.56 0-102.4 45.84-102.4 102.4v179.2h204.8v-179.2c0-56.56-45.84-102.4-102.4-102.4zM76.8 358.4v51.2c0 14.16 11.44 25.6 25.6 25.6h25.6v-149.2c-29.84 10.56-51.2 38.96-51.2 72.4z" />
|
56 |
<glyph unicode="" glyph-name="moon" d="M351.207 440.32c17.562-9.856 34.099-22.195 49.050-37.094 87.552-87.603 87.552-229.53 0-317.082s-229.504-87.552-317.082 0c-14.925 14.95-27.264 31.514-37.094 49.050 85.376-47.795 195.405-35.507 268.007 37.094 72.627 72.627 84.941 182.631 37.12 268.032z" />
|
57 |
<glyph unicode="" glyph-name="popup" d="M435.2 435.2h-204.8c-14.16 0-25.6-11.44-25.6-25.6v-204.8c0-14.16 11.44-25.6 25.6-25.6h204.8c14.16 0 25.6 11.44 25.6 25.6v204.8c0 14.16-11.44 25.6-25.6 25.6zM409.6 230.4h-153.6v153.6h153.6v-153.6zM256 76.8h-153.6v153.6h51.2v51.2h-76.8c-14.16 0-25.6-11.44-25.6-25.6v-204.8c0-14.16 11.44-25.6 25.6-25.6h204.8c14.16 0 25.6 11.44 25.6 25.6v76.8h-51.2v-51.2z" />
|
58 |
<glyph unicode="" glyph-name="availability" d="M384 435.2h-51.2v-51.2h51.2v51.2zM435.2 435.2h-25.6v-76.8h-102.4v76.8h-102.4v-76.8h-102.4v76.8h-25.6c-14.16 0-25.6-11.44-25.6-25.6v-358.4c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v358.4c0 14.16-11.44 25.6-25.6 25.6zM409.6 76.8h-307.2v230.4h307.2v-230.4zM179.2 435.2h-51.2v-51.2h51.2v51.2zM230.4 115.2l-76.4 76.4 29.12 29.12 47.28-47.28 98.8 98.8 29.2-29.040-128-128z" />
|
59 |
+
<glyph unicode="" glyph-name="scoreboard" d="M435.2 25.6h-358.4c-14.16 0-25.6 11.44-25.6 25.6v358.4c0 14.16 11.44 25.6 25.6 25.6h358.4c14.16 0 25.6-11.44 25.6-25.6v-358.4c0-14.16-11.44-25.6-25.6-25.6zM409.6 384h-307.2v-307.2h307.2v307.2zM217.6 307.2l12.8-12.8v-51.2l-12.8-12.8 12.8-12.8v-51.2l-12.8-12.8h-64l-12.8 12.8v51.2l12.8 12.8-12.8 12.8v51.2l12.8 12.8h64zM166.4 179.2h38.4v38.4h-38.4v-38.4zM166.4 243.2h38.4v38.4h-38.4v-38.4zM256 268.8c7.040 0 12.8-5.76 12.8-12.8s-5.76-12.8-12.8-12.8-12.8 5.76-12.8 12.8 5.76 12.8 12.8 12.8zM256 217.6c7.040 0 12.8-5.76 12.8-12.8s-5.76-12.8-12.8-12.8-12.8 5.76-12.8 12.8 5.76 12.8 12.8 12.8zM358.4 307.2l12.8-12.8v-51.2l-12.8-12.8 12.8-12.8v-51.2l-12.8-12.8h-64l-12.8 12.8v51.2l12.8 12.8-12.8 12.8v51.2l12.8 12.8h64zM307.2 179.2h38.4v38.4h-38.4v-38.4zM307.2 243.2h38.4v38.4h-38.4v-38.4z" />
|
60 |
<glyph unicode="" glyph-name="ticket" d="M125.6 190.96l90.96-90.96 166.8 166.88-90.96 90.88-166.8-166.8zM489.12 315.84l-38.72 38.64c-7.36-4-15.76-6.32-24.8-6.32-28.56 0-51.76 23.2-51.76 51.84 0 8.96 2.24 17.44 6.32 24.8l-38.72 38.72c-10.080 10.080-26.56 10.080-36.64 0l-281.92-281.84c-10.080-10.080-10.080-26.56 0-36.64l38.72-38.72c7.36 4 15.84 6.32 24.8 6.32 28.64 0 51.84-23.2 51.84-51.76 0-8.96-2.24-17.44-6.32-24.8l38.72-38.72c10.080-10.080 26.56-10.080 36.64 0l281.84 281.76c10 10.16 10 26.64 0 36.72v0zM216.56 58.4l-132.56 132.56 208.48 208.4 132.48-132.48-208.4-208.48z" />
|
61 |
</font></defs></svg>
|
assets/fonts/sportspress.ttf
CHANGED
Binary file
|
assets/fonts/sportspress.woff
CHANGED
Binary file
|
assets/fonts/sportspress.woff2
CHANGED
Binary file
|
assets/js/admin/editor-lang.php
CHANGED
@@ -27,7 +27,7 @@ $raw = apply_filters( 'sportspress_tinymce_strings', array(
|
|
27 |
'details' => __( 'Details', 'sportspress' ),
|
28 |
'results' => __( 'Results', 'sportspress' ),
|
29 |
'countdown' => __( 'Countdown', 'sportspress' ),
|
30 |
-
'performance' => __( '
|
31 |
'calendar' => __( 'Calendar', 'sportspress' ),
|
32 |
'statistics' => __( 'Statistics', 'sportspress' ),
|
33 |
'table' => __( 'League Table', 'sportspress' ),
|
27 |
'details' => __( 'Details', 'sportspress' ),
|
28 |
'results' => __( 'Results', 'sportspress' ),
|
29 |
'countdown' => __( 'Countdown', 'sportspress' ),
|
30 |
+
'performance' => __( 'Box Score', 'sportspress' ),
|
31 |
'calendar' => __( 'Calendar', 'sportspress' ),
|
32 |
'statistics' => __( 'Statistics', 'sportspress' ),
|
33 |
'table' => __( 'League Table', 'sportspress' ),
|
assets/js/admin/sportspress-admin.js
CHANGED
@@ -262,6 +262,26 @@ jQuery(document).ready(function($){
|
|
262 |
// Trigger total stats calculator
|
263 |
$(".sp-data-table .sp-total input").trigger("updateTotal");
|
264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
// Select all checkboxes
|
266 |
$(".sp-select-all-range").on("change", ".sp-select-all", function() {
|
267 |
$range = $(this).closest(".sp-select-all-range");
|
@@ -291,6 +311,12 @@ jQuery(document).ready(function($){
|
|
291 |
handle: ".icon",
|
292 |
axis: "y"
|
293 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
// Autosave
|
296 |
$(".sp-autosave").change(function() {
|
262 |
// Trigger total stats calculator
|
263 |
$(".sp-data-table .sp-total input").trigger("updateTotal");
|
264 |
|
265 |
+
// Sync inputs
|
266 |
+
$(".sp-sync-input").on("keyup", function() {
|
267 |
+
name = $(this).attr("name");
|
268 |
+
$el = $("input[name='"+name+"']");
|
269 |
+
if ( $el.length > 1 ) {
|
270 |
+
val = $(this).val();
|
271 |
+
$el.val(val);
|
272 |
+
}
|
273 |
+
});
|
274 |
+
|
275 |
+
// Sync selects
|
276 |
+
$(".sp-sync-select").on("change", function() {
|
277 |
+
name = $(this).attr("name");
|
278 |
+
$el = $("select[name='"+name+"']")
|
279 |
+
if ( $el.length > 1 ) {
|
280 |
+
val = $(this).val();
|
281 |
+
$el.val(val);
|
282 |
+
}
|
283 |
+
});
|
284 |
+
|
285 |
// Select all checkboxes
|
286 |
$(".sp-select-all-range").on("change", ".sp-select-all", function() {
|
287 |
$range = $(this).closest(".sp-select-all-range");
|
311 |
handle: ".icon",
|
312 |
axis: "y"
|
313 |
});
|
314 |
+
|
315 |
+
// Sortable lists
|
316 |
+
$( ".sp-sortable-list" ).sortable({
|
317 |
+
handle: ".sp-item-handle",
|
318 |
+
placeholder: "sp-item-placeholder"
|
319 |
+
});
|
320 |
|
321 |
// Autosave
|
322 |
$(".sp-autosave").change(function() {
|
assets/js/google-maps.js
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
window.google = window.google || {};
|
4 |
-
google.maps = google.maps || {};
|
5 |
-
(function() {
|
6 |
-
|
7 |
-
function getScript(src) {
|
8 |
-
document.write('<' + 'script src="' + src + '"' +
|
9 |
-
' type="text/javascript"><' + '/script>');
|
10 |
-
}
|
11 |
-
|
12 |
-
var modules = google.maps.modules = {};
|
13 |
-
google.maps.__gjsload__ = function(name, text) {
|
14 |
-
modules[name] = text;
|
15 |
-
};
|
16 |
-
|
17 |
-
google.maps.Load = function(apiLoad) {
|
18 |
-
delete google.maps.Load;
|
19 |
-
apiLoad([0.009999999776482582,[[["https://mts0.googleapis.com/vt?lyrs=m@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.googleapis.com/vt?lyrs=m@248000000\u0026src=api\u0026hl=en-US\u0026"],null,null,null,null,"m@248000000",["https://mts0.google.com/vt?lyrs=m@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.google.com/vt?lyrs=m@248000000\u0026src=api\u0026hl=en-US\u0026"]],[["https://khms0.googleapis.com/kh?v=144\u0026hl=en-US\u0026","https://khms1.googleapis.com/kh?v=144\u0026hl=en-US\u0026"],null,null,null,1,"144",["https://khms0.google.com/kh?v=144\u0026hl=en-US\u0026","https://khms1.google.com/kh?v=144\u0026hl=en-US\u0026"]],[["https://mts0.googleapis.com/vt?lyrs=h@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.googleapis.com/vt?lyrs=h@248000000\u0026src=api\u0026hl=en-US\u0026"],null,null,null,null,"h@248000000",["https://mts0.google.com/vt?lyrs=h@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.google.com/vt?lyrs=h@248000000\u0026src=api\u0026hl=en-US\u0026"]],[["https://mts0.googleapis.com/vt?lyrs=t@132,r@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.googleapis.com/vt?lyrs=t@132,r@248000000\u0026src=api\u0026hl=en-US\u0026"],null,null,null,null,"t@132,r@248000000",["https://mts0.google.com/vt?lyrs=t@132,r@248000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.google.com/vt?lyrs=t@132,r@248000000\u0026src=api\u0026hl=en-US\u0026"]],null,null,[["https://cbks0.googleapis.com/cbk?","https://cbks1.googleapis.com/cbk?"]],[["https://khms0.googleapis.com/kh?v=83\u0026hl=en-US\u0026","https://khms1.googleapis.com/kh?v=83\u0026hl=en-US\u0026"],null,null,null,null,"83",["https://khms0.google.com/kh?v=83\u0026hl=en-US\u0026","https://khms1.google.com/kh?v=83\u0026hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt?hl=en-US\u0026","https://mts1.googleapis.com/mapslt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/ft?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/ft?hl=en-US\u0026"]],[["https://mts0.googleapis.com/vt?hl=en-US\u0026","https://mts1.googleapis.com/vt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/loom?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/loom?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt?hl=en-US\u0026","https://mts1.googleapis.com/mapslt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/ft?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/ft?hl=en-US\u0026"]]],["en-US","US",null,0,null,null,"https://maps.gstatic.com/mapfiles/","https://csi.gstatic.com","https://maps.googleapis.com","https://maps.googleapis.com"],["https://maps.gstatic.com/intl/en_us/mapfiles/api-3/15/6","3.15.6"],[2178329814],1,null,null,null,null,0,"",null,null,1,"https://khms.googleapis.com/mz?v=144\u0026",null,"https://earthbuilder.googleapis.com","https://earthbuilder.googleapis.com",null,"https://mts.googleapis.com/vt/icon",[["https://mts0.googleapis.com/vt","https://mts1.googleapis.com/vt"],["https://mts0.googleapis.com/vt","https://mts1.googleapis.com/vt"],[null,[[0,"m",248000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[47],[37,[["smartmaps"]]]]],0],[null,[[0,"m",248000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[47],[37,[["smartmaps"]]]]],3],[null,[[0,"m",248000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[50],[37,[["smartmaps"]]]]],0],[null,[[0,"m",248000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[50],[37,[["smartmaps"]]]]],3],[null,[[4,"t",132],[0,"r",132000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[5],[37,[["smartmaps"]]]]],0],[null,[[4,"t",132],[0,"r",132000000]],[null,"en-US","US",null,18,null,null,null,null,null,null,[[5],[37,[["smartmaps"]]]]],3],[null,null,[null,"en-US","US",null,18],0],[null,null,[null,"en-US","US",null,18],3],[null,null,[null,"en-US","US",null,18],6],[null,null,[null,"en-US","US",null,18],0],["https://mts0.google.com/vt","https://mts1.google.com/vt"],"/maps/vt"],2,500], loadScriptTime);
|
20 |
-
};
|
21 |
-
var loadScriptTime = (new Date).getTime();
|
22 |
-
getScript("https://maps.gstatic.com/intl/en_us/mapfiles/api-3/15/6/main.js");
|
23 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/sp-maps.js
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
(function($) {
|
2 |
-
function sp_maps() {
|
3 |
-
$maps = $('.sp-google-map');
|
4 |
-
$maps.each(function() {
|
5 |
-
$self = $(this);
|
6 |
-
address = $self.attr('data-address');
|
7 |
-
latitude = $self.attr('data-latitude');
|
8 |
-
longitude = $self.attr('data-longitude');
|
9 |
-
var ll = new google.maps.LatLng(latitude,longitude);
|
10 |
-
var mapOptions = {
|
11 |
-
scrollwheel: false,
|
12 |
-
zoom: parseInt(vars.zoom),
|
13 |
-
center: ll,
|
14 |
-
mapTypeId: google.maps.MapTypeId[vars.map_type]
|
15 |
-
};
|
16 |
-
var map = new google.maps.Map($self[0], mapOptions)
|
17 |
-
var marker = new google.maps.Marker({
|
18 |
-
position: ll,
|
19 |
-
map: map,
|
20 |
-
animation: google.maps.Animation.DROP,
|
21 |
-
flat: true,
|
22 |
-
title: address
|
23 |
-
});
|
24 |
-
});
|
25 |
-
}
|
26 |
-
google.maps.event.addDomListener(window, "load", sp_maps);
|
27 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/sportspress.js
CHANGED
@@ -43,7 +43,7 @@ function sp_viewport() {
|
|
43 |
|
44 |
/* Data Tables */
|
45 |
$(".sp-data-table").each(function() {
|
46 |
-
sortable =
|
47 |
paginated = $(this).hasClass("sp-paginated-table");
|
48 |
display_length = parseInt($(this).attr("data-sp-rows"));
|
49 |
if ( display_length == undefined || isNaN( display_length ) ) display_length = 10;
|
43 |
|
44 |
/* Data Tables */
|
45 |
$(".sp-data-table").each(function() {
|
46 |
+
sortable = $(this).hasClass("sp-sortable-table");
|
47 |
paginated = $(this).hasClass("sp-paginated-table");
|
48 |
display_length = parseInt($(this).attr("data-sp-rows"));
|
49 |
if ( display_length == undefined || isNaN( display_length ) ) display_length = 10;
|
includes/admin/class-sp-admin-assets.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -86,7 +86,7 @@ class SP_Admin_Assets {
|
|
86 |
|
87 |
wp_register_script( 'jquery-fitvids', SP()->plugin_url() . '/assets/js/jquery.fitvids.js', array( 'jquery' ), '1.1', true );
|
88 |
|
89 |
-
wp_register_script( 'google-maps', '
|
90 |
|
91 |
wp_register_script( 'jquery-locationpicker', SP()->plugin_url() . '/assets/js/locationpicker.jquery.js', array( 'jquery', 'google-maps' ), '0.1.6', true );
|
92 |
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
+
* @version 2.0
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
86 |
|
87 |
wp_register_script( 'jquery-fitvids', SP()->plugin_url() . '/assets/js/jquery.fitvids.js', array( 'jquery' ), '1.1', true );
|
88 |
|
89 |
+
wp_register_script( 'google-maps', '//maps.googleapis.com/maps/api/js?key=AIzaSyAWyt_AG0k_Pgz4LuegtHwesA_OMRnSSAE&libraries=places' );
|
90 |
|
91 |
wp_register_script( 'jquery-locationpicker', SP()->plugin_url() . '/assets/js/locationpicker.jquery.js', array( 'jquery', 'google-maps' ), '0.1.6', true );
|
92 |
|
includes/admin/class-sp-admin-notices.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -45,6 +45,13 @@ class SP_Admin_Notices {
|
|
45 |
add_action( 'admin_notices', array( $this, 'install_notice' ) );
|
46 |
}
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
if ( ! empty( $_GET['hide_theme_support_notice'] ) ) {
|
49 |
$notices = array_diff( $notices, array( 'theme_support' ) );
|
50 |
update_option( 'sportspress_admin_notices', $notices );
|
@@ -77,6 +84,13 @@ class SP_Admin_Notices {
|
|
77 |
include( 'views/html-notice-install.php' );
|
78 |
}
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
/**
|
81 |
* Show the Theme Check notice
|
82 |
*/
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
+
* @version 2.0.9
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
45 |
add_action( 'admin_notices', array( $this, 'install_notice' ) );
|
46 |
}
|
47 |
|
48 |
+
if ( 'post' == $screen->base ) {
|
49 |
+
$post_id = get_the_ID();
|
50 |
+
if ( ! apply_filters( 'sportspress_user_can', current_user_can( 'edit_post', $post_id ), $post_id ) ) {
|
51 |
+
add_action( 'admin_notices', array( $this, 'no_access_notice' ) );
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
if ( ! empty( $_GET['hide_theme_support_notice'] ) ) {
|
56 |
$notices = array_diff( $notices, array( 'theme_support' ) );
|
57 |
update_option( 'sportspress_admin_notices', $notices );
|
84 |
include( 'views/html-notice-install.php' );
|
85 |
}
|
86 |
|
87 |
+
/**
|
88 |
+
* Displays a notice when the user doesn't have access to edit a post type
|
89 |
+
*/
|
90 |
+
public function no_access_notice() {
|
91 |
+
include( 'views/html-notice-no-access.php' );
|
92 |
+
}
|
93 |
+
|
94 |
/**
|
95 |
* Show the Theme Check notice
|
96 |
*/
|
includes/admin/class-sp-admin-post-types.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -24,6 +24,7 @@ class SP_Admin_Post_Types {
|
|
24 |
add_action( 'admin_init', array( $this, 'include_post_type_handlers' ) );
|
25 |
add_action( 'save_post', array( $this, 'unflag_post' ) );
|
26 |
add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
|
|
|
27 |
}
|
28 |
|
29 |
/**
|
@@ -105,6 +106,16 @@ class SP_Admin_Post_Types {
|
|
105 |
|
106 |
return $messages;
|
107 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
|
110 |
endif;
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
+
* @version 2.0
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
24 |
add_action( 'admin_init', array( $this, 'include_post_type_handlers' ) );
|
25 |
add_action( 'save_post', array( $this, 'unflag_post' ) );
|
26 |
add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
|
27 |
+
add_filter( 'sportspress_meta_boxes', array( $this, 'meta_boxes' ) );
|
28 |
}
|
29 |
|
30 |
/**
|
106 |
|
107 |
return $messages;
|
108 |
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Remove meta boxes as needed
|
112 |
+
*/
|
113 |
+
public static function meta_boxes( $meta_boxes ) {
|
114 |
+
if ( 'manual' != get_option( 'sportspress_player_columns', 'auto' ) ) {
|
115 |
+
unset( $meta_boxes['sp_player']['columns'] );
|
116 |
+
}
|
117 |
+
return $meta_boxes;
|
118 |
+
}
|
119 |
}
|
120 |
|
121 |
endif;
|
includes/admin/class-sp-admin-sports.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress admin sports class stores preset sport data.
|
6 |
*
|
7 |
* @class SP_Admin_Sports
|
8 |
-
* @version
|
9 |
* @package SportsPress/Admin
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -100,28 +100,21 @@ class SP_Admin_Sports {
|
|
100 |
// Positions
|
101 |
$positions = sp_array_value( $preset, 'positions', array() );
|
102 |
$i = 0;
|
103 |
-
foreach ( $positions as $
|
104 |
-
if (
|
105 |
-
|
106 |
-
|
107 |
-
// Insert parent position
|
108 |
-
$slug = $i . '-' . sanitize_title( $parent );
|
109 |
-
wp_insert_term( $parent, 'sp_position', array( 'slug' => $slug ) );
|
110 |
-
}
|
111 |
-
|
112 |
-
// Insert positions with parent
|
113 |
-
foreach ( $position as $index => $child ) {
|
114 |
-
$parent_term = term_exists( $parent, 'sp_position' );
|
115 |
-
$parent_id = $parent_term['term_id'];
|
116 |
-
$slug = $index . '-' . sanitize_title( $child );
|
117 |
-
wp_insert_term( $child, 'sp_position', array( 'slug' => $slug, 'parent' => $parent_id ) );
|
118 |
-
}
|
119 |
} else {
|
120 |
-
|
121 |
-
|
122 |
-
$slug = $i . '-' . sanitize_title( $position );
|
123 |
-
wp_insert_term( $position, 'sp_position', array( 'slug' => $slug ) );
|
124 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
$i++;
|
126 |
}
|
127 |
|
5 |
* The SportsPress admin sports class stores preset sport data.
|
6 |
*
|
7 |
* @class SP_Admin_Sports
|
8 |
+
* @version 2.0
|
9 |
* @package SportsPress/Admin
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
100 |
// Positions
|
101 |
$positions = sp_array_value( $preset, 'positions', array() );
|
102 |
$i = 0;
|
103 |
+
foreach ( $positions as $position ) {
|
104 |
+
if ( is_string( $position ) ) {
|
105 |
+
$name = $position;
|
106 |
+
$sections = array( 0, 1 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
} else {
|
108 |
+
$name = sp_array_value( $position, 'name', __( 'Position', 'sportspress' ) );
|
109 |
+
$sections = sp_array_value( $position, 'sections', array( 0, 1 ) );
|
|
|
|
|
110 |
}
|
111 |
+
$slug = $i . '-' . sanitize_title( $name );
|
112 |
+
$term = wp_insert_term( $name, 'sp_position', array( 'slug' => $slug ) );
|
113 |
+
if ( is_wp_error( $term ) ) continue;
|
114 |
+
$t_id = $term['term_id'];
|
115 |
+
$term_meta = get_option( "taxonomy_$t_id" );
|
116 |
+
$term_meta['sp_sections'] = $sections;
|
117 |
+
update_option( "taxonomy_$t_id", $term_meta );
|
118 |
$i++;
|
119 |
}
|
120 |
|
includes/admin/class-sp-admin-taxonomies.php
CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
7 |
* Handles taxonomies in admin
|
8 |
*
|
9 |
* @class SP_Admin_Taxonomies
|
10 |
-
* @version
|
11 |
* @package SportsPress/Admin
|
12 |
* @category Class
|
13 |
* @author ThemeBoy
|
@@ -132,9 +132,15 @@ class SP_Admin_Taxonomies {
|
|
132 |
public function add_position_fields() {
|
133 |
?>
|
134 |
<div class="form-field">
|
135 |
-
<label
|
136 |
-
<
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
</div>
|
139 |
<?php
|
140 |
}
|
@@ -147,14 +153,24 @@ class SP_Admin_Taxonomies {
|
|
147 |
*/
|
148 |
public function edit_position_fields( $term ) {
|
149 |
$t_id = $term->term_id;
|
150 |
-
$
|
|
|
151 |
<tr class="form-field">
|
152 |
-
<th scope="row" valign="top"><label for="term_meta[
|
|
|
153 |
<td>
|
154 |
-
<
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
</td>
|
157 |
</tr>
|
|
|
|
|
158 |
<?php
|
159 |
}
|
160 |
|
@@ -219,7 +235,7 @@ class SP_Admin_Taxonomies {
|
|
219 |
*/
|
220 |
public function position_columns( $columns ) {
|
221 |
$new_columns = array();
|
222 |
-
$new_columns['
|
223 |
$new_columns['posts'] = __( 'Players', 'sportspress' );
|
224 |
|
225 |
unset( $columns['description'] );
|
@@ -260,13 +276,23 @@ class SP_Admin_Taxonomies {
|
|
260 |
|
261 |
$columns .= $address;
|
262 |
|
263 |
-
} elseif ( $column == '
|
264 |
-
|
265 |
-
$
|
266 |
-
|
267 |
-
$
|
268 |
-
|
269 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
}
|
272 |
|
7 |
* Handles taxonomies in admin
|
8 |
*
|
9 |
* @class SP_Admin_Taxonomies
|
10 |
+
* @version 2.0
|
11 |
* @package SportsPress/Admin
|
12 |
* @category Class
|
13 |
* @author ThemeBoy
|
132 |
public function add_position_fields() {
|
133 |
?>
|
134 |
<div class="form-field">
|
135 |
+
<label><?php _e( 'Statistics', 'sportspress' ); ?></label>
|
136 |
+
<select name="term_meta[sp_sections][]" id="term_meta[sp_sections][]" class="widefat chosen-select<?php if ( is_rtl() ): ?> chosen-rtl<?php endif; ?>" multiple="multiple">
|
137 |
+
<?php
|
138 |
+
$options = apply_filters( 'sportspress_performance_sections', array( 0 => __( 'Offense', 'sportspress' ), 1 => __( 'Defense', 'sportspress' ) ) );
|
139 |
+
foreach ( $options as $key => $value ):
|
140 |
+
printf( '<option value="%s" %s>%s</option>', $key, selected( true ), $value );
|
141 |
+
endforeach;
|
142 |
+
?>
|
143 |
+
</select>
|
144 |
</div>
|
145 |
<?php
|
146 |
}
|
153 |
*/
|
154 |
public function edit_position_fields( $term ) {
|
155 |
$t_id = $term->term_id;
|
156 |
+
$sections = sp_get_term_sections( $t_id );
|
157 |
+
?>
|
158 |
<tr class="form-field">
|
159 |
+
<th scope="row" valign="top"><label for="term_meta[sp_sections]"><?php _e( 'Statistics', 'sportspress' ); ?></label></th>
|
160 |
+
<input type="hidden" name="term_meta[sp_sections]" value="">
|
161 |
<td>
|
162 |
+
<select name="term_meta[sp_sections][]" id="term_meta[sp_sections][]" class="widefat chosen-select<?php if ( is_rtl() ): ?> chosen-rtl<?php endif; ?>" multiple="multiple">
|
163 |
+
<?php
|
164 |
+
$options = apply_filters( 'sportspress_performance_sections', array( 0 => __( 'Offense', 'sportspress' ), 1 => __( 'Defense', 'sportspress' ) ) );
|
165 |
+
foreach ( $options as $key => $value ):
|
166 |
+
printf( '<option value="%s" %s>%s</option>', $key, selected( in_array( $key, $sections ), true, false ), $value );
|
167 |
+
endforeach;
|
168 |
+
?>
|
169 |
+
</select>
|
170 |
</td>
|
171 |
</tr>
|
172 |
+
|
173 |
+
</div>
|
174 |
<?php
|
175 |
}
|
176 |
|
235 |
*/
|
236 |
public function position_columns( $columns ) {
|
237 |
$new_columns = array();
|
238 |
+
$new_columns['sp_sections'] = __( 'Statistics', 'sportspress' );
|
239 |
$new_columns['posts'] = __( 'Players', 'sportspress' );
|
240 |
|
241 |
unset( $columns['description'] );
|
276 |
|
277 |
$columns .= $address;
|
278 |
|
279 |
+
} elseif ( $column == 'sp_sections' ) {
|
280 |
+
|
281 |
+
$options = apply_filters( 'sportspress_performance_sections', array( 0 => __( 'Offense', 'sportspress' ), 1 => __( 'Defense', 'sportspress' ) ) );
|
282 |
+
|
283 |
+
$sections = sp_get_term_sections( $id );
|
284 |
+
|
285 |
+
$section_names = array();
|
286 |
+
|
287 |
+
if ( is_array( $sections ) ) {
|
288 |
+
foreach ( $sections as $section ) {
|
289 |
+
if ( array_key_exists( $section, $options ) ) {
|
290 |
+
$section_names[] = $options[ $section ];
|
291 |
+
}
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
$columns .= implode( ', ', $section_names );
|
296 |
|
297 |
}
|
298 |
|
includes/admin/class-sp-admin-welcome.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* @author ThemeBoy
|
10 |
* @category Admin
|
11 |
* @package SportsPress/Admin
|
12 |
-
* @version
|
13 |
*/
|
14 |
|
15 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -99,10 +99,12 @@ class SP_Admin_Welcome {
|
|
99 |
if ( ! empty( $_GET['sp-updated'] ) || ! empty( $_GET['sp-installed'] ) )
|
100 |
flush_rewrite_rules();
|
101 |
|
102 |
-
//
|
103 |
-
$
|
|
|
|
|
104 |
?>
|
105 |
-
<
|
106 |
|
107 |
<div class="sp-badge"><?php printf( __( 'Version %s', 'sportspress' ), SP()->version ); ?></div>
|
108 |
|
@@ -115,7 +117,7 @@ class SP_Admin_Welcome {
|
|
115 |
else
|
116 |
$message = __( 'Thanks for installing!', 'sportspress' );
|
117 |
|
118 |
-
printf( __( '%s SportsPress %s has lots of refinements we think you’ll love.', 'sportspress' ), $message, $
|
119 |
?>
|
120 |
</div>
|
121 |
|
@@ -128,7 +130,7 @@ class SP_Admin_Welcome {
|
|
128 |
|
129 |
<h2 class="nav-tab-wrapper">
|
130 |
<a class="nav-tab <?php if ( $_GET['page'] == 'sp-about' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sp-about' ), 'index.php' ) ) ); ?>">
|
131 |
-
<?php _e( '
|
132 |
</a><a class="nav-tab <?php if ( $_GET['page'] == 'sp-credits' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sp-credits' ), 'index.php' ) ) ); ?>">
|
133 |
<?php _e( 'Credits', 'sportspress' ); ?>
|
134 |
</a><a class="nav-tab <?php if ( $_GET['page'] == 'sp-translators' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sp-translators' ), 'index.php' ) ) ); ?>">
|
@@ -159,7 +161,7 @@ class SP_Admin_Welcome {
|
|
159 |
$sport = $_POST['sportspress_sport'];
|
160 |
SP_Admin_Sports::apply_preset( $sport );
|
161 |
update_option( 'sportspress_sport', $_POST['sportspress_sport'] );
|
162 |
-
update_option( '
|
163 |
?>
|
164 |
<div id="message" class="updated sportspress-message">
|
165 |
<p><strong><?php _e( 'Your settings have been saved.', 'sportspress' ); ?></strong></p>
|
@@ -171,59 +173,54 @@ class SP_Admin_Welcome {
|
|
171 |
SP_Admin_Sample_Data::insert_posts();
|
172 |
endif;
|
173 |
?>
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
<
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
) );
|
213 |
-
?>
|
214 |
-
<?php if ( sizeof ( $steps ) ) { ?>
|
215 |
-
<div class="sportspress-steps">
|
216 |
-
<ul>
|
217 |
-
<?php foreach ( $steps as $step ) { ?>
|
218 |
-
<li><a href="<?php echo esc_url( $step['link'] ); ?>" class="welcome-icon sp-welcome-icon"><i class="<?php echo sp_array_value( $step, 'icon' ); ?>"></i> <?php echo $step['label']; ?></a></li>
|
219 |
-
<?php } ?>
|
220 |
-
</ul>
|
221 |
</div>
|
222 |
-
|
|
|
|
|
|
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
|
|
|
227 |
<form method="post" id="mainform" action="" enctype="multipart/form-data">
|
228 |
<h4><?php _e( 'Basic Setup', 'sportspress' ); ?></h4>
|
229 |
<p><?php _e( 'Select your timezone and sport to get started.', 'sportspress' ); ?></p>
|
@@ -282,20 +279,22 @@ class SP_Admin_Welcome {
|
|
282 |
<?php wp_nonce_field( 'sportspress-settings' ); ?>
|
283 |
</p>
|
284 |
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
<?php } ?>
|
286 |
</div>
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
<a href="<?php echo add_query_arg( array( 'theme' => 'rookie' ), network_admin_url( 'theme-install.php' ) ); ?>" class="sp-theme-screenshot"><img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>/assets/images/modules/rookie.png"></a>
|
291 |
-
<p><?php _e( 'Have you tried the free Rookie theme yet?', 'sportspress' ); ?></p>
|
292 |
-
<p><?php _e( 'Rookie is a free starter theme for SportsPress designed by ThemeBoy.', 'sportspress' ); ?></p>
|
293 |
-
<p class="sp-module-actions">
|
294 |
-
<a class="button button-large" href="<?php echo add_query_arg( array( 'theme' => 'rookie' ), network_admin_url( 'theme-install.php' ) ); ?>"><?php _e( 'Install Now', 'sportspress' ); ?></a>
|
295 |
-
</p>
|
296 |
-
</div>
|
297 |
-
<?php } ?>
|
298 |
-
</div>
|
299 |
</div>
|
300 |
<?php
|
301 |
}
|
9 |
* @author ThemeBoy
|
10 |
* @category Admin
|
11 |
* @package SportsPress/Admin
|
12 |
+
* @version 2.0.3
|
13 |
*/
|
14 |
|
15 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
99 |
if ( ! empty( $_GET['sp-updated'] ) || ! empty( $_GET['sp-installed'] ) )
|
100 |
flush_rewrite_rules();
|
101 |
|
102 |
+
// Get major version number
|
103 |
+
$version = explode( '.', SP()->version, 3 );
|
104 |
+
unset( $version[2] );
|
105 |
+
$display_version = implode( '.', $version );
|
106 |
?>
|
107 |
+
<h1 class="sp-welcome-logo"><?php echo apply_filters( 'sportspress_logo', '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/images/welcome/sportspress' . ( class_exists( 'SportsPress_Pro' ) ? '-pro' : '' ) . '.png" alt="' . __( 'SportsPress', 'sportspress' ) . '">' ); ?></h1>
|
108 |
|
109 |
<div class="sp-badge"><?php printf( __( 'Version %s', 'sportspress' ), SP()->version ); ?></div>
|
110 |
|
117 |
else
|
118 |
$message = __( 'Thanks for installing!', 'sportspress' );
|
119 |
|
120 |
+
printf( __( '%s SportsPress %s has lots of refinements we think you’ll love.', 'sportspress' ), $message, $display_version );
|
121 |
?>
|
122 |
</div>
|
123 |
|
130 |
|
131 |
<h2 class="nav-tab-wrapper">
|
132 |
<a class="nav-tab <?php if ( $_GET['page'] == 'sp-about' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sp-about' ), 'index.php' ) ) ); ?>">
|
133 |
+
<?php _e( 'Welcome', 'sportspress' ); ?>
|
134 |
</a><a class="nav-tab <?php if ( $_GET['page'] == 'sp-credits' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sp-credits' ), 'index.php' ) ) ); ?>">
|
135 |
<?php _e( 'Credits', 'sportspress' ); ?>
|
136 |
</a><a class="nav-tab <?php if ( $_GET['page'] == 'sp-translators' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sp-translators' ), 'index.php' ) ) ); ?>">
|
161 |
$sport = $_POST['sportspress_sport'];
|
162 |
SP_Admin_Sports::apply_preset( $sport );
|
163 |
update_option( 'sportspress_sport', $_POST['sportspress_sport'] );
|
164 |
+
update_option( 'sportspress_installed', 1 );
|
165 |
?>
|
166 |
<div id="message" class="updated sportspress-message">
|
167 |
<p><strong><?php _e( 'Your settings have been saved.', 'sportspress' ); ?></strong></p>
|
173 |
SP_Admin_Sample_Data::insert_posts();
|
174 |
endif;
|
175 |
?>
|
176 |
+
<?php if ( get_option( 'sportspress_installed' ) ) { ?>
|
177 |
+
|
178 |
+
<div class="headline-feature feature-video sp-fitvids" style="background-color:#191E23;">
|
179 |
+
<iframe width="990" height="557" src="https://www.youtube.com/embed/KQyga_C5a6M?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
|
180 |
+
</div>
|
181 |
+
|
182 |
+
<hr>
|
183 |
+
|
184 |
+
<div class="feature-section two-col">
|
185 |
+
<h2>Customization Improvements</h2>
|
186 |
+
<div class="col">
|
187 |
+
<img src="https://cdn-themeboy.netdna-ssl.com/wp-content/uploads/layout-designer.gif" alt=""/>
|
188 |
+
<h3>Layout Designer</h3>
|
189 |
+
<p>You can now choose to show or hide specific elements and reorder them as you like. Design your own unique layouts for event, team, player, and staff pages.</p>
|
190 |
+
</div>
|
191 |
+
<div class="col">
|
192 |
+
<img src="https://cdn-themeboy.netdna-ssl.com/wp-content/uploads/smart-statistics.png" alt=""/>
|
193 |
+
<h3>Smarter Statistics</h3>
|
194 |
+
<p>Offensive and defensive statistics can now be displayed separately in events and player profiles. A global visibility option lets you choose whether to show or hide each column.</p>
|
195 |
+
</div>
|
196 |
+
</div>
|
197 |
+
|
198 |
+
<hr />
|
199 |
+
|
200 |
+
<div class="changelog">
|
201 |
+
<h2>Take Control of Your Data</h2>
|
202 |
+
<div class="under-the-hood three-col">
|
203 |
+
<div class="col">
|
204 |
+
<h3>Taxonomy Ordering</h3>
|
205 |
+
<p>The order of competitions, seasons, venues, positions, and roles can now be changed by editing the slug of each term.</p>
|
206 |
+
</div>
|
207 |
+
<div class="col">
|
208 |
+
<h3>Career Totals</h3>
|
209 |
+
<p>Display career totals in player statistics tables. This row is added as a footer below the list of seasons.</p>
|
210 |
+
</div>
|
211 |
+
<div class="col">
|
212 |
+
<h3>REST API Support</h3>
|
213 |
+
<p>SportsPress now integrates with the WP REST API with custom endpoints for retrieving and updating sports data.</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
</div>
|
215 |
+
</div>
|
216 |
+
</div>
|
217 |
+
|
218 |
+
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ) ); ?>"><?php _e( 'Go to SportsPress Settings', 'sportspress' ); ?></a>
|
219 |
|
220 |
+
<?php } else { ?>
|
221 |
+
|
222 |
+
<div class="sp-feature feature-section col two-col">
|
223 |
+
<div>
|
224 |
<form method="post" id="mainform" action="" enctype="multipart/form-data">
|
225 |
<h4><?php _e( 'Basic Setup', 'sportspress' ); ?></h4>
|
226 |
<p><?php _e( 'Select your timezone and sport to get started.', 'sportspress' ); ?></p>
|
279 |
<?php wp_nonce_field( 'sportspress-settings' ); ?>
|
280 |
</p>
|
281 |
</form>
|
282 |
+
</div>
|
283 |
+
<?php if ( current_user_can( 'install_themes' ) && ! current_theme_supports( 'sportspress' ) ) { ?>
|
284 |
+
<div class="last-feature">
|
285 |
+
<h4><?php _e( 'Free SportsPress Theme', 'sportspress' ); ?></h4>
|
286 |
+
<a href="<?php echo add_query_arg( array( 'theme' => 'rookie' ), network_admin_url( 'theme-install.php' ) ); ?>" class="sp-theme-screenshot"><img src="<?php echo plugin_dir_url( SP_PLUGIN_FILE ); ?>/assets/images/modules/rookie.png"></a>
|
287 |
+
<p><?php _e( 'Have you tried the free Rookie theme yet?', 'sportspress' ); ?></p>
|
288 |
+
<p><?php _e( 'Rookie is a free starter theme for SportsPress designed by ThemeBoy.', 'sportspress' ); ?></p>
|
289 |
+
<p class="sp-module-actions">
|
290 |
+
<a class="button button-large" href="<?php echo add_query_arg( array( 'theme' => 'rookie' ), network_admin_url( 'theme-install.php' ) ); ?>"><?php _e( 'Install Now', 'sportspress' ); ?></a>
|
291 |
+
</p>
|
292 |
+
</div>
|
293 |
<?php } ?>
|
294 |
</div>
|
295 |
+
|
296 |
+
<?php } ?>
|
297 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
</div>
|
299 |
<?php
|
300 |
}
|
includes/admin/importers/class-sp-event-importer.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Importers
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -147,7 +147,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|
147 |
endif;
|
148 |
|
149 |
// Define post type args
|
150 |
-
$args = array( 'post_type' => 'sp_event', 'post_status' => 'publish', 'post_date' => $date );
|
151 |
|
152 |
// Insert event
|
153 |
$id = wp_insert_post( $args );
|
@@ -305,10 +305,12 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|
305 |
// Get event name
|
306 |
$title = get_the_title( $id );
|
307 |
|
308 |
-
//
|
309 |
-
if ( $title )
|
|
|
|
|
310 |
$title .= ' ' . get_option( 'sportspress_event_teams_delimiter', 'vs' ) . ' ';
|
311 |
-
|
312 |
|
313 |
// Append team name to event name
|
314 |
$title .= $team_name;
|
@@ -317,6 +319,7 @@ if ( class_exists( 'WP_Importer' ) ) {
|
|
317 |
$post = array(
|
318 |
'ID' => $id,
|
319 |
'post_title' => $title,
|
|
|
320 |
);
|
321 |
wp_update_post( $post );
|
322 |
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Importers
|
8 |
+
* @version 2.0.4
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
147 |
endif;
|
148 |
|
149 |
// Define post type args
|
150 |
+
$args = array( 'post_type' => 'sp_event', 'post_status' => 'publish', 'post_date' => $date, 'post_title' => __( 'Event', 'sportspress' ) );
|
151 |
|
152 |
// Insert event
|
153 |
$id = wp_insert_post( $args );
|
305 |
// Get event name
|
306 |
$title = get_the_title( $id );
|
307 |
|
308 |
+
// Initialize event name
|
309 |
+
if ( __( 'Event', 'sportspress' ) === $title ) {
|
310 |
+
$title = '';
|
311 |
+
} else {
|
312 |
$title .= ' ' . get_option( 'sportspress_event_teams_delimiter', 'vs' ) . ' ';
|
313 |
+
}
|
314 |
|
315 |
// Append team name to event name
|
316 |
$title .= $team_name;
|
319 |
$post = array(
|
320 |
'ID' => $id,
|
321 |
'post_title' => $title,
|
322 |
+
'post_name' => $id,
|
323 |
);
|
324 |
wp_update_post( $post );
|
325 |
|
includes/admin/post-types/class-sp-admin-cpt-event.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Post_Types
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -29,6 +29,9 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|
29 |
// Post title fields
|
30 |
add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 1, 2 );
|
31 |
|
|
|
|
|
|
|
32 |
// Before data updates
|
33 |
add_filter( 'wp_insert_post_data', array( $this, 'wp_insert_post_data' ), 99, 2 );
|
34 |
|
@@ -57,10 +60,28 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
|
|
57 |
return $text;
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
/**
|
61 |
* Auto-generate an event title based on the team playing if left blank.
|
62 |
*
|
63 |
* @param array $data
|
|
|
64 |
* @return array
|
65 |
*/
|
66 |
public function wp_insert_post_data( $data, $postarr ) {
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Post_Types
|
8 |
+
* @version 2.0.2
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
// Post title fields
|
30 |
add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 1, 2 );
|
31 |
|
32 |
+
// Empty data filter
|
33 |
+
add_filter( 'wp_insert_post_empty_content', array( $this, 'wp_insert_post_empty_content' ), 99, 2 );
|
34 |
+
|
35 |
// Before data updates
|
36 |
add_filter( 'wp_insert_post_data', array( $this, 'wp_insert_post_data' ), 99, 2 );
|
37 |
|
60 |
return $text;
|
61 |
}
|
62 |
|
63 |
+
/**
|
64 |
+
* Mark as not empty when saving event if teams are selected for auto title.
|
65 |
+
*
|
66 |
+
* @param array $maybe_empty
|
67 |
+
* @param array $postarr
|
68 |
+
* @return bool
|
69 |
+
*/
|
70 |
+
public function wp_insert_post_empty_content( $maybe_empty, $postarr ) {
|
71 |
+
if ( $maybe_empty && 'sp_event' === sp_array_value( $postarr, 'post_type' ) ):
|
72 |
+
$teams = sp_array_value( $postarr, 'sp_team', array() );
|
73 |
+
$teams = array_filter( $teams );
|
74 |
+
if ( sizeof( $teams ) ) return false;
|
75 |
+
endif;
|
76 |
+
|
77 |
+
return $maybe_empty;
|
78 |
+
}
|
79 |
+
|
80 |
/**
|
81 |
* Auto-generate an event title based on the team playing if left blank.
|
82 |
*
|
83 |
* @param array $data
|
84 |
+
* @param array $postarr
|
85 |
* @return array
|
86 |
*/
|
87 |
public function wp_insert_post_data( $data, $postarr ) {
|
includes/admin/post-types/class-sp-admin-meta-boxes.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author ThemeBoy
|
8 |
* @category Admin
|
9 |
* @package SportsPress/Admin/Meta_Boxes
|
10 |
-
* @version
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -138,18 +138,12 @@ class SP_Admin_Meta_Boxes {
|
|
138 |
'priority' => 'high',
|
139 |
),
|
140 |
'performance' => array(
|
141 |
-
'title' => __( '
|
142 |
'save' => 'SP_Meta_Box_Event_Performance::save',
|
143 |
'output' => 'SP_Meta_Box_Event_Performance::output',
|
144 |
'context' => 'normal',
|
145 |
'priority' => 'high',
|
146 |
),
|
147 |
-
'editor' => array(
|
148 |
-
'title' => __( 'Article', 'sportspress' ),
|
149 |
-
'output' => 'SP_Meta_Box_Event_Editor::output',
|
150 |
-
'context' => 'normal',
|
151 |
-
'priority' => 'low',
|
152 |
-
),
|
153 |
),
|
154 |
'sp_team' => array(
|
155 |
'details' => array(
|
@@ -159,12 +153,6 @@ class SP_Admin_Meta_Boxes {
|
|
159 |
'context' => 'side',
|
160 |
'priority' => 'default',
|
161 |
),
|
162 |
-
'editor' => array(
|
163 |
-
'title' => __( 'Profile', 'sportspress' ),
|
164 |
-
'output' => 'SP_Meta_Box_Team_Editor::output',
|
165 |
-
'context' => 'normal',
|
166 |
-
'priority' => 'low',
|
167 |
-
),
|
168 |
'staff' => array(
|
169 |
'title' => __( 'Staff', 'sportspress' ),
|
170 |
'save' => 'SP_Meta_Box_Team_Staff::save',
|
@@ -208,12 +196,6 @@ class SP_Admin_Meta_Boxes {
|
|
208 |
'context' => 'normal',
|
209 |
'priority' => 'high',
|
210 |
),
|
211 |
-
'editor' => array(
|
212 |
-
'title' => __( 'Profile', 'sportspress' ),
|
213 |
-
'output' => 'SP_Meta_Box_Player_Editor::output',
|
214 |
-
'context' => 'normal',
|
215 |
-
'priority' => 'low',
|
216 |
-
),
|
217 |
),
|
218 |
'sp_staff' => array(
|
219 |
'shortcode' => array(
|
@@ -229,12 +211,6 @@ class SP_Admin_Meta_Boxes {
|
|
229 |
'context' => 'side',
|
230 |
'priority' => 'default',
|
231 |
),
|
232 |
-
'editor' => array(
|
233 |
-
'title' => __( 'Profile', 'sportspress' ),
|
234 |
-
'output' => 'SP_Meta_Box_Staff_Editor::output',
|
235 |
-
'context' => 'normal',
|
236 |
-
'priority' => 'low',
|
237 |
-
),
|
238 |
),
|
239 |
);
|
240 |
|
7 |
* @author ThemeBoy
|
8 |
* @category Admin
|
9 |
* @package SportsPress/Admin/Meta_Boxes
|
10 |
+
* @version 2.0
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
138 |
'priority' => 'high',
|
139 |
),
|
140 |
'performance' => array(
|
141 |
+
'title' => __( 'Box Score', 'sportspress' ),
|
142 |
'save' => 'SP_Meta_Box_Event_Performance::save',
|
143 |
'output' => 'SP_Meta_Box_Event_Performance::output',
|
144 |
'context' => 'normal',
|
145 |
'priority' => 'high',
|
146 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
),
|
148 |
'sp_team' => array(
|
149 |
'details' => array(
|
153 |
'context' => 'side',
|
154 |
'priority' => 'default',
|
155 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
'staff' => array(
|
157 |
'title' => __( 'Staff', 'sportspress' ),
|
158 |
'save' => 'SP_Meta_Box_Team_Staff::save',
|
196 |
'context' => 'normal',
|
197 |
'priority' => 'high',
|
198 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
),
|
200 |
'sp_staff' => array(
|
201 |
'shortcode' => array(
|
211 |
'context' => 'side',
|
212 |
'priority' => 'default',
|
213 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
),
|
215 |
);
|
216 |
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-editor.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Calendar Editor
|
4 |
-
*
|
5 |
-
* @author ThemeBoy
|
6 |
-
* @category Admin
|
7 |
-
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version 0.8
|
9 |
-
*/
|
10 |
-
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
-
|
13 |
-
/**
|
14 |
-
* SP_Meta_Box_Calendar_Editor
|
15 |
-
*/
|
16 |
-
class SP_Meta_Box_Calendar_Editor {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Output the metabox
|
20 |
-
*/
|
21 |
-
public static function output( $post ) {
|
22 |
-
wp_editor( $post->post_content, 'content' );
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-event-editor.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Event Editor
|
4 |
-
*
|
5 |
-
* @author ThemeBoy
|
6 |
-
* @category Admin
|
7 |
-
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version 0.8
|
9 |
-
*/
|
10 |
-
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
-
|
13 |
-
/**
|
14 |
-
* SP_Meta_Box_Event_Editor
|
15 |
-
*/
|
16 |
-
class SP_Meta_Box_Event_Editor {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Output the metabox
|
20 |
-
*/
|
21 |
-
public static function output( $post ) {
|
22 |
-
wp_editor( $post->post_content, 'content' );
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -29,7 +29,7 @@ class SP_Meta_Box_Event_Performance {
|
|
29 |
$manual = false;
|
30 |
|
31 |
// Determine if we need checkboxes
|
32 |
-
if ( $manual
|
33 |
$has_checkboxes = true;
|
34 |
else
|
35 |
$has_checkboxes = false;
|
@@ -179,7 +179,7 @@ class SP_Meta_Box_Event_Performance {
|
|
179 |
?>
|
180 |
<div>
|
181 |
<p><strong><?php echo get_the_title( $team_id ); ?> — <?php echo $section_label; ?></strong></p>
|
182 |
-
<?php self::table( $labels[ $section_id ], $columns, $data[ $section_id ], $team_id, $has_checkboxes, $positions, $status, $section_id, $formats, $order, $numbers ); ?>
|
183 |
<?php do_action( 'sportspress_after_event_performance_table_admin', $labels[ $section_id ], $columns, $data[ $section_id ], $team_id ); ?>
|
184 |
</div>
|
185 |
<?php
|
@@ -238,7 +238,7 @@ class SP_Meta_Box_Event_Performance {
|
|
238 |
<?php if ( $sortable ) { ?>
|
239 |
<th class="icon"> </th>
|
240 |
<?php } ?>
|
241 |
-
<?php if ( $numbers ) { ?>
|
242 |
<th>#</th>
|
243 |
<?php } ?>
|
244 |
<th><?php _e( 'Player', 'sportspress' ); ?></th>
|
@@ -259,7 +259,7 @@ class SP_Meta_Box_Event_Performance {
|
|
259 |
<?php endif; ?>
|
260 |
</th>
|
261 |
<?php endforeach; ?>
|
262 |
-
<?php if ( $status
|
263 |
<th>
|
264 |
<?php _e( 'Status', 'sportspress' ); ?>
|
265 |
</th>
|
@@ -281,7 +281,7 @@ class SP_Meta_Box_Event_Performance {
|
|
281 |
<?php if ( $sortable ) { ?>
|
282 |
<td> </td>
|
283 |
<?php } ?>
|
284 |
-
<?php if ( $numbers ) { ?>
|
285 |
<td> </td>
|
286 |
<?php } ?>
|
287 |
<td><strong><?php _e( 'Total', 'sportspress' ); ?></strong></td>
|
@@ -297,7 +297,7 @@ class SP_Meta_Box_Event_Performance {
|
|
297 |
?>
|
298 |
<td><input type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" placeholder="<?php echo trim( $placeholder ); ?>" value="<?php echo esc_attr( $value ); ?>" data-sp-format="<?php echo $format; ?>" /></td>
|
299 |
<?php endforeach; ?>
|
300 |
-
<?php if ( $status
|
301 |
<td> </td>
|
302 |
<?php } ?>
|
303 |
</tr>
|
@@ -312,16 +312,15 @@ class SP_Meta_Box_Event_Performance {
|
|
312 |
public static function row( $labels = array(), $player_id = 0, $player_performance = array(), $team_id = 0, $data = array(), $positions = true, $status = true, $sortable = true, $numbers = true, $section = -1, $formats = array() ) {
|
313 |
if ( $player_id <= 0 ) return;
|
314 |
|
315 |
-
$number = get_post_meta( $player_id, 'sp_number', true );
|
316 |
$value = sp_array_value( $player_performance, 'number', '' );
|
317 |
?>
|
318 |
<tr class="sp-row sp-post" data-player="<?php echo $player_id; ?>">
|
319 |
<?php if ( $sortable ) { ?>
|
320 |
<td class="icon"><span class="dashicons dashicons-menu post-state-format"></span></td>
|
321 |
<?php } ?>
|
322 |
-
<?php if ( $numbers ) { ?>
|
323 |
<td>
|
324 |
-
<input class="small-text sp-player-number-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][number]" value="<?php echo esc_attr( $value ); ?>" />
|
325 |
</td>
|
326 |
<?php } ?>
|
327 |
<td>
|
@@ -357,10 +356,10 @@ class SP_Meta_Box_Event_Performance {
|
|
357 |
$placeholder = sp_get_format_placeholder( sp_array_value( $formats, $column, 'number' ) );
|
358 |
?>
|
359 |
<td>
|
360 |
-
<input class="sp-player-<?php echo $column; ?>-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; ?>" />
|
361 |
</td>
|
362 |
<?php endforeach; ?>
|
363 |
-
<?php if ( $status
|
364 |
<td class="sp-status-selector">
|
365 |
<?php echo self::status_select( $team_id, $player_id, sp_array_value( $player_performance, 'status', null ) ); ?>
|
366 |
<?php echo self::sub_select( $team_id, $player_id, sp_array_value( $player_performance, 'sub', null ), $data ); ?>
|
@@ -383,7 +382,7 @@ class SP_Meta_Box_Event_Performance {
|
|
383 |
'sub' => __( 'Substitute', 'sportspress' ),
|
384 |
) );
|
385 |
|
386 |
-
$output = '<select name="sp_players[' . $team_id . '][' . $player_id . '][status]">';
|
387 |
|
388 |
foreach( $options as $key => $name ):
|
389 |
$output .= '<option value="' . $key . '"' . ( $key == $value ? ' selected' : '' ) . '>' . $name . '</option>';
|
@@ -403,7 +402,7 @@ class SP_Meta_Box_Event_Performance {
|
|
403 |
if ( ! $team_id || ! $player_id )
|
404 |
return '—';
|
405 |
|
406 |
-
$output = '<select name="sp_players[' . $team_id . '][' . $player_id . '][sub]" style="display: none;">';
|
407 |
|
408 |
$output .= '<option value="0">' . __( 'None', 'sportspress' ) . '</option>';
|
409 |
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.0.6
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
$manual = false;
|
30 |
|
31 |
// Determine if we need checkboxes
|
32 |
+
if ( $manual )
|
33 |
$has_checkboxes = true;
|
34 |
else
|
35 |
$has_checkboxes = false;
|
179 |
?>
|
180 |
<div>
|
181 |
<p><strong><?php echo get_the_title( $team_id ); ?> — <?php echo $section_label; ?></strong></p>
|
182 |
+
<?php self::table( $labels[ $section_id ], $columns, $data[ $section_id ], $team_id, ( $has_checkboxes && 0 === $i ), $positions, $status, $section_id, $formats, $order, $numbers ); ?>
|
183 |
<?php do_action( 'sportspress_after_event_performance_table_admin', $labels[ $section_id ], $columns, $data[ $section_id ], $team_id ); ?>
|
184 |
</div>
|
185 |
<?php
|
238 |
<?php if ( $sortable ) { ?>
|
239 |
<th class="icon"> </th>
|
240 |
<?php } ?>
|
241 |
+
<?php if ( apply_filters( 'sportspress_event_performance_show_numbers', $numbers, $section ) ) { ?>
|
242 |
<th>#</th>
|
243 |
<?php } ?>
|
244 |
<th><?php _e( 'Player', 'sportspress' ); ?></th>
|
259 |
<?php endif; ?>
|
260 |
</th>
|
261 |
<?php endforeach; ?>
|
262 |
+
<?php if ( apply_filters( 'sportspress_event_performance_show_status', $status, $section ) ) { ?>
|
263 |
<th>
|
264 |
<?php _e( 'Status', 'sportspress' ); ?>
|
265 |
</th>
|
281 |
<?php if ( $sortable ) { ?>
|
282 |
<td> </td>
|
283 |
<?php } ?>
|
284 |
+
<?php if ( apply_filters( 'sportspress_event_performance_show_numbers', $numbers, $section ) ) { ?>
|
285 |
<td> </td>
|
286 |
<?php } ?>
|
287 |
<td><strong><?php _e( 'Total', 'sportspress' ); ?></strong></td>
|
297 |
?>
|
298 |
<td><input type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" placeholder="<?php echo trim( $placeholder ); ?>" value="<?php echo esc_attr( $value ); ?>" data-sp-format="<?php echo $format; ?>" /></td>
|
299 |
<?php endforeach; ?>
|
300 |
+
<?php if ( apply_filters( 'sportspress_event_performance_show_status', $status, $section ) ) { ?>
|
301 |
<td> </td>
|
302 |
<?php } ?>
|
303 |
</tr>
|
312 |
public static function row( $labels = array(), $player_id = 0, $player_performance = array(), $team_id = 0, $data = array(), $positions = true, $status = true, $sortable = true, $numbers = true, $section = -1, $formats = array() ) {
|
313 |
if ( $player_id <= 0 ) return;
|
314 |
|
|
|
315 |
$value = sp_array_value( $player_performance, 'number', '' );
|
316 |
?>
|
317 |
<tr class="sp-row sp-post" data-player="<?php echo $player_id; ?>">
|
318 |
<?php if ( $sortable ) { ?>
|
319 |
<td class="icon"><span class="dashicons dashicons-menu post-state-format"></span></td>
|
320 |
<?php } ?>
|
321 |
+
<?php if ( apply_filters( 'sportspress_event_performance_show_numbers', $numbers, $section ) ) { ?>
|
322 |
<td>
|
323 |
+
<input class="small-text sp-player-number-input sp-sync-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][number]" value="<?php echo esc_attr( $value ); ?>" />
|
324 |
</td>
|
325 |
<?php } ?>
|
326 |
<td>
|
356 |
$placeholder = sp_get_format_placeholder( sp_array_value( $formats, $column, 'number' ) );
|
357 |
?>
|
358 |
<td>
|
359 |
+
<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; ?>" />
|
360 |
</td>
|
361 |
<?php endforeach; ?>
|
362 |
+
<?php if ( apply_filters( 'sportspress_event_performance_show_status', $status, $section ) ) { ?>
|
363 |
<td class="sp-status-selector">
|
364 |
<?php echo self::status_select( $team_id, $player_id, sp_array_value( $player_performance, 'status', null ) ); ?>
|
365 |
<?php echo self::sub_select( $team_id, $player_id, sp_array_value( $player_performance, 'sub', null ), $data ); ?>
|
382 |
'sub' => __( 'Substitute', 'sportspress' ),
|
383 |
) );
|
384 |
|
385 |
+
$output = '<select class="sp-sync-select" name="sp_players[' . $team_id . '][' . $player_id . '][status]">';
|
386 |
|
387 |
foreach( $options as $key => $name ):
|
388 |
$output .= '<option value="' . $key . '"' . ( $key == $value ? ' selected' : '' ) . '>' . $name . '</option>';
|
402 |
if ( ! $team_id || ! $player_id )
|
403 |
return '—';
|
404 |
|
405 |
+
$output = '<select class="sp-sync-select" name="sp_players[' . $team_id . '][' . $player_id . '][sub]" style="display: none;">';
|
406 |
|
407 |
$output .= '<option value="0">' . __( 'None', 'sportspress' ) . '</option>';
|
408 |
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-event-shortcode.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -22,7 +22,7 @@ class SP_Meta_Box_Event_Shortcode {
|
|
22 |
$shortcodes = apply_filters( 'sportspress_event_shortcodes', array(
|
23 |
'event_results' => __( 'Results', 'sportspress' ),
|
24 |
'event_details' => __( 'Details', 'sportspress' ),
|
25 |
-
'event_performance' => __( '
|
26 |
) );
|
27 |
if ( $shortcodes ) {
|
28 |
?>
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.0
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
22 |
$shortcodes = apply_filters( 'sportspress_event_shortcodes', array(
|
23 |
'event_results' => __( 'Results', 'sportspress' ),
|
24 |
'event_details' => __( 'Details', 'sportspress' ),
|
25 |
+
'event_performance' => __( 'Box Score', 'sportspress' ),
|
26 |
) );
|
27 |
if ( $shortcodes ) {
|
28 |
?>
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-list-editor.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* List Editor
|
4 |
-
*
|
5 |
-
* @author ThemeBoy
|
6 |
-
* @category Admin
|
7 |
-
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version 0.8
|
9 |
-
*/
|
10 |
-
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
-
|
13 |
-
/**
|
14 |
-
* SP_Meta_Box_List_Editor
|
15 |
-
*/
|
16 |
-
class SP_Meta_Box_List_Editor {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Output the metabox
|
20 |
-
*/
|
21 |
-
public static function output( $post ) {
|
22 |
-
wp_editor( $post->post_content, 'content' );
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-performance-details.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -29,6 +29,8 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config {
|
|
29 |
} else {
|
30 |
$readonly = false;
|
31 |
}
|
|
|
|
|
32 |
$section = get_post_meta( $post->ID, 'sp_section', true );
|
33 |
if ( '' === $section ) {
|
34 |
$section = -1;
|
@@ -66,6 +68,32 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config {
|
|
66 |
</select>
|
67 |
</p>
|
68 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
|
71 |
/**
|
@@ -75,5 +103,8 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config {
|
|
75 |
self::delete_duplicate( $_POST );
|
76 |
update_post_meta( $post_id, 'sp_section', (int) sp_array_value( $_POST, 'sp_section', -1 ) );
|
77 |
update_post_meta( $post_id, 'sp_format', sp_array_value( $_POST, 'sp_format', 'number' ) );
|
|
|
|
|
|
|
78 |
}
|
79 |
}
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.0
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
} else {
|
30 |
$readonly = false;
|
31 |
}
|
32 |
+
|
33 |
+
// Post Meta
|
34 |
$section = get_post_meta( $post->ID, 'sp_section', true );
|
35 |
if ( '' === $section ) {
|
36 |
$section = -1;
|
68 |
</select>
|
69 |
</p>
|
70 |
<?php
|
71 |
+
if ( 'auto' === get_option( 'sportspress_player_columns', 'auto' ) ) {
|
72 |
+
$visible = get_post_meta( $post->ID, 'sp_visible', true );
|
73 |
+
if ( '' === $visible ) {
|
74 |
+
$visible = 1;
|
75 |
+
}
|
76 |
+
?>
|
77 |
+
<p>
|
78 |
+
<strong><?php _e( 'Visible', 'sportspress' ); ?></strong>
|
79 |
+
<i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php _e( 'Display in player profile?', 'sportspress' ); ?>"></i>
|
80 |
+
</p>
|
81 |
+
<ul class="sp-visible-selector">
|
82 |
+
<li>
|
83 |
+
<label class="selectit">
|
84 |
+
<input name="sp_visible" id="sp_visible_yes" type="radio" value="1" <?php checked( $visible ); ?>>
|
85 |
+
<?php _e( 'Yes', 'sportspress' ); ?>
|
86 |
+
</label>
|
87 |
+
</li>
|
88 |
+
<li>
|
89 |
+
<label class="selectit">
|
90 |
+
<input name="sp_visible" id="sp_visible_no" type="radio" value="0" <?php checked( ! $visible ); ?>>
|
91 |
+
<?php _e( 'No', 'sportspress' ); ?>
|
92 |
+
</label>
|
93 |
+
</li>
|
94 |
+
</ul>
|
95 |
+
<?php
|
96 |
+
}
|
97 |
}
|
98 |
|
99 |
/**
|
103 |
self::delete_duplicate( $_POST );
|
104 |
update_post_meta( $post_id, 'sp_section', (int) sp_array_value( $_POST, 'sp_section', -1 ) );
|
105 |
update_post_meta( $post_id, 'sp_format', sp_array_value( $_POST, 'sp_format', 'number' ) );
|
106 |
+
if ( 'auto' === get_option( 'sportspress_player_columns', 'auto' ) ) {
|
107 |
+
update_post_meta( $post_id, 'sp_visible', sp_array_value( $_POST, 'sp_visible', 1 ) );
|
108 |
+
}
|
109 |
}
|
110 |
}
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-player-columns.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -26,7 +26,7 @@ class SP_Meta_Box_Player_Columns {
|
|
26 |
<?php if ( $tabs ) { ?>
|
27 |
<ul id="sp_column-tabs" class="wp-tab-bar sp-tab-bar">
|
28 |
<?php foreach ( $tabs as $index => $post_type ) { $object = get_post_type_object( $post_type ); ?>
|
29 |
-
<li class="wp-tab<?php if ( 0 == $index ) { ?>-active<?php } ?>"><a href="#<?php echo $post_type; ?>-all"><?php echo $object->labels->
|
30 |
<?php } ?>
|
31 |
</ul>
|
32 |
<?php
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.0
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
26 |
<?php if ( $tabs ) { ?>
|
27 |
<ul id="sp_column-tabs" class="wp-tab-bar sp-tab-bar">
|
28 |
<?php foreach ( $tabs as $index => $post_type ) { $object = get_post_type_object( $post_type ); ?>
|
29 |
+
<li class="wp-tab<?php if ( 0 == $index ) { ?>-active<?php } ?>"><a href="#<?php echo $post_type; ?>-all"><?php echo $object->labels->menu_name; ?></a></li>
|
30 |
<?php } ?>
|
31 |
</ul>
|
32 |
<?php
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-player-editor.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Player Editor
|
4 |
-
*
|
5 |
-
* @author ThemeBoy
|
6 |
-
* @category Admin
|
7 |
-
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version 0.8
|
9 |
-
*/
|
10 |
-
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
-
|
13 |
-
/**
|
14 |
-
* SP_Meta_Box_Player_Editor
|
15 |
-
*/
|
16 |
-
class SP_Meta_Box_Player_Editor {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Output the metabox
|
20 |
-
*/
|
21 |
-
public static function output( $post ) {
|
22 |
-
wp_editor( $post->post_content, 'content' );
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-player-statistics.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -22,24 +22,54 @@ class SP_Meta_Box_Player_Statistics {
|
|
22 |
$player = new SP_Player( $post );
|
23 |
$leagues = get_the_terms( $post->ID, 'sp_league' );
|
24 |
$league_num = sizeof( $leagues );
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
?>
|
31 |
-
<p><strong><?php
|
32 |
<?php
|
33 |
-
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = $player->data(
|
34 |
-
self::table( $post->ID,
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
|
45 |
/**
|
@@ -53,7 +83,8 @@ class SP_Meta_Box_Player_Statistics {
|
|
53 |
/**
|
54 |
* Admin edit table
|
55 |
*/
|
56 |
-
public static function table( $id = null, $league_id, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $leagues = array(), $has_checkboxes = false, $
|
|
|
57 |
$teams = array_filter( get_post_meta( $id, 'sp_team', false ) );
|
58 |
?>
|
59 |
<div class="sp-data-table-container">
|
@@ -61,16 +92,9 @@ class SP_Meta_Box_Player_Statistics {
|
|
61 |
<thead>
|
62 |
<tr>
|
63 |
<th><?php _e( 'Season', 'sportspress' ); ?></th>
|
64 |
-
<?php if ( apply_filters( 'sportspress_player_team_statistics', $league_id ) ): ?>
|
65 |
<th>
|
66 |
-
<?php
|
67 |
-
<label for="sp_columns_team">
|
68 |
-
<input type="checkbox" name="sp_columns[]" value="team" id="sp_columns_team" <?php checked( ! is_array( $columns ) || array_key_exists( 'team', $columns ) ); ?>>
|
69 |
-
<?php _e( 'Team', 'sportspress' ); ?>
|
70 |
-
</label>
|
71 |
-
<?php else: ?>
|
72 |
-
<?php _e( 'Team', 'sportspress' ); ?>
|
73 |
-
<?php endif; ?>
|
74 |
</th>
|
75 |
<?php endif; ?>
|
76 |
<?php foreach ( $columns as $key => $label ): if ( $key == 'team' ) continue; ?>
|
@@ -78,35 +102,51 @@ class SP_Meta_Box_Player_Statistics {
|
|
78 |
<?php endforeach; ?>
|
79 |
</tr>
|
80 |
</thead>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
<tbody>
|
82 |
<?php
|
83 |
$i = 0;
|
84 |
foreach ( $data as $div_id => $div_stats ):
|
85 |
if ( $div_id === 'statistics' ) continue;
|
|
|
86 |
$div = get_term( $div_id, 'sp_season' );
|
87 |
?>
|
88 |
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
89 |
<td>
|
90 |
-
|
91 |
-
|
92 |
-
<?php
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
<?php endif; ?>
|
97 |
-
<?php
|
98 |
-
if ( 'WP_Error' == get_class( $div ) ) _e( 'Total', 'sportspress' );
|
99 |
-
else echo $div->name;
|
100 |
-
?>
|
101 |
-
</label>
|
102 |
-
<?php else: ?>
|
103 |
<?php
|
104 |
-
if (
|
105 |
-
|
106 |
?>
|
107 |
-
|
108 |
</td>
|
109 |
-
<?php if ( apply_filters( 'sportspress_player_team_statistics', $league_id ) ): ?>
|
110 |
<?php if ( $div_id == 0 ): ?>
|
111 |
<td> </td>
|
112 |
<?php else: ?>
|
@@ -127,12 +167,12 @@ class SP_Meta_Box_Player_Statistics {
|
|
127 |
array(
|
128 |
'taxonomy' => 'sp_league',
|
129 |
'terms' => $league_id,
|
130 |
-
'field' => '
|
131 |
),
|
132 |
array(
|
133 |
'taxonomy' => 'sp_season',
|
134 |
'terms' => $div_id,
|
135 |
-
'field' => '
|
136 |
),
|
137 |
),
|
138 |
);
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.0.13
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
22 |
$player = new SP_Player( $post );
|
23 |
$leagues = get_the_terms( $post->ID, 'sp_league' );
|
24 |
$league_num = sizeof( $leagues );
|
25 |
+
$sections = get_option( 'sportspress_player_performance_sections', -1 );
|
26 |
|
27 |
+
if ( $leagues ) {
|
28 |
+
if ( -1 == $sections ) {
|
29 |
+
// Loop through statistics for each league
|
30 |
+
$i = 0;
|
31 |
+
foreach ( $leagues as $league ):
|
32 |
+
?>
|
33 |
+
<p><strong><?php echo $league->name; ?></strong></p>
|
34 |
+
<?php
|
35 |
+
list( $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes ) = $player->data( $league->term_id, true );
|
36 |
+
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0, true );
|
37 |
+
$i ++;
|
38 |
+
endforeach;
|
39 |
?>
|
40 |
+
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?></strong></p>
|
41 |
<?php
|
42 |
+
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = $player->data( 0, true );
|
43 |
+
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams );
|
44 |
+
} else {
|
45 |
+
// Determine order of sections
|
46 |
+
if ( 1 == $sections ) {
|
47 |
+
$section_order = array( 1 => __( 'Defense', 'sportspress' ), 0 => __( 'Offense', 'sportspress' ) );
|
48 |
+
} else {
|
49 |
+
$section_order = array( __( 'Offense', 'sportspress' ), __( 'Defense', 'sportspress' ) );
|
50 |
+
}
|
51 |
+
|
52 |
+
$s = 0;
|
53 |
+
foreach ( $section_order as $section_id => $section_label ) {
|
54 |
+
// Loop through statistics for each league
|
55 |
+
$i = 0;
|
56 |
+
foreach ( $leagues as $league ):
|
57 |
+
?>
|
58 |
+
<p><strong><?php echo $league->name; ?> — <?php echo $section_label; ?></strong></p>
|
59 |
+
<?php
|
60 |
+
list( $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes ) = $player->data( $league->term_id, true, $section_id );
|
61 |
+
self::table( $post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 );
|
62 |
+
$i ++;
|
63 |
+
endforeach;
|
64 |
+
?>
|
65 |
+
<p><strong><?php _e( 'Career Total', 'sportspress' ); ?> — <?php echo $section_label; ?></strong></p>
|
66 |
+
<?php
|
67 |
+
list( $columns, $data, $placeholders, $merged, $seasons_teams ) = $player->data( 0, true, $section_id );
|
68 |
+
self::table( $post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0 );
|
69 |
+
$s ++;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
}
|
74 |
|
75 |
/**
|
83 |
/**
|
84 |
* Admin edit table
|
85 |
*/
|
86 |
+
public static function table( $id = null, $league_id, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $leagues = array(), $has_checkboxes = false, $team_select = false ) {
|
87 |
+
$readonly = false;
|
88 |
$teams = array_filter( get_post_meta( $id, 'sp_team', false ) );
|
89 |
?>
|
90 |
<div class="sp-data-table-container">
|
92 |
<thead>
|
93 |
<tr>
|
94 |
<th><?php _e( 'Season', 'sportspress' ); ?></th>
|
95 |
+
<?php if ( $team_select && apply_filters( 'sportspress_player_team_statistics', $league_id ) ): ?>
|
96 |
<th>
|
97 |
+
<?php _e( 'Team', 'sportspress' ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
</th>
|
99 |
<?php endif; ?>
|
100 |
<?php foreach ( $columns as $key => $label ): if ( $key == 'team' ) continue; ?>
|
102 |
<?php endforeach; ?>
|
103 |
</tr>
|
104 |
</thead>
|
105 |
+
<tfoot>
|
106 |
+
<?php $div_stats = sp_array_value( $data, 0, array() ); ?>
|
107 |
+
<tr class="sp-row sp-total">
|
108 |
+
<td>
|
109 |
+
<label><strong><?php _e( 'Total', 'sportspress' ); ?></strong></label>
|
110 |
+
</td>
|
111 |
+
<?php if ( $team_select && apply_filters( 'sportspress_player_team_statistics', true ) ) { ?>
|
112 |
+
<td> </td>
|
113 |
+
<?php } ?>
|
114 |
+
<?php foreach ( $columns as $column => $label ): if ( $column == 'team' ) continue;
|
115 |
+
?>
|
116 |
+
<td><?php
|
117 |
+
$value = sp_array_value( sp_array_value( $data, 0, array() ), $column, null );
|
118 |
+
$placeholder = sp_array_value( sp_array_value( $placeholders, 0, array() ), $column, 0 );
|
119 |
+
if ( $readonly )
|
120 |
+
echo $value ? $value : $placeholder;
|
121 |
+
else
|
122 |
+
echo '<input type="text" name="sp_statistics[' . $league_id . '][0][' . $column . ']" value="' . esc_attr( $value ) . '" placeholder="' . esc_attr( $placeholder ) . '"' . ( $readonly ? ' disabled="disabled"' : '' ) . ' data-sp-format="number" />';
|
123 |
+
?></td>
|
124 |
+
<?php endforeach; ?>
|
125 |
+
</tr>
|
126 |
+
</tfoot>
|
127 |
<tbody>
|
128 |
<?php
|
129 |
$i = 0;
|
130 |
foreach ( $data as $div_id => $div_stats ):
|
131 |
if ( $div_id === 'statistics' ) continue;
|
132 |
+
if ( $div_id === 0 ) continue;
|
133 |
$div = get_term( $div_id, 'sp_season' );
|
134 |
?>
|
135 |
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
|
136 |
<td>
|
137 |
+
<label>
|
138 |
+
<?php if ( ! apply_filters( 'sportspress_player_team_statistics', $league_id ) ): ?>
|
139 |
+
<?php $value = sp_array_value( $leagues, $div_id, '-1' ); ?>
|
140 |
+
<input type="hidden" name="sp_leagues[<?php echo $league_id; ?>][<?php echo $div_id; ?>]" value="-1">
|
141 |
+
<input type="checkbox" name="sp_leagues[<?php echo $league_id; ?>][<?php echo $div_id; ?>]" value="1" <?php checked( $value ); ?>>
|
142 |
+
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
<?php
|
144 |
+
if ( 0 === $div_id ) _e( 'Total', 'sportspress' );
|
145 |
+
elseif ( 'WP_Error' != get_class( $div ) ) echo $div->name;
|
146 |
?>
|
147 |
+
</label>
|
148 |
</td>
|
149 |
+
<?php if ( $team_select && apply_filters( 'sportspress_player_team_statistics', $league_id ) ): ?>
|
150 |
<?php if ( $div_id == 0 ): ?>
|
151 |
<td> </td>
|
152 |
<?php else: ?>
|
167 |
array(
|
168 |
'taxonomy' => 'sp_league',
|
169 |
'terms' => $league_id,
|
170 |
+
'field' => 'term_id',
|
171 |
),
|
172 |
array(
|
173 |
'taxonomy' => 'sp_season',
|
174 |
'terms' => $div_id,
|
175 |
+
'field' => 'term_id',
|
176 |
),
|
177 |
),
|
178 |
);
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-staff-editor.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Staff Editor
|
4 |
-
*
|
5 |
-
* @author ThemeBoy
|
6 |
-
* @category Admin
|
7 |
-
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version 0.8
|
9 |
-
*/
|
10 |
-
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
-
|
13 |
-
/**
|
14 |
-
* SP_Meta_Box_Staff_Editor
|
15 |
-
*/
|
16 |
-
class SP_Meta_Box_Staff_Editor {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Output the metabox
|
20 |
-
*/
|
21 |
-
public static function output( $post ) {
|
22 |
-
wp_editor( $post->post_content, 'content' );
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-statistic-details.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -24,9 +24,13 @@ class SP_Meta_Box_Statistic_Details extends SP_Meta_Box_Config {
|
|
24 |
public static function output( $post ) {
|
25 |
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
26 |
$precision = get_post_meta( $post->ID, 'sp_precision', true );
|
|
|
|
|
27 |
|
28 |
// Defaults
|
29 |
-
if ( $precision
|
|
|
|
|
30 |
?>
|
31 |
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
|
32 |
<p>
|
@@ -37,6 +41,35 @@ class SP_Meta_Box_Statistic_Details extends SP_Meta_Box_Config {
|
|
37 |
<p class="sp-precision-selector">
|
38 |
<input name="sp_precision" type="text" size="4" id="sp_precision" value="<?php echo $precision; ?>" placeholder="0">
|
39 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
<?php
|
41 |
}
|
42 |
|
@@ -45,7 +78,9 @@ class SP_Meta_Box_Statistic_Details extends SP_Meta_Box_Config {
|
|
45 |
*/
|
46 |
public static function save( $post_id, $post ) {
|
47 |
self::delete_duplicate( $_POST );
|
|
|
48 |
update_post_meta( $post_id, 'sp_precision', (int) sp_array_value( $_POST, 'sp_precision', 1 ) );
|
|
|
49 |
}
|
50 |
|
51 |
}
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.0
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
24 |
public static function output( $post ) {
|
25 |
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
26 |
$precision = get_post_meta( $post->ID, 'sp_precision', true );
|
27 |
+
$section = get_post_meta( $post->ID, 'sp_section', true );
|
28 |
+
$visible = get_post_meta( $post->ID, 'sp_visible', true );
|
29 |
|
30 |
// Defaults
|
31 |
+
if ( '' === $precision ) $precision = 0;
|
32 |
+
if ( '' === $section ) $section = -1;
|
33 |
+
if ( '' === $visible ) $visible = 1;
|
34 |
?>
|
35 |
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
|
36 |
<p>
|
41 |
<p class="sp-precision-selector">
|
42 |
<input name="sp_precision" type="text" size="4" id="sp_precision" value="<?php echo $precision; ?>" placeholder="0">
|
43 |
</p>
|
44 |
+
<p><strong><?php _e( 'Category', 'sportspress' ); ?></strong></p>
|
45 |
+
<p class="sp-section-selector">
|
46 |
+
<select name="sp_section">
|
47 |
+
<?php
|
48 |
+
$options = apply_filters( 'sportspress_performance_sections', array( -1 => __( 'All', 'sportspress' ), 0 => __( 'Offense', 'sportspress' ), 1 => __( 'Defense', 'sportspress' ) ) );
|
49 |
+
foreach ( $options as $key => $value ):
|
50 |
+
printf( '<option value="%s" %s>%s</option>', $key, selected( $key == $section, true, false ), $value );
|
51 |
+
endforeach;
|
52 |
+
?>
|
53 |
+
</select>
|
54 |
+
</p>
|
55 |
+
<p>
|
56 |
+
<strong><?php _e( 'Visible', 'sportspress' ); ?></strong>
|
57 |
+
<i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php _e( 'Display in player profile?', 'sportspress' ); ?>"></i>
|
58 |
+
</p>
|
59 |
+
<ul class="sp-visible-selector">
|
60 |
+
<li>
|
61 |
+
<label class="selectit">
|
62 |
+
<input name="sp_visible" id="sp_visible_yes" type="radio" value="1" <?php checked( $visible ); ?>>
|
63 |
+
<?php _e( 'Yes', 'sportspress' ); ?>
|
64 |
+
</label>
|
65 |
+
</li>
|
66 |
+
<li>
|
67 |
+
<label class="selectit">
|
68 |
+
<input name="sp_visible" id="sp_visible_no" type="radio" value="0" <?php checked( ! $visible ); ?>>
|
69 |
+
<?php _e( 'No', 'sportspress' ); ?>
|
70 |
+
</label>
|
71 |
+
</li>
|
72 |
+
</ul>
|
73 |
<?php
|
74 |
}
|
75 |
|
78 |
*/
|
79 |
public static function save( $post_id, $post ) {
|
80 |
self::delete_duplicate( $_POST );
|
81 |
+
update_post_meta( $post_id, 'sp_section', (int) sp_array_value( $_POST, 'sp_section', -1 ) );
|
82 |
update_post_meta( $post_id, 'sp_precision', (int) sp_array_value( $_POST, 'sp_precision', 1 ) );
|
83 |
+
update_post_meta( $post_id, 'sp_visible', sp_array_value( $_POST, 'sp_visible', 1 ) );
|
84 |
}
|
85 |
|
86 |
}
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-table-editor.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Table Editor
|
4 |
-
*
|
5 |
-
* @author ThemeBoy
|
6 |
-
* @category Admin
|
7 |
-
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version 0.8
|
9 |
-
*/
|
10 |
-
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
-
|
13 |
-
/**
|
14 |
-
* SP_Meta_Box_Table_Editor
|
15 |
-
*/
|
16 |
-
class SP_Meta_Box_Table_Editor {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Output the metabox
|
20 |
-
*/
|
21 |
-
public static function output( $post ) {
|
22 |
-
wp_editor( $post->post_content, 'content' );
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/post-types/meta-boxes/class-sp-meta-box-team-editor.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Team Editor
|
4 |
-
*
|
5 |
-
* @author ThemeBoy
|
6 |
-
* @category Admin
|
7 |
-
* @package SportsPress/Admin/Meta_Boxes
|
8 |
-
* @version 0.8
|
9 |
-
*/
|
10 |
-
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
-
|
13 |
-
/**
|
14 |
-
* SP_Meta_Box_Team_Editor
|
15 |
-
*/
|
16 |
-
class SP_Meta_Box_Team_Editor {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Output the metabox
|
20 |
-
*/
|
21 |
-
public static function output( $post ) {
|
22 |
-
wp_editor( $post->post_content, 'content' );
|
23 |
-
}
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/settings/class-sp-settings-events.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -23,11 +23,15 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|
23 |
public function __construct() {
|
24 |
$this->id = 'events';
|
25 |
$this->label = __( 'Events', 'sportspress' );
|
|
|
|
|
|
|
26 |
|
27 |
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
28 |
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
29 |
add_action( 'sportspress_admin_field_current_mode', array( $this, 'current_mode_setting' ) );
|
30 |
add_action( 'sportspress_admin_field_delimiter', array( $this, 'delimiter_setting' ) );
|
|
|
31 |
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
32 |
}
|
33 |
|
@@ -55,20 +59,15 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|
55 |
),
|
56 |
|
57 |
apply_filters( 'sportspress_event_template_options', array(
|
|
|
|
|
58 |
array(
|
59 |
'title' => __( 'Display', 'sportspress' ),
|
60 |
-
'desc' => __( 'Logos', 'sportspress' ),
|
61 |
-
'id' => 'sportspress_event_show_logos',
|
62 |
-
'default' => 'yes',
|
63 |
-
'type' => 'checkbox',
|
64 |
-
'checkboxgroup' => 'start',
|
65 |
-
),
|
66 |
-
array(
|
67 |
'desc' => __( 'Date', 'sportspress' ),
|
68 |
'id' => 'sportspress_event_show_date',
|
69 |
'default' => 'yes',
|
70 |
'type' => 'checkbox',
|
71 |
-
'checkboxgroup' => '',
|
72 |
),
|
73 |
array(
|
74 |
'desc' => __( 'Time', 'sportspress' ),
|
@@ -77,34 +76,6 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|
77 |
'type' => 'checkbox',
|
78 |
'checkboxgroup' => '',
|
79 |
),
|
80 |
-
array(
|
81 |
-
'desc' => __( 'Results', 'sportspress' ),
|
82 |
-
'id' => 'sportspress_event_show_results',
|
83 |
-
'default' => 'yes',
|
84 |
-
'type' => 'checkbox',
|
85 |
-
'checkboxgroup' => '',
|
86 |
-
),
|
87 |
-
array(
|
88 |
-
'desc' => __( 'Details', 'sportspress' ),
|
89 |
-
'id' => 'sportspress_event_show_details',
|
90 |
-
'default' => 'yes',
|
91 |
-
'type' => 'checkbox',
|
92 |
-
'checkboxgroup' => '',
|
93 |
-
),
|
94 |
-
array(
|
95 |
-
'desc' => __( 'Venue', 'sportspress' ),
|
96 |
-
'id' => 'sportspress_event_show_venue',
|
97 |
-
'default' => 'yes',
|
98 |
-
'type' => 'checkbox',
|
99 |
-
'checkboxgroup' => '',
|
100 |
-
),
|
101 |
-
array(
|
102 |
-
'desc' => __( 'Scorecard', 'sportspress' ),
|
103 |
-
'id' => 'sportspress_event_show_performance',
|
104 |
-
'default' => 'yes',
|
105 |
-
'type' => 'checkbox',
|
106 |
-
'checkboxgroup' => 'end',
|
107 |
-
),
|
108 |
) ),
|
109 |
|
110 |
array(
|
@@ -151,6 +122,14 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|
151 |
'id' => 'sportspress_event_filter_teams_by_season',
|
152 |
'default' => 'no',
|
153 |
'type' => 'checkbox',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
'checkboxgroup' => 'end',
|
155 |
),
|
156 |
|
@@ -179,8 +158,6 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|
179 |
'options' => array(
|
180 |
'ROADMAP' => __( 'Default', 'sportspress' ),
|
181 |
'SATELLITE' => __( 'Satellite', 'sportspress' ),
|
182 |
-
'HYBRID' => __( 'Hybrid', 'sportspress' ),
|
183 |
-
'TERRAIN' => __( 'Terrain', 'sportspress' ),
|
184 |
),
|
185 |
),
|
186 |
|
@@ -242,7 +219,7 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|
242 |
apply_filters( 'sportspress_event_logo_options', array(
|
243 |
array(
|
244 |
'title' => __( 'Display', 'sportspress' ),
|
245 |
-
'desc' => __( '
|
246 |
'id' => 'sportspress_event_logos_show_team_names',
|
247 |
'default' => 'no',
|
248 |
'type' => 'checkbox',
|
@@ -250,7 +227,15 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|
250 |
),
|
251 |
|
252 |
array(
|
253 |
-
'desc' => __( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
'id' => 'sportspress_event_logos_show_results',
|
255 |
'default' => 'no',
|
256 |
'type' => 'checkbox',
|
@@ -277,14 +262,6 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|
277 |
'manual' => __( 'Manual', 'sportspress' ),
|
278 |
),
|
279 |
),
|
280 |
-
|
281 |
-
array(
|
282 |
-
'title' => __( 'Teams', 'sportspress' ),
|
283 |
-
'desc' => __( 'Reverse order', 'sportspress' ),
|
284 |
-
'id' => 'sportspress_event_results_reverse_teams',
|
285 |
-
'default' => 'no',
|
286 |
-
'type' => 'checkbox',
|
287 |
-
),
|
288 |
|
289 |
array(
|
290 |
'title' => __( 'Outcome', 'sportspress' ),
|
@@ -300,7 +277,7 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|
300 |
),
|
301 |
|
302 |
array(
|
303 |
-
array( 'title' => __( '
|
304 |
),
|
305 |
|
306 |
apply_filters( 'sportspress_performance_options', array(
|
@@ -351,14 +328,6 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|
351 |
),
|
352 |
),
|
353 |
|
354 |
-
array(
|
355 |
-
'title' => __( 'Teams', 'sportspress' ),
|
356 |
-
'desc' => __( 'Reverse order', 'sportspress' ),
|
357 |
-
'id' => 'sportspress_event_performance_reverse_teams',
|
358 |
-
'default' => 'no',
|
359 |
-
'type' => 'checkbox',
|
360 |
-
),
|
361 |
-
|
362 |
array(
|
363 |
'title' => __( 'Positions', 'sportspress' ),
|
364 |
'desc' => __( 'Top-level only', 'sportspress' ),
|
@@ -421,8 +390,7 @@ class SP_Settings_Events extends SP_Settings_Page {
|
|
421 |
* Save settings
|
422 |
*/
|
423 |
public function save() {
|
424 |
-
|
425 |
-
SP_Admin_Settings::save_fields( $settings );
|
426 |
|
427 |
if ( isset( $_POST['sportspress_event_teams_delimiter'] ) )
|
428 |
update_option( 'sportspress_event_teams_delimiter', $_POST['sportspress_event_teams_delimiter'] );
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
+
* @version 2.0.13
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
23 |
public function __construct() {
|
24 |
$this->id = 'events';
|
25 |
$this->label = __( 'Events', 'sportspress' );
|
26 |
+
|
27 |
+
$this->template = 'event';
|
28 |
+
$this->templates = SP()->templates->event;
|
29 |
|
30 |
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
31 |
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
32 |
add_action( 'sportspress_admin_field_current_mode', array( $this, 'current_mode_setting' ) );
|
33 |
add_action( 'sportspress_admin_field_delimiter', array( $this, 'delimiter_setting' ) );
|
34 |
+
add_action( 'sportspress_admin_field_event_layout', array( $this, 'layout_setting' ) );
|
35 |
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
36 |
}
|
37 |
|
59 |
),
|
60 |
|
61 |
apply_filters( 'sportspress_event_template_options', array(
|
62 |
+
array( 'type' => 'event_layout' ),
|
63 |
+
|
64 |
array(
|
65 |
'title' => __( 'Display', 'sportspress' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
'desc' => __( 'Date', 'sportspress' ),
|
67 |
'id' => 'sportspress_event_show_date',
|
68 |
'default' => 'yes',
|
69 |
'type' => 'checkbox',
|
70 |
+
'checkboxgroup' => 'start',
|
71 |
),
|
72 |
array(
|
73 |
'desc' => __( 'Time', 'sportspress' ),
|
76 |
'type' => 'checkbox',
|
77 |
'checkboxgroup' => '',
|
78 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
) ),
|
80 |
|
81 |
array(
|
122 |
'id' => 'sportspress_event_filter_teams_by_season',
|
123 |
'default' => 'no',
|
124 |
'type' => 'checkbox',
|
125 |
+
'checkboxgroup' => '',
|
126 |
+
),
|
127 |
+
|
128 |
+
array(
|
129 |
+
'desc' => __( 'Reverse order', 'sportspress' ),
|
130 |
+
'id' => 'sportspress_event_reverse_teams',
|
131 |
+
'default' => 'no',
|
132 |
+
'type' => 'checkbox',
|
133 |
'checkboxgroup' => 'end',
|
134 |
),
|
135 |
|
158 |
'options' => array(
|
159 |
'ROADMAP' => __( 'Default', 'sportspress' ),
|
160 |
'SATELLITE' => __( 'Satellite', 'sportspress' ),
|
|
|
|
|
161 |
),
|
162 |
),
|
163 |
|
219 |
apply_filters( 'sportspress_event_logo_options', array(
|
220 |
array(
|
221 |
'title' => __( 'Display', 'sportspress' ),
|
222 |
+
'desc' => __( 'Name', 'sportspress' ),
|
223 |
'id' => 'sportspress_event_logos_show_team_names',
|
224 |
'default' => 'no',
|
225 |
'type' => 'checkbox',
|
227 |
),
|
228 |
|
229 |
array(
|
230 |
+
'desc' => __( 'Time', 'sportspress' ),
|
231 |
+
'id' => 'sportspress_event_logos_show_time',
|
232 |
+
'default' => 'no',
|
233 |
+
'type' => 'checkbox',
|
234 |
+
'checkboxgroup' => '',
|
235 |
+
),
|
236 |
+
|
237 |
+
array(
|
238 |
+
'desc' => __( 'Results', 'sportspress' ),
|
239 |
'id' => 'sportspress_event_logos_show_results',
|
240 |
'default' => 'no',
|
241 |
'type' => 'checkbox',
|
262 |
'manual' => __( 'Manual', 'sportspress' ),
|
263 |
),
|
264 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
|
266 |
array(
|
267 |
'title' => __( 'Outcome', 'sportspress' ),
|
277 |
),
|
278 |
|
279 |
array(
|
280 |
+
array( 'title' => __( 'Box Score', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'performance_options' ),
|
281 |
),
|
282 |
|
283 |
apply_filters( 'sportspress_performance_options', array(
|
328 |
),
|
329 |
),
|
330 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
array(
|
332 |
'title' => __( 'Positions', 'sportspress' ),
|
333 |
'desc' => __( 'Top-level only', 'sportspress' ),
|
390 |
* Save settings
|
391 |
*/
|
392 |
public function save() {
|
393 |
+
parent::save();
|
|
|
394 |
|
395 |
if ( isset( $_POST['sportspress_event_teams_delimiter'] ) )
|
396 |
update_option( 'sportspress_event_teams_delimiter', $_POST['sportspress_event_teams_delimiter'] );
|
includes/admin/settings/class-sp-settings-general.php
CHANGED
@@ -98,14 +98,17 @@ class SP_Settings_General extends SP_Settings_Page {
|
|
98 |
));
|
99 |
endif;
|
100 |
|
101 |
-
$options = array_merge( $options,
|
|
|
102 |
array(
|
103 |
'title' => __( 'Custom CSS', 'sportspress' ),
|
104 |
'id' => 'sportspress_custom_css',
|
105 |
'css' => 'width:100%; height: 130px;',
|
106 |
'type' => 'textarea',
|
107 |
),
|
108 |
-
|
|
|
|
|
109 |
array(
|
110 |
'title' => __( 'Scripts', 'sportspress' ),
|
111 |
'desc' => __( 'Live countdowns', 'sportspress' ),
|
@@ -124,7 +127,9 @@ class SP_Settings_General extends SP_Settings_Page {
|
|
124 |
'checkboxgroup' => 'end',
|
125 |
'desc_tip' => __( 'This will enable a shortcode menu to be displayed in the visual editor.', 'sportspress' ),
|
126 |
),
|
127 |
-
|
|
|
|
|
128 |
array(
|
129 |
'title' => __( 'Tables', 'sportspress' ),
|
130 |
'desc' => __( 'Responsive', 'sportspress' ),
|
@@ -158,7 +163,7 @@ class SP_Settings_General extends SP_Settings_Page {
|
|
158 |
'type' => 'checkbox',
|
159 |
'desc_tip' => __( 'Hide widget when same as content.', 'sportspress' ),
|
160 |
),
|
161 |
-
));
|
162 |
|
163 |
if ( apply_filters( 'sportspress_enable_header', false ) ) {
|
164 |
$options[] = array(
|
98 |
));
|
99 |
endif;
|
100 |
|
101 |
+
$options = array_merge( $options,
|
102 |
+
array(
|
103 |
array(
|
104 |
'title' => __( 'Custom CSS', 'sportspress' ),
|
105 |
'id' => 'sportspress_custom_css',
|
106 |
'css' => 'width:100%; height: 130px;',
|
107 |
'type' => 'textarea',
|
108 |
),
|
109 |
+
),
|
110 |
+
|
111 |
+
apply_filters( 'sportspress_general_script_options', array(
|
112 |
array(
|
113 |
'title' => __( 'Scripts', 'sportspress' ),
|
114 |
'desc' => __( 'Live countdowns', 'sportspress' ),
|
127 |
'checkboxgroup' => 'end',
|
128 |
'desc_tip' => __( 'This will enable a shortcode menu to be displayed in the visual editor.', 'sportspress' ),
|
129 |
),
|
130 |
+
) ),
|
131 |
+
|
132 |
+
array(
|
133 |
array(
|
134 |
'title' => __( 'Tables', 'sportspress' ),
|
135 |
'desc' => __( 'Responsive', 'sportspress' ),
|
163 |
'type' => 'checkbox',
|
164 |
'desc_tip' => __( 'Hide widget when same as content.', 'sportspress' ),
|
165 |
),
|
166 |
+
) );
|
167 |
|
168 |
if ( apply_filters( 'sportspress_enable_header', false ) ) {
|
169 |
$options[] = array(
|
includes/admin/settings/class-sp-settings-page.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
-
* @version 0
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -19,7 +19,8 @@ class SP_Settings_Page {
|
|
19 |
|
20 |
protected $id = '';
|
21 |
protected $label = '';
|
22 |
-
|
|
|
23 |
/**
|
24 |
* Add this page to settings
|
25 |
*/
|
@@ -56,8 +57,70 @@ class SP_Settings_Page {
|
|
56 |
$settings = $this->get_settings();
|
57 |
SP_Admin_Settings::save_fields( $settings );
|
58 |
|
59 |
-
|
60 |
-
do_action( 'sportspress_update_options_' . $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
}
|
63 |
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
+
* @version 2.0
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
19 |
|
20 |
protected $id = '';
|
21 |
protected $label = '';
|
22 |
+
protected $template = '';
|
23 |
+
public $templates = array();
|
24 |
/**
|
25 |
* Add this page to settings
|
26 |
*/
|
57 |
$settings = $this->get_settings();
|
58 |
SP_Admin_Settings::save_fields( $settings );
|
59 |
|
60 |
+
if ( $current_section )
|
61 |
+
do_action( 'sportspress_update_options_' . $this->template . '_' . $current_section );
|
62 |
+
|
63 |
+
if ( ! empty( $this->templates ) )
|
64 |
+
update_option( 'sportspress_' . $this->template . '_template_order', sp_array_value( $_POST, 'sportspress_' . $this->template . '_template_order', false ) );
|
65 |
+
|
66 |
+
if ( isset( $_POST['sportspress_template_visibility'] ) && is_array( $_POST['sportspress_template_visibility'] ) ) {
|
67 |
+
foreach ( $_POST['sportspress_template_visibility'] as $option => $toggled ) {
|
68 |
+
if ( $toggled ) {
|
69 |
+
update_option( $option, 'yes' );
|
70 |
+
} else {
|
71 |
+
update_option( $option, 'no' );
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Layout settings
|
80 |
+
*
|
81 |
+
* @access public
|
82 |
+
* @return void
|
83 |
+
*/
|
84 |
+
public function layout_setting() {
|
85 |
+
$templates = apply_filters( 'sportspress_' . $this->template . '_templates', $this->templates );
|
86 |
+
|
87 |
+
$layout = get_option( 'sportspress_' . $this->template . '_template_order' );
|
88 |
+
if ( false === $layout ) {
|
89 |
+
$layout = array_keys( $templates );
|
90 |
+
}
|
91 |
+
|
92 |
+
$templates = array_merge( array_flip( $layout ), $templates );
|
93 |
+
?>
|
94 |
+
<tr valign="top">
|
95 |
+
<th>
|
96 |
+
<?php _e( 'Layout', 'sportspress' ); ?>
|
97 |
+
</th>
|
98 |
+
<td class="sp-sortable-list-container">
|
99 |
+
<p class="description"><?php _e( 'Drag each item into the order you prefer.', 'sportspress' ); ?></p>
|
100 |
+
|
101 |
+
<ul class="sp-layout sp-sortable-list ui-sortable">
|
102 |
+
<?php foreach ( $templates as $template => $details ) {
|
103 |
+
if ( ! is_array( $details ) ) continue;
|
104 |
+
$option = sp_array_value( $details, 'option', 'sportspress_' . $this->template . '_show_' . $template );
|
105 |
+
$visibility = get_option( $option, sp_array_value( $details, 'default', 'yes' ) );
|
106 |
+
?>
|
107 |
+
<li>
|
108 |
+
<div class="sp-item-bar sp-layout-item-bar">
|
109 |
+
<div class="sp-item-handle sp-layout-item-handle ui-sortable-handle">
|
110 |
+
<span class="sp-item-title item-title"><?php echo sp_array_value( $details, 'title', ucfirst( $template ) ); ?></span>
|
111 |
+
<input type="hidden" name="sportspress_<?php echo $this->template; ?>_template_order[]" value="<?php echo $template; ?>">
|
112 |
+
</div>
|
113 |
+
|
114 |
+
<input type="hidden" name="sportspress_template_visibility[<?php echo $option; ?>]" value="0">
|
115 |
+
<input class="sp-toggle-switch" type="checkbox" name="sportspress_template_visibility[<?php echo $option; ?>]" id="<?php echo $option; ?>" value="1" <?php checked( $visibility, 'yes' ); ?>>
|
116 |
+
<label for="sportspress_<?php echo $this->template; ?>_show_<?php echo $template; ?>"></label>
|
117 |
+
</div>
|
118 |
+
</li>
|
119 |
+
<?php } ?>
|
120 |
+
</ul>
|
121 |
+
</td>
|
122 |
+
</tr>
|
123 |
+
<?php
|
124 |
}
|
125 |
}
|
126 |
|
includes/admin/settings/class-sp-settings-players.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -23,9 +23,13 @@ class SP_Settings_Players extends SP_Settings_Page {
|
|
23 |
public function __construct() {
|
24 |
$this->id = 'players';
|
25 |
$this->label = __( 'Players', 'sportspress' );
|
|
|
|
|
|
|
26 |
|
27 |
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
28 |
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
|
|
29 |
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
30 |
}
|
31 |
|
@@ -37,12 +41,13 @@ class SP_Settings_Players extends SP_Settings_Page {
|
|
37 |
public function get_settings() {
|
38 |
|
39 |
$settings = array_merge(
|
40 |
-
|
41 |
array(
|
42 |
array( 'title' => __( 'Player Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_options' ),
|
43 |
),
|
44 |
|
45 |
apply_filters( 'sportspress_player_options', array(
|
|
|
|
|
46 |
array(
|
47 |
'title' => __( 'Link', 'sportspress' ),
|
48 |
'desc' => __( 'Link players', 'sportspress' ),
|
@@ -51,31 +56,6 @@ class SP_Settings_Players extends SP_Settings_Page {
|
|
51 |
'type' => 'checkbox',
|
52 |
),
|
53 |
|
54 |
-
array(
|
55 |
-
'title' => __( 'Display', 'sportspress' ),
|
56 |
-
'desc' => __( 'Photo', 'sportspress' ),
|
57 |
-
'id' => 'sportspress_player_show_photo',
|
58 |
-
'default' => 'yes',
|
59 |
-
'type' => 'checkbox',
|
60 |
-
'checkboxgroup' => 'start',
|
61 |
-
),
|
62 |
-
|
63 |
-
array(
|
64 |
-
'desc' => __( 'Details', 'sportspress' ),
|
65 |
-
'id' => 'sportspress_player_show_details',
|
66 |
-
'default' => 'yes',
|
67 |
-
'type' => 'checkbox',
|
68 |
-
'checkboxgroup' => '',
|
69 |
-
),
|
70 |
-
|
71 |
-
array(
|
72 |
-
'desc' => __( 'Statistics', 'sportspress' ),
|
73 |
-
'id' => 'sportspress_player_show_statistics',
|
74 |
-
'default' => 'yes',
|
75 |
-
'type' => 'checkbox',
|
76 |
-
'checkboxgroup' => 'end',
|
77 |
-
),
|
78 |
-
|
79 |
array(
|
80 |
'title' => __( 'Details', 'sportspress' ),
|
81 |
'desc' => __( 'Nationality', 'sportspress' ),
|
@@ -125,6 +105,37 @@ class SP_Settings_Players extends SP_Settings_Page {
|
|
125 |
'checkboxgroup' => 'end',
|
126 |
),
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
array(
|
129 |
'title' => __( 'Nationality', 'sportspress' ),
|
130 |
'desc' => __( 'Display national flags', 'sportspress' ),
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
+
* @version 2.0
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
23 |
public function __construct() {
|
24 |
$this->id = 'players';
|
25 |
$this->label = __( 'Players', 'sportspress' );
|
26 |
+
|
27 |
+
$this->template = 'player';
|
28 |
+
$this->templates = SP()->templates->player;
|
29 |
|
30 |
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
31 |
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
32 |
+
add_action( 'sportspress_admin_field_player_layout', array( $this, 'layout_setting' ) );
|
33 |
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
34 |
}
|
35 |
|
41 |
public function get_settings() {
|
42 |
|
43 |
$settings = array_merge(
|
|
|
44 |
array(
|
45 |
array( 'title' => __( 'Player Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_options' ),
|
46 |
),
|
47 |
|
48 |
apply_filters( 'sportspress_player_options', array(
|
49 |
+
array( 'type' => 'player_layout' ),
|
50 |
+
|
51 |
array(
|
52 |
'title' => __( 'Link', 'sportspress' ),
|
53 |
'desc' => __( 'Link players', 'sportspress' ),
|
56 |
'type' => 'checkbox',
|
57 |
),
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
array(
|
60 |
'title' => __( 'Details', 'sportspress' ),
|
61 |
'desc' => __( 'Nationality', 'sportspress' ),
|
105 |
'checkboxgroup' => 'end',
|
106 |
),
|
107 |
|
108 |
+
array(
|
109 |
+
'title' => __( 'Columns', 'sportspress' ),
|
110 |
+
'id' => 'sportspress_player_columns',
|
111 |
+
'default' => 'auto',
|
112 |
+
'type' => 'radio',
|
113 |
+
'options' => array(
|
114 |
+
'auto' => __( 'Auto', 'sportspress' ),
|
115 |
+
'manual' => __( 'Manual', 'sportspress' ),
|
116 |
+
),
|
117 |
+
),
|
118 |
+
|
119 |
+
array(
|
120 |
+
'title' => __( 'Statistics', 'sportspress' ),
|
121 |
+
'id' => 'sportspress_player_performance_sections',
|
122 |
+
'default' => -1,
|
123 |
+
'type' => 'radio',
|
124 |
+
'options' => array(
|
125 |
+
-1 => __( 'Combined', 'sportspress' ),
|
126 |
+
0 => __( 'Offense', 'sportspress' ) . ' → ' . __( 'Defense', 'sportspress' ),
|
127 |
+
1 => __( 'Defense', 'sportspress' ) . ' → ' . __( 'Offense', 'sportspress' ),
|
128 |
+
),
|
129 |
+
),
|
130 |
+
|
131 |
+
array(
|
132 |
+
'title' => __( 'Total', 'sportspress' ),
|
133 |
+
'desc' => __( 'Display total', 'sportspress' ),
|
134 |
+
'id' => 'sportspress_player_show_total',
|
135 |
+
'default' => 'no',
|
136 |
+
'type' => 'checkbox',
|
137 |
+
),
|
138 |
+
|
139 |
array(
|
140 |
'title' => __( 'Nationality', 'sportspress' ),
|
141 |
'desc' => __( 'Display national flags', 'sportspress' ),
|
includes/admin/settings/class-sp-settings-staff.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -23,9 +23,13 @@ class SP_Settings_Staff extends SP_Settings_Page {
|
|
23 |
public function __construct() {
|
24 |
$this->id = 'staff';
|
25 |
$this->label = __( 'Staff', 'sportspress' );
|
|
|
|
|
|
|
26 |
|
27 |
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
28 |
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
|
|
29 |
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
30 |
}
|
31 |
|
@@ -42,6 +46,8 @@ class SP_Settings_Staff extends SP_Settings_Page {
|
|
42 |
),
|
43 |
|
44 |
apply_filters( 'sportspress_staff_options', array(
|
|
|
|
|
45 |
array(
|
46 |
'title' => __( 'Link', 'sportspress' ),
|
47 |
'desc' => __( 'Link staff', 'sportspress' ),
|
@@ -50,23 +56,6 @@ class SP_Settings_Staff extends SP_Settings_Page {
|
|
50 |
'type' => 'checkbox',
|
51 |
),
|
52 |
|
53 |
-
array(
|
54 |
-
'title' => __( 'Display', 'sportspress' ),
|
55 |
-
'desc' => __( 'Photo', 'sportspress' ),
|
56 |
-
'id' => 'sportspress_staff_show_photo',
|
57 |
-
'default' => 'yes',
|
58 |
-
'type' => 'checkbox',
|
59 |
-
'checkboxgroup' => 'start',
|
60 |
-
),
|
61 |
-
|
62 |
-
array(
|
63 |
-
'desc' => __( 'Details', 'sportspress' ),
|
64 |
-
'id' => 'sportspress_staff_show_details',
|
65 |
-
'default' => 'yes',
|
66 |
-
'type' => 'checkbox',
|
67 |
-
'checkboxgroup' => 'end',
|
68 |
-
),
|
69 |
-
|
70 |
array(
|
71 |
'title' => __( 'Details', 'sportspress' ),
|
72 |
'desc' => __( 'Nationality', 'sportspress' ),
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
+
* @version 2.0
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
23 |
public function __construct() {
|
24 |
$this->id = 'staff';
|
25 |
$this->label = __( 'Staff', 'sportspress' );
|
26 |
+
|
27 |
+
$this->template = 'staff';
|
28 |
+
$this->templates = SP()->templates->staff;
|
29 |
|
30 |
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
31 |
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
32 |
+
add_action( 'sportspress_admin_field_staff_layout', array( $this, 'layout_setting' ) );
|
33 |
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
34 |
}
|
35 |
|
46 |
),
|
47 |
|
48 |
apply_filters( 'sportspress_staff_options', array(
|
49 |
+
array( 'type' => 'staff_layout' ),
|
50 |
+
|
51 |
array(
|
52 |
'title' => __( 'Link', 'sportspress' ),
|
53 |
'desc' => __( 'Link staff', 'sportspress' ),
|
56 |
'type' => 'checkbox',
|
57 |
),
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
array(
|
60 |
'title' => __( 'Details', 'sportspress' ),
|
61 |
'desc' => __( 'Nationality', 'sportspress' ),
|
includes/admin/settings/class-sp-settings-teams.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -23,9 +23,13 @@ class SP_Settings_Teams extends SP_Settings_Page {
|
|
23 |
public function __construct() {
|
24 |
$this->id = 'teams';
|
25 |
$this->label = __( 'Teams', 'sportspress' );
|
|
|
|
|
|
|
26 |
|
27 |
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
28 |
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
|
|
29 |
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
30 |
}
|
31 |
|
@@ -43,6 +47,8 @@ class SP_Settings_Teams extends SP_Settings_Page {
|
|
43 |
),
|
44 |
|
45 |
apply_filters( 'sportspress_team_options', array(
|
|
|
|
|
46 |
array(
|
47 |
'title' => __( 'Link', 'sportspress' ),
|
48 |
'desc' => __( 'Link teams', 'sportspress' ),
|
@@ -51,31 +57,6 @@ class SP_Settings_Teams extends SP_Settings_Page {
|
|
51 |
'type' => 'checkbox',
|
52 |
),
|
53 |
|
54 |
-
array(
|
55 |
-
'title' => __( 'Display', 'sportspress' ),
|
56 |
-
'desc' => __( 'Logo', 'sportspress' ),
|
57 |
-
'id' => 'sportspress_team_show_logo',
|
58 |
-
'default' => 'yes',
|
59 |
-
'type' => 'checkbox',
|
60 |
-
'checkboxgroup' => 'start',
|
61 |
-
),
|
62 |
-
|
63 |
-
array(
|
64 |
-
'desc' => __( 'Details', 'sportspress' ),
|
65 |
-
'id' => 'sportspress_team_show_details',
|
66 |
-
'default' => 'no',
|
67 |
-
'type' => 'checkbox',
|
68 |
-
'checkboxgroup' => '',
|
69 |
-
),
|
70 |
-
|
71 |
-
array(
|
72 |
-
'desc' => __( 'Visit Site', 'sportspress' ),
|
73 |
-
'id' => 'sportspress_team_show_link',
|
74 |
-
'default' => 'yes',
|
75 |
-
'type' => 'checkbox',
|
76 |
-
'checkboxgroup' => 'end',
|
77 |
-
),
|
78 |
-
|
79 |
array(
|
80 |
'title' => __( 'Venue', 'sportspress' ),
|
81 |
'desc' => __( 'Link venues', 'sportspress' ),
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Admin
|
8 |
+
* @version 2.0
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
23 |
public function __construct() {
|
24 |
$this->id = 'teams';
|
25 |
$this->label = __( 'Teams', 'sportspress' );
|
26 |
+
|
27 |
+
$this->template = 'team';
|
28 |
+
$this->templates = SP()->templates->team;
|
29 |
|
30 |
add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
|
31 |
add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) );
|
32 |
+
add_action( 'sportspress_admin_field_team_layout', array( $this, 'layout_setting' ) );
|
33 |
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
|
34 |
}
|
35 |
|
47 |
),
|
48 |
|
49 |
apply_filters( 'sportspress_team_options', array(
|
50 |
+
array( 'type' => 'team_layout' ),
|
51 |
+
|
52 |
array(
|
53 |
'title' => __( 'Link', 'sportspress' ),
|
54 |
'desc' => __( 'Link teams', 'sportspress' ),
|
57 |
'type' => 'checkbox',
|
58 |
),
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
array(
|
61 |
'title' => __( 'Venue', 'sportspress' ),
|
62 |
'desc' => __( 'Link venues', 'sportspress' ),
|
includes/admin/views/html-admin-config.php
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
<div class="wrap sportspress sportspress-config-wrap">
|
2 |
<h2>
|
3 |
<?php _e( 'Configure', 'sportspress' ); ?>
|
@@ -136,6 +140,11 @@
|
|
136 |
<tbody>
|
137 |
<?php
|
138 |
$selection = get_option( 'sportspress_primary_performance', 0 );
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
$args = array(
|
141 |
'post_type' => 'sp_performance',
|
@@ -152,18 +161,26 @@
|
|
152 |
<p class="description"><?php _e( 'Used for events.', 'sportspress' ); ?></p>
|
153 |
</th>
|
154 |
<td class="forminp">
|
155 |
-
<legend class="screen-reader-text"><span><?php _e( '
|
156 |
<form>
|
157 |
<?php wp_nonce_field( 'sp-save-primary-performance', 'sp-primary-performance-nonce', false ); ?>
|
158 |
<table class="widefat sp-admin-config-table">
|
159 |
<thead>
|
160 |
<tr>
|
161 |
<th class="radio" scope="col"><?php _e( 'Primary', 'sportspress' ); ?></th>
|
162 |
-
|
|
|
|
|
163 |
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
164 |
<th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
|
165 |
<th scope="col"><?php _e( 'Category', 'sportspress' ); ?></th>
|
166 |
<th scope="col"><?php _e( 'Format', 'sportspress' ); ?></th>
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
<th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
|
168 |
<th scope="col" class="edit"></th>
|
169 |
</tr>
|
@@ -171,8 +188,10 @@
|
|
171 |
<tfoot>
|
172 |
<tr>
|
173 |
<th class="radio"><input type="radio" class="sp-primary-performance-option" id="sportspress_primary_performance_0" name="sportspress_primary_performance" value="0" <?php checked( $selection, 0 ); ?>></th>
|
174 |
-
|
175 |
-
|
|
|
|
|
176 |
<?php
|
177 |
if ( sizeof( $data ) > 0 ):
|
178 |
$default = reset( $data );
|
@@ -185,28 +204,39 @@
|
|
185 |
</tr>
|
186 |
</tfoot>
|
187 |
<?php if ( $data ): $i = 0; foreach ( $data as $row ): ?>
|
|
|
|
|
|
|
|
|
188 |
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
189 |
<td class="radio"><input type="radio" class="sp-primary-performance-option" id="sportspress_primary_performance_<?php echo $row->post_name; ?>" name="sportspress_primary_performance" value="<?php echo $row->post_name; ?>" <?php checked( $selection, $row->post_name ); ?>></td>
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
|
|
196 |
|
197 |
-
|
198 |
-
|
199 |
-
|
|
|
200 |
<td class="row-title"><?php echo $row->post_title; ?></td>
|
201 |
<td><code><?php echo $row->post_name; ?></code></td>
|
202 |
<td><?php echo sp_get_post_section( $row->ID ); ?></td>
|
203 |
<td><?php echo sp_get_post_format( $row->ID ); ?></td>
|
|
|
|
|
|
|
|
|
|
|
204 |
<td><p class="description"><?php echo $row->post_excerpt; ?></p></td>
|
205 |
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
206 |
</tr>
|
207 |
<?php $i++; endforeach; else: ?>
|
208 |
<tr class="alternate">
|
209 |
-
<td colspan="
|
210 |
</tr>
|
211 |
<?php endif; ?>
|
212 |
</table>
|
@@ -334,6 +364,10 @@
|
|
334 |
'order' => 'ASC'
|
335 |
);
|
336 |
$data = get_posts( $args );
|
|
|
|
|
|
|
|
|
337 |
?>
|
338 |
<tr valign="top">
|
339 |
<th scope="row" class="titledesc">
|
@@ -347,21 +381,38 @@
|
|
347 |
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
348 |
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
|
349 |
<th scope="col"><?php _e( 'Decimal Places', 'sportspress' ); ?></th>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
<th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
|
351 |
<th scope="col" class="edit"></th>
|
352 |
</tr>
|
353 |
</thead>
|
354 |
<?php if ( $data ): $i = 0; foreach ( $data as $row ): ?>
|
|
|
|
|
|
|
|
|
355 |
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
356 |
<td class="row-title"><?php echo $row->post_title; ?></td>
|
357 |
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
|
358 |
<td><?php echo sp_get_post_precision( $row->ID ); ?></td>
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
<td><p class="description"><?php echo $row->post_excerpt; ?></p></td>
|
360 |
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
361 |
</tr>
|
362 |
<?php $i++; endforeach; else: ?>
|
363 |
<tr class="alternate">
|
364 |
-
<td colspan="
|
365 |
</tr>
|
366 |
<?php endif; ?>
|
367 |
</table>
|
1 |
+
<?php
|
2 |
+
$columns = get_option( 'sportspress_player_columns', 'auto' );
|
3 |
+
?>
|
4 |
+
|
5 |
<div class="wrap sportspress sportspress-config-wrap">
|
6 |
<h2>
|
7 |
<?php _e( 'Configure', 'sportspress' ); ?>
|
140 |
<tbody>
|
141 |
<?php
|
142 |
$selection = get_option( 'sportspress_primary_performance', 0 );
|
143 |
+
$mode = get_option( 'sportspress_event_performance_mode', 'values' );
|
144 |
+
$colspan = 7;
|
145 |
+
|
146 |
+
if ( 'icons' === $mode ) $colspan ++;
|
147 |
+
if ( 'auto' === $columns ) $colspan ++;
|
148 |
|
149 |
$args = array(
|
150 |
'post_type' => 'sp_performance',
|
161 |
<p class="description"><?php _e( 'Used for events.', 'sportspress' ); ?></p>
|
162 |
</th>
|
163 |
<td class="forminp">
|
164 |
+
<legend class="screen-reader-text"><span><?php _e( 'Player Performance', 'sportspress' ) ?></span></legend>
|
165 |
<form>
|
166 |
<?php wp_nonce_field( 'sp-save-primary-performance', 'sp-primary-performance-nonce', false ); ?>
|
167 |
<table class="widefat sp-admin-config-table">
|
168 |
<thead>
|
169 |
<tr>
|
170 |
<th class="radio" scope="col"><?php _e( 'Primary', 'sportspress' ); ?></th>
|
171 |
+
<?php if ( 'icons' === $mode ) { ?>
|
172 |
+
<th class="icon" scope="col"><?php _e( 'Icon', 'sportspress' ); ?></th>
|
173 |
+
<?php } ?>
|
174 |
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
175 |
<th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
|
176 |
<th scope="col"><?php _e( 'Category', 'sportspress' ); ?></th>
|
177 |
<th scope="col"><?php _e( 'Format', 'sportspress' ); ?></th>
|
178 |
+
<?php if ( 'auto' === $columns ) { ?>
|
179 |
+
<th scope="col">
|
180 |
+
<?php _e( 'Visible', 'sportspress' ); ?>
|
181 |
+
<i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php _e( 'Display in player profile?', 'sportspress' ); ?>"></i>
|
182 |
+
</th>
|
183 |
+
<?php } ?>
|
184 |
<th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
|
185 |
<th scope="col" class="edit"></th>
|
186 |
</tr>
|
188 |
<tfoot>
|
189 |
<tr>
|
190 |
<th class="radio"><input type="radio" class="sp-primary-performance-option" id="sportspress_primary_performance_0" name="sportspress_primary_performance" value="0" <?php checked( $selection, 0 ); ?>></th>
|
191 |
+
<?php if ( 'icons' === $mode ) { ?>
|
192 |
+
<th class="icon"> </td>
|
193 |
+
<?php } ?>
|
194 |
+
<th colspan="<?php echo $colspan - 1; ?>"><label for="sportspress_primary_performance_0">
|
195 |
<?php
|
196 |
if ( sizeof( $data ) > 0 ):
|
197 |
$default = reset( $data );
|
204 |
</tr>
|
205 |
</tfoot>
|
206 |
<?php if ( $data ): $i = 0; foreach ( $data as $row ): ?>
|
207 |
+
<?php
|
208 |
+
$visible = get_post_meta( $row->ID, 'sp_visible', true );
|
209 |
+
if ( '' === $visible ) $visible = 1;
|
210 |
+
?>
|
211 |
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
212 |
<td class="radio"><input type="radio" class="sp-primary-performance-option" id="sportspress_primary_performance_<?php echo $row->post_name; ?>" name="sportspress_primary_performance" value="<?php echo $row->post_name; ?>" <?php checked( $selection, $row->post_name ); ?>></td>
|
213 |
+
<?php if ( 'icons' === $mode ) { ?>
|
214 |
+
<td class="icon">
|
215 |
+
<?php
|
216 |
+
if ( has_post_thumbnail( $row->ID ) )
|
217 |
+
$icon = get_the_post_thumbnail( $row->ID, 'sportspress-fit-mini' );
|
218 |
+
else
|
219 |
+
$icon = ' ';
|
220 |
|
221 |
+
echo apply_filters( 'sportspress_performance_icon', $icon, $row->ID );
|
222 |
+
?>
|
223 |
+
</td>
|
224 |
+
<?php } ?>
|
225 |
<td class="row-title"><?php echo $row->post_title; ?></td>
|
226 |
<td><code><?php echo $row->post_name; ?></code></td>
|
227 |
<td><?php echo sp_get_post_section( $row->ID ); ?></td>
|
228 |
<td><?php echo sp_get_post_format( $row->ID ); ?></td>
|
229 |
+
<?php if ( 'auto' === $columns ) { ?>
|
230 |
+
<td>
|
231 |
+
<?php if ( $visible ) { ?><i class="dashicons dashicons-yes"></i><?php } else { ?> <?php } ?>
|
232 |
+
</td>
|
233 |
+
<?php } ?>
|
234 |
<td><p class="description"><?php echo $row->post_excerpt; ?></p></td>
|
235 |
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
236 |
</tr>
|
237 |
<?php $i++; endforeach; else: ?>
|
238 |
<tr class="alternate">
|
239 |
+
<td colspan="<?php echo $colspan; ?>"><?php _e( 'No results found.', 'sportspress' ); ?></td>
|
240 |
</tr>
|
241 |
<?php endif; ?>
|
242 |
</table>
|
364 |
'order' => 'ASC'
|
365 |
);
|
366 |
$data = get_posts( $args );
|
367 |
+
|
368 |
+
$colspan = 6;
|
369 |
+
|
370 |
+
if ( 'auto' === $columns ) $colspan ++;
|
371 |
?>
|
372 |
<tr valign="top">
|
373 |
<th scope="row" class="titledesc">
|
381 |
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
382 |
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
|
383 |
<th scope="col"><?php _e( 'Decimal Places', 'sportspress' ); ?></th>
|
384 |
+
<th scope="col"><?php _e( 'Category', 'sportspress' ); ?></th>
|
385 |
+
<?php if ( 'auto' === $columns ) { ?>
|
386 |
+
<th scope="col">
|
387 |
+
<?php _e( 'Visible', 'sportspress' ); ?>
|
388 |
+
<i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php _e( 'Display in player profile?', 'sportspress' ); ?>"></i>
|
389 |
+
</th>
|
390 |
+
<?php } ?>
|
391 |
<th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
|
392 |
<th scope="col" class="edit"></th>
|
393 |
</tr>
|
394 |
</thead>
|
395 |
<?php if ( $data ): $i = 0; foreach ( $data as $row ): ?>
|
396 |
+
<?php
|
397 |
+
$visible = get_post_meta( $row->ID, 'sp_visible', true );
|
398 |
+
if ( '' === $visible ) $visible = 1;
|
399 |
+
?>
|
400 |
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
401 |
<td class="row-title"><?php echo $row->post_title; ?></td>
|
402 |
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
|
403 |
<td><?php echo sp_get_post_precision( $row->ID ); ?></td>
|
404 |
+
<td><?php echo sp_get_post_section( $row->ID ); ?></td>
|
405 |
+
<?php if ( 'auto' === $columns ) { ?>
|
406 |
+
<td>
|
407 |
+
<?php if ( $visible ) { ?><i class="dashicons dashicons-yes"></i><?php } else { ?> <?php } ?>
|
408 |
+
</td>
|
409 |
+
<?php } ?>
|
410 |
<td><p class="description"><?php echo $row->post_excerpt; ?></p></td>
|
411 |
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
412 |
</tr>
|
413 |
<?php $i++; endforeach; else: ?>
|
414 |
<tr class="alternate">
|
415 |
+
<td colspan="<?php echo $colspan; ?>"><?php _e( 'No results found.', 'sportspress' ); ?></td>
|
416 |
</tr>
|
417 |
<?php endif; ?>
|
418 |
</table>
|
includes/admin/views/html-notice-no-access.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
?>
|
4 |
+
<div id="message" class="error">
|
5 |
+
<p><?php _e( 'You are not allowed to edit this item.', 'sportspress' ); ?></p>
|
6 |
+
</div>
|
includes/api/class-sp-rest-api.php
ADDED
@@ -0,0 +1,757 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* REST API Class
|
4 |
+
*
|
5 |
+
* The SportsPress REST API class handles all API-related hooks.
|
6 |
+
*
|
7 |
+
* @class SP_REST_API
|
8 |
+
* @version 2.0
|
9 |
+
* @package SportsPress/Classes
|
10 |
+
* @category Class
|
11 |
+
* @package SportsPress/API
|
12 |
+
* @author ThemeBoy
|
13 |
+
*/
|
14 |
+
|
15 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
16 |
+
|
17 |
+
if ( ! class_exists( 'SP_REST_API' ) ) :
|
18 |
+
|
19 |
+
/**
|
20 |
+
* SP_REST_API Class
|
21 |
+
*/
|
22 |
+
class SP_REST_API {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Constructor.
|
26 |
+
*/
|
27 |
+
public function __construct() {
|
28 |
+
// Create REST routes
|
29 |
+
add_action( 'rest_api_init', array( $this, 'create_routes' ) );
|
30 |
+
add_action( 'rest_api_init', array( $this, 'register_fields' ), 0 );
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Create REST routes.
|
35 |
+
*/
|
36 |
+
public static function create_routes() {
|
37 |
+
if ( ! class_exists( 'SP_REST_Posts_Controller' ) ) {
|
38 |
+
require_once dirname( __FILE__ ) . '/class-sp-rest-posts-controller.php';
|
39 |
+
}
|
40 |
+
|
41 |
+
$controller = new SP_REST_Posts_Controller( 'sp_event' );
|
42 |
+
$controller->register_routes();
|
43 |
+
|
44 |
+
$controller = new SP_REST_Posts_Controller( 'sp_team' );
|
45 |
+
$controller->register_routes();
|
46 |
+
|
47 |
+
$controller = new SP_REST_Posts_Controller( 'sp_player' );
|
48 |
+
$controller->register_routes();
|
49 |
+
|
50 |
+
$controller = new SP_REST_Posts_Controller( 'sp_staff' );
|
51 |
+
$controller->register_routes();
|
52 |
+
|
53 |
+
do_action( 'sportspress_create_rest_routes' );
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Register REST fields.
|
58 |
+
*/
|
59 |
+
public static function register_fields() {
|
60 |
+
register_rest_field( 'sp_event',
|
61 |
+
'teams',
|
62 |
+
array(
|
63 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
64 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
65 |
+
'schema' => array(
|
66 |
+
'description' => __( 'Teams', 'sportspress' ),
|
67 |
+
'type' => 'array',
|
68 |
+
'context' => array( 'view', 'edit', 'embed' ),
|
69 |
+
'arg_options' => array(
|
70 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
71 |
+
),
|
72 |
+
),
|
73 |
+
)
|
74 |
+
);
|
75 |
+
|
76 |
+
register_rest_field( 'sp_event',
|
77 |
+
'main_results',
|
78 |
+
array(
|
79 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
80 |
+
'schema' => array(
|
81 |
+
'description' => __( 'Main Results', 'sportspress' ),
|
82 |
+
'type' => 'array',
|
83 |
+
'context' => array( 'view', 'embed' ),
|
84 |
+
'arg_options' => array(
|
85 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
86 |
+
),
|
87 |
+
),
|
88 |
+
)
|
89 |
+
);
|
90 |
+
|
91 |
+
register_rest_field( 'sp_event',
|
92 |
+
'outcome',
|
93 |
+
array(
|
94 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
95 |
+
'schema' => array(
|
96 |
+
'description' => __( 'Outcome', 'sportspress' ),
|
97 |
+
'type' => 'array',
|
98 |
+
'context' => array( 'view', 'embed' ),
|
99 |
+
'arg_options' => array(
|
100 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
101 |
+
),
|
102 |
+
),
|
103 |
+
)
|
104 |
+
);
|
105 |
+
|
106 |
+
register_rest_field( 'sp_event',
|
107 |
+
'winner',
|
108 |
+
array(
|
109 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
110 |
+
'schema' => array(
|
111 |
+
'description' => __( 'Winner', 'sportspress' ),
|
112 |
+
'type' => 'integer',
|
113 |
+
'context' => array( 'view', 'embed' ),
|
114 |
+
'arg_options' => array(
|
115 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
116 |
+
),
|
117 |
+
),
|
118 |
+
)
|
119 |
+
);
|
120 |
+
|
121 |
+
register_rest_field( 'sp_event',
|
122 |
+
'minutes',
|
123 |
+
array(
|
124 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
125 |
+
'update_callback' => 'SP_REST_API::update_post_meta',
|
126 |
+
'schema' => array(
|
127 |
+
'description' => __( 'Full Time', 'sportspress' ),
|
128 |
+
'type' => 'integer',
|
129 |
+
'context' => array( 'view', 'edit', 'embed' ),
|
130 |
+
'arg_options' => array(
|
131 |
+
'sanitize_callback' => 'absint',
|
132 |
+
),
|
133 |
+
),
|
134 |
+
)
|
135 |
+
);
|
136 |
+
|
137 |
+
register_rest_field( 'sp_event',
|
138 |
+
'players',
|
139 |
+
array(
|
140 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
141 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
142 |
+
'schema' => array(
|
143 |
+
'description' => __( 'Players', 'sportspress' ),
|
144 |
+
'type' => 'array',
|
145 |
+
'context' => array( 'view', 'edit' ),
|
146 |
+
'arg_options' => array(
|
147 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
148 |
+
),
|
149 |
+
),
|
150 |
+
)
|
151 |
+
);
|
152 |
+
|
153 |
+
register_rest_field( 'sp_event',
|
154 |
+
'staff',
|
155 |
+
array(
|
156 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
157 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
158 |
+
'schema' => array(
|
159 |
+
'description' => __( 'Staff', 'sportspress' ),
|
160 |
+
'type' => 'array',
|
161 |
+
'context' => array( 'view', 'edit' ),
|
162 |
+
'arg_options' => array(
|
163 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
164 |
+
),
|
165 |
+
),
|
166 |
+
)
|
167 |
+
);
|
168 |
+
|
169 |
+
register_rest_field( 'sp_event',
|
170 |
+
'results',
|
171 |
+
array(
|
172 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
173 |
+
'update_callback' => 'SP_REST_API::update_post_meta_arrays',
|
174 |
+
'schema' => array(
|
175 |
+
'description' => __( 'Results', 'sportspress' ),
|
176 |
+
'type' => 'array',
|
177 |
+
'context' => array( 'view', 'edit' ),
|
178 |
+
'arg_options' => array(
|
179 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
180 |
+
),
|
181 |
+
),
|
182 |
+
)
|
183 |
+
);
|
184 |
+
|
185 |
+
register_rest_field( 'sp_event',
|
186 |
+
'performance',
|
187 |
+
array(
|
188 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
189 |
+
'update_callback' => 'SP_REST_API::update_post_meta_arrays_multi',
|
190 |
+
'schema' => array(
|
191 |
+
'description' => __( 'Box Score', 'sportspress' ),
|
192 |
+
'type' => 'array',
|
193 |
+
'context' => array( 'view', 'edit' ),
|
194 |
+
'arg_options' => array(
|
195 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
196 |
+
),
|
197 |
+
),
|
198 |
+
)
|
199 |
+
);
|
200 |
+
|
201 |
+
register_rest_field( 'sp_team',
|
202 |
+
'staff',
|
203 |
+
array(
|
204 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
205 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
206 |
+
'schema' => array(
|
207 |
+
'description' => __( 'Staff', 'sportspress' ),
|
208 |
+
'type' => 'array',
|
209 |
+
'context' => array( 'view', 'edit' ),
|
210 |
+
'arg_options' => array(
|
211 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
212 |
+
),
|
213 |
+
),
|
214 |
+
)
|
215 |
+
);
|
216 |
+
|
217 |
+
register_rest_field( 'sp_team',
|
218 |
+
'tables',
|
219 |
+
array(
|
220 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
221 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
222 |
+
'schema' => array(
|
223 |
+
'description' => __( 'League Tables', 'sportspress' ),
|
224 |
+
'type' => 'array',
|
225 |
+
'context' => array( 'view', 'edit' ),
|
226 |
+
'arg_options' => array(
|
227 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
228 |
+
),
|
229 |
+
),
|
230 |
+
)
|
231 |
+
);
|
232 |
+
|
233 |
+
register_rest_field( 'sp_team',
|
234 |
+
'lists',
|
235 |
+
array(
|
236 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
237 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
238 |
+
'schema' => array(
|
239 |
+
'description' => __( 'Player Lists', 'sportspress' ),
|
240 |
+
'type' => 'array',
|
241 |
+
'context' => array( 'view', 'edit' ),
|
242 |
+
'arg_options' => array(
|
243 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
244 |
+
),
|
245 |
+
),
|
246 |
+
)
|
247 |
+
);
|
248 |
+
|
249 |
+
register_rest_field( 'sp_team',
|
250 |
+
'events',
|
251 |
+
array(
|
252 |
+
'get_callback' => 'SP_REST_API::get_post_ids_with_meta',
|
253 |
+
'schema' => array(
|
254 |
+
'description' => __( 'Events', 'sportspress' ),
|
255 |
+
'type' => 'array',
|
256 |
+
'context' => array( 'view' ),
|
257 |
+
'arg_options' => array(
|
258 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
259 |
+
),
|
260 |
+
),
|
261 |
+
)
|
262 |
+
);
|
263 |
+
|
264 |
+
register_rest_field( 'sp_team',
|
265 |
+
'abbreviation',
|
266 |
+
array(
|
267 |
+
'get_callback' => 'SP_REST_API::get_post_meta',
|
268 |
+
'update_callback' => 'SP_REST_API::update_post_meta',
|
269 |
+
'schema' => array(
|
270 |
+
'description' => __( 'Abbreviation', 'sportspress' ),
|
271 |
+
'type' => 'string',
|
272 |
+
'context' => array( 'view', 'edit', 'embed' ),
|
273 |
+
'arg_options' => array(
|
274 |
+
'sanitize_callback' => 'sanitize_text_field',
|
275 |
+
),
|
276 |
+
),
|
277 |
+
)
|
278 |
+
);
|
279 |
+
|
280 |
+
register_rest_field( 'sp_team',
|
281 |
+
'url',
|
282 |
+
array(
|
283 |
+
'get_callback' => 'SP_REST_API::get_post_meta',
|
284 |
+
'update_callback' => 'SP_REST_API::update_post_meta',
|
285 |
+
'schema' => array(
|
286 |
+
'description' => __( 'Site URL', 'sportspress' ),
|
287 |
+
'type' => 'string',
|
288 |
+
'context' => array( 'view', 'edit', 'embed' ),
|
289 |
+
'arg_options' => array(
|
290 |
+
'sanitize_callback' => 'sanitize_text_field',
|
291 |
+
),
|
292 |
+
),
|
293 |
+
)
|
294 |
+
);
|
295 |
+
|
296 |
+
register_rest_field( 'sp_player',
|
297 |
+
'number',
|
298 |
+
array(
|
299 |
+
'get_callback' => 'SP_REST_API::get_post_meta',
|
300 |
+
'update_callback' => 'SP_REST_API::update_post_meta',
|
301 |
+
'schema' => array(
|
302 |
+
'description' => __( 'Squad Number', 'sportspress' ),
|
303 |
+
'type' => 'integer',
|
304 |
+
'context' => array( 'view', 'edit', 'embed' ),
|
305 |
+
'arg_options' => array(
|
306 |
+
'sanitize_callback' => 'absint',
|
307 |
+
),
|
308 |
+
),
|
309 |
+
)
|
310 |
+
);
|
311 |
+
|
312 |
+
register_rest_field( 'sp_player',
|
313 |
+
'teams',
|
314 |
+
array(
|
315 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
316 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
317 |
+
'schema' => array(
|
318 |
+
'description' => __( 'Teams', 'sportspress' ),
|
319 |
+
'type' => 'array',
|
320 |
+
'context' => array( 'view', 'edit' ),
|
321 |
+
'arg_options' => array(
|
322 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
323 |
+
),
|
324 |
+
),
|
325 |
+
)
|
326 |
+
);
|
327 |
+
|
328 |
+
register_rest_field( 'sp_player',
|
329 |
+
'current_teams',
|
330 |
+
array(
|
331 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
332 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
333 |
+
'schema' => array(
|
334 |
+
'description' => __( 'Current Teams', 'sportspress' ),
|
335 |
+
'type' => 'array',
|
336 |
+
'context' => array( 'view', 'edit' ),
|
337 |
+
'arg_options' => array(
|
338 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
339 |
+
),
|
340 |
+
),
|
341 |
+
)
|
342 |
+
);
|
343 |
+
|
344 |
+
register_rest_field( 'sp_player',
|
345 |
+
'past_teams',
|
346 |
+
array(
|
347 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
348 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
349 |
+
'schema' => array(
|
350 |
+
'description' => __( 'Past Teams', 'sportspress' ),
|
351 |
+
'type' => 'array',
|
352 |
+
'context' => array( 'view', 'edit' ),
|
353 |
+
'arg_options' => array(
|
354 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
355 |
+
),
|
356 |
+
),
|
357 |
+
)
|
358 |
+
);
|
359 |
+
|
360 |
+
register_rest_field( 'sp_player',
|
361 |
+
'nationalities',
|
362 |
+
array(
|
363 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
364 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
365 |
+
'schema' => array(
|
366 |
+
'description' => __( 'Nationalities', 'sportspress' ),
|
367 |
+
'type' => 'array',
|
368 |
+
'context' => array( 'view', 'embed' ),
|
369 |
+
'arg_options' => array(
|
370 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
371 |
+
),
|
372 |
+
),
|
373 |
+
)
|
374 |
+
);
|
375 |
+
|
376 |
+
register_rest_field( 'sp_player',
|
377 |
+
'metrics',
|
378 |
+
array(
|
379 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
380 |
+
'update_callback' => 'SP_REST_API::update_post_meta_array',
|
381 |
+
'schema' => array(
|
382 |
+
'description' => __( 'Metrics', 'sportspress' ),
|
383 |
+
'type' => 'array',
|
384 |
+
'context' => array( 'view', 'edit' ),
|
385 |
+
'arg_options' => array(
|
386 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
387 |
+
),
|
388 |
+
),
|
389 |
+
)
|
390 |
+
);
|
391 |
+
|
392 |
+
register_rest_field( 'sp_player',
|
393 |
+
'statistics',
|
394 |
+
array(
|
395 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
396 |
+
'update_callback' => 'SP_REST_API::update_post_meta_arrays_multi',
|
397 |
+
'schema' => array(
|
398 |
+
'description' => __( 'Statistics', 'sportspress' ),
|
399 |
+
'type' => 'array',
|
400 |
+
'context' => array( 'view', 'edit' ),
|
401 |
+
'arg_options' => array(
|
402 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
403 |
+
),
|
404 |
+
),
|
405 |
+
)
|
406 |
+
);
|
407 |
+
|
408 |
+
register_rest_field( 'sp_staff',
|
409 |
+
'teams',
|
410 |
+
array(
|
411 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
412 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
413 |
+
'schema' => array(
|
414 |
+
'description' => __( 'Teams', 'sportspress' ),
|
415 |
+
'type' => 'array',
|
416 |
+
'context' => array( 'view', 'edit' ),
|
417 |
+
'arg_options' => array(
|
418 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
419 |
+
),
|
420 |
+
),
|
421 |
+
)
|
422 |
+
);
|
423 |
+
|
424 |
+
register_rest_field( 'sp_staff',
|
425 |
+
'current_teams',
|
426 |
+
array(
|
427 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
428 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
429 |
+
'schema' => array(
|
430 |
+
'description' => __( 'Current Teams', 'sportspress' ),
|
431 |
+
'type' => 'array',
|
432 |
+
'context' => array( 'view', 'edit' ),
|
433 |
+
'arg_options' => array(
|
434 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
435 |
+
),
|
436 |
+
),
|
437 |
+
)
|
438 |
+
);
|
439 |
+
|
440 |
+
register_rest_field( 'sp_staff',
|
441 |
+
'past_teams',
|
442 |
+
array(
|
443 |
+
'get_callback' => 'SP_REST_API::get_post_meta_recursive',
|
444 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
445 |
+
'schema' => array(
|
446 |
+
'description' => __( 'Past Teams', 'sportspress' ),
|
447 |
+
'type' => 'array',
|
448 |
+
'context' => array( 'view', 'edit' ),
|
449 |
+
'arg_options' => array(
|
450 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
451 |
+
),
|
452 |
+
),
|
453 |
+
)
|
454 |
+
);
|
455 |
+
|
456 |
+
register_rest_field( 'sp_staff',
|
457 |
+
'nationalities',
|
458 |
+
array(
|
459 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
460 |
+
'update_callback' => 'SP_REST_API::update_post_meta_recursive',
|
461 |
+
'schema' => array(
|
462 |
+
'description' => __( 'Nationalities', 'sportspress' ),
|
463 |
+
'type' => 'array',
|
464 |
+
'context' => array( 'view', 'embed' ),
|
465 |
+
'arg_options' => array(
|
466 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
467 |
+
),
|
468 |
+
),
|
469 |
+
)
|
470 |
+
);
|
471 |
+
|
472 |
+
do_action( 'sportspress_register_rest_fields' );
|
473 |
+
}
|
474 |
+
|
475 |
+
/**
|
476 |
+
* Get the value of a single SportsPress meta field.
|
477 |
+
*
|
478 |
+
* @param array $object Details of current post.
|
479 |
+
* @param string $field_name Name of field.
|
480 |
+
* @param WP_REST_Request $request Current request
|
481 |
+
*
|
482 |
+
* @return mixed
|
483 |
+
*/
|
484 |
+
public static function get_post_meta( $object, $field_name, $request ) {
|
485 |
+
$meta = get_post_meta( $object['id'], self::meta_key( $field_name ), true );
|
486 |
+
|
487 |
+
if ( ctype_digit( $meta ) ) {
|
488 |
+
$meta = intval( $meta );
|
489 |
+
}
|
490 |
+
|
491 |
+
return $meta;
|
492 |
+
}
|
493 |
+
|
494 |
+
/**
|
495 |
+
* Handler for updating custom field data.
|
496 |
+
*
|
497 |
+
* @param mixed $value The value of the field
|
498 |
+
* @param object $object The object from the response
|
499 |
+
* @param string $field_name Name of field
|
500 |
+
*
|
501 |
+
* @return bool|int
|
502 |
+
*/
|
503 |
+
public static function update_post_meta( $value, $object, $field_name ) {
|
504 |
+
return update_post_meta( $object->ID, self::meta_key( $field_name ), strip_tags( $value ) );
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* Handler for updating array values by merging with the existing array.
|
509 |
+
*
|
510 |
+
* @param mixed $value The value of the field
|
511 |
+
* @param object $object The object from the response
|
512 |
+
* @param string $field_name Name of field
|
513 |
+
*
|
514 |
+
* @return bool|int
|
515 |
+
*/
|
516 |
+
public static function update_post_meta_array( $value, $object, $field_name ) {
|
517 |
+
if ( ! is_array( $value ) ) return false;
|
518 |
+
|
519 |
+
$type = $object->post_type;
|
520 |
+
|
521 |
+
$meta = get_post_meta( $object->ID, self::meta_key( $field_name, $type ), true );
|
522 |
+
|
523 |
+
if ( ! is_array( $meta ) ) $meta = array();
|
524 |
+
|
525 |
+
$meta = array_merge( $meta, $value );
|
526 |
+
|
527 |
+
return update_post_meta( $object->ID, self::meta_key( $field_name, $type ), $meta );
|
528 |
+
}
|
529 |
+
|
530 |
+
/**
|
531 |
+
* Handler for updating array values by merging with the existing multidimentional array.
|
532 |
+
*
|
533 |
+
* @param mixed $value The value of the field
|
534 |
+
* @param object $object The object from the response
|
535 |
+
* @param string $field_name Name of field
|
536 |
+
*
|
537 |
+
* @return bool|int
|
538 |
+
*/
|
539 |
+
public static function update_post_meta_arrays( $value, $object, $field_name ) {
|
540 |
+
if ( ! is_array( $value ) ) return false;
|
541 |
+
|
542 |
+
$type = $object->post_type;
|
543 |
+
|
544 |
+
$meta = get_post_meta( $object->ID, self::meta_key( $field_name, $type ), true );
|
545 |
+
|
546 |
+
if ( ! is_array( $meta ) ) $meta = array();
|
547 |
+
|
548 |
+
foreach ( $value as $index => $array ) {
|
549 |
+
if ( ! is_array( $array ) ) continue;
|
550 |
+
|
551 |
+
if ( ! isset( $meta[ $index ] ) || ! is_array( $meta[ $index ] ) ) {
|
552 |
+
$meta[ $index ] = array();
|
553 |
+
}
|
554 |
+
|
555 |
+
$meta[ $index ] = array_merge( $meta[ $index ], $array );
|
556 |
+
}
|
557 |
+
|
558 |
+
return update_post_meta( $object->ID, self::meta_key( $field_name, $type ), $meta );
|
559 |
+
}
|
560 |
+
|
561 |
+
/**
|
562 |
+
* Handler for updating array values by merging with existing multidimensional arrays.
|
563 |
+
*
|
564 |
+
* @param mixed $value The value of the field
|
565 |
+
* @param object $object The object from the response
|
566 |
+
* @param string $field_name Name of field
|
567 |
+
*
|
568 |
+
* @return bool|int
|
569 |
+
*/
|
570 |
+
public static function update_post_meta_arrays_multi( $value, $object, $field_name ) {
|
571 |
+
if ( ! is_array( $value ) ) return false;
|
572 |
+
|
573 |
+
$type = $object->post_type;
|
574 |
+
|
575 |
+
$meta = get_post_meta( $object->ID, self::meta_key( $field_name, $type ), true );
|
576 |
+
|
577 |
+
if ( ! is_array( $meta ) ) $meta = array();
|
578 |
+
|
579 |
+
foreach ( $value as $key => $arrays ) {
|
580 |
+
if ( ! is_array( $arrays ) ) continue;
|
581 |
+
|
582 |
+
if ( ! isset( $meta[ $key ] ) || ! is_array( $meta[ $key ] ) ) {
|
583 |
+
$meta[ $key ] = array();
|
584 |
+
}
|
585 |
+
|
586 |
+
foreach ( $arrays as $index => $array ) {
|
587 |
+
if ( ! is_array( $array ) ) continue;
|
588 |
+
|
589 |
+
if ( ! isset( $meta[ $key ][ $index ] ) || ! is_array( $meta[ $key ][ $index ] ) ) {
|
590 |
+
$meta[ $key ][ $index ] = array();
|
591 |
+
}
|
592 |
+
|
593 |
+
$meta[ $key ][ $index ] = array_merge( $meta[ $key ][ $index ], $array );
|
594 |
+
}
|
595 |
+
}
|
596 |
+
|
597 |
+
return update_post_meta( $object->ID, self::meta_key( $field_name, $type ), $meta );
|
598 |
+
}
|
599 |
+
|
600 |
+
/**
|
601 |
+
* Get an array of SportsPress meta field values.
|
602 |
+
*
|
603 |
+
* @param array $object Details of current post.
|
604 |
+
* @param string $field_name Name of field.
|
605 |
+
* @param WP_REST_Request $request Current request
|
606 |
+
*
|
607 |
+
* @return mixed
|
608 |
+
*/
|
609 |
+
public static function get_post_meta_recursive( $object, $field_name, $request ) {
|
610 |
+
$meta = get_post_meta( $object['id'], self::meta_key( $field_name ), false );
|
611 |
+
|
612 |
+
return array_map( 'intval', $meta );
|
613 |
+
}
|
614 |
+
|
615 |
+
/**
|
616 |
+
* Handler for updating multiple custom field values.
|
617 |
+
*
|
618 |
+
* @param array $values The values of the field
|
619 |
+
* @param object $object The object from the response
|
620 |
+
* @param string $field_name Name of field
|
621 |
+
*
|
622 |
+
* @return bool|int
|
623 |
+
*/
|
624 |
+
public static function update_post_meta_recursive( $values, $object, $field_name ) {
|
625 |
+
delete_post_meta( $object->ID, self::meta_key( $field_name ) );
|
626 |
+
|
627 |
+
$response = true;
|
628 |
+
foreach ( $values as $value ) {
|
629 |
+
$response = add_post_meta( $object->ID, self::meta_key( $field_name ), $value );
|
630 |
+
}
|
631 |
+
|
632 |
+
return $response;
|
633 |
+
}
|
634 |
+
|
635 |
+
/**
|
636 |
+
* Get an array of SportsPress meta field values and split into separate arrays based on placeholder zeroes.
|
637 |
+
*
|
638 |
+
* @param array $object Details of current post.
|
639 |
+
* @param string $field_name Name of field.
|
640 |
+
* @param WP_REST_Request $request Current request
|
641 |
+
*
|
642 |
+
* @return mixed
|
643 |
+
*/
|
644 |
+
public static function get_post_meta_recursive_split( $object, $field_name, $request ) {
|
645 |
+
$array = self::get_post_meta_recursive( $object, $field_name, $request );
|
646 |
+
|
647 |
+
$meta = array();
|
648 |
+
$i = 0;
|
649 |
+
foreach ( $array as $value ) {
|
650 |
+
if ( $value ) {
|
651 |
+
$meta[ $i ][] = $value;
|
652 |
+
} else {
|
653 |
+
$i ++;
|
654 |
+
}
|
655 |
+
}
|
656 |
+
|
657 |
+
return $meta;
|
658 |
+
}
|
659 |
+
|
660 |
+
/**
|
661 |
+
* Get a list of posts with a meta value of the given field name.
|
662 |
+
*
|
663 |
+
* @param array $object Details of current post.
|
664 |
+
* @param string $field_name Name of field.
|
665 |
+
* @param WP_REST_Request $request Current request
|
666 |
+
*
|
667 |
+
* @return mixed
|
668 |
+
*/
|
669 |
+
public static function get_post_ids_with_meta( $object, $field_name, $request ) {
|
670 |
+
$meta_key = self::meta_key( $field_name );
|
671 |
+
|
672 |
+
$query_args = array(
|
673 |
+
'post_type' => $meta_key,
|
674 |
+
'posts_per_page' => 2000,
|
675 |
+
'meta_query' => array(
|
676 |
+
'key' => $object['type'],
|
677 |
+
'value' => $object['id'],
|
678 |
+
'compare' => 'IN',
|
679 |
+
),
|
680 |
+
);
|
681 |
+
|
682 |
+
if ( 'sp_event' === $meta_key ) {
|
683 |
+
$query_args['orderby'] = 'date';
|
684 |
+
$query_args['order'] = 'DESC';
|
685 |
+
$query_args['post_status'] = array( 'publish', 'future' );
|
686 |
+
} else {
|
687 |
+
$query_args['orderby'] = 'title';
|
688 |
+
$query_args['order'] = 'ASC';
|
689 |
+
$query_args['post_status'] = 'publish';
|
690 |
+
}
|
691 |
+
|
692 |
+
$posts_query = new WP_Query();
|
693 |
+
$query_result = $posts_query->query( $query_args );
|
694 |
+
|
695 |
+
return wp_list_pluck( $query_result, 'ID' );
|
696 |
+
}
|
697 |
+
|
698 |
+
/**
|
699 |
+
* Get custom SportsPress data based on post type and field name.
|
700 |
+
*
|
701 |
+
* @param array $object Details of current post.
|
702 |
+
* @param string $field_name Name of field.
|
703 |
+
* @param WP_REST_Request $request Current request
|
704 |
+
*
|
705 |
+
* @return mixed
|
706 |
+
*/
|
707 |
+
public static function get_post_data( $object, $field_name, $request ) {
|
708 |
+
$type = $object['type'];
|
709 |
+
|
710 |
+
$post = new $type( $object['id'] );
|
711 |
+
|
712 |
+
return $post->$field_name();
|
713 |
+
}
|
714 |
+
|
715 |
+
/**
|
716 |
+
* Get meta key of a field
|
717 |
+
*/
|
718 |
+
public static function meta_key( $field_name, $type = null ) {
|
719 |
+
$names = array(
|
720 |
+
'current_teams' => 'sp_current_team',
|
721 |
+
'events' => 'sp_event',
|
722 |
+
'lists' => 'sp_list',
|
723 |
+
'nationalities' => 'sp_nationality',
|
724 |
+
'past_teams' => 'sp_past_team',
|
725 |
+
'performance' => 'sp_players',
|
726 |
+
'players' => 'sp_player',
|
727 |
+
'table' => 'sp_teams',
|
728 |
+
'tables' => 'sp_table',
|
729 |
+
'teams' => 'sp_team',
|
730 |
+
);
|
731 |
+
|
732 |
+
if ( isset( $type ) ) {
|
733 |
+
switch ( $type ) {
|
734 |
+
case 'sp_table':
|
735 |
+
$names['data'] = 'sp_teams';
|
736 |
+
break;
|
737 |
+
case 'sp_list':
|
738 |
+
$names['data'] = 'sp_players';
|
739 |
+
break;
|
740 |
+
}
|
741 |
+
}
|
742 |
+
|
743 |
+
$names = apply_filters( 'sportspress_rest_meta_keys', $names, $type );
|
744 |
+
|
745 |
+
if ( array_key_exists( $field_name, $names ) ) {
|
746 |
+
$field_name = $names[ $field_name ];
|
747 |
+
} else {
|
748 |
+
$field_name = 'sp_' . $field_name;
|
749 |
+
}
|
750 |
+
|
751 |
+
return $field_name;
|
752 |
+
}
|
753 |
+
}
|
754 |
+
|
755 |
+
endif;
|
756 |
+
|
757 |
+
return new SP_REST_API();
|
includes/api/class-sp-rest-posts-controller.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SP_REST_Posts_Controller extends WP_REST_Posts_Controller {
|
4 |
+
|
5 |
+
protected $post_type;
|
6 |
+
|
7 |
+
public function __construct( $post_type ) {
|
8 |
+
$this->post_type = $post_type;
|
9 |
+
$this->namespace = 'sportspress/v2';
|
10 |
+
$obj = get_post_type_object( $post_type );
|
11 |
+
$this->rest_base = ! empty( $obj->rest_base ) ? $obj->rest_base : $obj->name;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Register the routes for the objects of the controller.
|
16 |
+
*/
|
17 |
+
public function register_routes() {
|
18 |
+
|
19 |
+
register_rest_route( $this->namespace, '/' . $this->rest_base, array(
|
20 |
+
array(
|
21 |
+
'methods' => WP_REST_Server::READABLE,
|
22 |
+
'callback' => array( $this, 'get_items' ),
|
23 |
+
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
24 |
+
'args' => $this->get_collection_params(),
|
25 |
+
),
|
26 |
+
array(
|
27 |
+
'methods' => WP_REST_Server::CREATABLE,
|
28 |
+
'callback' => array( $this, 'create_item' ),
|
29 |
+
'permission_callback' => array( $this, 'create_item_permissions_check' ),
|
30 |
+
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ),
|
31 |
+
),
|
32 |
+
'schema' => array( $this, 'get_public_item_schema' ),
|
33 |
+
) );
|
34 |
+
register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
|
35 |
+
array(
|
36 |
+
'methods' => WP_REST_Server::READABLE,
|
37 |
+
'callback' => array( $this, 'get_item' ),
|
38 |
+
'permission_callback' => array( $this, 'get_item_permissions_check' ),
|
39 |
+
'args' => array(
|
40 |
+
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
|
41 |
+
),
|
42 |
+
),
|
43 |
+
array(
|
44 |
+
'methods' => WP_REST_Server::EDITABLE,
|
45 |
+
'callback' => array( $this, 'update_item' ),
|
46 |
+
'permission_callback' => array( $this, 'update_item_permissions_check' ),
|
47 |
+
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
|
48 |
+
),
|
49 |
+
array(
|
50 |
+
'methods' => WP_REST_Server::DELETABLE,
|
51 |
+
'callback' => array( $this, 'delete_item' ),
|
52 |
+
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
|
53 |
+
'args' => array(
|
54 |
+
'force' => array(
|
55 |
+
'default' => false,
|
56 |
+
'description' => __( 'Whether to bypass trash and force deletion.' ),
|
57 |
+
),
|
58 |
+
),
|
59 |
+
),
|
60 |
+
'schema' => array( $this, 'get_public_item_schema' ),
|
61 |
+
) );
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
includes/api/class-sp-rest-teams-controller.php
DELETED
@@ -1,301 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class SP_REST_Teams_Controller extends WP_REST_Posts_Controller {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var string
|
7 |
-
*/
|
8 |
-
public $namespace = 'sportspress/v2';
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @var string
|
12 |
-
*/
|
13 |
-
public $route = 'teams';
|
14 |
-
|
15 |
-
public function __construct() {
|
16 |
-
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Register the routes for the objects of the controller.
|
21 |
-
*/
|
22 |
-
public function register_routes() {
|
23 |
-
register_rest_route( $this->namespace, '/' . $this->route, array(
|
24 |
-
array(
|
25 |
-
'methods' => WP_REST_Server::READABLE,
|
26 |
-
'callback' => array( $this, 'get_items' ),
|
27 |
-
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
28 |
-
'args' => array(),
|
29 |
-
),
|
30 |
-
/*
|
31 |
-
array(
|
32 |
-
'methods' => WP_REST_Server::CREATABLE,
|
33 |
-
'callback' => array( $this, 'create_item' ),
|
34 |
-
'permission_callback' => array( $this, 'create_item_permissions_check' ),
|
35 |
-
'args' => $this->get_endpoint_args_for_item_schema( true ),
|
36 |
-
),
|
37 |
-
*/
|
38 |
-
) );
|
39 |
-
|
40 |
-
register_rest_route( $this->namespace, '/' . $this->route . '/(?P<id>[\d]+)', array(
|
41 |
-
array(
|
42 |
-
'methods' => WP_REST_Server::READABLE,
|
43 |
-
'callback' => array( $this, 'get_item' ),
|
44 |
-
'permission_callback' => array( $this, 'get_item_permissions_check' ),
|
45 |
-
'args' => array(
|
46 |
-
'context' => array(
|
47 |
-
'default' => 'view',
|
48 |
-
),
|
49 |
-
),
|
50 |
-
),
|
51 |
-
/*
|
52 |
-
array(
|
53 |
-
'methods' => WP_REST_Server::EDITABLE,
|
54 |
-
'callback' => array( $this, 'update_item' ),
|
55 |
-
'permission_callback' => array( $this, 'update_item_permissions_check' ),
|
56 |
-
'args' => $this->get_endpoint_args_for_item_schema( false ),
|
57 |
-
),
|
58 |
-
array(
|
59 |
-
'methods' => WP_REST_Server::DELETABLE,
|
60 |
-
'callback' => array( $this, 'delete_item' ),
|
61 |
-
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
|
62 |
-
'args' => array(
|
63 |
-
'force' => array(
|
64 |
-
'default' => false,
|
65 |
-
),
|
66 |
-
),
|
67 |
-
),
|
68 |
-
*/
|
69 |
-
) );
|
70 |
-
register_rest_route( $this->namespace, '/' . $this->route . '/schema', array(
|
71 |
-
'methods' => WP_REST_Server::READABLE,
|
72 |
-
'callback' => array( $this, 'get_public_item_schema' ),
|
73 |
-
) );
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Get a collection of items
|
78 |
-
*
|
79 |
-
* @param WP_REST_Request $request Full data about the request.
|
80 |
-
* @return WP_Error|WP_REST_Response
|
81 |
-
*/
|
82 |
-
public function get_items( $request ) {
|
83 |
-
$args = array(
|
84 |
-
'post_type' => 'sp_team',
|
85 |
-
'posts_per_page' => 500,
|
86 |
-
);
|
87 |
-
$items = get_posts( $args );
|
88 |
-
$data = array();
|
89 |
-
foreach( $items as $item ) {
|
90 |
-
$itemdata = $this->prepare_item_for_response( $item, $request );
|
91 |
-
$data[] = $this->prepare_response_for_collection( $itemdata );
|
92 |
-
}
|
93 |
-
|
94 |
-
return new WP_REST_Response( $data, 200 );
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Get one item from the collection
|
99 |
-
*
|
100 |
-
* @param WP_REST_Request $request Full data about the request.
|
101 |
-
* @return WP_Error|WP_REST_Response
|
102 |
-
*/
|
103 |
-
public function get_item( $request ) {
|
104 |
-
//get parameters from request
|
105 |
-
$params = $request->get_params();
|
106 |
-
$item = get_post( $params['id'] );//do a query, call another class, etc
|
107 |
-
$data = $this->prepare_item_for_response( $item, $request );
|
108 |
-
|
109 |
-
//return a response or error based on some conditional
|
110 |
-
if ( 1 == 1 ) {
|
111 |
-
return new WP_REST_Response( $data, 200 );
|
112 |
-
}else{
|
113 |
-
return new WP_Error( 'code', __( 'message', 'text-domain' ) );
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Create one item from the collection
|
119 |
-
*
|
120 |
-
* @param WP_REST_Request $request Full data about the request.
|
121 |
-
* @return WP_Error|WP_REST_Request
|
122 |
-
*/
|
123 |
-
public function create_item( $request ) {
|
124 |
-
|
125 |
-
$item = $this->prepare_item_for_database( $request );
|
126 |
-
|
127 |
-
if ( function_exists( 'slug_some_function_to_create_item') ) {
|
128 |
-
$data = slug_some_function_to_create_item( $item );
|
129 |
-
if ( is_array( $data ) ) {
|
130 |
-
return new WP_REST_Response( $data, 200 );
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
return new WP_Error( 'cant-create', __( 'message', 'text-domain'), array( 'status' => 500 ) );
|
135 |
-
|
136 |
-
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* Update one item from the collection
|
141 |
-
*
|
142 |
-
* @param WP_REST_Request $request Full data about the request.
|
143 |
-
* @return WP_Error|WP_REST_Request
|
144 |
-
*/
|
145 |
-
public function update_item( $request ) {
|
146 |
-
$item = $this->prepare_item_for_database( $request );
|
147 |
-
|
148 |
-
if ( function_exists( 'slug_some_function_to_update_item') ) {
|
149 |
-
$data = slug_some_function_to_update_item( $item );
|
150 |
-
if ( is_array( $data ) ) {
|
151 |
-
return new WP_REST_Response( $data, 200 );
|
152 |
-
}
|
153 |
-
}
|
154 |
-
|
155 |
-
return new WP_Error( 'cant-update', __( 'message', 'text-domain'), array( 'status' => 500 ) );
|
156 |
-
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Delete one item from the collection
|
161 |
-
*
|
162 |
-
* @param WP_REST_Request $request Full data about the request.
|
163 |
-
* @return WP_Error|WP_REST_Request
|
164 |
-
*/
|
165 |
-
public function delete_item( $request ) {
|
166 |
-
$item = $this->prepare_item_for_database( $request );
|
167 |
-
|
168 |
-
if ( function_exists( 'slug_some_function_to_delete_item') ) {
|
169 |
-
$deleted = slug_some_function_to_delete_item( $item );
|
170 |
-
if ( $deleted ) {
|
171 |
-
return new WP_REST_Response( true, 200 );
|
172 |
-
}
|
173 |
-
}
|
174 |
-
|
175 |
-
return new WP_Error( 'cant-delete', __( 'message', 'text-domain'), array( 'status' => 500 ) );
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Check if a given request has access to get items
|
180 |
-
*
|
181 |
-
* @param WP_REST_Request $request Full data about the request.
|
182 |
-
* @return WP_Error|bool
|
183 |
-
*/
|
184 |
-
public function get_items_permissions_check( $request ) {
|
185 |
-
return true;
|
186 |
-
//return current_user_can( 'edit_something' );
|
187 |
-
}
|
188 |
-
|
189 |
-
/**
|
190 |
-
* Check if a given request has access to get a specific item
|
191 |
-
*
|
192 |
-
* @param WP_REST_Request $request Full data about the request.
|
193 |
-
* @return WP_Error|bool
|
194 |
-
*/
|
195 |
-
public function get_item_permissions_check( $request ) {
|
196 |
-
return $this->get_items_permissions_check( $request );
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Check if a given request has access to create items
|
201 |
-
*
|
202 |
-
* @param WP_REST_Request $request Full data about the request.
|
203 |
-
* @return WP_Error|bool
|
204 |
-
*/
|
205 |
-
public function create_item_permissions_check( $request ) {
|
206 |
-
return current_user_can( 'edit_something' );
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* Check if a given request has access to update a specific item
|
211 |
-
*
|
212 |
-
* @param WP_REST_Request $request Full data about the request.
|
213 |
-
* @return WP_Error|bool
|
214 |
-
*/
|
215 |
-
public function update_item_permissions_check( $request ) {
|
216 |
-
return $this->create_item_permissions_check( $request );
|
217 |
-
}
|
218 |
-
|
219 |
-
/**
|
220 |
-
* Check if a given request has access to delete a specific item
|
221 |
-
*
|
222 |
-
* @param WP_REST_Request $request Full data about the request.
|
223 |
-
* @return WP_Error|bool
|
224 |
-
*/
|
225 |
-
public function delete_item_permissions_check( $request ) {
|
226 |
-
return $this->create_item_permissions_check( $request );
|
227 |
-
}
|
228 |
-
|
229 |
-
/**
|
230 |
-
* Prepare the item for create or update operation
|
231 |
-
*
|
232 |
-
* @param WP_REST_Request $request Request object
|
233 |
-
* @return WP_Error|object $prepared_item
|
234 |
-
*/
|
235 |
-
protected function prepare_item_for_database( $request ) {
|
236 |
-
return array();
|
237 |
-
}
|
238 |
-
|
239 |
-
/**
|
240 |
-
* Prepare the item for the REST response
|
241 |
-
*
|
242 |
-
* @param mixed $item WordPress representation of the item.
|
243 |
-
* @param WP_REST_Request $request Request object.
|
244 |
-
* @return mixed
|
245 |
-
*/
|
246 |
-
public function prepare_item_for_response( $post, $request ) {
|
247 |
-
$data = array(
|
248 |
-
'id' => $post->ID,
|
249 |
-
'guid' => array(
|
250 |
-
'raw' => $post->guid,
|
251 |
-
'rendered' => apply_filters( 'get_the_guid', $post->guid ),
|
252 |
-
),
|
253 |
-
'slug' => $post->post_name,
|
254 |
-
'link' => get_permalink( $post->ID ),
|
255 |
-
'title' => array(
|
256 |
-
'raw' => $post->post_title,
|
257 |
-
'rendered' => get_the_title( $post->ID ),
|
258 |
-
),
|
259 |
-
'content' => array(
|
260 |
-
'raw' => $post->post_content,
|
261 |
-
'rendered' => apply_filters( 'the_content', $post->post_content ),
|
262 |
-
),
|
263 |
-
'featured_media' => (int) get_post_thumbnail_id( $post->ID ),
|
264 |
-
'abbreviation' => sp_get_abbreviation( $post->ID ),
|
265 |
-
'leagues' => sp_get_leagues( $post->ID ),
|
266 |
-
'seasons' => sp_get_seasons( $post->ID ),
|
267 |
-
'venues' => sp_get_venues( $post->ID ),
|
268 |
-
);
|
269 |
-
|
270 |
-
return $data;
|
271 |
-
}
|
272 |
-
|
273 |
-
/**
|
274 |
-
* Get the query params for collections
|
275 |
-
*
|
276 |
-
* @return array
|
277 |
-
*/
|
278 |
-
public function get_collection_params() {
|
279 |
-
return array(
|
280 |
-
'page' => array(
|
281 |
-
'description' => 'Current page of the collection.',
|
282 |
-
'type' => 'integer',
|
283 |
-
'default' => 1,
|
284 |
-
'sanitize_callback' => 'absint',
|
285 |
-
),
|
286 |
-
'per_page' => array(
|
287 |
-
'description' => 'Maximum number of items to be returned in result set.',
|
288 |
-
'type' => 'integer',
|
289 |
-
'default' => 10,
|
290 |
-
'sanitize_callback' => 'absint',
|
291 |
-
),
|
292 |
-
'search' => array(
|
293 |
-
'description' => 'Limit results to those matching a string.',
|
294 |
-
'type' => 'string',
|
295 |
-
'sanitize_callback' => 'sanitize_text_field',
|
296 |
-
),
|
297 |
-
);
|
298 |
-
}
|
299 |
-
}
|
300 |
-
|
301 |
-
new SP_REST_Teams_Controller();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-sp-ajax.php
CHANGED
@@ -8,7 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
8 |
* AJAX Event Handler
|
9 |
*
|
10 |
* @class SP_AJAX
|
11 |
-
* @version
|
12 |
* @package SportsPress/Classes
|
13 |
* @category Class
|
14 |
* @author ThemeBoy
|
@@ -201,6 +201,62 @@ class SP_AJAX {
|
|
201 |
?>
|
202 |
</label>
|
203 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
<p>
|
205 |
<label>
|
206 |
<?php _e( 'Status:', 'sportspress' ); ?>
|
@@ -248,6 +304,7 @@ class SP_AJAX {
|
|
248 |
<?php
|
249 |
$args = array(
|
250 |
'post_type' => 'sp_calendar',
|
|
|
251 |
'name' => 'id',
|
252 |
'values' => 'ID',
|
253 |
);
|
@@ -255,6 +312,62 @@ class SP_AJAX {
|
|
255 |
?>
|
256 |
</label>
|
257 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
<p>
|
259 |
<label>
|
260 |
<?php _e( 'Status:', 'sportspress' ); ?>
|
@@ -301,6 +414,8 @@ class SP_AJAX {
|
|
301 |
'event' => __( 'Event', 'sportspress' ),
|
302 |
'teams' => __( 'Teams', 'sportspress' ),
|
303 |
'time' => __( 'Time', 'sportspress' ),
|
|
|
|
|
304 |
'venue' => __( 'Venue', 'sportspress' ),
|
305 |
'article' => __( 'Article', 'sportspress' ),
|
306 |
);
|
@@ -346,6 +461,7 @@ class SP_AJAX {
|
|
346 |
<?php
|
347 |
$args = array(
|
348 |
'post_type' => 'sp_calendar',
|
|
|
349 |
'name' => 'id',
|
350 |
'values' => 'ID',
|
351 |
);
|
@@ -353,6 +469,62 @@ class SP_AJAX {
|
|
353 |
?>
|
354 |
</label>
|
355 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
<p>
|
357 |
<label>
|
358 |
<?php _e( 'Status:', 'sportspress' ); ?>
|
@@ -735,10 +907,18 @@ class SP_AJAX {
|
|
735 |
args.show_venue = $div.find('[name=show_venue]:checked').length;
|
736 |
args.show_league = $div.find('[name=show_league]:checked').length;
|
737 |
} else if ( 'event_calendar' == type ) {
|
|
|
|
|
|
|
|
|
738 |
args.status = $div.find('[name=status]').val();
|
739 |
args.show_all_events_link = $div.find('[name=show_all_events_link]:checked').length;
|
740 |
} else if ( 'event_list' == type ) {
|
741 |
args.title = $div.find('[name=title]').val();
|
|
|
|
|
|
|
|
|
742 |
args.status = $div.find('[name=status]').val();
|
743 |
args.date = $div.find('[name=date]').val();
|
744 |
args.number = $div.find('[name=number]').val();
|
@@ -747,6 +927,10 @@ class SP_AJAX {
|
|
747 |
args.show_all_events_link = $div.find('[name=show_all_events_link]:checked').length;
|
748 |
} else if ( 'event_blocks' == type ) {
|
749 |
args.title = $div.find('[name=title]').val();
|
|
|
|
|
|
|
|
|
750 |
args.status = $div.find('[name=status]').val();
|
751 |
args.date = $div.find('[name=date]').val();
|
752 |
args.number = $div.find('[name=number]').val();
|
8 |
* AJAX Event Handler
|
9 |
*
|
10 |
* @class SP_AJAX
|
11 |
+
* @version 2.0
|
12 |
* @package SportsPress/Classes
|
13 |
* @category Class
|
14 |
* @author ThemeBoy
|
201 |
?>
|
202 |
</label>
|
203 |
</p>
|
204 |
+
<p>
|
205 |
+
<label>
|
206 |
+
<?php _e( 'Team:', 'sportspress' ); ?>
|
207 |
+
<?php
|
208 |
+
$args = array(
|
209 |
+
'post_type' => 'sp_team',
|
210 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
211 |
+
'name' => 'team',
|
212 |
+
'values' => 'ID',
|
213 |
+
);
|
214 |
+
sp_dropdown_pages( $args );
|
215 |
+
?>
|
216 |
+
</label>
|
217 |
+
</p>
|
218 |
+
<p>
|
219 |
+
<label>
|
220 |
+
<?php _e( 'Competition:', 'sportspress' ); ?>
|
221 |
+
<?php
|
222 |
+
$args = array(
|
223 |
+
'taxonomy' => 'sp_league',
|
224 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
225 |
+
'name' => 'league',
|
226 |
+
'values' => 'term_id',
|
227 |
+
);
|
228 |
+
sp_dropdown_taxonomies( $args );
|
229 |
+
?>
|
230 |
+
</label>
|
231 |
+
</p>
|
232 |
+
<p>
|
233 |
+
<label>
|
234 |
+
<?php _e( 'Season:', 'sportspress' ); ?>
|
235 |
+
<?php
|
236 |
+
$args = array(
|
237 |
+
'taxonomy' => 'sp_season',
|
238 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
239 |
+
'name' => 'season',
|
240 |
+
'values' => 'term_id',
|
241 |
+
);
|
242 |
+
sp_dropdown_taxonomies( $args );
|
243 |
+
?>
|
244 |
+
</label>
|
245 |
+
</p>
|
246 |
+
<p>
|
247 |
+
<label>
|
248 |
+
<?php _e( 'Venue:', 'sportspress' ); ?>
|
249 |
+
<?php
|
250 |
+
$args = array(
|
251 |
+
'taxonomy' => 'sp_venue',
|
252 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
253 |
+
'name' => 'venue',
|
254 |
+
'values' => 'term_id',
|
255 |
+
);
|
256 |
+
sp_dropdown_taxonomies( $args );
|
257 |
+
?>
|
258 |
+
</label>
|
259 |
+
</p>
|
260 |
<p>
|
261 |
<label>
|
262 |
<?php _e( 'Status:', 'sportspress' ); ?>
|
304 |
<?php
|
305 |
$args = array(
|
306 |
'post_type' => 'sp_calendar',
|
307 |
+
'show_option_all' => __( 'All', 'sportspress' ),
|
308 |
'name' => 'id',
|
309 |
'values' => 'ID',
|
310 |
);
|
312 |
?>
|
313 |
</label>
|
314 |
</p>
|
315 |
+
<p>
|
316 |
+
<label>
|
317 |
+
<?php _e( 'Team:', 'sportspress' ); ?>
|
318 |
+
<?php
|
319 |
+
$args = array(
|
320 |
+
'post_type' => 'sp_team',
|
321 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
322 |
+
'name' => 'team',
|
323 |
+
'values' => 'ID',
|
324 |
+
);
|
325 |
+
sp_dropdown_pages( $args );
|
326 |
+
?>
|
327 |
+
</label>
|
328 |
+
</p>
|
329 |
+
<p>
|
330 |
+
<label>
|
331 |
+
<?php _e( 'Competition:', 'sportspress' ); ?>
|
332 |
+
<?php
|
333 |
+
$args = array(
|
334 |
+
'taxonomy' => 'sp_league',
|
335 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
336 |
+
'name' => 'league',
|
337 |
+
'values' => 'term_id',
|
338 |
+
);
|
339 |
+
sp_dropdown_taxonomies( $args );
|
340 |
+
?>
|
341 |
+
</label>
|
342 |
+
</p>
|
343 |
+
<p>
|
344 |
+
<label>
|
345 |
+
<?php _e( 'Season:', 'sportspress' ); ?>
|
346 |
+
<?php
|
347 |
+
$args = array(
|
348 |
+
'taxonomy' => 'sp_season',
|
349 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
350 |
+
'name' => 'season',
|
351 |
+
'values' => 'term_id',
|
352 |
+
);
|
353 |
+
sp_dropdown_taxonomies( $args );
|
354 |
+
?>
|
355 |
+
</label>
|
356 |
+
</p>
|
357 |
+
<p>
|
358 |
+
<label>
|
359 |
+
<?php _e( 'Venue:', 'sportspress' ); ?>
|
360 |
+
<?php
|
361 |
+
$args = array(
|
362 |
+
'taxonomy' => 'sp_venue',
|
363 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
364 |
+
'name' => 'venue',
|
365 |
+
'values' => 'term_id',
|
366 |
+
);
|
367 |
+
sp_dropdown_taxonomies( $args );
|
368 |
+
?>
|
369 |
+
</label>
|
370 |
+
</p>
|
371 |
<p>
|
372 |
<label>
|
373 |
<?php _e( 'Status:', 'sportspress' ); ?>
|
414 |
'event' => __( 'Event', 'sportspress' ),
|
415 |
'teams' => __( 'Teams', 'sportspress' ),
|
416 |
'time' => __( 'Time', 'sportspress' ),
|
417 |
+
'league' => __( 'Competition', 'sportspress' ),
|
418 |
+
'season' => __( 'Season', 'sportspress' ),
|
419 |
'venue' => __( 'Venue', 'sportspress' ),
|
420 |
'article' => __( 'Article', 'sportspress' ),
|
421 |
);
|
461 |
<?php
|
462 |
$args = array(
|
463 |
'post_type' => 'sp_calendar',
|
464 |
+
'show_option_all' => __( 'All', 'sportspress' ),
|
465 |
'name' => 'id',
|
466 |
'values' => 'ID',
|
467 |
);
|
469 |
?>
|
470 |
</label>
|
471 |
</p>
|
472 |
+
<p>
|
473 |
+
<label>
|
474 |
+
<?php _e( 'Team:', 'sportspress' ); ?>
|
475 |
+
<?php
|
476 |
+
$args = array(
|
477 |
+
'post_type' => 'sp_team',
|
478 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
479 |
+
'name' => 'team',
|
480 |
+
'values' => 'ID',
|
481 |
+
);
|
482 |
+
sp_dropdown_pages( $args );
|
483 |
+
?>
|
484 |
+
</label>
|
485 |
+
</p>
|
486 |
+
<p>
|
487 |
+
<label>
|
488 |
+
<?php _e( 'Competition:', 'sportspress' ); ?>
|
489 |
+
<?php
|
490 |
+
$args = array(
|
491 |
+
'taxonomy' => 'sp_league',
|
492 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
493 |
+
'name' => 'league',
|
494 |
+
'values' => 'term_id',
|
495 |
+
);
|
496 |
+
sp_dropdown_taxonomies( $args );
|
497 |
+
?>
|
498 |
+
</label>
|
499 |
+
</p>
|
500 |
+
<p>
|
501 |
+
<label>
|
502 |
+
<?php _e( 'Season:', 'sportspress' ); ?>
|
503 |
+
<?php
|
504 |
+
$args = array(
|
505 |
+
'taxonomy' => 'sp_season',
|
506 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
507 |
+
'name' => 'season',
|
508 |
+
'values' => 'term_id',
|
509 |
+
);
|
510 |
+
sp_dropdown_taxonomies( $args );
|
511 |
+
?>
|
512 |
+
</label>
|
513 |
+
</p>
|
514 |
+
<p>
|
515 |
+
<label>
|
516 |
+
<?php _e( 'Venue:', 'sportspress' ); ?>
|
517 |
+
<?php
|
518 |
+
$args = array(
|
519 |
+
'taxonomy' => 'sp_venue',
|
520 |
+
'show_option_all' => __( 'Default', 'sportspress' ),
|
521 |
+
'name' => 'venue',
|
522 |
+
'values' => 'term_id',
|
523 |
+
);
|
524 |
+
sp_dropdown_taxonomies( $args );
|
525 |
+
?>
|
526 |
+
</label>
|
527 |
+
</p>
|
528 |
<p>
|
529 |
<label>
|
530 |
<?php _e( 'Status:', 'sportspress' ); ?>
|
907 |
args.show_venue = $div.find('[name=show_venue]:checked').length;
|
908 |
args.show_league = $div.find('[name=show_league]:checked').length;
|
909 |
} else if ( 'event_calendar' == type ) {
|
910 |
+
args.team = $div.find('[name=team]').val();
|
911 |
+
args.league = $div.find('[name=league]').val();
|
912 |
+
args.season = $div.find('[name=season]').val();
|
913 |
+
args.venue = $div.find('[name=venue]').val();
|
914 |
args.status = $div.find('[name=status]').val();
|
915 |
args.show_all_events_link = $div.find('[name=show_all_events_link]:checked').length;
|
916 |
} else if ( 'event_list' == type ) {
|
917 |
args.title = $div.find('[name=title]').val();
|
918 |
+
args.team = $div.find('[name=team]').val();
|
919 |
+
args.league = $div.find('[name=league]').val();
|
920 |
+
args.season = $div.find('[name=season]').val();
|
921 |
+
args.venue = $div.find('[name=venue]').val();
|
922 |
args.status = $div.find('[name=status]').val();
|
923 |
args.date = $div.find('[name=date]').val();
|
924 |
args.number = $div.find('[name=number]').val();
|
927 |
args.show_all_events_link = $div.find('[name=show_all_events_link]:checked').length;
|
928 |
} else if ( 'event_blocks' == type ) {
|
929 |
args.title = $div.find('[name=title]').val();
|
930 |
+
args.team = $div.find('[name=team]').val();
|
931 |
+
args.league = $div.find('[name=league]').val();
|
932 |
+
args.season = $div.find('[name=season]').val();
|
933 |
+
args.venue = $div.find('[name=venue]').val();
|
934 |
args.status = $div.find('[name=status]').val();
|
935 |
args.date = $div.find('[name=date]').val();
|
936 |
args.number = $div.find('[name=number]').val();
|
includes/class-sp-calendar.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress calendar class handles individual calendar data.
|
6 |
*
|
7 |
* @class SP_Calendar
|
8 |
-
* @version
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -34,6 +34,18 @@ class SP_Calendar extends SP_Custom_Post {
|
|
34 |
/** @var int The season ID. */
|
35 |
public $season;
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
/**
|
38 |
* __construct function.
|
39 |
*
|
@@ -52,6 +64,7 @@ class SP_Calendar extends SP_Custom_Post {
|
|
52 |
$this->status = $this->__get( 'status' );
|
53 |
$this->date = $this->__get( 'date' );
|
54 |
$this->order = $this->__get( 'order' );
|
|
|
55 |
|
56 |
if ( ! $this->status )
|
57 |
$this->status = 'any';
|
@@ -67,6 +80,9 @@ class SP_Calendar extends SP_Custom_Post {
|
|
67 |
|
68 |
if ( ! $this->to )
|
69 |
$this->to = get_post_meta( $this->ID, 'sp_date_to', true );
|
|
|
|
|
|
|
70 |
}
|
71 |
|
72 |
/**
|
@@ -80,11 +96,13 @@ class SP_Calendar extends SP_Custom_Post {
|
|
80 |
|
81 |
$args = array(
|
82 |
'post_type' => 'sp_event',
|
83 |
-
'
|
84 |
-
'posts_per_page' => -1,
|
85 |
'orderby' => 'date',
|
86 |
'order' => $this->order,
|
87 |
'post_status' => $this->status,
|
|
|
|
|
|
|
88 |
'tax_query' => array(
|
89 |
'relation' => 'AND'
|
90 |
),
|
@@ -111,6 +129,26 @@ class SP_Calendar extends SP_Custom_Post {
|
|
111 |
$season_ids = array( $this->season );
|
112 |
endif;
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
if ( $pagenow != 'post-new.php' ):
|
115 |
if ( $this->ID ):
|
116 |
$leagues = get_the_terms( $this->ID, 'sp_league' );
|
@@ -126,14 +164,6 @@ class SP_Calendar extends SP_Custom_Post {
|
|
126 |
endforeach;
|
127 |
endif;
|
128 |
|
129 |
-
if ( isset( $league_ids ) ) {
|
130 |
-
$args['tax_query'][] = array(
|
131 |
-
'taxonomy' => 'sp_league',
|
132 |
-
'field' => 'id',
|
133 |
-
'terms' => $league_ids
|
134 |
-
);
|
135 |
-
}
|
136 |
-
|
137 |
if ( ! isset( $season_ids ) && $seasons ):
|
138 |
$season_ids = array();
|
139 |
foreach( $seasons as $season ):
|
@@ -141,39 +171,67 @@ class SP_Calendar extends SP_Custom_Post {
|
|
141 |
endforeach;
|
142 |
endif;
|
143 |
|
144 |
-
if ( isset( $
|
145 |
-
$args['tax_query'][] = array(
|
146 |
-
'taxonomy' => 'sp_season',
|
147 |
-
'field' => 'id',
|
148 |
-
'terms' => $season_ids
|
149 |
-
);
|
150 |
-
}
|
151 |
-
|
152 |
-
if ( $venues ):
|
153 |
$venue_ids = array();
|
154 |
foreach( $venues as $venue ):
|
155 |
$venue_ids[] = $venue->term_id;
|
156 |
endforeach;
|
157 |
-
$args['tax_query'][] = array(
|
158 |
-
'taxonomy' => 'sp_venue',
|
159 |
-
'field' => 'id',
|
160 |
-
'terms' => $venue_ids
|
161 |
-
);
|
162 |
endif;
|
163 |
-
|
164 |
-
if ( ! empty( $teams ) ):
|
165 |
-
$args['meta_query'] = array(
|
166 |
-
array(
|
167 |
-
'key' => 'sp_team',
|
168 |
-
'value' => $teams,
|
169 |
-
'compare' => 'IN',
|
170 |
-
),
|
171 |
-
);
|
172 |
-
endif;
|
173 |
-
|
174 |
endif;
|
175 |
|
176 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
else:
|
179 |
$events = null;
|
5 |
* The SportsPress calendar class handles individual calendar data.
|
6 |
*
|
7 |
* @class SP_Calendar
|
8 |
+
* @version 2.0.13
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
34 |
/** @var int The season ID. */
|
35 |
public $season;
|
36 |
|
37 |
+
/** @var int The venue ID. */
|
38 |
+
public $venue;
|
39 |
+
|
40 |
+
/** @var int The team ID. */
|
41 |
+
public $team;
|
42 |
+
|
43 |
+
/** @var int The player ID. */
|
44 |
+
public $player;
|
45 |
+
|
46 |
+
/** @var int Number of events. */
|
47 |
+
public $number;
|
48 |
+
|
49 |
/**
|
50 |
* __construct function.
|
51 |
*
|
64 |
$this->status = $this->__get( 'status' );
|
65 |
$this->date = $this->__get( 'date' );
|
66 |
$this->order = $this->__get( 'order' );
|
67 |
+
$this->number = $this->__get( 'number' );
|
68 |
|
69 |
if ( ! $this->status )
|
70 |
$this->status = 'any';
|
80 |
|
81 |
if ( ! $this->to )
|
82 |
$this->to = get_post_meta( $this->ID, 'sp_date_to', true );
|
83 |
+
|
84 |
+
if ( ! $this->number )
|
85 |
+
$this->number = 500;
|
86 |
}
|
87 |
|
88 |
/**
|
96 |
|
97 |
$args = array(
|
98 |
'post_type' => 'sp_event',
|
99 |
+
'posts_per_page' => $this->number,
|
|
|
100 |
'orderby' => 'date',
|
101 |
'order' => $this->order,
|
102 |
'post_status' => $this->status,
|
103 |
+
'meta_query' => array(
|
104 |
+
'relation' => 'AND'
|
105 |
+
),
|
106 |
'tax_query' => array(
|
107 |
'relation' => 'AND'
|
108 |
),
|
129 |
$season_ids = array( $this->season );
|
130 |
endif;
|
131 |
|
132 |
+
if ( $this->venue ):
|
133 |
+
$venue_ids = array( $this->venue );
|
134 |
+
endif;
|
135 |
+
|
136 |
+
if ( $this->team ):
|
137 |
+
$args['meta_query'][] = array(
|
138 |
+
'key' => 'sp_team',
|
139 |
+
'value' => array( $this->team ),
|
140 |
+
'compare' => 'IN',
|
141 |
+
);
|
142 |
+
endif;
|
143 |
+
|
144 |
+
if ( $this->player ):
|
145 |
+
$args['meta_query'][] = array(
|
146 |
+
'key' => 'sp_player',
|
147 |
+
'value' => array( $this->player ),
|
148 |
+
'compare' => 'IN',
|
149 |
+
);
|
150 |
+
endif;
|
151 |
+
|
152 |
if ( $pagenow != 'post-new.php' ):
|
153 |
if ( $this->ID ):
|
154 |
$leagues = get_the_terms( $this->ID, 'sp_league' );
|
164 |
endforeach;
|
165 |
endif;
|
166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
if ( ! isset( $season_ids ) && $seasons ):
|
168 |
$season_ids = array();
|
169 |
foreach( $seasons as $season ):
|
171 |
endforeach;
|
172 |
endif;
|
173 |
|
174 |
+
if ( ! isset( $venue_ids ) && $venues ):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
$venue_ids = array();
|
176 |
foreach( $venues as $venue ):
|
177 |
$venue_ids[] = $venue->term_id;
|
178 |
endforeach;
|
|
|
|
|
|
|
|
|
|
|
179 |
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
endif;
|
181 |
|
182 |
+
|
183 |
+
if ( isset( $league_ids ) ) {
|
184 |
+
$args['tax_query'][] = array(
|
185 |
+
'taxonomy' => 'sp_league',
|
186 |
+
'field' => 'term_id',
|
187 |
+
'terms' => $league_ids
|
188 |
+
);
|
189 |
+
}
|
190 |
+
|
191 |
+
if ( isset( $season_ids ) ) {
|
192 |
+
$args['tax_query'][] = array(
|
193 |
+
'taxonomy' => 'sp_season',
|
194 |
+
'field' => 'term_id',
|
195 |
+
'terms' => $season_ids
|
196 |
+
);
|
197 |
+
}
|
198 |
+
|
199 |
+
if ( isset( $venue_ids ) ) {
|
200 |
+
$args['tax_query'][] = array(
|
201 |
+
'taxonomy' => 'sp_venue',
|
202 |
+
'field' => 'term_id',
|
203 |
+
'terms' => $venue_ids
|
204 |
+
);
|
205 |
+
}
|
206 |
+
|
207 |
+
if ( ! empty( $teams ) ) {
|
208 |
+
$args['meta_query'] = array(
|
209 |
+
array(
|
210 |
+
'key' => 'sp_team',
|
211 |
+
'value' => $teams,
|
212 |
+
'compare' => 'IN',
|
213 |
+
),
|
214 |
+
);
|
215 |
+
}
|
216 |
+
|
217 |
+
if ( 'auto' === $this->date ) {
|
218 |
+
if ( 'any' === $this->status ) {
|
219 |
+
$args['post_status'] = 'publish';
|
220 |
+
$args['order'] = 'DESC';
|
221 |
+
$args['posts_per_page'] = ceil( $this->number / 2 );
|
222 |
+
$results = get_posts( $args );
|
223 |
+
$results = array_reverse( $results, true );
|
224 |
+
|
225 |
+
$args['post_status'] = 'future';
|
226 |
+
$args['order'] = 'ASC';
|
227 |
+
$args['posts_per_page'] = floor( $this->number / 2 );
|
228 |
+
$fixtures = get_posts( $args );
|
229 |
+
|
230 |
+
$events = array_merge_recursive( $results, $fixtures );
|
231 |
+
}
|
232 |
+
} else {
|
233 |
+
$events = get_posts( $args );
|
234 |
+
}
|
235 |
|
236 |
else:
|
237 |
$events = null;
|
includes/class-sp-event.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress event class handles individual event data.
|
6 |
*
|
7 |
* @class SP_Event
|
8 |
-
* @version
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -25,6 +25,12 @@ class SP_Event extends SP_Custom_Post{
|
|
25 |
}
|
26 |
return $post_status;
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
public function results( $admin = false ) {
|
30 |
$teams = (array)get_post_meta( $this->ID, 'sp_team', false );
|
@@ -38,6 +44,10 @@ class SP_Event extends SP_Custom_Post{
|
|
38 |
|
39 |
// Get results for all teams
|
40 |
$data = sp_array_combine( $teams, $results, true );
|
|
|
|
|
|
|
|
|
41 |
|
42 |
if ( $admin ):
|
43 |
return array( $columns, $usecolumns, $data );
|
@@ -117,7 +127,7 @@ class SP_Event extends SP_Custom_Post{
|
|
117 |
endif;
|
118 |
endforeach;
|
119 |
if ( ! array_key_exists( 'number', $player_performance ) ):
|
120 |
-
$performance[ $team_id ][ $player_id ]['number'] = get_post_meta( $player_id, 'sp_number', true );
|
121 |
endif;
|
122 |
if ( ! array_key_exists( 'position', $player_performance ) || $player_performance['position'] == null ):
|
123 |
$performance[ $team_id ][ $player_id ]['position'] = sp_get_the_term_id( $player_id, 'sp_position', null );
|
5 |
* The SportsPress event class handles individual event data.
|
6 |
*
|
7 |
* @class SP_Event
|
8 |
+
* @version 2.0.7
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
25 |
}
|
26 |
return $post_status;
|
27 |
}
|
28 |
+
|
29 |
+
public function minutes() {
|
30 |
+
$minutes = get_post_meta( $this->ID, 'sp_minutes', true );
|
31 |
+
if ( '' === $minutes ) $minutes = 90;
|
32 |
+
return $minutes;
|
33 |
+
}
|
34 |
|
35 |
public function results( $admin = false ) {
|
36 |
$teams = (array)get_post_meta( $this->ID, 'sp_team', false );
|
44 |
|
45 |
// Get results for all teams
|
46 |
$data = sp_array_combine( $teams, $results, true );
|
47 |
+
|
48 |
+
if ( 'yes' === get_option( 'sportspress_event_reverse_teams', 'no' ) ) {
|
49 |
+
$data = array_reverse( $data, true );
|
50 |
+
}
|
51 |
|
52 |
if ( $admin ):
|
53 |
return array( $columns, $usecolumns, $data );
|
127 |
endif;
|
128 |
endforeach;
|
129 |
if ( ! array_key_exists( 'number', $player_performance ) ):
|
130 |
+
$performance[ $team_id ][ $player_id ]['number'] = apply_filters( 'sportspress_event_performance_default_squad_number', get_post_meta( $player_id, 'sp_number', true ) );
|
131 |
endif;
|
132 |
if ( ! array_key_exists( 'position', $player_performance ) || $player_performance['position'] == null ):
|
133 |
$performance[ $team_id ][ $player_id ]['position'] = sp_get_the_term_id( $player_id, 'sp_position', null );
|
includes/class-sp-frontend-scripts.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Handle frontend forms
|
4 |
*
|
5 |
* @class SP_Frontend_Scripts
|
6 |
-
* @version
|
7 |
* @package SportsPress/Classes
|
8 |
* @category Class
|
9 |
* @author ThemeBoy
|
@@ -75,12 +75,6 @@ class SP_Frontend_Scripts {
|
|
75 |
wp_enqueue_script( 'jquery-countdown', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/jquery.countdown.min.js', array( 'jquery' ), '2.0.2', true );
|
76 |
wp_enqueue_script( 'sportspress', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/sportspress.js', array( 'jquery' ), SP()->version, true );
|
77 |
|
78 |
-
if ( is_singular( 'sp_event' ) || is_tax( 'sp_venue' ) ):
|
79 |
-
wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3.exp', true );
|
80 |
-
wp_enqueue_script( 'sp-maps', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/sp-maps.js', array( 'jquery', 'google-maps' ), time(), true );
|
81 |
-
wp_localize_script( 'sp-maps', 'vars', array( 'map_type' => strtoupper( get_option( 'sportspress_map_type', 'ROADMAP' ) ), 'zoom' => get_option( 'sportspress_map_zoom', 15 ) ) );
|
82 |
-
endif;
|
83 |
-
|
84 |
// Localize scripts
|
85 |
wp_localize_script( 'sportspress', 'localized_strings', array( 'days' => __( 'days', 'sportspress' ), 'hrs' => __( 'hrs', 'sportspress' ), 'mins' => __( 'mins', 'sportspress' ), 'secs' => __( 'secs', 'sportspress' ), 'previous' => __( 'Previous', 'sportspress' ), 'next' => __( 'Next', 'sportspress' ) ) );
|
86 |
|
3 |
* Handle frontend forms
|
4 |
*
|
5 |
* @class SP_Frontend_Scripts
|
6 |
+
* @version 2.0.11
|
7 |
* @package SportsPress/Classes
|
8 |
* @category Class
|
9 |
* @author ThemeBoy
|
75 |
wp_enqueue_script( 'jquery-countdown', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/jquery.countdown.min.js', array( 'jquery' ), '2.0.2', true );
|
76 |
wp_enqueue_script( 'sportspress', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/sportspress.js', array( 'jquery' ), SP()->version, true );
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
// Localize scripts
|
79 |
wp_localize_script( 'sportspress', 'localized_strings', array( 'days' => __( 'days', 'sportspress' ), 'hrs' => __( 'hrs', 'sportspress' ), 'mins' => __( 'mins', 'sportspress' ), 'secs' => __( 'secs', 'sportspress' ), 'previous' => __( 'Previous', 'sportspress' ), 'next' => __( 'Next', 'sportspress' ) ) );
|
80 |
|
includes/class-sp-install.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Classes
|
8 |
-
* @version
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -22,6 +22,9 @@ class SP_Install {
|
|
22 |
*/
|
23 |
public function __construct() {
|
24 |
register_activation_hook( SP_PLUGIN_FILE, array( $this, 'install' ) );
|
|
|
|
|
|
|
25 |
|
26 |
add_action( 'admin_init', array( $this, 'install_actions' ) );
|
27 |
add_action( 'admin_init', array( $this, 'check_version' ), 5 );
|
@@ -88,14 +91,12 @@ class SP_Install {
|
|
88 |
// Queue upgrades
|
89 |
$current_version = get_option( 'sportspress_version', null );
|
90 |
|
|
|
|
|
|
|
91 |
// Update version
|
92 |
update_option( 'sportspress_version', SP()->version );
|
93 |
|
94 |
-
// Check if pages are needed
|
95 |
-
if ( ! get_option( 'sportspress_sport' ) ) {
|
96 |
-
update_option( '_sp_needs_welcome', 1 );
|
97 |
-
}
|
98 |
-
|
99 |
// Flush rules after install
|
100 |
flush_rewrite_rules();
|
101 |
|
@@ -131,15 +132,6 @@ class SP_Install {
|
|
131 |
add_option( 'sportspress_frontend_css_text', '#222222' );
|
132 |
add_option( 'sportspress_frontend_css_heading', '#ffffff' );
|
133 |
add_option( 'sportspress_frontend_css_link', '#00a69c' );
|
134 |
-
|
135 |
-
if ( ! get_option( 'sportspress_installed' ) ) {
|
136 |
-
// Configure default sport
|
137 |
-
$sport = 'custom';
|
138 |
-
update_option( 'sportspress_sport', $sport );
|
139 |
-
|
140 |
-
// Flag as installed
|
141 |
-
update_option( 'sportspress_installed', 1 );
|
142 |
-
}
|
143 |
}
|
144 |
|
145 |
/**
|
@@ -400,6 +392,25 @@ class SP_Install {
|
|
400 |
endif;
|
401 |
}
|
402 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
/**
|
404 |
* Get capabilities for SportsPress - these are assigned during installation or reset
|
405 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @category Admin
|
7 |
* @package SportsPress/Classes
|
8 |
+
* @version 2.0.7
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
22 |
*/
|
23 |
public function __construct() {
|
24 |
register_activation_hook( SP_PLUGIN_FILE, array( $this, 'install' ) );
|
25 |
+
|
26 |
+
if ( defined( 'SP_PRO_PLUGIN_FILE' ) )
|
27 |
+
register_activation_hook( SP_PRO_PLUGIN_FILE, array( $this, 'install' ) );
|
28 |
|
29 |
add_action( 'admin_init', array( $this, 'install_actions' ) );
|
30 |
add_action( 'admin_init', array( $this, 'check_version' ), 5 );
|
91 |
// Queue upgrades
|
92 |
$current_version = get_option( 'sportspress_version', null );
|
93 |
|
94 |
+
// Do upgrades
|
95 |
+
$this->upgrades( $current_version );
|
96 |
+
|
97 |
// Update version
|
98 |
update_option( 'sportspress_version', SP()->version );
|
99 |
|
|
|
|
|
|
|
|
|
|
|
100 |
// Flush rules after install
|
101 |
flush_rewrite_rules();
|
102 |
|
132 |
add_option( 'sportspress_frontend_css_text', '#222222' );
|
133 |
add_option( 'sportspress_frontend_css_heading', '#ffffff' );
|
134 |
add_option( 'sportspress_frontend_css_link', '#00a69c' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
|
137 |
/**
|
392 |
endif;
|
393 |
}
|
394 |
|
395 |
+
/**
|
396 |
+
* Make adjustments based on current version of the plugin
|
397 |
+
*
|
398 |
+
* @access public
|
399 |
+
* @return void
|
400 |
+
*/
|
401 |
+
public function upgrades( $version = null ) {
|
402 |
+
if ( null === $version ) return;
|
403 |
+
|
404 |
+
if ( version_compare( $version, '2.0', '<' ) ) {
|
405 |
+
update_option( 'sportspress_player_columns', 'manual' );
|
406 |
+
}
|
407 |
+
|
408 |
+
if ( version_compare( $version, '2.1', '<' ) ) {
|
409 |
+
$option = get_option( 'sportspress_event_results_reverse_teams', 'no' );
|
410 |
+
update_option( 'sportspress_event_reverse_teams', $option );
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
/**
|
415 |
* Get capabilities for SportsPress - these are assigned during installation or reset
|
416 |
*
|
includes/class-sp-league-table.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress league table class handles individual league table data.
|
6 |
*
|
7 |
* @class SP_League_Table
|
8 |
-
* @version
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -35,6 +35,7 @@ class SP_League_Table extends SP_Custom_Post{
|
|
35 |
$usecolumns = get_post_meta( $this->ID, 'sp_columns', true );
|
36 |
$adjustments = get_post_meta( $this->ID, 'sp_adjustments', true );
|
37 |
$select = get_post_meta( $this->ID, 'sp_select', true );
|
|
|
38 |
|
39 |
// Get labels from result variables
|
40 |
$result_labels = (array)sp_get_var_labels( 'sp_result' );
|
@@ -59,7 +60,7 @@ class SP_League_Table extends SP_Custom_Post{
|
|
59 |
if ( $league_ids ):
|
60 |
$args['tax_query'][] = array(
|
61 |
'taxonomy' => 'sp_league',
|
62 |
-
'field' => '
|
63 |
'terms' => $league_ids
|
64 |
);
|
65 |
endif;
|
@@ -67,7 +68,7 @@ class SP_League_Table extends SP_Custom_Post{
|
|
67 |
if ( $season_ids ):
|
68 |
$args['tax_query'][] = array(
|
69 |
'taxonomy' => 'sp_season',
|
70 |
-
'field' => '
|
71 |
'terms' => $season_ids
|
72 |
);
|
73 |
endif;
|
@@ -201,7 +202,7 @@ class SP_League_Table extends SP_Custom_Post{
|
|
201 |
if ( $league_ids ):
|
202 |
$args['tax_query'][] = array(
|
203 |
'taxonomy' => 'sp_league',
|
204 |
-
'field' => '
|
205 |
'terms' => $league_ids
|
206 |
);
|
207 |
endif;
|
@@ -209,7 +210,7 @@ class SP_League_Table extends SP_Custom_Post{
|
|
209 |
if ( $season_ids ):
|
210 |
$args['tax_query'][] = array(
|
211 |
'taxonomy' => 'sp_season',
|
212 |
-
'field' => '
|
213 |
'terms' => $season_ids
|
214 |
);
|
215 |
endif;
|
@@ -449,7 +450,7 @@ class SP_League_Table extends SP_Custom_Post{
|
|
449 |
if ( sp_array_value( sp_array_value( $placeholders, $team_id, array() ), $stat->post_name, '' ) == '' ):
|
450 |
|
451 |
if ( $stat->equation == null ):
|
452 |
-
$placeholder
|
453 |
if ( $placeholder == null ):
|
454 |
$placeholder = '-';
|
455 |
endif;
|
@@ -537,16 +538,16 @@ class SP_League_Table extends SP_Custom_Post{
|
|
537 |
// Add team name to row
|
538 |
$merged[ $team_id ] = array();
|
539 |
|
540 |
-
$team_data['name'] =
|
541 |
|
542 |
foreach ( $team_data as $key => $value ):
|
543 |
|
544 |
// Use static data if key exists and value is not empty, else use placeholder
|
545 |
if ( array_key_exists( $team_id, $tempdata ) && array_key_exists( $key, $tempdata[ $team_id ] ) && $tempdata[ $team_id ][ $key ] != '' ):
|
546 |
-
$
|
547 |
-
else:
|
548 |
-
$merged[ $team_id ][ $key ] = $value;
|
549 |
endif;
|
|
|
|
|
550 |
|
551 |
endforeach;
|
552 |
|
@@ -645,7 +646,6 @@ class SP_League_Table extends SP_Custom_Post{
|
|
645 |
return $this->pos;
|
646 |
}
|
647 |
|
648 |
-
|
649 |
/**
|
650 |
* Calculate and add games back.
|
651 |
*
|
5 |
* The SportsPress league table class handles individual league table data.
|
6 |
*
|
7 |
* @class SP_League_Table
|
8 |
+
* @version 2.0.13
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
35 |
$usecolumns = get_post_meta( $this->ID, 'sp_columns', true );
|
36 |
$adjustments = get_post_meta( $this->ID, 'sp_adjustments', true );
|
37 |
$select = get_post_meta( $this->ID, 'sp_select', true );
|
38 |
+
$abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
|
39 |
|
40 |
// Get labels from result variables
|
41 |
$result_labels = (array)sp_get_var_labels( 'sp_result' );
|
60 |
if ( $league_ids ):
|
61 |
$args['tax_query'][] = array(
|
62 |
'taxonomy' => 'sp_league',
|
63 |
+
'field' => 'term_id',
|
64 |
'terms' => $league_ids
|
65 |
);
|
66 |
endif;
|
68 |
if ( $season_ids ):
|
69 |
$args['tax_query'][] = array(
|
70 |
'taxonomy' => 'sp_season',
|
71 |
+
'field' => 'term_id',
|
72 |
'terms' => $season_ids
|
73 |
);
|
74 |
endif;
|
202 |
if ( $league_ids ):
|
203 |
$args['tax_query'][] = array(
|
204 |
'taxonomy' => 'sp_league',
|
205 |
+
'field' => 'term_id',
|
206 |
'terms' => $league_ids
|
207 |
);
|
208 |
endif;
|
210 |
if ( $season_ids ):
|
211 |
$args['tax_query'][] = array(
|
212 |
'taxonomy' => 'sp_season',
|
213 |
+
'field' => 'term_id',
|
214 |
'terms' => $season_ids
|
215 |
);
|
216 |
endif;
|
450 |
if ( sp_array_value( sp_array_value( $placeholders, $team_id, array() ), $stat->post_name, '' ) == '' ):
|
451 |
|
452 |
if ( $stat->equation == null ):
|
453 |
+
$placeholder = sp_array_value( sp_array_value( $adjustments, $team_id, array() ), $stat->post_name, null );
|
454 |
if ( $placeholder == null ):
|
455 |
$placeholder = '-';
|
456 |
endif;
|
538 |
// Add team name to row
|
539 |
$merged[ $team_id ] = array();
|
540 |
|
541 |
+
$team_data['name'] = sp_get_team_name( $team_id, $abbreviate_teams );
|
542 |
|
543 |
foreach ( $team_data as $key => $value ):
|
544 |
|
545 |
// Use static data if key exists and value is not empty, else use placeholder
|
546 |
if ( array_key_exists( $team_id, $tempdata ) && array_key_exists( $key, $tempdata[ $team_id ] ) && $tempdata[ $team_id ][ $key ] != '' ):
|
547 |
+
$value = $tempdata[ $team_id ][ $key ];
|
|
|
|
|
548 |
endif;
|
549 |
+
|
550 |
+
$merged[ $team_id ][ $key ] = $value;
|
551 |
|
552 |
endforeach;
|
553 |
|
646 |
return $this->pos;
|
647 |
}
|
648 |
|
|
|
649 |
/**
|
650 |
* Calculate and add games back.
|
651 |
*
|
includes/class-sp-modules.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress modules class stores available modules.
|
6 |
*
|
7 |
* @class SP_Modules
|
8 |
-
* @version
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -29,6 +29,13 @@ class SP_Modules {
|
|
29 |
'icon' => 'sp-icon-calendar',
|
30 |
'desc' => __( 'Organize and publish calendars using different layouts.', 'sportspress' ),
|
31 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
'match_stats' => array(
|
33 |
'label' => __( 'Match Stats', 'sportspress' ),
|
34 |
'class' => 'SportsPress_Match_Stats',
|
@@ -112,7 +119,7 @@ class SP_Modules {
|
|
112 |
'label' => __( 'Twitter', 'sportspress' ),
|
113 |
'class' => 'SportsPress_Twitter',
|
114 |
'action' => __( 'Tweet #SportsPress', 'sportspress' ),
|
115 |
-
'link' => 'http://tboy.co/
|
116 |
'tip' => __( 'Help spread the word by tweeting with #SportsPress and get the Twitter module for free.', 'sportspress' ),
|
117 |
'icon' => 'dashicons dashicons-twitter',
|
118 |
'desc' => __( 'Add a Twitter feed to team, player, and staff pages.', 'sportspress' ),
|
5 |
* The SportsPress modules class stores available modules.
|
6 |
*
|
7 |
* @class SP_Modules
|
8 |
+
* @version 2.0
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
29 |
'icon' => 'sp-icon-calendar',
|
30 |
'desc' => __( 'Organize and publish calendars using different layouts.', 'sportspress' ),
|
31 |
),
|
32 |
+
'scoreboard' => array(
|
33 |
+
'label' => __( 'Scoreboard', 'sportspress' ),
|
34 |
+
'class' => 'SportsPress_Scoreboard',
|
35 |
+
'icon' => 'sp-icon-scoreboard',
|
36 |
+
'link' => 'http://tboy.co/pro',
|
37 |
+
'desc' => __( 'Display multiple event results in a horizontal scoreboard.', 'sportspress' ),
|
38 |
+
),
|
39 |
'match_stats' => array(
|
40 |
'label' => __( 'Match Stats', 'sportspress' ),
|
41 |
'class' => 'SportsPress_Match_Stats',
|
119 |
'label' => __( 'Twitter', 'sportspress' ),
|
120 |
'class' => 'SportsPress_Twitter',
|
121 |
'action' => __( 'Tweet #SportsPress', 'sportspress' ),
|
122 |
+
'link' => 'http://tboy.co/tweet',
|
123 |
'tip' => __( 'Help spread the word by tweeting with #SportsPress and get the Twitter module for free.', 'sportspress' ),
|
124 |
'icon' => 'dashicons dashicons-twitter',
|
125 |
'desc' => __( 'Add a Twitter feed to team, player, and staff pages.', 'sportspress' ),
|
includes/class-sp-player-list.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress player list class handles individual player list data.
|
6 |
*
|
7 |
* @class SP_Player_List
|
8 |
-
* @version
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -73,7 +73,7 @@ class SP_Player_List extends SP_Custom_Post {
|
|
73 |
if ( $league_ids ):
|
74 |
$args['tax_query'][] = array(
|
75 |
'taxonomy' => 'sp_league',
|
76 |
-
'field' => '
|
77 |
'terms' => $league_ids
|
78 |
);
|
79 |
endif;
|
@@ -81,7 +81,7 @@ class SP_Player_List extends SP_Custom_Post {
|
|
81 |
if ( $season_ids ):
|
82 |
$args['tax_query'][] = array(
|
83 |
'taxonomy' => 'sp_season',
|
84 |
-
'field' => '
|
85 |
'terms' => $season_ids
|
86 |
);
|
87 |
endif;
|
@@ -89,7 +89,7 @@ class SP_Player_List extends SP_Custom_Post {
|
|
89 |
if ( $position_ids ):
|
90 |
$args['tax_query'][] = array(
|
91 |
'taxonomy' => 'sp_position',
|
92 |
-
'field' => '
|
93 |
'terms' => $position_ids
|
94 |
);
|
95 |
endif;
|
@@ -219,7 +219,7 @@ class SP_Player_List extends SP_Custom_Post {
|
|
219 |
if ( $league_ids ):
|
220 |
$args['tax_query'][] = array(
|
221 |
'taxonomy' => 'sp_league',
|
222 |
-
'field' => '
|
223 |
'terms' => $league_ids
|
224 |
);
|
225 |
endif;
|
@@ -227,7 +227,7 @@ class SP_Player_List extends SP_Custom_Post {
|
|
227 |
if ( $season_ids ):
|
228 |
$args['tax_query'][] = array(
|
229 |
'taxonomy' => 'sp_season',
|
230 |
-
'field' => '
|
231 |
'terms' => $season_ids
|
232 |
);
|
233 |
endif;
|
@@ -509,10 +509,10 @@ class SP_Player_List extends SP_Custom_Post {
|
|
509 |
|
510 |
// Use static data if key exists and value is not empty, else use placeholder
|
511 |
if ( array_key_exists( $player_id, $tempdata ) && array_key_exists( $key, $tempdata[ $player_id ] ) && $tempdata[ $player_id ][ $key ] != '' ):
|
512 |
-
$
|
513 |
-
else:
|
514 |
-
$merged[ $player_id ][ $key ] = $value;
|
515 |
endif;
|
|
|
|
|
516 |
|
517 |
endforeach;
|
518 |
endforeach;
|
@@ -605,5 +605,4 @@ class SP_Player_List extends SP_Custom_Post {
|
|
605 |
// Default sort by number
|
606 |
return sp_array_value( $a, 'number', 0 ) - sp_array_value( $b, 'number', 0 );
|
607 |
}
|
608 |
-
|
609 |
}
|
5 |
* The SportsPress player list class handles individual player list data.
|
6 |
*
|
7 |
* @class SP_Player_List
|
8 |
+
* @version 2.0.13
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
73 |
if ( $league_ids ):
|
74 |
$args['tax_query'][] = array(
|
75 |
'taxonomy' => 'sp_league',
|
76 |
+
'field' => 'term_id',
|
77 |
'terms' => $league_ids
|
78 |
);
|
79 |
endif;
|
81 |
if ( $season_ids ):
|
82 |
$args['tax_query'][] = array(
|
83 |
'taxonomy' => 'sp_season',
|
84 |
+
'field' => 'term_id',
|
85 |
'terms' => $season_ids
|
86 |
);
|
87 |
endif;
|
89 |
if ( $position_ids ):
|
90 |
$args['tax_query'][] = array(
|
91 |
'taxonomy' => 'sp_position',
|
92 |
+
'field' => 'term_id',
|
93 |
'terms' => $position_ids
|
94 |
);
|
95 |
endif;
|
219 |
if ( $league_ids ):
|
220 |
$args['tax_query'][] = array(
|
221 |
'taxonomy' => 'sp_league',
|
222 |
+
'field' => 'term_id',
|
223 |
'terms' => $league_ids
|
224 |
);
|
225 |
endif;
|
227 |
if ( $season_ids ):
|
228 |
$args['tax_query'][] = array(
|
229 |
'taxonomy' => 'sp_season',
|
230 |
+
'field' => 'term_id',
|
231 |
'terms' => $season_ids
|
232 |
);
|
233 |
endif;
|
509 |
|
510 |
// Use static data if key exists and value is not empty, else use placeholder
|
511 |
if ( array_key_exists( $player_id, $tempdata ) && array_key_exists( $key, $tempdata[ $player_id ] ) && $tempdata[ $player_id ][ $key ] != '' ):
|
512 |
+
$value = $tempdata[ $player_id ][ $key ];
|
|
|
|
|
513 |
endif;
|
514 |
+
|
515 |
+
$merged[ $player_id ][ $key ] = $value;
|
516 |
|
517 |
endforeach;
|
518 |
endforeach;
|
605 |
// Default sort by number
|
606 |
return sp_array_value( $a, 'number', 0 ) - sp_array_value( $b, 'number', 0 );
|
607 |
}
|
|
|
608 |
}
|
includes/class-sp-player.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress player class handles individual player data.
|
6 |
*
|
7 |
* @class SP_Player
|
8 |
-
* @version
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -109,16 +109,85 @@ class SP_Player extends SP_Custom_Post {
|
|
109 |
* @param bool $admin
|
110 |
* @return array
|
111 |
*/
|
112 |
-
public function data( $league_id, $admin = false ) {
|
113 |
|
114 |
$seasons = (array)get_the_terms( $this->ID, 'sp_season' );
|
115 |
$metrics = (array)get_post_meta( $this->ID, 'sp_metrics', true );
|
116 |
$stats = (array)get_post_meta( $this->ID, 'sp_statistics', true );
|
117 |
$leagues = sp_array_value( (array)get_post_meta( $this->ID, 'sp_leagues', true ), $league_id, array() );
|
118 |
-
$
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
// Get labels from outcome variables
|
124 |
$outcome_labels = (array)sp_get_var_labels( 'sp_outcome' );
|
@@ -205,7 +274,7 @@ class SP_Player extends SP_Custom_Post {
|
|
205 |
if ( $league_id ):
|
206 |
$args['tax_query'][] = array(
|
207 |
'taxonomy' => 'sp_league',
|
208 |
-
'field' => '
|
209 |
'terms' => $league_id
|
210 |
);
|
211 |
endif;
|
@@ -213,7 +282,7 @@ class SP_Player extends SP_Custom_Post {
|
|
213 |
if ( $div_id ):
|
214 |
$args['tax_query'][] = array(
|
215 |
'taxonomy' => 'sp_season',
|
216 |
-
'field' => '
|
217 |
'terms' => $div_id
|
218 |
);
|
219 |
endif;
|
@@ -404,8 +473,44 @@ class SP_Player extends SP_Custom_Post {
|
|
404 |
|
405 |
endforeach;
|
406 |
|
407 |
-
// Get
|
408 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
|
410 |
// Merge the data and placeholders arrays
|
411 |
$merged = array();
|
@@ -420,7 +525,7 @@ class SP_Player extends SP_Custom_Post {
|
|
420 |
$season_name = sp_array_value( $season_names, $season_id, ' ' );
|
421 |
|
422 |
if ( $team_id ):
|
423 |
-
$team_name =
|
424 |
|
425 |
if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false ):
|
426 |
$team_permalink = get_permalink( $team_id );
|
@@ -440,10 +545,10 @@ class SP_Player extends SP_Custom_Post {
|
|
440 |
|
441 |
// Use static data if key exists and value is not empty, else use placeholder
|
442 |
if ( array_key_exists( $season_id, $data ) && array_key_exists( $key, $data[ $season_id ] ) && $data[ $season_id ][ $key ] != '' ):
|
443 |
-
$
|
444 |
-
else:
|
445 |
-
$merged[ $season_id ][ $key ] = $value;
|
446 |
endif;
|
|
|
|
|
447 |
|
448 |
endforeach;
|
449 |
|
@@ -460,28 +565,79 @@ class SP_Player extends SP_Custom_Post {
|
|
460 |
$labels[ $key ] = $columns[ $key ];
|
461 |
endif;
|
462 |
endforeach; endif;
|
463 |
-
return array( $labels, $data, $placeholders, $merged, $leagues );
|
464 |
else:
|
465 |
-
if (
|
466 |
-
$
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
$labels = array( 'name' => __( 'Season', 'sportspress' ) );
|
480 |
-
if ( in_array( 'team', $this->columns ) )
|
481 |
$labels['team'] = __( 'Team', 'sportspress' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
$merged[0] = array_merge( $labels, $columns );
|
|
|
483 |
return $merged;
|
484 |
endif;
|
485 |
}
|
486 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
}
|
5 |
* The SportsPress player class handles individual player data.
|
6 |
*
|
7 |
* @class SP_Player
|
8 |
+
* @version 2.0.13
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
109 |
* @param bool $admin
|
110 |
* @return array
|
111 |
*/
|
112 |
+
public function data( $league_id, $admin = false, $section = -1 ) {
|
113 |
|
114 |
$seasons = (array)get_the_terms( $this->ID, 'sp_season' );
|
115 |
$metrics = (array)get_post_meta( $this->ID, 'sp_metrics', true );
|
116 |
$stats = (array)get_post_meta( $this->ID, 'sp_statistics', true );
|
117 |
$leagues = sp_array_value( (array)get_post_meta( $this->ID, 'sp_leagues', true ), $league_id, array() );
|
118 |
+
$abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
|
119 |
+
$manual_columns = 'manual' == get_option( 'sportspress_player_columns', 'auto' ) ? true : false;
|
120 |
+
|
121 |
+
// Get performance labels
|
122 |
+
$args = array(
|
123 |
+
'post_type' => array( 'sp_performance' ),
|
124 |
+
'numberposts' => 100,
|
125 |
+
'posts_per_page' => 100,
|
126 |
+
'orderby' => 'menu_order',
|
127 |
+
'order' => 'ASC',
|
128 |
+
);
|
129 |
+
|
130 |
+
$posts = get_posts( $args );
|
131 |
+
|
132 |
+
if ( $manual_columns ) {
|
133 |
+
$usecolumns = get_post_meta( $this->ID, 'sp_columns', true );
|
134 |
+
$has_checkboxes = true;
|
135 |
+
} else {
|
136 |
+
$usecolumns = array();
|
137 |
+
if ( is_array( $posts ) ) {
|
138 |
+
foreach ( $posts as $post ) {
|
139 |
+
// Get visibility
|
140 |
+
$visible = get_post_meta( $post->ID, 'sp_visible', true );
|
141 |
+
if ( '' === $visible || $visible ) {
|
142 |
+
$usecolumns[] = $post->post_name;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
}
|
146 |
+
$has_checkboxes = false;
|
147 |
+
}
|
148 |
+
|
149 |
+
$performance_labels = array();
|
150 |
+
|
151 |
+
foreach ( $posts as $post ):
|
152 |
+
if ( -1 === $section ) {
|
153 |
+
$performance_labels[ $post->post_name ] = $post->post_title;
|
154 |
+
} else {
|
155 |
+
$post_section = get_post_meta( $post->ID, 'sp_section', true );
|
156 |
+
|
157 |
+
if ( '' === $post_section ) {
|
158 |
+
$post_section = -1;
|
159 |
+
}
|
160 |
+
|
161 |
+
if ( $section == $post_section || -1 == $post_section ) {
|
162 |
+
$performance_labels[ $post->post_name ] = $post->post_title;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
endforeach;
|
166 |
+
|
167 |
+
// Get statistic labels
|
168 |
+
$args = array(
|
169 |
+
'post_type' => array( 'sp_statistic' ),
|
170 |
+
'numberposts' => 100,
|
171 |
+
'posts_per_page' => 100,
|
172 |
+
'orderby' => 'menu_order',
|
173 |
+
'order' => 'ASC',
|
174 |
+
);
|
175 |
+
|
176 |
+
$posts = get_posts( $args );
|
177 |
+
|
178 |
+
if ( $manual_columns ) {
|
179 |
+
$usecolumns += get_post_meta( $this->ID, 'sp_columns', true );
|
180 |
+
} else {
|
181 |
+
if ( is_array( $posts ) ) {
|
182 |
+
foreach ( $posts as $post ) {
|
183 |
+
// Get visibility
|
184 |
+
$visible = get_post_meta( $post->ID, 'sp_visible', true );
|
185 |
+
if ( '' === $visible || $visible ) {
|
186 |
+
$usecolumns[] = $post->post_name;
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
191 |
|
192 |
// Get labels from outcome variables
|
193 |
$outcome_labels = (array)sp_get_var_labels( 'sp_outcome' );
|
274 |
if ( $league_id ):
|
275 |
$args['tax_query'][] = array(
|
276 |
'taxonomy' => 'sp_league',
|
277 |
+
'field' => 'term_id',
|
278 |
'terms' => $league_id
|
279 |
);
|
280 |
endif;
|
282 |
if ( $div_id ):
|
283 |
$args['tax_query'][] = array(
|
284 |
'taxonomy' => 'sp_season',
|
285 |
+
'field' => 'term_id',
|
286 |
'terms' => $div_id
|
287 |
);
|
288 |
endif;
|
473 |
|
474 |
endforeach;
|
475 |
|
476 |
+
// Get labels by section
|
477 |
+
$args = array(
|
478 |
+
'post_type' => 'sp_statistic',
|
479 |
+
'numberposts' => 100,
|
480 |
+
'posts_per_page' => 100,
|
481 |
+
'orderby' => 'menu_order',
|
482 |
+
'order' => 'ASC',
|
483 |
+
);
|
484 |
+
|
485 |
+
$posts = get_posts( $args );
|
486 |
+
|
487 |
+
$stats = array();
|
488 |
+
|
489 |
+
foreach ( $posts as $post ):
|
490 |
+
if ( -1 === $section ) {
|
491 |
+
$stats[ $post->post_name ] = $post->post_title;
|
492 |
+
} else {
|
493 |
+
$post_section = get_post_meta( $post->ID, 'sp_section', true );
|
494 |
+
|
495 |
+
if ( '' === $post_section ) {
|
496 |
+
$post_section = -1;
|
497 |
+
}
|
498 |
+
|
499 |
+
if ( $admin ) {
|
500 |
+
if ( 1 == $section ) {
|
501 |
+
if ( 1 == $post_section ) {
|
502 |
+
$stats[ $post->post_name ] = $post->post_title;
|
503 |
+
}
|
504 |
+
} else {
|
505 |
+
if ( 1 != $post_section ) {
|
506 |
+
$stats[ $post->post_name ] = $post->post_title;
|
507 |
+
}
|
508 |
+
}
|
509 |
+
} elseif ( $section == $post_section || -1 == $post_section ) {
|
510 |
+
$stats[ $post->post_name ] = $post->post_title;
|
511 |
+
}
|
512 |
+
}
|
513 |
+
endforeach;
|
514 |
|
515 |
// Merge the data and placeholders arrays
|
516 |
$merged = array();
|
525 |
$season_name = sp_array_value( $season_names, $season_id, ' ' );
|
526 |
|
527 |
if ( $team_id ):
|
528 |
+
$team_name = sp_get_team_name( $team_id, $abbreviate_teams );
|
529 |
|
530 |
if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false ):
|
531 |
$team_permalink = get_permalink( $team_id );
|
545 |
|
546 |
// Use static data if key exists and value is not empty, else use placeholder
|
547 |
if ( array_key_exists( $season_id, $data ) && array_key_exists( $key, $data[ $season_id ] ) && $data[ $season_id ][ $key ] != '' ):
|
548 |
+
$value = $data[ $season_id ][ $key ];
|
|
|
|
|
549 |
endif;
|
550 |
+
|
551 |
+
$merged[ $season_id ][ $key ] = $value;
|
552 |
|
553 |
endforeach;
|
554 |
|
565 |
$labels[ $key ] = $columns[ $key ];
|
566 |
endif;
|
567 |
endforeach; endif;
|
568 |
+
return array( $labels, $data, $placeholders, $merged, $leagues, $has_checkboxes );
|
569 |
else:
|
570 |
+
if ( is_array( $usecolumns ) ):
|
571 |
+
foreach ( $columns as $key => $label ):
|
572 |
+
if ( ! in_array( $key, $usecolumns ) ):
|
573 |
+
unset( $columns[ $key ] );
|
574 |
+
endif;
|
575 |
+
endforeach;
|
576 |
+
endif;
|
577 |
+
|
578 |
+
$labels = array();
|
579 |
+
|
580 |
+
if ( 'no' === get_option( 'sportspress_player_show_statistics', 'yes' ) ) {
|
581 |
+
$merged = array();
|
582 |
+
} else {
|
583 |
+
$labels['name'] = __( 'Season', 'sportspress' );
|
|
|
|
|
584 |
$labels['team'] = __( 'Team', 'sportspress' );
|
585 |
+
}
|
586 |
+
|
587 |
+
if ( 'yes' === get_option( 'sportspress_player_show_total', 'no' ) ) {
|
588 |
+
// Get totals calculated from events
|
589 |
+
$total_placeholders = sp_array_value( $placeholders, 0, array() );
|
590 |
+
|
591 |
+
// Get totals as entered directly and filter out the empty values
|
592 |
+
$total_data = sp_array_value( $data, 0, array() );
|
593 |
+
|
594 |
+
// Get totals of all seasons as entered manually
|
595 |
+
$totals = array();
|
596 |
+
foreach ( $merged as $season => $stats ) {
|
597 |
+
foreach ( $stats as $key => $value ) {
|
598 |
+
$totals[ $key ] = sp_array_value( $totals, $key, 0 ) + $value;
|
599 |
+
}
|
600 |
+
}
|
601 |
+
|
602 |
+
// Merge with direct values
|
603 |
+
foreach ( $total_data as $key => $value ) {
|
604 |
+
if ( '' === $value ) {
|
605 |
+
$total_data[ $key ] = sp_array_value( $totals, $key, 0 );
|
606 |
+
}
|
607 |
+
}
|
608 |
+
|
609 |
+
// Then merge with placeholder values
|
610 |
+
$total = array_merge( $total_placeholders, $total_data );
|
611 |
+
$merged[-1] = $total;
|
612 |
+
$merged[-1]['name'] = __( 'Total', 'sportspress' );
|
613 |
+
}
|
614 |
+
|
615 |
$merged[0] = array_merge( $labels, $columns );
|
616 |
+
|
617 |
return $merged;
|
618 |
endif;
|
619 |
}
|
620 |
|
621 |
+
/**
|
622 |
+
* Returns formatted data for all competitions
|
623 |
+
*
|
624 |
+
* @access public
|
625 |
+
* @param int $league_id
|
626 |
+
* @param bool $admin
|
627 |
+
* @return array
|
628 |
+
*/
|
629 |
+
public function statistics() {
|
630 |
+
$terms = get_the_terms( $this->ID, 'sp_league' );
|
631 |
+
|
632 |
+
$statistics = array();
|
633 |
+
|
634 |
+
if ( is_array( $terms ) ) {
|
635 |
+
foreach ( $terms as $term ) {
|
636 |
+
$statistics[ $term->term_id ] = $this->data( $term->term_id );
|
637 |
+
}
|
638 |
+
}
|
639 |
+
|
640 |
+
return $statistics;
|
641 |
+
}
|
642 |
+
|
643 |
}
|
includes/class-sp-post-types.php
CHANGED
@@ -9,7 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
9 |
* Registers post types and taxonomies
|
10 |
*
|
11 |
* @class SP_Post_types
|
12 |
-
* @version
|
13 |
* @package SportsPress/Classes
|
14 |
* @category Class
|
15 |
* @author ThemeBoy
|
@@ -47,7 +47,7 @@ class SP_Post_types {
|
|
47 |
'search_items' => __( 'Search', 'sportspress' ),
|
48 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
49 |
);
|
50 |
-
$args = array(
|
51 |
'label' => __( 'Competitions', 'sportspress' ),
|
52 |
'labels' => $labels,
|
53 |
'public' => true,
|
@@ -55,7 +55,10 @@ class SP_Post_types {
|
|
55 |
'show_tagcloud' => false,
|
56 |
'hierarchical' => true,
|
57 |
'rewrite' => array( 'slug' => get_option( 'sportspress_league_slug', 'league' ) ),
|
58 |
-
|
|
|
|
|
|
|
59 |
$object_types = apply_filters( 'sportspress_league_object_types', array( 'sp_event', 'sp_calendar', 'sp_team', 'sp_table', 'sp_player', 'sp_list', 'sp_staff' ) );
|
60 |
register_taxonomy( 'sp_league', $object_types, $args );
|
61 |
foreach ( $object_types as $object_type ):
|
@@ -78,7 +81,7 @@ class SP_Post_types {
|
|
78 |
'search_items' => __( 'Search', 'sportspress' ),
|
79 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
80 |
);
|
81 |
-
$args = array(
|
82 |
'label' => __( 'Seasons', 'sportspress' ),
|
83 |
'labels' => $labels,
|
84 |
'public' => true,
|
@@ -86,7 +89,10 @@ class SP_Post_types {
|
|
86 |
'show_tagcloud' => false,
|
87 |
'hierarchical' => true,
|
88 |
'rewrite' => array( 'slug' => get_option( 'sportspress_season_slug', 'season' ) ),
|
89 |
-
|
|
|
|
|
|
|
90 |
$object_types = apply_filters( 'sportspress_season_object_types', array( 'sp_event', 'sp_calendar', 'sp_team', 'sp_table', 'sp_player', 'sp_list', 'sp_staff' ) );
|
91 |
register_taxonomy( 'sp_season', $object_types, $args );
|
92 |
foreach ( $object_types as $object_type ):
|
@@ -109,7 +115,7 @@ class SP_Post_types {
|
|
109 |
'search_items' => __( 'Search', 'sportspress' ),
|
110 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
111 |
);
|
112 |
-
$args = array(
|
113 |
'label' => __( 'Venues', 'sportspress' ),
|
114 |
'labels' => $labels,
|
115 |
'public' => true,
|
@@ -117,7 +123,10 @@ class SP_Post_types {
|
|
117 |
'show_tagcloud' => false,
|
118 |
'hierarchical' => true,
|
119 |
'rewrite' => array( 'slug' => get_option( 'sportspress_venue_slug', 'venue' ) ),
|
120 |
-
|
|
|
|
|
|
|
121 |
$object_types = apply_filters( 'sportspress_event_object_types', array( 'sp_event', 'sp_calendar', 'sp_team' ) );
|
122 |
register_taxonomy( 'sp_venue', $object_types, $args );
|
123 |
foreach ( $object_types as $object_type ):
|
@@ -140,7 +149,7 @@ class SP_Post_types {
|
|
140 |
'search_items' => __( 'Search', 'sportspress' ),
|
141 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
142 |
);
|
143 |
-
$args = array(
|
144 |
'label' => __( 'Positions', 'sportspress' ),
|
145 |
'labels' => $labels,
|
146 |
'public' => true,
|
@@ -148,7 +157,10 @@ class SP_Post_types {
|
|
148 |
'show_tagcloud' => false,
|
149 |
'hierarchical' => true,
|
150 |
'rewrite' => array( 'slug' => get_option( 'sportspress_position_slug', 'position' ) ),
|
151 |
-
|
|
|
|
|
|
|
152 |
$object_types = apply_filters( 'sportspress_position_object_types', array( 'sp_player', 'sp_list' ) );
|
153 |
register_taxonomy( 'sp_position', $object_types, $args );
|
154 |
foreach ( $object_types as $object_type ):
|
@@ -171,7 +183,7 @@ class SP_Post_types {
|
|
171 |
'search_items' => __( 'Search', 'sportspress' ),
|
172 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
173 |
);
|
174 |
-
$args = array(
|
175 |
'label' => __( 'Jobs', 'sportspress' ),
|
176 |
'labels' => $labels,
|
177 |
'public' => true,
|
@@ -179,7 +191,10 @@ class SP_Post_types {
|
|
179 |
'show_tagcloud' => false,
|
180 |
'hierarchical' => true,
|
181 |
'rewrite' => array( 'slug' => get_option( 'sportspress_role_slug', 'role' ) ),
|
182 |
-
|
|
|
|
|
|
|
183 |
$object_types = apply_filters( 'sportspress_role_object_types', array( 'sp_staff' ) );
|
184 |
register_taxonomy( 'sp_role', $object_types, $args );
|
185 |
foreach ( $object_types as $object_type ):
|
@@ -221,7 +236,7 @@ class SP_Post_types {
|
|
221 |
'has_archive' => false,
|
222 |
'show_in_nav_menus' => false,
|
223 |
'can_export' => false,
|
224 |
-
'show_in_menu'
|
225 |
)
|
226 |
)
|
227 |
);
|
@@ -251,7 +266,7 @@ class SP_Post_types {
|
|
251 |
'has_archive' => false,
|
252 |
'show_in_nav_menus' => false,
|
253 |
'can_export' => false,
|
254 |
-
'show_in_menu'
|
255 |
)
|
256 |
)
|
257 |
);
|
@@ -281,7 +296,7 @@ class SP_Post_types {
|
|
281 |
'has_archive' => false,
|
282 |
'show_in_nav_menus' => false,
|
283 |
'can_export' => false,
|
284 |
-
'show_in_menu'
|
285 |
)
|
286 |
)
|
287 |
);
|
@@ -311,7 +326,7 @@ class SP_Post_types {
|
|
311 |
'has_archive' => false,
|
312 |
'show_in_nav_menus' => false,
|
313 |
'can_export' => false,
|
314 |
-
'show_in_menu'
|
315 |
)
|
316 |
)
|
317 |
);
|
@@ -321,6 +336,7 @@ class SP_Post_types {
|
|
321 |
array(
|
322 |
'labels' => array(
|
323 |
'name' => __( 'Player Performance', 'sportspress' ),
|
|
|
324 |
'singular_name' => __( 'Player Performance', 'sportspress' ),
|
325 |
'add_new_item' => __( 'Add New Performance', 'sportspress' ),
|
326 |
'edit_item' => __( 'Edit Performance', 'sportspress' ),
|
@@ -341,7 +357,7 @@ class SP_Post_types {
|
|
341 |
'has_archive' => false,
|
342 |
'show_in_nav_menus' => false,
|
343 |
'can_export' => false,
|
344 |
-
'show_in_menu'
|
345 |
)
|
346 |
)
|
347 |
);
|
@@ -351,6 +367,7 @@ class SP_Post_types {
|
|
351 |
array(
|
352 |
'labels' => array(
|
353 |
'name' => __( 'Player Statistics', 'sportspress' ),
|
|
|
354 |
'singular_name' => __( 'Statistic', 'sportspress' ),
|
355 |
'add_new_item' => __( 'Add New Statistic', 'sportspress' ),
|
356 |
'edit_item' => __( 'Edit Statistic', 'sportspress' ),
|
@@ -371,7 +388,7 @@ class SP_Post_types {
|
|
371 |
'has_archive' => false,
|
372 |
'show_in_nav_menus' => false,
|
373 |
'can_export' => false,
|
374 |
-
'show_in_menu'
|
375 |
)
|
376 |
)
|
377 |
);
|
@@ -396,10 +413,13 @@ class SP_Post_types {
|
|
396 |
'exclude_from_search' => false,
|
397 |
'hierarchical' => false,
|
398 |
'rewrite' => array( 'slug' => get_option( 'sportspress_event_slug', 'event' ) ),
|
399 |
-
'supports' => array( 'title', 'author', 'thumbnail', 'excerpt' ),
|
400 |
'has_archive' => false,
|
401 |
'show_in_nav_menus' => true,
|
402 |
'menu_icon' => 'dashicons-calendar',
|
|
|
|
|
|
|
403 |
);
|
404 |
|
405 |
if ( get_option( 'sportspress_event_comment_status', 'no' ) == 'yes' ):
|
@@ -430,10 +450,13 @@ class SP_Post_types {
|
|
430 |
'exclude_from_search' => false,
|
431 |
'hierarchical' => true,
|
432 |
'rewrite' => array( 'slug' => get_option( 'sportspress_team_slug', 'team' ) ),
|
433 |
-
'supports' => array( 'title', 'author', 'thumbnail', 'page-attributes', 'excerpt' ),
|
434 |
'has_archive' => false,
|
435 |
'show_in_nav_menus' => true,
|
436 |
'menu_icon' => 'dashicons-shield-alt',
|
|
|
|
|
|
|
437 |
)
|
438 |
)
|
439 |
);
|
@@ -460,10 +483,13 @@ class SP_Post_types {
|
|
460 |
'exclude_from_search' => false,
|
461 |
'hierarchical' => false,
|
462 |
'rewrite' => array( 'slug' => get_option( 'sportspress_player_slug', 'player' ) ),
|
463 |
-
'supports' => array( 'title', 'author', 'thumbnail', 'excerpt', 'page-attributes' ),
|
464 |
'has_archive' => false,
|
465 |
'show_in_nav_menus' => true,
|
466 |
'menu_icon' => 'dashicons-groups',
|
|
|
|
|
|
|
467 |
)
|
468 |
)
|
469 |
);
|
@@ -490,10 +516,13 @@ class SP_Post_types {
|
|
490 |
'exclude_from_search' => false,
|
491 |
'hierarchical' => false,
|
492 |
'rewrite' => array( 'slug' => get_option( 'sportspress_staff_slug', 'staff' ) ),
|
493 |
-
'supports' => array( 'title', 'author', 'thumbnail', 'excerpt' ),
|
494 |
'has_archive' => false,
|
495 |
'show_in_nav_menus' => true,
|
496 |
'menu_icon' => 'dashicons-businessman',
|
|
|
|
|
|
|
497 |
)
|
498 |
)
|
499 |
);
|
9 |
* Registers post types and taxonomies
|
10 |
*
|
11 |
* @class SP_Post_types
|
12 |
+
* @version 2.0
|
13 |
* @package SportsPress/Classes
|
14 |
* @category Class
|
15 |
* @author ThemeBoy
|
47 |
'search_items' => __( 'Search', 'sportspress' ),
|
48 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
49 |
);
|
50 |
+
$args = apply_filters( 'sportspress_register_taxonomy_league', array(
|
51 |
'label' => __( 'Competitions', 'sportspress' ),
|
52 |
'labels' => $labels,
|
53 |
'public' => true,
|
55 |
'show_tagcloud' => false,
|
56 |
'hierarchical' => true,
|
57 |
'rewrite' => array( 'slug' => get_option( 'sportspress_league_slug', 'league' ) ),
|
58 |
+
'show_in_rest' => true,
|
59 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
60 |
+
'rest_base' => 'leagues',
|
61 |
+
) );
|
62 |
$object_types = apply_filters( 'sportspress_league_object_types', array( 'sp_event', 'sp_calendar', 'sp_team', 'sp_table', 'sp_player', 'sp_list', 'sp_staff' ) );
|
63 |
register_taxonomy( 'sp_league', $object_types, $args );
|
64 |
foreach ( $object_types as $object_type ):
|
81 |
'search_items' => __( 'Search', 'sportspress' ),
|
82 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
83 |
);
|
84 |
+
$args = apply_filters( 'sportspress_register_taxonomy_season', array(
|
85 |
'label' => __( 'Seasons', 'sportspress' ),
|
86 |
'labels' => $labels,
|
87 |
'public' => true,
|
89 |
'show_tagcloud' => false,
|
90 |
'hierarchical' => true,
|
91 |
'rewrite' => array( 'slug' => get_option( 'sportspress_season_slug', 'season' ) ),
|
92 |
+
'show_in_rest' => true,
|
93 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
94 |
+
'rest_base' => 'seasons',
|
95 |
+
) );
|
96 |
$object_types = apply_filters( 'sportspress_season_object_types', array( 'sp_event', 'sp_calendar', 'sp_team', 'sp_table', 'sp_player', 'sp_list', 'sp_staff' ) );
|
97 |
register_taxonomy( 'sp_season', $object_types, $args );
|
98 |
foreach ( $object_types as $object_type ):
|
115 |
'search_items' => __( 'Search', 'sportspress' ),
|
116 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
117 |
);
|
118 |
+
$args = apply_filters( 'sportspress_register_taxonomy_venue', array(
|
119 |
'label' => __( 'Venues', 'sportspress' ),
|
120 |
'labels' => $labels,
|
121 |
'public' => true,
|
123 |
'show_tagcloud' => false,
|
124 |
'hierarchical' => true,
|
125 |
'rewrite' => array( 'slug' => get_option( 'sportspress_venue_slug', 'venue' ) ),
|
126 |
+
'show_in_rest' => true,
|
127 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
128 |
+
'rest_base' => 'venues',
|
129 |
+
) );
|
130 |
$object_types = apply_filters( 'sportspress_event_object_types', array( 'sp_event', 'sp_calendar', 'sp_team' ) );
|
131 |
register_taxonomy( 'sp_venue', $object_types, $args );
|
132 |
foreach ( $object_types as $object_type ):
|
149 |
'search_items' => __( 'Search', 'sportspress' ),
|
150 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
151 |
);
|
152 |
+
$args = apply_filters( 'sportspress_register_taxonomy_position', array(
|
153 |
'label' => __( 'Positions', 'sportspress' ),
|
154 |
'labels' => $labels,
|
155 |
'public' => true,
|
157 |
'show_tagcloud' => false,
|
158 |
'hierarchical' => true,
|
159 |
'rewrite' => array( 'slug' => get_option( 'sportspress_position_slug', 'position' ) ),
|
160 |
+
'show_in_rest' => true,
|
161 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
162 |
+
'rest_base' => 'positions',
|
163 |
+
) );
|
164 |
$object_types = apply_filters( 'sportspress_position_object_types', array( 'sp_player', 'sp_list' ) );
|
165 |
register_taxonomy( 'sp_position', $object_types, $args );
|
166 |
foreach ( $object_types as $object_type ):
|
183 |
'search_items' => __( 'Search', 'sportspress' ),
|
184 |
'not_found' => __( 'No results found.', 'sportspress' ),
|
185 |
);
|
186 |
+
$args = apply_filters( 'sportspress_register_taxonomy_role', array(
|
187 |
'label' => __( 'Jobs', 'sportspress' ),
|
188 |
'labels' => $labels,
|
189 |
'public' => true,
|
191 |
'show_tagcloud' => false,
|
192 |
'hierarchical' => true,
|
193 |
'rewrite' => array( 'slug' => get_option( 'sportspress_role_slug', 'role' ) ),
|
194 |
+
'show_in_rest' => true,
|
195 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
196 |
+
'rest_base' => 'roles',
|
197 |
+
) );
|
198 |
$object_types = apply_filters( 'sportspress_role_object_types', array( 'sp_staff' ) );
|
199 |
register_taxonomy( 'sp_role', $object_types, $args );
|
200 |
foreach ( $object_types as $object_type ):
|
236 |
'has_archive' => false,
|
237 |
'show_in_nav_menus' => false,
|
238 |
'can_export' => false,
|
239 |
+
'show_in_menu' => false,
|
240 |
)
|
241 |
)
|
242 |
);
|
266 |
'has_archive' => false,
|
267 |
'show_in_nav_menus' => false,
|
268 |
'can_export' => false,
|
269 |
+
'show_in_menu' => false,
|
270 |
)
|
271 |
)
|
272 |
);
|
296 |
'has_archive' => false,
|
297 |
'show_in_nav_menus' => false,
|
298 |
'can_export' => false,
|
299 |
+
'show_in_menu' => false,
|
300 |
)
|
301 |
)
|
302 |
);
|
326 |
'has_archive' => false,
|
327 |
'show_in_nav_menus' => false,
|
328 |
'can_export' => false,
|
329 |
+
'show_in_menu' => false,
|
330 |
)
|
331 |
)
|
332 |
);
|
336 |
array(
|
337 |
'labels' => array(
|
338 |
'name' => __( 'Player Performance', 'sportspress' ),
|
339 |
+
'menu_name' => __( 'Performance', 'sportspress' ),
|
340 |
'singular_name' => __( 'Player Performance', 'sportspress' ),
|
341 |
'add_new_item' => __( 'Add New Performance', 'sportspress' ),
|
342 |
'edit_item' => __( 'Edit Performance', 'sportspress' ),
|
357 |
'has_archive' => false,
|
358 |
'show_in_nav_menus' => false,
|
359 |
'can_export' => false,
|
360 |
+
'show_in_menu' => false,
|
361 |
)
|
362 |
)
|
363 |
);
|
367 |
array(
|
368 |
'labels' => array(
|
369 |
'name' => __( 'Player Statistics', 'sportspress' ),
|
370 |
+
'menu_name' => __( 'Statistics', 'sportspress' ),
|
371 |
'singular_name' => __( 'Statistic', 'sportspress' ),
|
372 |
'add_new_item' => __( 'Add New Statistic', 'sportspress' ),
|
373 |
'edit_item' => __( 'Edit Statistic', 'sportspress' ),
|
388 |
'has_archive' => false,
|
389 |
'show_in_nav_menus' => false,
|
390 |
'can_export' => false,
|
391 |
+
'show_in_menu' => false,
|
392 |
)
|
393 |
)
|
394 |
);
|
413 |
'exclude_from_search' => false,
|
414 |
'hierarchical' => false,
|
415 |
'rewrite' => array( 'slug' => get_option( 'sportspress_event_slug', 'event' ) ),
|
416 |
+
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt' ),
|
417 |
'has_archive' => false,
|
418 |
'show_in_nav_menus' => true,
|
419 |
'menu_icon' => 'dashicons-calendar',
|
420 |
+
'show_in_rest' => true,
|
421 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
422 |
+
'rest_base' => 'events',
|
423 |
);
|
424 |
|
425 |
if ( get_option( 'sportspress_event_comment_status', 'no' ) == 'yes' ):
|
450 |
'exclude_from_search' => false,
|
451 |
'hierarchical' => true,
|
452 |
'rewrite' => array( 'slug' => get_option( 'sportspress_team_slug', 'team' ) ),
|
453 |
+
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'excerpt' ),
|
454 |
'has_archive' => false,
|
455 |
'show_in_nav_menus' => true,
|
456 |
'menu_icon' => 'dashicons-shield-alt',
|
457 |
+
'show_in_rest' => true,
|
458 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
459 |
+
'rest_base' => 'teams',
|
460 |
)
|
461 |
)
|
462 |
);
|
483 |
'exclude_from_search' => false,
|
484 |
'hierarchical' => false,
|
485 |
'rewrite' => array( 'slug' => get_option( 'sportspress_player_slug', 'player' ) ),
|
486 |
+
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'page-attributes' ),
|
487 |
'has_archive' => false,
|
488 |
'show_in_nav_menus' => true,
|
489 |
'menu_icon' => 'dashicons-groups',
|
490 |
+
'show_in_rest' => true,
|
491 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
492 |
+
'rest_base' => 'players',
|
493 |
)
|
494 |
)
|
495 |
);
|
516 |
'exclude_from_search' => false,
|
517 |
'hierarchical' => false,
|
518 |
'rewrite' => array( 'slug' => get_option( 'sportspress_staff_slug', 'staff' ) ),
|
519 |
+
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt' ),
|
520 |
'has_archive' => false,
|
521 |
'show_in_nav_menus' => true,
|
522 |
'menu_icon' => 'dashicons-businessman',
|
523 |
+
'show_in_rest' => true,
|
524 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
525 |
+
'rest_base' => 'staff',
|
526 |
)
|
527 |
)
|
528 |
);
|
includes/class-sp-rest-api.php
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* REST API Class
|
4 |
-
*
|
5 |
-
* The SportsPress REST API class handles all API-related hooks.
|
6 |
-
*
|
7 |
-
* @class SP_REST_API
|
8 |
-
* @version 1.9.19
|
9 |
-
* @package SportsPress/Classes
|
10 |
-
* @category Class
|
11 |
-
* @package SportsPress/API
|
12 |
-
* @author ThemeBoy
|
13 |
-
*/
|
14 |
-
|
15 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
16 |
-
|
17 |
-
if ( ! class_exists( 'SP_REST_API' ) ) :
|
18 |
-
|
19 |
-
/**
|
20 |
-
* SP_REST_API Class
|
21 |
-
*/
|
22 |
-
class SP_REST_API {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Constructor.
|
26 |
-
*/
|
27 |
-
public function __construct() {
|
28 |
-
// Include required files
|
29 |
-
$this->includes();
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Include required files.
|
34 |
-
*/
|
35 |
-
private function includes() {
|
36 |
-
require_once dirname( __FILE__ ) . '/api/class-sp-rest-teams-controller.php';
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
endif;
|
41 |
-
|
42 |
-
return new SP_REST_API();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-sp-team.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* The SportsPress team class handles individual team data.
|
6 |
*
|
7 |
* @class SP_Team
|
8 |
-
* @version
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
@@ -160,7 +160,7 @@ class SP_Team extends SP_Custom_Post {
|
|
160 |
if ( $league_id ):
|
161 |
$args['tax_query'][] = array(
|
162 |
'taxonomy' => 'sp_league',
|
163 |
-
'field' => '
|
164 |
'terms' => $league_id
|
165 |
);
|
166 |
endif;
|
@@ -168,7 +168,7 @@ class SP_Team extends SP_Custom_Post {
|
|
168 |
if ( $div_id ):
|
169 |
$args['tax_query'][] = array(
|
170 |
'taxonomy' => 'sp_season',
|
171 |
-
'field' => '
|
172 |
'terms' => $div_id
|
173 |
);
|
174 |
endif;
|
@@ -394,8 +394,17 @@ class SP_Team extends SP_Custom_Post {
|
|
394 |
'posts_per_page' => -1,
|
395 |
'orderby' => 'menu_order',
|
396 |
'order' => 'ASC',
|
397 |
-
'
|
398 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
);
|
400 |
$lists = get_posts( $args );
|
401 |
|
5 |
* The SportsPress team class handles individual team data.
|
6 |
*
|
7 |
* @class SP_Team
|
8 |
+
* @version 2.0.13
|
9 |
* @package SportsPress/Classes
|
10 |
* @category Class
|
11 |
* @author ThemeBoy
|
160 |
if ( $league_id ):
|
161 |
$args['tax_query'][] = array(
|
162 |
'taxonomy' => 'sp_league',
|
163 |
+
'field' => 'term_id',
|
164 |
'terms' => $league_id
|
165 |
);
|
166 |
endif;
|
168 |
if ( $div_id ):
|
169 |
$args['tax_query'][] = array(
|
170 |
'taxonomy' => 'sp_season',
|
171 |
+
'field' => 'term_id',
|
172 |
'terms' => $div_id
|
173 |
);
|
174 |
endif;
|
394 |
'posts_per_page' => -1,
|
395 |
'orderby' => 'menu_order',
|
396 |
'order' => 'ASC',
|
397 |
+
'meta_query' => array(
|
398 |
+
'relation' => 'OR',
|
399 |
+
array(
|
400 |
+
'key' => 'sp_team',
|
401 |
+
'value' => $this->ID,
|
402 |
+
),
|
403 |
+
array(
|
404 |
+
'key' => 'sp_team',
|
405 |
+
'value' => '0',
|
406 |
+
),
|
407 |
+
),
|
408 |
);
|
409 |
$lists = get_posts( $args );
|
410 |
|
includes/class-sp-template-loader.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Template Loader
|
4 |
*
|
5 |
* @class SP_Template_Loader
|
6 |
-
* @version
|
7 |
* @package SportsPress/Classes
|
8 |
* @category Class
|
9 |
* @author ThemeBoy
|
@@ -24,10 +24,17 @@ class SP_Template_Loader {
|
|
24 |
add_filter( 'the_content', array( $this, 'staff_content' ) );
|
25 |
}
|
26 |
|
27 |
-
public function add_content( $content, $
|
28 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
if ( ! in_the_loop() ) return; // Return if not in main loop
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
if ( $content ) {
|
32 |
if ( $caption ) {
|
33 |
$content = '<h3 class="sp-post-caption">' . $caption . '</h3>' . $content;
|
@@ -36,30 +43,53 @@ class SP_Template_Loader {
|
|
36 |
$content = '<div class="sp-post-content">' . $content . '</div>';
|
37 |
}
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
echo $content;
|
63 |
|
64 |
return ob_get_clean();
|
65 |
}
|
3 |
* Template Loader
|
4 |
*
|
5 |
* @class SP_Template_Loader
|
6 |
+
* @version 2.0.7
|
7 |
* @package SportsPress/Classes
|
8 |
* @category Class
|
9 |
* @author ThemeBoy
|
24 |
add_filter( 'the_content', array( $this, 'staff_content' ) );
|
25 |
}
|
26 |
|
27 |
+
public function add_content( $content, $type, $position = 10, $caption = null ) {
|
28 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
if ( ! in_the_loop() ) return; // Return if not in main loop
|
30 |
|
31 |
+
// Return password form if required
|
32 |
+
if ( post_password_required() ) {
|
33 |
+
echo get_the_password_form();
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
|
37 |
+
// Prepend caption to content if given
|
38 |
if ( $content ) {
|
39 |
if ( $caption ) {
|
40 |
$content = '<h3 class="sp-post-caption">' . $caption . '</h3>' . $content;
|
43 |
$content = '<div class="sp-post-content">' . $content . '</div>';
|
44 |
}
|
45 |
|
46 |
+
global $wp_filter;
|
47 |
+
|
48 |
+
// Array of hooks associated with this post type
|
49 |
+
$hooks = array(
|
50 |
+
'sportspress_before_single_' . $type,
|
51 |
+
'sportspress_single_' . $type . '_content',
|
52 |
+
'sportspress_after_single_' . $type,
|
53 |
+
);
|
54 |
+
|
55 |
+
$actions = array();
|
56 |
+
|
57 |
+
// Find all actions associated with those hooks
|
58 |
+
foreach ( $hooks as $hook ) {
|
59 |
+
$priorities = sp_array_value( $wp_filter, $hook, array() );
|
60 |
+
|
61 |
+
foreach ( $priorities as $priority => $action ) {
|
62 |
+
$a = reset( $action );
|
63 |
+
$function = sp_array_value( $a, 'function', false );
|
64 |
+
remove_action( $hook, $function, $priority );
|
65 |
+
$actions[] = $function;
|
66 |
+
}
|
67 |
}
|
68 |
+
|
69 |
+
// Get layout setting
|
70 |
+
$layout = (array) get_option( 'sportspress_' . $type . '_template_order', array() );
|
71 |
+
|
72 |
+
// Combine layout setting with available templates
|
73 |
+
$templates = array_merge( array_flip( $layout ), SP()->templates->$type );
|
74 |
+
|
75 |
+
$templates = apply_filters( 'sportspress_' . $type . '_templates', $templates );
|
76 |
|
77 |
+
ob_start();
|
78 |
+
|
79 |
+
// Loop through templates
|
80 |
+
foreach ( $templates as $key => $template ) {
|
81 |
+
// Ignore templates that are unavailable or that have been turned off
|
82 |
+
if ( ! is_array( $template ) ) continue;
|
83 |
+
if ( ! isset( $template['option'] ) ) continue;
|
84 |
+
if ( 'yes' !== get_option( $template['option'], sp_array_value( $template, 'default', 'yes' ) ) ) continue;
|
85 |
+
|
86 |
+
// Render the template
|
87 |
+
if ( 'content' === $key ) {
|
88 |
+
echo $content;
|
89 |
+
} else {
|
90 |
+
call_user_func( $template['action'] );
|
91 |
+
}
|
92 |
+
}
|
|
|
93 |
|
94 |
return ob_get_clean();
|
95 |
}
|
includes/class-sp-templates.php
ADDED
@@ -0,0 +1,276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SportsPress templates
|
4 |
+
*
|
5 |
+
* The SportsPress templates class stores template layout data.
|
6 |
+
*
|
7 |
+
* @class SP_Templates
|
8 |
+
* @version 2.0
|
9 |
+
* @package SportsPress/Classes
|
10 |
+
* @category Class
|
11 |
+
* @author ThemeBoy
|
12 |
+
*/
|
13 |
+
class SP_Templates {
|
14 |
+
|
15 |
+
/** @var array Array of templates */
|
16 |
+
private $data = array();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Constructor for the templates class - defines all templates.
|
20 |
+
*
|
21 |
+
* @access public
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
+
public function __construct() {
|
25 |
+
$this->data = array(
|
26 |
+
'event' => array_merge(
|
27 |
+
apply_filters( 'sportspress_before_event_template', array(
|
28 |
+
'logos' => array(
|
29 |
+
'title' => __( 'Logos', 'sportspress' ),
|
30 |
+
'option' => 'sportspress_event_show_logos',
|
31 |
+
'action' => 'sportspress_output_event_logos',
|
32 |
+
'default' => 'yes',
|
33 |
+
),
|
34 |
+
'excerpt' => array(
|
35 |
+
'title' => __( 'Excerpt', 'sportspress' ),
|
36 |
+
'option' => 'sportspress_event_show_excerpt',
|
37 |
+
'action' => 'sportspress_output_post_excerpt',
|
38 |
+
'default' => 'yes',
|
39 |
+
),
|
40 |
+
) ),
|
41 |
+
|
42 |
+
array(
|
43 |
+
'content' => array(
|
44 |
+
'title' => __( 'Article', 'sportspress' ),
|
45 |
+
'option' => 'sportspress_event_show_content',
|
46 |
+
'action' => 'sportspress_output_event_content',
|
47 |
+
'default' => 'yes',
|
48 |
+
),
|
49 |
+
),
|
50 |
+
|
51 |
+
apply_filters( 'sportspress_after_event_template', array(
|
52 |
+
'video' => array(
|
53 |
+
'title' => __( 'Video', 'sportspress' ),
|
54 |
+
'option' => 'sportspress_event_show_video',
|
55 |
+
'action' => 'sportspress_output_event_video',
|
56 |
+
'default' => 'yes',
|
57 |
+
),
|
58 |
+
'details' => array(
|
59 |
+
'title' => __( 'Details', 'sportspress' ),
|
60 |
+
'option' => 'sportspress_event_show_details',
|
61 |
+
'action' => 'sportspress_output_event_details',
|
62 |
+
'default' => 'yes',
|
63 |
+
),
|
64 |
+
'venue' => array(
|
65 |
+
'title' => __( 'Venue', 'sportspress' ),
|
66 |
+
'option' => 'sportspress_event_show_venue',
|
67 |
+
'action' => 'sportspress_output_event_venue',
|
68 |
+
'default' => 'yes',
|
69 |
+
),
|
70 |
+
'results' => array(
|
71 |
+
'title' => __( 'Results', 'sportspress' ),
|
72 |
+
'option' => 'sportspress_event_show_results',
|
73 |
+
'action' => 'sportspress_output_event_results',
|
74 |
+
'default' => 'yes',
|
75 |
+
),
|
76 |
+
'performance' => array(
|
77 |
+
'title' => __( 'Box Score', 'sportspress' ),
|
78 |
+
'option' => 'sportspress_event_show_performance',
|
79 |
+
'action' => 'sportspress_output_event_performance',
|
80 |
+
'default' => 'yes',
|
81 |
+
),
|
82 |
+
) )
|
83 |
+
),
|
84 |
+
'calendar' => array_merge(
|
85 |
+
apply_filters( 'sportspress_before_calendar_template', array() ),
|
86 |
+
|
87 |
+
array(
|
88 |
+
'content' => array(
|
89 |
+
'title' => __( 'Description', 'sportspress' ),
|
90 |
+
'option' => 'sportspress_calendar_show_content',
|
91 |
+
'action' => 'sportspress_output_calendar_content',
|
92 |
+
'default' => 'yes',
|
93 |
+
),
|
94 |
+
),
|
95 |
+
|
96 |
+
apply_filters( 'sportspress_after_calendar_template', array(
|
97 |
+
'data' => array(
|
98 |
+
'title' => __( 'Calendar', 'sportspress' ),
|
99 |
+
'option' => 'sportspress_calendar_show_data',
|
100 |
+
'action' => 'sportspress_output_calendar',
|
101 |
+
'default' => 'yes',
|
102 |
+
),
|
103 |
+
) )
|
104 |
+
),
|
105 |
+
'team' => array_merge(
|
106 |
+
apply_filters( 'sportspress_before_team_template', array(
|
107 |
+
'logo' => array(
|
108 |
+
'title' => __( 'Logo', 'sportspress' ),
|
109 |
+
'option' => 'sportspress_team_show_logo',
|
110 |
+
'action' => 'sportspress_output_team_logo',
|
111 |
+
'default' => 'yes',
|
112 |
+
),
|
113 |
+
'excerpt' => array(
|
114 |
+
'title' => __( 'Excerpt', 'sportspress' ),
|
115 |
+
'option' => 'sportspress_team_show_excerpt',
|
116 |
+
'action' => 'sportspress_output_post_excerpt',
|
117 |
+
'default' => 'yes',
|
118 |
+
),
|
119 |
+
) ),
|
120 |
+
|
121 |
+
array(
|
122 |
+
'content' => array(
|
123 |
+
'title' => __( 'Profile', 'sportspress' ),
|
124 |
+
'option' => 'sportspress_team_show_content',
|
125 |
+
'action' => 'sportspress_output_team_content',
|
126 |
+
'default' => 'yes',
|
127 |
+
),
|
128 |
+
),
|
129 |
+
|
130 |
+
apply_filters( 'sportspress_after_team_template', array(
|
131 |
+
'link' => array(
|
132 |
+
'title' => __( 'Visit Site', 'sportspress' ),
|
133 |
+
'option' => 'sportspress_team_show_link',
|
134 |
+
'action' => 'sportspress_output_team_link',
|
135 |
+
'default' => 'no',
|
136 |
+
),
|
137 |
+
'details' => array(
|
138 |
+
'title' => __( 'Details', 'sportspress' ),
|
139 |
+
'option' => 'sportspress_team_show_details',
|
140 |
+
'action' => 'sportspress_output_team_details',
|
141 |
+
'default' => 'no',
|
142 |
+
),
|
143 |
+
'staff' => array(
|
144 |
+
'title' => __( 'Staff', 'sportspress' ),
|
145 |
+
'option' => 'sportspress_team_show_staff',
|
146 |
+
'action' => 'sportspress_output_team_staff',
|
147 |
+
'default' => 'yes',
|
148 |
+
),
|
149 |
+
) )
|
150 |
+
),
|
151 |
+
'table' => array_merge(
|
152 |
+
apply_filters( 'sportspress_before_table_template', array() ),
|
153 |
+
|
154 |
+
array(
|
155 |
+
'content' => array(
|
156 |
+
'title' => __( 'Description', 'sportspress' ),
|
157 |
+
'option' => 'sportspress_table_show_content',
|
158 |
+
'action' => 'sportspress_output_table_content',
|
159 |
+
'default' => 'yes',
|
160 |
+
),
|
161 |
+
),
|
162 |
+
|
163 |
+
apply_filters( 'sportspress_after_table_template', array(
|
164 |
+
'data' => array(
|
165 |
+
'title' => __( 'League Table', 'sportspress' ),
|
166 |
+
'option' => 'sportspress_table_show_data',
|
167 |
+
'action' => 'sportspress_output_league_table',
|
168 |
+
'default' => 'yes',
|
169 |
+
),
|
170 |
+
) )
|
171 |
+
),
|
172 |
+
'player' => array_merge(
|
173 |
+
apply_filters( 'sportspress_before_player_template', array(
|
174 |
+
'photo' => array(
|
175 |
+
'title' => __( 'Photo', 'sportspress' ),
|
176 |
+
'option' => 'sportspress_player_show_photo',
|
177 |
+
'action' => 'sportspress_output_player_photo',
|
178 |
+
'default' => 'yes',
|
179 |
+
),
|
180 |
+
'details' => array(
|
181 |
+
'title' => __( 'Details', 'sportspress' ),
|
182 |
+
'option' => 'sportspress_player_show_details',
|
183 |
+
'action' => 'sportspress_output_player_details',
|
184 |
+
'default' => 'yes',
|
185 |
+
),
|
186 |
+
'excerpt' => array(
|
187 |
+
'title' => __( 'Excerpt', 'sportspress' ),
|
188 |
+
'option' => 'sportspress_player_show_excerpt',
|
189 |
+
'action' => 'sportspress_output_post_excerpt',
|
190 |
+
'default' => 'yes',
|
191 |
+
),
|
192 |
+
) ),
|
193 |
+
|
194 |
+
array(
|
195 |
+
'content' => array(
|
196 |
+
'title' => __( 'Profile', 'sportspress' ),
|
197 |
+
'option' => 'sportspress_player_show_content',
|
198 |
+
'action' => 'sportspress_output_player_content',
|
199 |
+
'default' => 'yes',
|
200 |
+
),
|
201 |
+
),
|
202 |
+
|
203 |
+
apply_filters( 'sportspress_after_player_template', array(
|
204 |
+
'statistics' => array(
|
205 |
+
'title' => __( 'Statistics', 'sportspress' ),
|
206 |
+
'option' => 'sportspress_player_show_statistics',
|
207 |
+
'action' => 'sportspress_output_player_statistics',
|
208 |
+
'default' => 'yes',
|
209 |
+
),
|
210 |
+
) )
|
211 |
+
),
|
212 |
+
'list' => array_merge(
|
213 |
+
apply_filters( 'sportspress_before_list_template', array() ),
|
214 |
+
|
215 |
+
array(
|
216 |
+
'content' => array(
|
217 |
+
'title' => __( 'Description', 'sportspress' ),
|
218 |
+
'option' => 'sportspress_list_show_content',
|
219 |
+
'action' => 'sportspress_output_list_content',
|
220 |
+
'default' => 'yes',
|
221 |
+
),
|
222 |
+
),
|
223 |
+
|
224 |
+
apply_filters( 'sportspress_after_list_template', array(
|
225 |
+
'data' => array(
|
226 |
+
'title' => __( 'Player List', 'sportspress' ),
|
227 |
+
'option' => 'sportspress_list_show_data',
|
228 |
+
'action' => 'sportspress_output_player_list',
|
229 |
+
'default' => 'yes',
|
230 |
+
),
|
231 |
+
) )
|
232 |
+
),
|
233 |
+
'staff' => array_merge(
|
234 |
+
apply_filters( 'sportspress_before_staff_template', array(
|
235 |
+
'photo' => array(
|
236 |
+
'title' => __( 'Photo', 'sportspress' ),
|
237 |
+
'option' => 'sportspress_staff_show_photo',
|
238 |
+
'action' => 'sportspress_output_staff_photo',
|
239 |
+
'default' => 'yes',
|
240 |
+
),
|
241 |
+
'details' => array(
|
242 |
+
'title' => __( 'Details', 'sportspress' ),
|
243 |
+
'option' => 'sportspress_staff_show_details',
|
244 |
+
'action' => 'sportspress_output_staff_details',
|
245 |
+
'default' => 'yes',
|
246 |
+
),
|
247 |
+
'excerpt' => array(
|
248 |
+
'title' => __( 'Excerpt', 'sportspress' ),
|
249 |
+
'option' => 'sportspress_staff_show_excerpt',
|
250 |
+
'action' => 'sportspress_output_post_excerpt',
|
251 |
+
'default' => 'yes',
|
252 |
+
),
|
253 |
+
) ),
|
254 |
+
|
255 |
+
array(
|
256 |
+
'content' => array(
|
257 |
+
'title' => __( 'Profile', 'sportspress' ),
|
258 |
+
'option' => 'sportspress_staff_show_content',
|
259 |
+
'action' => 'sportspress_output_staff_content',
|
260 |
+
'default' => 'yes',
|
261 |
+
),
|
262 |
+
),
|
263 |
+
|
264 |
+
apply_filters( 'sportspress_after_staff_template', array() )
|
265 |
+
),
|
266 |
+
);
|
267 |
+
}
|
268 |
+
|
269 |
+
public function __get( $key ) {
|
270 |
+
return ( array_key_exists( $key, $this->data ) ? $this->data[ $key ] : array() );
|
271 |
+
}
|
272 |
+
|
273 |
+
public function __set( $key, $value ){
|
274 |
+
$this->data[ $key ] = $value;
|
275 |
+
}
|
276 |
+
}
|
includes/sp-api-functions.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
-
* @version
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -21,8 +21,17 @@ function sp_get_time( $post = 0, $format = null ) {
|
|
21 |
return get_post_time( $format, false, $post, true );
|
22 |
}
|
23 |
|
24 |
-
function sp_the_time( $post = 0 ) {
|
25 |
-
echo sp_get_time( $post );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
function sp_get_posts( $post_type = 'post', $args = array() ) {
|
@@ -46,6 +55,28 @@ function sp_get_seasons( $post = 0, $ids = true ) {
|
|
46 |
return $terms;
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
/*
|
50 |
* Event functions
|
51 |
*/
|
@@ -200,7 +231,7 @@ function sp_get_logo_url( $post = 0, $size = 'icon' ) {
|
|
200 |
}
|
201 |
|
202 |
function sp_get_abbreviation( $post = 0 ) {
|
203 |
-
return get_post_meta
|
204 |
}
|
205 |
|
206 |
function sp_get_venues( $post = 0, $ids = true ) {
|
@@ -209,6 +240,17 @@ function sp_get_venues( $post = 0, $ids = true ) {
|
|
209 |
return $terms;
|
210 |
}
|
211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
function sp_is_home_venue( $post = 0, $event = 0 ) {
|
213 |
$pv = sp_get_venues( $post );
|
214 |
$ev = sp_get_venues( $event );
|
@@ -231,6 +273,27 @@ function sp_team_logo( $post = 0 ) {
|
|
231 |
sp_get_template( 'team-logo.php', array( 'id' => $post ) );
|
232 |
}
|
233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
function sp_team_details( $post = 0 ) {
|
235 |
sp_get_template( 'team-details.php', array( 'id' => $post ) );
|
236 |
}
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
+
* @version 2.0
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
21 |
return get_post_time( $format, false, $post, true );
|
22 |
}
|
23 |
|
24 |
+
function sp_the_time( $post = 0, $format = null ) {
|
25 |
+
echo sp_get_time( $post, $format );
|
26 |
+
}
|
27 |
+
|
28 |
+
function sp_get_date( $post = 0, $format = null ) {
|
29 |
+
if ( null == $format ) $format = get_option( 'date_format' );
|
30 |
+
return get_post_time( $format, false, $post, true );
|
31 |
+
}
|
32 |
+
|
33 |
+
function sp_the_date( $post = 0, $format = null ) {
|
34 |
+
echo sp_get_date( $post, $format );
|
35 |
}
|
36 |
|
37 |
function sp_get_posts( $post_type = 'post', $args = array() ) {
|
55 |
return $terms;
|
56 |
}
|
57 |
|
58 |
+
function sp_the_leagues( $post = 0, $delimiter = ', ' ) {
|
59 |
+
$terms = sp_get_leagues( $post, false );
|
60 |
+
$arr = array();
|
61 |
+
if ( $terms ) {
|
62 |
+
foreach ( $terms as $term ):
|
63 |
+
$arr[] = $term->name;
|
64 |
+
endforeach;
|
65 |
+
}
|
66 |
+
echo implode( $delimiter, $arr );
|
67 |
+
}
|
68 |
+
|
69 |
+
function sp_the_seasons( $post = 0, $delimiter = ', ' ) {
|
70 |
+
$terms = sp_get_seasons( $post, false );
|
71 |
+
$arr = array();
|
72 |
+
if ( $terms ) {
|
73 |
+
foreach ( $terms as $term ):
|
74 |
+
$arr[] = $term->name;
|
75 |
+
endforeach;
|
76 |
+
}
|
77 |
+
echo implode( $delimiter, $arr );
|
78 |
+
}
|
79 |
+
|
80 |
/*
|
81 |
* Event functions
|
82 |
*/
|
231 |
}
|
232 |
|
233 |
function sp_get_abbreviation( $post = 0 ) {
|
234 |
+
return get_post_meta( $post, 'sp_abbreviation', true );
|
235 |
}
|
236 |
|
237 |
function sp_get_venues( $post = 0, $ids = true ) {
|
240 |
return $terms;
|
241 |
}
|
242 |
|
243 |
+
function sp_the_venues( $post = 0, $delimiter = ', ' ) {
|
244 |
+
$terms = sp_get_venues( $post, false );
|
245 |
+
$arr = array();
|
246 |
+
if ( $terms ) {
|
247 |
+
foreach ( $terms as $term ):
|
248 |
+
$arr[] = $term->name;
|
249 |
+
endforeach;
|
250 |
+
}
|
251 |
+
echo implode( $delimiter, $arr );
|
252 |
+
}
|
253 |
+
|
254 |
function sp_is_home_venue( $post = 0, $event = 0 ) {
|
255 |
$pv = sp_get_venues( $post );
|
256 |
$ev = sp_get_venues( $event );
|
273 |
sp_get_template( 'team-logo.php', array( 'id' => $post ) );
|
274 |
}
|
275 |
|
276 |
+
function sp_get_short_name( $post = 0 ) {
|
277 |
+
$abbreviation = sp_get_abbreviation( $post, 'sp_abbreviation', true );
|
278 |
+
if ( $abbreviation ) {
|
279 |
+
return $abbreviation;
|
280 |
+
} else {
|
281 |
+
return get_the_title( $post );
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
function sp_short_name( $post = 0 ) {
|
286 |
+
echo sp_get_short_name( $post );
|
287 |
+
}
|
288 |
+
|
289 |
+
function sp_get_team_name( $post = 0, $short = true ) {
|
290 |
+
if ( $short ) {
|
291 |
+
return sp_get_short_name( $post );
|
292 |
+
} else {
|
293 |
+
return get_the_title( $post );
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
function sp_team_details( $post = 0 ) {
|
298 |
sp_get_template( 'team-details.php', array( 'id' => $post ) );
|
299 |
}
|
includes/sp-conditional-functions.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
-
* @version
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -78,7 +78,7 @@ if ( ! function_exists( 'sp_config_types' ) ) {
|
|
78 |
*/
|
79 |
if ( ! function_exists( 'sp_taxonomies' ) ) {
|
80 |
function sp_taxonomies() {
|
81 |
-
return apply_filters( 'sportspress_taxonomies', array( 'sp_league', 'sp_season', 'sp_venue', 'sp_position' ) );
|
82 |
}
|
83 |
}
|
84 |
|
@@ -138,6 +138,24 @@ if ( ! function_exists( 'is_sp_config_type' ) ) {
|
|
138 |
}
|
139 |
}
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
if ( ! function_exists( 'is_ajax' ) ) {
|
142 |
|
143 |
/**
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
+
* @version 2.0
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
78 |
*/
|
79 |
if ( ! function_exists( 'sp_taxonomies' ) ) {
|
80 |
function sp_taxonomies() {
|
81 |
+
return apply_filters( 'sportspress_taxonomies', array( 'sp_league', 'sp_season', 'sp_venue', 'sp_position', 'sp_role' ) );
|
82 |
}
|
83 |
}
|
84 |
|
138 |
}
|
139 |
}
|
140 |
|
141 |
+
/**
|
142 |
+
* is_sp_taxonomy - Returns true if post is SportsPress taxonomy
|
143 |
+
*
|
144 |
+
* @access public
|
145 |
+
* @return bool
|
146 |
+
*/
|
147 |
+
if ( ! function_exists( 'is_sp_taxonomy' ) ) {
|
148 |
+
function is_sp_taxonomy( $typenow = null ) {
|
149 |
+
if ( $typenow == null ) global $typenow;
|
150 |
+
|
151 |
+
$taxonomies = sp_taxonomies();
|
152 |
+
|
153 |
+
if ( in_array( $typenow, $taxonomies ) )
|
154 |
+
return true;
|
155 |
+
return false;
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
if ( ! function_exists( 'is_ajax' ) ) {
|
160 |
|
161 |
/**
|
includes/sp-core-functions.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
-
* @version
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -482,7 +482,25 @@ if ( !function_exists( 'sp_get_format_placeholder' ) ) {
|
|
482 |
) );
|
483 |
return sp_array_value( $placeholders, $key, 0 );
|
484 |
}
|
485 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
|
487 |
if ( !function_exists( 'sp_dropdown_statuses' ) ) {
|
488 |
function sp_dropdown_statuses( $args = array() ) {
|
@@ -1253,16 +1271,16 @@ if ( !function_exists( 'sp_sort_table_teams' ) ) {
|
|
1253 |
|
1254 |
if ( !function_exists( 'sp_get_next_event' ) ) {
|
1255 |
function sp_get_next_event( $args = array() ) {
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
}
|
1267 |
}
|
1268 |
|
@@ -1313,20 +1331,19 @@ if ( !function_exists( 'sp_taxonomy_field' ) ) {
|
|
1313 |
function sp_get_text_options() {
|
1314 |
$strings = apply_filters( 'sportspress_text', array(
|
1315 |
__( 'Article', 'sportspress' ),
|
1316 |
-
__( '
|
1317 |
__( 'Career Total', 'sportspress' ),
|
|
|
1318 |
__( 'Current Team', 'sportspress' ),
|
1319 |
-
__( 'Current Teams', 'sportspress' ),
|
1320 |
__( 'Date', 'sportspress' ),
|
1321 |
__( 'Defense', 'sportspress' ),
|
1322 |
__( 'Details', 'sportspress' ),
|
1323 |
__( 'Event', 'sportspress' ),
|
1324 |
-
__( '
|
1325 |
__( 'Nationality', 'sportspress' ),
|
1326 |
__( 'Offense', 'sportspress' ),
|
1327 |
__( 'Outcome', 'sportspress' ),
|
1328 |
__( 'Past Teams', 'sportspress' ),
|
1329 |
-
__( 'Played', 'sportspress' ),
|
1330 |
__( 'Player', 'sportspress' ),
|
1331 |
__( 'Pos', 'sportspress' ),
|
1332 |
__( 'Position', 'sportspress' ),
|
@@ -1336,7 +1353,6 @@ function sp_get_text_options() {
|
|
1336 |
__( 'Results', 'sportspress' ),
|
1337 |
__( 'Season', 'sportspress' ),
|
1338 |
__( 'Staff', 'sportspress' ),
|
1339 |
-
__( 'Substitutes', 'sportspress' ),
|
1340 |
__( 'Team', 'sportspress' ),
|
1341 |
__( 'Teams', 'sportspress' ),
|
1342 |
__( 'Time', 'sportspress' ),
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
+
* @version 2.0.9
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
482 |
) );
|
483 |
return sp_array_value( $placeholders, $key, 0 );
|
484 |
}
|
485 |
+
}
|
486 |
+
|
487 |
+
if ( !function_exists( 'sp_get_term_sections' ) ) {
|
488 |
+
function sp_get_term_sections( $t_id ) {
|
489 |
+
$term_meta = get_option( "taxonomy_$t_id" );
|
490 |
+
if ( isset( $term_meta['sp_sections'] ) ) {
|
491 |
+
$sections = $term_meta['sp_sections'];
|
492 |
+
} else {
|
493 |
+
$sections = apply_filters( 'sportspress_performance_sections', array( 0 => __( 'Offense', 'sportspress' ), 1 => __( 'Defense', 'sportspress' ) ) );
|
494 |
+
$sections = array_keys( $sections );
|
495 |
+
}
|
496 |
+
|
497 |
+
if ( '' === $sections ) {
|
498 |
+
$sections = array();
|
499 |
+
}
|
500 |
+
|
501 |
+
return $sections;
|
502 |
+
}
|
503 |
+
}
|
504 |
|
505 |
if ( !function_exists( 'sp_dropdown_statuses' ) ) {
|
506 |
function sp_dropdown_statuses( $args = array() ) {
|
1271 |
|
1272 |
if ( !function_exists( 'sp_get_next_event' ) ) {
|
1273 |
function sp_get_next_event( $args = array() ) {
|
1274 |
+
$options = array(
|
1275 |
+
'post_type' => 'sp_event',
|
1276 |
+
'posts_per_page' => 1,
|
1277 |
+
'order' => 'ASC',
|
1278 |
+
'post_status' => 'future',
|
1279 |
+
);
|
1280 |
+
$options = array_merge( $options, $args );
|
1281 |
+
$posts = get_posts( $options );
|
1282 |
+
if ( $posts && is_array( $posts ) ) return array_pop( $posts );
|
1283 |
+
else return false;
|
1284 |
}
|
1285 |
}
|
1286 |
|
1331 |
function sp_get_text_options() {
|
1332 |
$strings = apply_filters( 'sportspress_text', array(
|
1333 |
__( 'Article', 'sportspress' ),
|
1334 |
+
__( 'Box Score', 'sportspress' ),
|
1335 |
__( 'Career Total', 'sportspress' ),
|
1336 |
+
__( 'Competition', 'sportspress' ),
|
1337 |
__( 'Current Team', 'sportspress' ),
|
|
|
1338 |
__( 'Date', 'sportspress' ),
|
1339 |
__( 'Defense', 'sportspress' ),
|
1340 |
__( 'Details', 'sportspress' ),
|
1341 |
__( 'Event', 'sportspress' ),
|
1342 |
+
__( 'Fixtures', 'sportspress' ),
|
1343 |
__( 'Nationality', 'sportspress' ),
|
1344 |
__( 'Offense', 'sportspress' ),
|
1345 |
__( 'Outcome', 'sportspress' ),
|
1346 |
__( 'Past Teams', 'sportspress' ),
|
|
|
1347 |
__( 'Player', 'sportspress' ),
|
1348 |
__( 'Pos', 'sportspress' ),
|
1349 |
__( 'Position', 'sportspress' ),
|
1353 |
__( 'Results', 'sportspress' ),
|
1354 |
__( 'Season', 'sportspress' ),
|
1355 |
__( 'Staff', 'sportspress' ),
|
|
|
1356 |
__( 'Team', 'sportspress' ),
|
1357 |
__( 'Teams', 'sportspress' ),
|
1358 |
__( 'Time', 'sportspress' ),
|
includes/sp-template-functions.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
-
* @version
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -48,11 +48,16 @@ function sp_body_class( $classes ) {
|
|
48 |
|
49 |
if ( 'sp_event' == $post_type ) {
|
50 |
$id = get_the_ID();
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
53 |
}
|
54 |
if ( 'results' == sp_get_status( $id ) ) {
|
55 |
-
|
|
|
|
|
56 |
}
|
57 |
} elseif ( 'sp_team' == $post_type && 'yes' == get_option( 'sportspress_team_show_logo', 'yes' ) ) {
|
58 |
$classes[] = 'sp-show-image';
|
@@ -298,6 +303,19 @@ if ( ! function_exists( 'sportspress_output_team_lists' ) ) {
|
|
298 |
sp_get_template( 'team-lists.php' );
|
299 |
}
|
300 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
|
302 |
/** Single League Table ********************************************************/
|
303 |
|
7 |
* @author ThemeBoy
|
8 |
* @category Core
|
9 |
* @package SportsPress/Functions
|
10 |
+
* @version 2.0
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
48 |
|
49 |
if ( 'sp_event' == $post_type ) {
|
50 |
$id = get_the_ID();
|
51 |
+
$show_venue = get_option( 'sportspress_event_show_venue', 'yes' ) == 'yes' ? true : false;
|
52 |
+
if ( $show_venue && get_the_terms( $id, 'sp_venue' ) ) {
|
53 |
+
if ( get_option( 'sportspress_event_show_maps', 'yes' ) == 'yes' ) {
|
54 |
+
$classes[] = 'sp-has-venue';
|
55 |
+
}
|
56 |
}
|
57 |
if ( 'results' == sp_get_status( $id ) ) {
|
58 |
+
if ( get_option( 'sportspress_event_show_results', 'yes' ) == 'yes' ) {
|
59 |
+
$classes[] = 'sp-has-results';
|
60 |
+
}
|
61 |
}
|
62 |
} elseif ( 'sp_team' == $post_type && 'yes' == get_option( 'sportspress_team_show_logo', 'yes' ) ) {
|
63 |
$classes[] = 'sp-show-image';
|
303 |
sp_get_template( 'team-lists.php' );
|
304 |
}
|
305 |
}
|
306 |
+
if ( ! function_exists( 'sportspress_output_team_events' ) ) {
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Output the team events.
|
310 |
+
*
|
311 |
+
* @access public
|
312 |
+
* @subpackage Team/Events
|
313 |
+
* @return void
|
314 |
+
*/
|
315 |
+
function sportspress_output_team_events() {
|
316 |
+
sp_get_template( 'team-events.php' );
|
317 |
+
}
|
318 |
+
}
|
319 |
|
320 |
/** Single League Table ********************************************************/
|
321 |
|
includes/sp-template-hooks.php
CHANGED
@@ -75,18 +75,14 @@ add_action( 'sportspress_before_single_team', 'sportspress_output_post_excerpt',
|
|
75 |
* @see sportspress_output_team_staff()
|
76 |
* @see sportspress_output_team_lists()
|
77 |
* @see sportspress_output_team_tables()
|
|
|
78 |
*/
|
79 |
add_action( 'sportspress_single_team_content', 'sportspress_output_team_link', 0 );
|
80 |
add_action( 'sportspress_single_team_content', 'sportspress_output_team_details', 10 );
|
81 |
add_action( 'sportspress_single_team_content', 'sportspress_output_team_staff', 15 );
|
82 |
add_action( 'sportspress_single_team_content', 'sportspress_output_team_lists', 20 );
|
83 |
add_action( 'sportspress_single_team_content', 'sportspress_output_team_tables', 30 );
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Before Single Table
|
87 |
-
* @see sportspress_output_post_excerpt()
|
88 |
-
*/
|
89 |
-
add_action( 'sportspress_before_single_table', 'sportspress_output_post_excerpt', 20 );
|
90 |
|
91 |
/**
|
92 |
* Single Table Content
|
@@ -272,18 +268,6 @@ function sportspress_team_permalink( $permalink, $post ) {
|
|
272 |
}
|
273 |
add_filter( 'post_type_link', 'sportspress_team_permalink', 10, 2 );
|
274 |
|
275 |
-
function sportspress_abbreviate_team( $title, $id = null ) {
|
276 |
-
if ( ! is_admin() && 'sp_team' == get_post_type( $id ) && get_option( 'sportspress_abbreviate_teams', 'yes' ) == 'yes' ):
|
277 |
-
if ( in_the_loop() && get_the_ID() == $id ) return $title;
|
278 |
-
$abbreviation = get_post_meta( $id, 'sp_abbreviation', true );
|
279 |
-
if ( ! empty( $abbreviation ) ):
|
280 |
-
return $abbreviation;
|
281 |
-
endif;
|
282 |
-
endif;
|
283 |
-
return $title;
|
284 |
-
}
|
285 |
-
add_filter( 'the_title', 'sportspress_abbreviate_team', 10, 2 );
|
286 |
-
|
287 |
function sportspress_no_terms_links( $term_list, $taxonomy ) {
|
288 |
|
289 |
if ( in_array( $taxonomy, array( 'sp_league', 'sp_season', 'sp_position', 'sp_role' ) ) )
|
@@ -293,6 +277,20 @@ function sportspress_no_terms_links( $term_list, $taxonomy ) {
|
|
293 |
}
|
294 |
add_filter( 'the_terms', 'sportspress_no_terms_links', 10, 2 );
|
295 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
function sportspress_pre_get_posts( $query ) {
|
297 |
$post_type = sp_array_value( $query->query, 'post_type', null );
|
298 |
|
@@ -311,7 +309,8 @@ function sportspress_pre_get_posts( $query ) {
|
|
311 |
endif;
|
312 |
else:
|
313 |
if ( isset( $query->query[ 'sp_venue' ] ) ):
|
314 |
-
|
|
|
315 |
endif;
|
316 |
endif;
|
317 |
|
75 |
* @see sportspress_output_team_staff()
|
76 |
* @see sportspress_output_team_lists()
|
77 |
* @see sportspress_output_team_tables()
|
78 |
+
* @see sportspress_output_team_events()
|
79 |
*/
|
80 |
add_action( 'sportspress_single_team_content', 'sportspress_output_team_link', 0 );
|
81 |
add_action( 'sportspress_single_team_content', 'sportspress_output_team_details', 10 );
|
82 |
add_action( 'sportspress_single_team_content', 'sportspress_output_team_staff', 15 );
|
83 |
add_action( 'sportspress_single_team_content', 'sportspress_output_team_lists', 20 );
|
84 |
add_action( 'sportspress_single_team_content', 'sportspress_output_team_tables', 30 );
|
85 |
+
add_action( 'sportspress_single_team_content', 'sportspress_output_team_events', 40 );
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
/**
|
88 |
* Single Table Content
|
268 |
}
|
269 |
add_filter( 'post_type_link', 'sportspress_team_permalink', 10, 2 );
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
function sportspress_no_terms_links( $term_list, $taxonomy ) {
|
272 |
|
273 |
if ( in_array( $taxonomy, array( 'sp_league', 'sp_season', 'sp_position', 'sp_role' ) ) )
|
277 |
}
|
278 |
add_filter( 'the_terms', 'sportspress_no_terms_links', 10, 2 );
|
279 |
|
280 |
+
function sportspress_strcmp_term_slug( $a, $b ) {
|
281 |
+
return strcmp( $a->slug, $b->slug );
|
282 |
+
}
|
283 |
+
|
284 |
+
function sportspress_term_order( $terms, $post_id, $taxonomy ) {
|
285 |
+
|
286 |
+
if ( is_sp_taxonomy( $taxonomy ) ) {
|
287 |
+
uasort( $terms, 'sportspress_strcmp_term_slug' );
|
288 |
+
}
|
289 |
+
|
290 |
+
return $terms;
|
291 |
+
}
|
292 |
+
add_filter( 'get_the_terms', 'sportspress_term_order', 10, 3 );
|
293 |
+
|
294 |
function sportspress_pre_get_posts( $query ) {
|
295 |
$post_type = sp_array_value( $query->query, 'post_type', null );
|
296 |
|
309 |
endif;
|
310 |
else:
|
311 |
if ( isset( $query->query[ 'sp_venue' ] ) ):
|
312 |
+
$query->set( 'post_type', 'sp_event' );
|
313 |
+
$GLOBALS[ 'wp_post_statuses' ][ 'future' ]->public = true;
|
314 |
endif;
|
315 |
endif;
|
316 |
|
languages/sportspress.pot
CHANGED
@@ -116,7 +116,7 @@ msgstr ""
|
|
116 |
#: includes/admin/settings/class-sp-settings-events.php:303
|
117 |
#: includes/sp-core-functions.php:1316 modules/sportspress-tutorials.php:93
|
118 |
#: templates/event-performance.php:108
|
119 |
-
msgid "
|
120 |
msgstr ""
|
121 |
|
122 |
#: assets/js/admin/editor-lang.php:31
|
116 |
#: includes/admin/settings/class-sp-settings-events.php:303
|
117 |
#: includes/sp-core-functions.php:1316 modules/sportspress-tutorials.php:93
|
118 |
#: templates/event-performance.php:108
|
119 |
+
msgid "Box Score"
|
120 |
msgstr ""
|
121 |
|
122 |
#: assets/js/admin/editor-lang.php:31
|
modules/sportspress-birthdays.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Add birthdays to players and staff.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
-
Version:
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Birthdays' ) ) :
|
|
17 |
* Main SportsPress Birthdays Class
|
18 |
*
|
19 |
* @class SportsPress_Birthdays
|
20 |
-
* @version
|
21 |
*/
|
22 |
class SportsPress_Birthdays {
|
23 |
|
@@ -29,6 +29,7 @@ class SportsPress_Birthdays {
|
|
29 |
$this->define_constants();
|
30 |
|
31 |
add_filter( 'gettext', array( $this, 'gettext' ), 20, 3 );
|
|
|
32 |
add_filter( 'sportspress_player_options', array( $this, 'add_player_options' ) );
|
33 |
add_filter( 'sportspress_staff_options', array( $this, 'add_staff_options' ) );
|
34 |
add_filter( 'sportspress_player_details', array( $this, 'add_player_details' ), 20, 2 );
|
@@ -42,7 +43,7 @@ class SportsPress_Birthdays {
|
|
42 |
*/
|
43 |
private function define_constants() {
|
44 |
if ( !defined( 'SP_BIRTHDAYS_VERSION' ) )
|
45 |
-
define( 'SP_BIRTHDAYS_VERSION', '
|
46 |
|
47 |
if ( !defined( 'SP_BIRTHDAYS_URL' ) )
|
48 |
define( 'SP_BIRTHDAYS_URL', plugin_dir_url( __FILE__ ) );
|
@@ -80,6 +81,16 @@ class SportsPress_Birthdays {
|
|
80 |
return $translated_text;
|
81 |
}
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
/**
|
84 |
* Add options to player settings page.
|
85 |
*
|
5 |
Description: Add birthdays to players and staff.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.0.8
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress Birthdays Class
|
18 |
*
|
19 |
* @class SportsPress_Birthdays
|
20 |
+
* @version 2.0.8
|
21 |
*/
|
22 |
class SportsPress_Birthdays {
|
23 |
|
29 |
$this->define_constants();
|
30 |
|
31 |
add_filter( 'gettext', array( $this, 'gettext' ), 20, 3 );
|
32 |
+
add_filter( 'sportspress_text', array( $this, 'add_text_options' ) );
|
33 |
add_filter( 'sportspress_player_options', array( $this, 'add_player_options' ) );
|
34 |
add_filter( 'sportspress_staff_options', array( $this, 'add_staff_options' ) );
|
35 |
add_filter( 'sportspress_player_details', array( $this, 'add_player_details' ), 20, 2 );
|
43 |
*/
|
44 |
private function define_constants() {
|
45 |
if ( !defined( 'SP_BIRTHDAYS_VERSION' ) )
|
46 |
+
define( 'SP_BIRTHDAYS_VERSION', '2.0.8' );
|
47 |
|
48 |
if ( !defined( 'SP_BIRTHDAYS_URL' ) )
|
49 |
define( 'SP_BIRTHDAYS_URL', plugin_dir_url( __FILE__ ) );
|
81 |
return $translated_text;
|
82 |
}
|
83 |
|
84 |
+
/**
|
85 |
+
* Add text options
|
86 |
+
*/
|
87 |
+
public function add_text_options( $options = array() ) {
|
88 |
+
return array_merge( $options, array(
|
89 |
+
__( 'Age', 'sportspress' ),
|
90 |
+
__( 'Birthday', 'sportspress' ),
|
91 |
+
) );
|
92 |
+
}
|
93 |
+
|
94 |
/**
|
95 |
* Add options to player settings page.
|
96 |
*
|
modules/sportspress-calendars.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Add event calendars to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
-
Version:
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Calendars' ) ) :
|
|
17 |
* Main SportsPress Calendars Class
|
18 |
*
|
19 |
* @class SportsPress_Calendars
|
20 |
-
* @version
|
21 |
*/
|
22 |
class SportsPress_Calendars {
|
23 |
|
@@ -33,11 +33,15 @@ class SportsPress_Calendars {
|
|
33 |
add_action( 'add_meta_boxes', array( $this, 'remove_meta_boxes' ), 10 );
|
34 |
add_action( 'sportspress_include_post_type_handlers', array( $this, 'include_post_type_handler' ) );
|
35 |
add_action( 'sportspress_widgets', array( $this, 'include_widgets' ) );
|
|
|
|
|
36 |
|
37 |
// Filters
|
38 |
add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
|
39 |
add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) );
|
40 |
-
add_filter( 'sportspress_event_settings', array( $this, '
|
|
|
|
|
41 |
}
|
42 |
|
43 |
/**
|
@@ -45,7 +49,7 @@ class SportsPress_Calendars {
|
|
45 |
*/
|
46 |
private function define_constants() {
|
47 |
if ( !defined( 'SP_CALENDARS_VERSION' ) )
|
48 |
-
define( 'SP_CALENDARS_VERSION', '
|
49 |
|
50 |
if ( !defined( 'SP_CALENDARS_URL' ) )
|
51 |
define( 'SP_CALENDARS_URL', plugin_dir_url( __FILE__ ) );
|
@@ -80,11 +84,14 @@ class SportsPress_Calendars {
|
|
80 |
'exclude_from_search' => false,
|
81 |
'hierarchical' => false,
|
82 |
'rewrite' => array( 'slug' => get_option( 'sportspress_calendar_slug', 'calendar' ) ),
|
83 |
-
'supports' => array( 'title', 'author', 'thumbnail' ),
|
84 |
'has_archive' => false,
|
85 |
'show_in_nav_menus' => true,
|
86 |
-
'show_in_menu'
|
87 |
'show_in_admin_bar' => true,
|
|
|
|
|
|
|
88 |
)
|
89 |
)
|
90 |
);
|
@@ -108,8 +115,6 @@ class SportsPress_Calendars {
|
|
108 |
|
109 |
/**
|
110 |
* Add widgets.
|
111 |
-
*
|
112 |
-
* @return array
|
113 |
*/
|
114 |
public function include_widgets() {
|
115 |
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-event-calendar.php' );
|
@@ -117,6 +122,50 @@ class SportsPress_Calendars {
|
|
117 |
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-event-blocks.php' );
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
/**
|
121 |
* Add meta boxes to calendars.
|
122 |
*
|
@@ -157,12 +206,6 @@ class SportsPress_Calendars {
|
|
157 |
'context' => 'normal',
|
158 |
'priority' => 'high',
|
159 |
),
|
160 |
-
'editor' => array(
|
161 |
-
'title' => __( 'Description', 'sportspress' ),
|
162 |
-
'output' => 'SP_Meta_Box_Calendar_Editor::output',
|
163 |
-
'context' => 'normal',
|
164 |
-
'priority' => 'low',
|
165 |
-
),
|
166 |
);
|
167 |
return $meta_boxes;
|
168 |
}
|
@@ -180,11 +223,11 @@ class SportsPress_Calendars {
|
|
180 |
}
|
181 |
|
182 |
/**
|
183 |
-
* Add settings.
|
184 |
*
|
185 |
* @return array
|
186 |
*/
|
187 |
-
public function
|
188 |
$settings = array_merge( $settings,
|
189 |
array(
|
190 |
array( 'title' => __( 'Event List', 'sportspress' ), 'type' => 'title', 'id' => 'event_list_options' ),
|
@@ -268,6 +311,14 @@ class SportsPress_Calendars {
|
|
268 |
'type' => 'checkbox',
|
269 |
),
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
array(
|
272 |
'title' => __( 'Details', 'sportspress' ),
|
273 |
'desc' => __( 'Display competition', 'sportspress' ),
|
@@ -305,7 +356,7 @@ class SportsPress_Calendars {
|
|
305 |
'title' => __( 'Limit', 'sportspress' ),
|
306 |
'id' => 'sportspress_event_blocks_rows',
|
307 |
'class' => 'small-text',
|
308 |
-
'default' => '
|
309 |
'desc' => __( 'events', 'sportspress' ),
|
310 |
'type' => 'number',
|
311 |
'custom_attributes' => array(
|
@@ -321,6 +372,44 @@ class SportsPress_Calendars {
|
|
321 |
);
|
322 |
return $settings;
|
323 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
}
|
325 |
|
326 |
endif;
|
5 |
Description: Add event calendars to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.0.7
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress Calendars Class
|
18 |
*
|
19 |
* @class SportsPress_Calendars
|
20 |
+
* @version 2.0.7
|
21 |
*/
|
22 |
class SportsPress_Calendars {
|
23 |
|
33 |
add_action( 'add_meta_boxes', array( $this, 'remove_meta_boxes' ), 10 );
|
34 |
add_action( 'sportspress_include_post_type_handlers', array( $this, 'include_post_type_handler' ) );
|
35 |
add_action( 'sportspress_widgets', array( $this, 'include_widgets' ) );
|
36 |
+
add_action( 'sportspress_create_rest_routes', array( $this, 'create_rest_routes' ) );
|
37 |
+
add_action( 'sportspress_register_rest_fields', array( $this, 'register_rest_fields' ) );
|
38 |
|
39 |
// Filters
|
40 |
add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
|
41 |
add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) );
|
42 |
+
add_filter( 'sportspress_event_settings', array( $this, 'add_event_settings' ) );
|
43 |
+
add_filter( 'sportspress_team_options', array( $this, 'add_team_options' ) );
|
44 |
+
add_filter( 'sportspress_after_team_template', array( $this, 'add_team_template' ), 40 );
|
45 |
}
|
46 |
|
47 |
/**
|
49 |
*/
|
50 |
private function define_constants() {
|
51 |
if ( !defined( 'SP_CALENDARS_VERSION' ) )
|
52 |
+
define( 'SP_CALENDARS_VERSION', '2.0.7' );
|
53 |
|
54 |
if ( !defined( 'SP_CALENDARS_URL' ) )
|
55 |
define( 'SP_CALENDARS_URL', plugin_dir_url( __FILE__ ) );
|
84 |
'exclude_from_search' => false,
|
85 |
'hierarchical' => false,
|
86 |
'rewrite' => array( 'slug' => get_option( 'sportspress_calendar_slug', 'calendar' ) ),
|
87 |
+
'supports' => array( 'title', 'editor', 'author', 'thumbnail' ),
|
88 |
'has_archive' => false,
|
89 |
'show_in_nav_menus' => true,
|
90 |
+
'show_in_menu' => 'edit.php?post_type=sp_event',
|
91 |
'show_in_admin_bar' => true,
|
92 |
+
'show_in_rest' => true,
|
93 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
94 |
+
'rest_base' => 'calendars',
|
95 |
)
|
96 |
)
|
97 |
);
|
115 |
|
116 |
/**
|
117 |
* Add widgets.
|
|
|
|
|
118 |
*/
|
119 |
public function include_widgets() {
|
120 |
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-event-calendar.php' );
|
122 |
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-event-blocks.php' );
|
123 |
}
|
124 |
|
125 |
+
/**
|
126 |
+
* Create REST API routes.
|
127 |
+
*/
|
128 |
+
public function create_rest_routes() {
|
129 |
+
$controller = new SP_REST_Posts_Controller( 'sp_calendar' );
|
130 |
+
$controller->register_routes();
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Register REST API fields.
|
135 |
+
*/
|
136 |
+
public function register_rest_fields() {
|
137 |
+
register_rest_field( 'sp_calendar',
|
138 |
+
'format',
|
139 |
+
array(
|
140 |
+
'get_callback' => 'SP_REST_API::get_post_meta',
|
141 |
+
'update_callback' => 'SP_REST_API::update_post_meta',
|
142 |
+
'schema' => array(
|
143 |
+
'description' => __( 'Layout', 'sportspress' ),
|
144 |
+
'type' => 'string',
|
145 |
+
'context' => array( 'view', 'edit' ),
|
146 |
+
'arg_options' => array(
|
147 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
148 |
+
),
|
149 |
+
),
|
150 |
+
)
|
151 |
+
);
|
152 |
+
|
153 |
+
register_rest_field( 'sp_calendar',
|
154 |
+
'data',
|
155 |
+
array(
|
156 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
157 |
+
'schema' => array(
|
158 |
+
'description' => __( 'Events', 'sportspress' ),
|
159 |
+
'type' => 'array',
|
160 |
+
'context' => array( 'view' ),
|
161 |
+
'arg_options' => array(
|
162 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
163 |
+
),
|
164 |
+
),
|
165 |
+
)
|
166 |
+
);
|
167 |
+
}
|
168 |
+
|
169 |
/**
|
170 |
* Add meta boxes to calendars.
|
171 |
*
|
206 |
'context' => 'normal',
|
207 |
'priority' => 'high',
|
208 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
);
|
210 |
return $meta_boxes;
|
211 |
}
|
223 |
}
|
224 |
|
225 |
/**
|
226 |
+
* Add event settings.
|
227 |
*
|
228 |
* @return array
|
229 |
*/
|
230 |
+
public function add_event_settings( $settings ) {
|
231 |
$settings = array_merge( $settings,
|
232 |
array(
|
233 |
array( 'title' => __( 'Event List', 'sportspress' ), 'type' => 'title', 'id' => 'event_list_options' ),
|
311 |
'type' => 'checkbox',
|
312 |
),
|
313 |
|
314 |
+
array(
|
315 |
+
'title' => __( 'Teams', 'sportspress' ),
|
316 |
+
'desc' => __( 'Display logos', 'sportspress' ),
|
317 |
+
'id' => 'sportspress_event_blocks_show_logos',
|
318 |
+
'default' => 'yes',
|
319 |
+
'type' => 'checkbox',
|
320 |
+
),
|
321 |
+
|
322 |
array(
|
323 |
'title' => __( 'Details', 'sportspress' ),
|
324 |
'desc' => __( 'Display competition', 'sportspress' ),
|
356 |
'title' => __( 'Limit', 'sportspress' ),
|
357 |
'id' => 'sportspress_event_blocks_rows',
|
358 |
'class' => 'small-text',
|
359 |
+
'default' => '5',
|
360 |
'desc' => __( 'events', 'sportspress' ),
|
361 |
'type' => 'number',
|
362 |
'custom_attributes' => array(
|
372 |
);
|
373 |
return $settings;
|
374 |
}
|
375 |
+
|
376 |
+
/**
|
377 |
+
* Add team options.
|
378 |
+
*
|
379 |
+
* @return array
|
380 |
+
*/
|
381 |
+
public function add_team_options( $options ) {
|
382 |
+
return array_merge( $options,
|
383 |
+
array(
|
384 |
+
array(
|
385 |
+
'title' => __( 'Events', 'sportspress' ),
|
386 |
+
'id' => 'sportspress_team_events_format',
|
387 |
+
'default' => 'title',
|
388 |
+
'type' => 'select',
|
389 |
+
'options' => array(
|
390 |
+
'blocks' => __( 'Blocks', 'sportspress' ),
|
391 |
+
'calendar' => __( 'Calendar', 'sportspress' ),
|
392 |
+
),
|
393 |
+
),
|
394 |
+
)
|
395 |
+
);
|
396 |
+
}
|
397 |
+
|
398 |
+
/**
|
399 |
+
* Add team template.
|
400 |
+
*
|
401 |
+
* @return array
|
402 |
+
*/
|
403 |
+
public function add_team_template( $templates ) {
|
404 |
+
return array_merge( $templates, array(
|
405 |
+
'events' => array(
|
406 |
+
'title' => __( 'Events', 'sportspress' ),
|
407 |
+
'option' => 'sportspress_team_show_events',
|
408 |
+
'action' => 'sportspress_output_team_events',
|
409 |
+
'default' => 'no',
|
410 |
+
),
|
411 |
+
) );
|
412 |
+
}
|
413 |
}
|
414 |
|
415 |
endif;
|
modules/sportspress-countdowns.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Add countdown widgets to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
-
Version:
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Countdowns' ) ) :
|
|
17 |
* Main SportsPress Countdowns Class
|
18 |
*
|
19 |
* @class SportsPress_Countdowns
|
20 |
-
* @version
|
21 |
*/
|
22 |
class SportsPress_Countdowns {
|
23 |
|
@@ -41,7 +41,7 @@ class SportsPress_Countdowns {
|
|
41 |
*/
|
42 |
private function define_constants() {
|
43 |
if ( !defined( 'SP_COUNTDOWNS_VERSION' ) )
|
44 |
-
define( 'SP_COUNTDOWNS_VERSION', '
|
45 |
|
46 |
if ( !defined( 'SP_COUNTDOWNS_URL' ) )
|
47 |
define( 'SP_COUNTDOWNS_URL', plugin_dir_url( __FILE__ ) );
|
@@ -77,7 +77,7 @@ class SportsPress_Countdowns {
|
|
77 |
public function add_settings( $settings ) {
|
78 |
$settings = array_merge( $settings,
|
79 |
array(
|
80 |
-
array( 'title' => __( '
|
81 |
),
|
82 |
|
83 |
apply_filters( 'sportspress_countdown_options', array(
|
5 |
Description: Add countdown widgets to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.0
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress Countdowns Class
|
18 |
*
|
19 |
* @class SportsPress_Countdowns
|
20 |
+
* @version 2.0
|
21 |
*/
|
22 |
class SportsPress_Countdowns {
|
23 |
|
41 |
*/
|
42 |
private function define_constants() {
|
43 |
if ( !defined( 'SP_COUNTDOWNS_VERSION' ) )
|
44 |
+
define( 'SP_COUNTDOWNS_VERSION', '2.0' );
|
45 |
|
46 |
if ( !defined( 'SP_COUNTDOWNS_URL' ) )
|
47 |
define( 'SP_COUNTDOWNS_URL', plugin_dir_url( __FILE__ ) );
|
77 |
public function add_settings( $settings ) {
|
78 |
$settings = array_merge( $settings,
|
79 |
array(
|
80 |
+
array( 'title' => __( 'Countdown', 'sportspress' ), 'type' => 'title', 'id' => 'countdown_options' ),
|
81 |
),
|
82 |
|
83 |
apply_filters( 'sportspress_countdown_options', array(
|
modules/sportspress-lazy-loading.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://tboy.co/pro
|
|
5 |
Description: Load players using Ajax to speed up the event edit screen.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com
|
8 |
-
Version:
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Lazy_Loading' ) ) :
|
|
17 |
* Main SportsPress Lazy Loading Class
|
18 |
*
|
19 |
* @class SportsPress_Lazy_Loading
|
20 |
-
* @version
|
21 |
*/
|
22 |
class SportsPress_Lazy_Loading {
|
23 |
|
@@ -72,7 +72,7 @@ class SportsPress_Lazy_Loading {
|
|
72 |
if ( $league ) {
|
73 |
$args['tax_query'][] = array(
|
74 |
'taxonomy' => 'sp_league',
|
75 |
-
'field' => '
|
76 |
'terms' => $league,
|
77 |
);
|
78 |
}
|
@@ -80,7 +80,7 @@ class SportsPress_Lazy_Loading {
|
|
80 |
if ( $season ) {
|
81 |
$args['tax_query'][] = array(
|
82 |
'taxonomy' => 'sp_season',
|
83 |
-
'field' => '
|
84 |
'terms' => $season,
|
85 |
);
|
86 |
}
|
@@ -156,7 +156,7 @@ class SportsPress_Lazy_Loading {
|
|
156 |
if ( $leagues ) {
|
157 |
$args['tax_query'][] = array(
|
158 |
'taxonomy' => 'sp_league',
|
159 |
-
'field' => '
|
160 |
'terms' => wp_list_pluck( $leagues, 'term_id' ),
|
161 |
);
|
162 |
}
|
@@ -164,7 +164,7 @@ class SportsPress_Lazy_Loading {
|
|
164 |
if ( $seasons ) {
|
165 |
$args['tax_query'][] = array(
|
166 |
'taxonomy' => 'sp_season',
|
167 |
-
'field' => '
|
168 |
'terms' => wp_list_pluck( $seasons, 'term_id' ),
|
169 |
);
|
170 |
}
|
5 |
Description: Load players using Ajax to speed up the event edit screen.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com
|
8 |
+
Version: 2.0.13
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress Lazy Loading Class
|
18 |
*
|
19 |
* @class SportsPress_Lazy_Loading
|
20 |
+
* @version 2.0.13
|
21 |
*/
|
22 |
class SportsPress_Lazy_Loading {
|
23 |
|
72 |
if ( $league ) {
|
73 |
$args['tax_query'][] = array(
|
74 |
'taxonomy' => 'sp_league',
|
75 |
+
'field' => 'term_id',
|
76 |
'terms' => $league,
|
77 |
);
|
78 |
}
|
80 |
if ( $season ) {
|
81 |
$args['tax_query'][] = array(
|
82 |
'taxonomy' => 'sp_season',
|
83 |
+
'field' => 'term_id',
|
84 |
'terms' => $season,
|
85 |
);
|
86 |
}
|
156 |
if ( $leagues ) {
|
157 |
$args['tax_query'][] = array(
|
158 |
'taxonomy' => 'sp_league',
|
159 |
+
'field' => 'term_id',
|
160 |
'terms' => wp_list_pluck( $leagues, 'term_id' ),
|
161 |
);
|
162 |
}
|
164 |
if ( $seasons ) {
|
165 |
$args['tax_query'][] = array(
|
166 |
'taxonomy' => 'sp_season',
|
167 |
+
'field' => 'term_id',
|
168 |
'terms' => wp_list_pluck( $seasons, 'term_id' ),
|
169 |
);
|
170 |
}
|
modules/sportspress-league-tables.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Add league tables to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
-
Version:
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_League_Tables' ) ) :
|
|
17 |
* Main SportsPress League Tables Class
|
18 |
*
|
19 |
* @class SportsPress_League_Tables
|
20 |
-
* @version
|
21 |
*/
|
22 |
class SportsPress_League_Tables {
|
23 |
|
@@ -33,12 +33,15 @@ class SportsPress_League_Tables {
|
|
33 |
add_action( 'add_meta_boxes', array( $this, 'remove_meta_boxes' ), 10 );
|
34 |
add_action( 'sportspress_include_post_type_handlers', array( $this, 'include_post_type_handler' ) );
|
35 |
add_action( 'sportspress_widgets', array( $this, 'include_widgets' ) );
|
|
|
|
|
36 |
|
37 |
// Filters
|
38 |
add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
|
39 |
add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) );
|
40 |
add_filter( 'sportspress_team_settings', array( $this, 'add_settings' ) );
|
41 |
add_filter( 'sportspress_team_options', array( $this, 'add_options' ) );
|
|
|
42 |
}
|
43 |
|
44 |
/**
|
@@ -46,7 +49,7 @@ class SportsPress_League_Tables {
|
|
46 |
*/
|
47 |
private function define_constants() {
|
48 |
if ( !defined( 'SP_LEAGUE_TABLES_VERSION' ) )
|
49 |
-
define( 'SP_LEAGUE_TABLES_VERSION', '
|
50 |
|
51 |
if ( !defined( 'SP_LEAGUE_TABLES_URL' ) )
|
52 |
define( 'SP_LEAGUE_TABLES_URL', plugin_dir_url( __FILE__ ) );
|
@@ -81,11 +84,14 @@ class SportsPress_League_Tables {
|
|
81 |
'exclude_from_search' => false,
|
82 |
'hierarchical' => false,
|
83 |
'rewrite' => array( 'slug' => get_option( 'sportspress_table_slug', 'table' ) ),
|
84 |
-
'supports' => array( 'title', 'page-attributes', 'thumbnail' ),
|
85 |
'has_archive' => false,
|
86 |
'show_in_nav_menus' => true,
|
87 |
'show_in_menu' => 'edit.php?post_type=sp_team',
|
88 |
'show_in_admin_bar' => true,
|
|
|
|
|
|
|
89 |
)
|
90 |
)
|
91 |
);
|
@@ -115,6 +121,35 @@ class SportsPress_League_Tables {
|
|
115 |
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-league-table.php' );
|
116 |
}
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
/**
|
119 |
* Add meta boxes.
|
120 |
*
|
@@ -158,12 +193,6 @@ class SportsPress_League_Tables {
|
|
158 |
'context' => 'normal',
|
159 |
'priority' => 'high',
|
160 |
),
|
161 |
-
'editor' => array(
|
162 |
-
'title' => __( 'Description', 'sportspress' ),
|
163 |
-
'output' => 'SP_Meta_Box_Table_Editor::output',
|
164 |
-
'context' => 'normal',
|
165 |
-
'priority' => 'low',
|
166 |
-
),
|
167 |
);
|
168 |
return $meta_boxes;
|
169 |
}
|
@@ -260,10 +289,32 @@ class SportsPress_League_Tables {
|
|
260 |
)
|
261 |
);
|
262 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
}
|
264 |
|
265 |
endif;
|
266 |
|
267 |
if ( get_option( 'sportspress_load_league_tables_module', 'yes' ) == 'yes' ) {
|
268 |
new SportsPress_League_Tables();
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
}
|
5 |
Description: Add league tables to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.0
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress League Tables Class
|
18 |
*
|
19 |
* @class SportsPress_League_Tables
|
20 |
+
* @version 2.0
|
21 |
*/
|
22 |
class SportsPress_League_Tables {
|
23 |
|
33 |
add_action( 'add_meta_boxes', array( $this, 'remove_meta_boxes' ), 10 );
|
34 |
add_action( 'sportspress_include_post_type_handlers', array( $this, 'include_post_type_handler' ) );
|
35 |
add_action( 'sportspress_widgets', array( $this, 'include_widgets' ) );
|
36 |
+
add_action( 'sportspress_create_rest_routes', array( $this, 'create_rest_routes' ) );
|
37 |
+
add_action( 'sportspress_register_rest_fields', array( $this, 'register_rest_fields' ) );
|
38 |
|
39 |
// Filters
|
40 |
add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
|
41 |
add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) );
|
42 |
add_filter( 'sportspress_team_settings', array( $this, 'add_settings' ) );
|
43 |
add_filter( 'sportspress_team_options', array( $this, 'add_options' ) );
|
44 |
+
add_filter( 'sportspress_after_team_template', array( $this, 'add_team_template' ), 30 );
|
45 |
}
|
46 |
|
47 |
/**
|
49 |
*/
|
50 |
private function define_constants() {
|
51 |
if ( !defined( 'SP_LEAGUE_TABLES_VERSION' ) )
|
52 |
+
define( 'SP_LEAGUE_TABLES_VERSION', '2.0' );
|
53 |
|
54 |
if ( !defined( 'SP_LEAGUE_TABLES_URL' ) )
|
55 |
define( 'SP_LEAGUE_TABLES_URL', plugin_dir_url( __FILE__ ) );
|
84 |
'exclude_from_search' => false,
|
85 |
'hierarchical' => false,
|
86 |
'rewrite' => array( 'slug' => get_option( 'sportspress_table_slug', 'table' ) ),
|
87 |
+
'supports' => array( 'title', 'editor', 'page-attributes', 'thumbnail' ),
|
88 |
'has_archive' => false,
|
89 |
'show_in_nav_menus' => true,
|
90 |
'show_in_menu' => 'edit.php?post_type=sp_team',
|
91 |
'show_in_admin_bar' => true,
|
92 |
+
'show_in_rest' => true,
|
93 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
94 |
+
'rest_base' => 'tables',
|
95 |
)
|
96 |
)
|
97 |
);
|
121 |
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-league-table.php' );
|
122 |
}
|
123 |
|
124 |
+
/**
|
125 |
+
* Create REST API routes.
|
126 |
+
*/
|
127 |
+
public function create_rest_routes() {
|
128 |
+
$controller = new SP_REST_Posts_Controller( 'sp_table' );
|
129 |
+
$controller->register_routes();
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Register REST API fields.
|
134 |
+
*/
|
135 |
+
public function register_rest_fields() {
|
136 |
+
register_rest_field( 'sp_table',
|
137 |
+
'data',
|
138 |
+
array(
|
139 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
140 |
+
'update_callback' => 'SP_REST_API::update_post_meta_arrays',
|
141 |
+
'schema' => array(
|
142 |
+
'description' => __( 'League Table', 'sportspress' ),
|
143 |
+
'type' => 'array',
|
144 |
+
'context' => array( 'view', 'edit' ),
|
145 |
+
'arg_options' => array(
|
146 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
147 |
+
),
|
148 |
+
),
|
149 |
+
)
|
150 |
+
);
|
151 |
+
}
|
152 |
+
|
153 |
/**
|
154 |
* Add meta boxes.
|
155 |
*
|
193 |
'context' => 'normal',
|
194 |
'priority' => 'high',
|
195 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
);
|
197 |
return $meta_boxes;
|
198 |
}
|
289 |
)
|
290 |
);
|
291 |
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Add team template.
|
295 |
+
*
|
296 |
+
* @return array
|
297 |
+
*/
|
298 |
+
public function add_team_template( $templates ) {
|
299 |
+
return array_merge( $templates, array(
|
300 |
+
'tables' => array(
|
301 |
+
'title' => __( 'League Tables', 'sportspress' ),
|
302 |
+
'option' => 'sportspress_team_show_tables',
|
303 |
+
'action' => 'sportspress_output_team_tables',
|
304 |
+
'default' => 'yes',
|
305 |
+
),
|
306 |
+
) );
|
307 |
+
}
|
308 |
}
|
309 |
|
310 |
endif;
|
311 |
|
312 |
if ( get_option( 'sportspress_load_league_tables_module', 'yes' ) == 'yes' ) {
|
313 |
new SportsPress_League_Tables();
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Create alias of SP_League_Table class for REST API.
|
317 |
+
* Note: class_alias is not supported in PHP < 5.3 so extend the original class instead.
|
318 |
+
*/
|
319 |
+
class SP_Table extends SP_League_Table {}
|
320 |
}
|
modules/sportspress-player-lists.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Add player lists to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
-
Version:
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Player_Lists' ) ) :
|
|
17 |
* Main SportsPress Player Lists Class
|
18 |
*
|
19 |
* @class SportsPress_Player_Lists
|
20 |
-
* @version
|
21 |
*/
|
22 |
class SportsPress_Player_Lists {
|
23 |
|
@@ -33,11 +33,14 @@ class SportsPress_Player_Lists {
|
|
33 |
add_action( 'add_meta_boxes', array( $this, 'remove_meta_boxes' ), 10 );
|
34 |
add_action( 'sportspress_include_post_type_handlers', array( $this, 'include_post_type_handler' ) );
|
35 |
add_action( 'sportspress_widgets', array( $this, 'include_widgets' ) );
|
|
|
|
|
36 |
|
37 |
// Filters
|
38 |
add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
|
39 |
add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) );
|
40 |
add_filter( 'sportspress_player_settings', array( $this, 'add_settings' ) );
|
|
|
41 |
}
|
42 |
|
43 |
/**
|
@@ -45,7 +48,7 @@ class SportsPress_Player_Lists {
|
|
45 |
*/
|
46 |
private function define_constants() {
|
47 |
if ( !defined( 'SP_PLAYER_LISTS_VERSION' ) )
|
48 |
-
define( 'SP_PLAYER_LISTS_VERSION', '
|
49 |
|
50 |
if ( !defined( 'SP_PLAYER_LISTS_URL' ) )
|
51 |
define( 'SP_PLAYER_LISTS_URL', plugin_dir_url( __FILE__ ) );
|
@@ -80,11 +83,14 @@ class SportsPress_Player_Lists {
|
|
80 |
'exclude_from_search' => false,
|
81 |
'hierarchical' => false,
|
82 |
'rewrite' => array( 'slug' => get_option( 'sportspress_list_slug', 'list' ) ),
|
83 |
-
'supports' => array( 'title', 'page-attributes', 'author', 'thumbnail' ),
|
84 |
'has_archive' => false,
|
85 |
'show_in_nav_menus' => true,
|
86 |
'show_in_menu' => 'edit.php?post_type=sp_player',
|
87 |
'show_in_admin_bar' => true,
|
|
|
|
|
|
|
88 |
)
|
89 |
)
|
90 |
);
|
@@ -116,6 +122,51 @@ class SportsPress_Player_Lists {
|
|
116 |
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-player-gallery.php' );
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
/**
|
120 |
* Add meta boxes.
|
121 |
*
|
@@ -164,12 +215,6 @@ class SportsPress_Player_Lists {
|
|
164 |
'context' => 'normal',
|
165 |
'priority' => 'high',
|
166 |
),
|
167 |
-
'editor' => array(
|
168 |
-
'title' => __( 'Description', 'sportspress' ),
|
169 |
-
'output' => 'SP_Meta_Box_List_Editor::output',
|
170 |
-
'context' => 'normal',
|
171 |
-
'priority' => 'low',
|
172 |
-
),
|
173 |
);
|
174 |
return $meta_boxes;
|
175 |
}
|
@@ -249,10 +294,32 @@ class SportsPress_Player_Lists {
|
|
249 |
)
|
250 |
) );
|
251 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
}
|
253 |
|
254 |
endif;
|
255 |
|
256 |
if ( get_option( 'sportspress_load_player_lists_module', 'yes' ) == 'yes' ) {
|
257 |
new SportsPress_Player_Lists();
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
}
|
5 |
Description: Add player lists to SportsPress.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.0
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress Player Lists Class
|
18 |
*
|
19 |
* @class SportsPress_Player_Lists
|
20 |
+
* @version 2.0
|
21 |
*/
|
22 |
class SportsPress_Player_Lists {
|
23 |
|
33 |
add_action( 'add_meta_boxes', array( $this, 'remove_meta_boxes' ), 10 );
|
34 |
add_action( 'sportspress_include_post_type_handlers', array( $this, 'include_post_type_handler' ) );
|
35 |
add_action( 'sportspress_widgets', array( $this, 'include_widgets' ) );
|
36 |
+
add_action( 'sportspress_create_rest_routes', array( $this, 'create_rest_routes' ) );
|
37 |
+
add_action( 'sportspress_register_rest_fields', array( $this, 'register_rest_fields' ) );
|
38 |
|
39 |
// Filters
|
40 |
add_filter( 'sportspress_meta_boxes', array( $this, 'add_meta_boxes' ) );
|
41 |
add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) );
|
42 |
add_filter( 'sportspress_player_settings', array( $this, 'add_settings' ) );
|
43 |
+
add_filter( 'sportspress_after_team_template', array( $this, 'add_team_template' ), 20 );
|
44 |
}
|
45 |
|
46 |
/**
|
48 |
*/
|
49 |
private function define_constants() {
|
50 |
if ( !defined( 'SP_PLAYER_LISTS_VERSION' ) )
|
51 |
+
define( 'SP_PLAYER_LISTS_VERSION', '2.0' );
|
52 |
|
53 |
if ( !defined( 'SP_PLAYER_LISTS_URL' ) )
|
54 |
define( 'SP_PLAYER_LISTS_URL', plugin_dir_url( __FILE__ ) );
|
83 |
'exclude_from_search' => false,
|
84 |
'hierarchical' => false,
|
85 |
'rewrite' => array( 'slug' => get_option( 'sportspress_list_slug', 'list' ) ),
|
86 |
+
'supports' => array( 'title', 'editor', 'page-attributes', 'author', 'thumbnail' ),
|
87 |
'has_archive' => false,
|
88 |
'show_in_nav_menus' => true,
|
89 |
'show_in_menu' => 'edit.php?post_type=sp_player',
|
90 |
'show_in_admin_bar' => true,
|
91 |
+
'show_in_rest' => true,
|
92 |
+
'rest_controller_class' => 'SP_REST_Posts_Controller',
|
93 |
+
'rest_base' => 'lists',
|
94 |
)
|
95 |
)
|
96 |
);
|
122 |
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-player-gallery.php' );
|
123 |
}
|
124 |
|
125 |
+
/**
|
126 |
+
* Create REST API routes.
|
127 |
+
*/
|
128 |
+
public function create_rest_routes() {
|
129 |
+
$controller = new SP_REST_Posts_Controller( 'sp_list' );
|
130 |
+
$controller->register_routes();
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Register REST API fields.
|
135 |
+
*/
|
136 |
+
public function register_rest_fields() {
|
137 |
+
register_rest_field( 'sp_list',
|
138 |
+
'format',
|
139 |
+
array(
|
140 |
+
'get_callback' => 'SP_REST_API::get_post_meta',
|
141 |
+
'update_callback' => 'SP_REST_API::update_post_meta',
|
142 |
+
'schema' => array(
|
143 |
+
'description' => __( 'Layout', 'sportspress' ),
|
144 |
+
'type' => 'string',
|
145 |
+
'context' => array( 'view', 'edit' ),
|
146 |
+
'arg_options' => array(
|
147 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
148 |
+
),
|
149 |
+
),
|
150 |
+
)
|
151 |
+
);
|
152 |
+
|
153 |
+
register_rest_field( 'sp_list',
|
154 |
+
'data',
|
155 |
+
array(
|
156 |
+
'get_callback' => 'SP_REST_API::get_post_data',
|
157 |
+
'update_callback' => 'SP_REST_API::update_post_meta_arrays',
|
158 |
+
'schema' => array(
|
159 |
+
'description' => __( 'Player List', 'sportspress' ),
|
160 |
+
'type' => 'array',
|
161 |
+
'context' => array( 'view', 'edit' ),
|
162 |
+
'arg_options' => array(
|
163 |
+
'sanitize_callback' => 'rest_sanitize_request_arg',
|
164 |
+
),
|
165 |
+
),
|
166 |
+
)
|
167 |
+
);
|
168 |
+
}
|
169 |
+
|
170 |
/**
|
171 |
* Add meta boxes.
|
172 |
*
|
215 |
'context' => 'normal',
|
216 |
'priority' => 'high',
|
217 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
);
|
219 |
return $meta_boxes;
|
220 |
}
|
294 |
)
|
295 |
) );
|
296 |
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Add team template.
|
300 |
+
*
|
301 |
+
* @return array
|
302 |
+
*/
|
303 |
+
public function add_team_template( $templates ) {
|
304 |
+
return array_merge( $templates, array(
|
305 |
+
'lists' => array(
|
306 |
+
'title' => __( 'Player Lists', 'sportspress' ),
|
307 |
+
'option' => 'sportspress_team_show_lists',
|
308 |
+
'action' => 'sportspress_output_team_lists',
|
309 |
+
'default' => 'yes',
|
310 |
+
),
|
311 |
+
) );
|
312 |
+
}
|
313 |
}
|
314 |
|
315 |
endif;
|
316 |
|
317 |
if ( get_option( 'sportspress_load_player_lists_module', 'yes' ) == 'yes' ) {
|
318 |
new SportsPress_Player_Lists();
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Create alias of SP_Player_List class for REST API.
|
322 |
+
* Note: class_alias is not supported in PHP < 5.3 so extend the original class instead.
|
323 |
+
*/
|
324 |
+
class SP_List extends SP_Player_List {}
|
325 |
}
|
modules/sportspress-tutorials.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://themeboy.com/
|
|
5 |
Description: Display SportsPress video tutorials.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
-
Version:
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SportsPress_Tutorials' ) ) :
|
|
17 |
* Main SportsPress Tutorials Class
|
18 |
*
|
19 |
* @class SportsPress_Tutorials
|
20 |
-
* @version
|
21 |
*/
|
22 |
class SportsPress_Tutorials {
|
23 |
|
@@ -44,7 +44,7 @@ class SportsPress_Tutorials {
|
|
44 |
*/
|
45 |
private function define_constants() {
|
46 |
if ( !defined( 'SP_TUTORIALS_VERSION' ) )
|
47 |
-
define( 'SP_TUTORIALS_VERSION', '
|
48 |
|
49 |
if ( !defined( 'SP_TUTORIALS_URL' ) )
|
50 |
define( 'SP_TUTORIALS_URL', plugin_dir_url( __FILE__ ) );
|
@@ -90,7 +90,7 @@ class SportsPress_Tutorials {
|
|
90 |
) ),
|
91 |
__( 'Events', 'sportspress' ) => apply_filters( 'sportspress_event_advanced_videos', array(
|
92 |
__( 'Event Outcomes', 'sportspress' ) . ' ' . __( '(Auto)', 'sportspress' ) => '//www.youtube-nocookie.com/embed/pCVfPv2O5yY?rel=0&showinfo=0',
|
93 |
-
__( '
|
94 |
) ),
|
95 |
__( 'Calendars', 'sportspress' ) => apply_filters( 'sportspress_calendar_advanced_videos', array(
|
96 |
__( 'Layout', 'sportspress' ) => '//www.youtube-nocookie.com/embed/aLx_5D0Xgnc?rel=0&showinfo=0',
|
5 |
Description: Display SportsPress video tutorials.
|
6 |
Author: ThemeBoy
|
7 |
Author URI: http://themeboy.com/
|
8 |
+
Version: 2.0
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
* Main SportsPress Tutorials Class
|
18 |
*
|
19 |
* @class SportsPress_Tutorials
|
20 |
+
* @version 2.0
|
21 |
*/
|
22 |
class SportsPress_Tutorials {
|
23 |
|
44 |
*/
|
45 |
private function define_constants() {
|
46 |
if ( !defined( 'SP_TUTORIALS_VERSION' ) )
|
47 |
+
define( 'SP_TUTORIALS_VERSION', '2.0' );
|
48 |
|
49 |
if ( !defined( 'SP_TUTORIALS_URL' ) )
|
50 |
define( 'SP_TUTORIALS_URL', plugin_dir_url( __FILE__ ) );
|
90 |
) ),
|
91 |
__( 'Events', 'sportspress' ) => apply_filters( 'sportspress_event_advanced_videos', array(
|
92 |
__( 'Event Outcomes', 'sportspress' ) . ' ' . __( '(Auto)', 'sportspress' ) => '//www.youtube-nocookie.com/embed/pCVfPv2O5yY?rel=0&showinfo=0',
|
93 |
+
__( 'Box Score', 'sportspress' ) => '//www.youtube-nocookie.com/embed/rERU6X7vjTc?rel=0&showinfo=0',
|
94 |
) ),
|
95 |
__( 'Calendars', 'sportspress' ) => apply_filters( 'sportspress_calendar_advanced_videos', array(
|
96 |
__( 'Layout', 'sportspress' ) => '//www.youtube-nocookie.com/embed/aLx_5D0Xgnc?rel=0&showinfo=0',
|
presets/team-sports/baseball.json
CHANGED
@@ -1,19 +1,16 @@
|
|
1 |
{
|
2 |
"name": "Baseball",
|
3 |
-
"positions":
|
4 |
-
"
|
5 |
-
"
|
6 |
-
"
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
"Right field"
|
15 |
-
]
|
16 |
-
},
|
17 |
"outcomes": [
|
18 |
{ "name" : "Win", "condition" : ">" },
|
19 |
{ "name" : "Loss", "condition" : "<" },
|
@@ -29,7 +26,7 @@
|
|
29 |
{ "name" : "7", "description" : "7th inning runs" },
|
30 |
{ "name" : "8", "description" : "8th inning runs" },
|
31 |
{ "name" : "9", "description" : "9th inning runs" },
|
32 |
-
{ "name" : "
|
33 |
{ "name" : "R", "description" : "Total runs", "primary" : 1 },
|
34 |
{ "name" : "H", "description" : "Hits" },
|
35 |
{ "name" : "E", "description" : "Errors" }
|
@@ -78,16 +75,18 @@
|
|
78 |
],
|
79 |
"options": {
|
80 |
"event_teams" : "2",
|
81 |
-
"
|
82 |
"event_show_players" : "yes",
|
83 |
"event_show_total" : "yes",
|
84 |
-
"
|
85 |
-
"
|
86 |
-
"
|
87 |
-
"
|
88 |
"event_split_players_by_team" : "yes",
|
89 |
"event_split_players_by_position" : "yes",
|
90 |
-
"
|
91 |
-
"event_performance_sections" : 0
|
|
|
|
|
92 |
}
|
93 |
}
|
1 |
{
|
2 |
"name": "Baseball",
|
3 |
+
"positions": [
|
4 |
+
{ "name" : "Pitcher", "sections" : [ 0, 1 ] },
|
5 |
+
{ "name" : "Catcher", "sections" : [ 0 ] },
|
6 |
+
{ "name" : "First base", "sections" : [ 0 ] },
|
7 |
+
{ "name" : "Second base", "sections" : [ 0 ] },
|
8 |
+
{ "name" : "Third base", "sections" : [ 0 ] },
|
9 |
+
{ "name" : "Shortstop", "sections" : [ 0 ] },
|
10 |
+
{ "name" : "Left field", "sections" : [ 0 ] },
|
11 |
+
{ "name" : "Center field", "sections" : [ 0 ] },
|
12 |
+
{ "name" : "Right field", "sections" : [ 0 ] }
|
13 |
+
],
|
|
|
|
|
|
|
14 |
"outcomes": [
|
15 |
{ "name" : "Win", "condition" : ">" },
|
16 |
{ "name" : "Loss", "condition" : "<" },
|
26 |
{ "name" : "7", "description" : "7th inning runs" },
|
27 |
{ "name" : "8", "description" : "8th inning runs" },
|
28 |
{ "name" : "9", "description" : "9th inning runs" },
|
29 |
+
{ "name" : "10", "description" : "10th inning runs" },
|
30 |
{ "name" : "R", "description" : "Total runs", "primary" : 1 },
|
31 |
{ "name" : "H", "description" : "Hits" },
|
32 |
{ "name" : "E", "description" : "Errors" }
|
75 |
],
|
76 |
"options": {
|
77 |
"event_teams" : "2",
|
78 |
+
"event_hide_child_positions" : "yes",
|
79 |
"event_show_players" : "yes",
|
80 |
"event_show_total" : "yes",
|
81 |
+
"event_reverse_teams" : "yes",
|
82 |
+
"event_performance_mode" : "values",
|
83 |
+
"event_show_player_numbers" : "yes",
|
84 |
+
"event_show_position" : "no",
|
85 |
"event_split_players_by_team" : "yes",
|
86 |
"event_split_players_by_position" : "yes",
|
87 |
+
"event_total_performance" : "all",
|
88 |
+
"event_performance_sections" : 0,
|
89 |
+
"player_performance_sections" : 0,
|
90 |
+
"player_show_total" : "yes"
|
91 |
}
|
92 |
}
|
presets/team-sports/cricket.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
{
|
2 |
"name": "Cricket",
|
3 |
"positions": [
|
4 |
-
"Batsman",
|
5 |
-
"Bowler"
|
6 |
],
|
7 |
"outcomes": [
|
8 |
{ "name" : "Win", "condition" : ">" },
|
@@ -53,7 +53,7 @@
|
|
53 |
"event_teams" : "2",
|
54 |
"event_logos_show_team_names" : "no",
|
55 |
"event_logos_show_results" : "yes",
|
56 |
-
"
|
57 |
"event_show_outcome" : "yes",
|
58 |
"event_show_players" : "yes",
|
59 |
"event_show_total" : "yes",
|
1 |
{
|
2 |
"name": "Cricket",
|
3 |
"positions": [
|
4 |
+
{ "name" : "Batsman", "sections" : [ 0 ] },
|
5 |
+
{ "name" : "Bowler", "sections" : [ 0, 1 ] }
|
6 |
],
|
7 |
"outcomes": [
|
8 |
{ "name" : "Win", "condition" : ">" },
|
53 |
"event_teams" : "2",
|
54 |
"event_logos_show_team_names" : "no",
|
55 |
"event_logos_show_results" : "yes",
|
56 |
+
"event_reverse_teams" : "no",
|
57 |
"event_show_outcome" : "yes",
|
58 |
"event_show_players" : "yes",
|
59 |
"event_show_total" : "yes",
|
presets/team-sports/floorball.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
{
|
2 |
"name": "Floorball",
|
3 |
"positions": [
|
4 |
-
"Forward",
|
5 |
-
"Defenseman",
|
6 |
-
"Goalkeeper"
|
7 |
],
|
8 |
"outcomes": [
|
9 |
{ "name" : "Win", "condition" : ">" },
|
1 |
{
|
2 |
"name": "Floorball",
|
3 |
"positions": [
|
4 |
+
{ "name" : "Forward", "sections" : [ 0 ] },
|
5 |
+
{ "name" : "Defenseman", "sections" : [ 0 ] },
|
6 |
+
{ "name" : "Goalkeeper", "sections" : [ 0, 1 ] }
|
7 |
],
|
8 |
"outcomes": [
|
9 |
{ "name" : "Win", "condition" : ">" },
|
presets/team-sports/handball.json
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
{
|
2 |
"name": "Handball",
|
3 |
"positions": [
|
4 |
-
"Goalkeeper",
|
5 |
-
"Center back",
|
6 |
-
"Left back",
|
7 |
-
"Right back",
|
8 |
-
"Pivot",
|
9 |
-
"Left wing",
|
10 |
-
"Right wing"
|
11 |
],
|
12 |
"outcomes": [
|
13 |
{ "name" : "Win", "condition" : ">" },
|
1 |
{
|
2 |
"name": "Handball",
|
3 |
"positions": [
|
4 |
+
{ "name" : "Goalkeeper", "sections" : [ 0, 1 ] },
|
5 |
+
{ "name" : "Center back", "sections" : [ 0 ] },
|
6 |
+
{ "name" : "Left back", "sections" : [ 0 ] },
|
7 |
+
{ "name" : "Right back", "sections" : [ 0 ] },
|
8 |
+
{ "name" : "Pivot", "sections" : [ 0 ] },
|
9 |
+
{ "name" : "Left wing", "sections" : [ 0 ] },
|
10 |
+
{ "name" : "Right wing", "sections" : [ 0 ] }
|
11 |
],
|
12 |
"outcomes": [
|
13 |
{ "name" : "Win", "condition" : ">" },
|
presets/team-sports/ice-hockey.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
{
|
2 |
"name": "Ice Hockey",
|
3 |
"positions": [
|
4 |
-
"Skater",
|
5 |
-
"Goalie"
|
6 |
],
|
7 |
"outcomes": [
|
8 |
{ "name" : "Win", "condition" : ">" },
|
1 |
{
|
2 |
"name": "Ice Hockey",
|
3 |
"positions": [
|
4 |
+
{ "name" : "Skater", "sections" : [ 0 ] },
|
5 |
+
{ "name" : "Goalie", "sections" : [ 0, 1 ] }
|
6 |
],
|
7 |
"outcomes": [
|
8 |
{ "name" : "Win", "condition" : ">" },
|
presets/team-sports/softball.json
CHANGED
@@ -1,19 +1,16 @@
|
|
1 |
{
|
2 |
"name": "Softball",
|
3 |
-
"positions":
|
4 |
-
"
|
5 |
-
"
|
6 |
-
"
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
"Right field"
|
15 |
-
]
|
16 |
-
},
|
17 |
"outcomes": [
|
18 |
{ "name" : "Win", "condition" : ">" },
|
19 |
{ "name" : "Loss", "condition" : "<" }
|
@@ -75,15 +72,14 @@
|
|
75 |
],
|
76 |
"options": {
|
77 |
"event_teams" : "2",
|
78 |
-
"
|
79 |
"event_show_players" : "yes",
|
80 |
"event_show_total" : "yes",
|
81 |
-
"
|
82 |
-
"
|
83 |
-
"sportspress_event_performance_reverse_teams" : "yes",
|
84 |
"event_show_player_numbers" : "no",
|
85 |
"event_split_players_by_team" : "yes",
|
86 |
"event_split_players_by_position" : "yes",
|
87 |
-
"
|
88 |
}
|
89 |
}
|
1 |
{
|
2 |
"name": "Softball",
|
3 |
+
"positions": [
|
4 |
+
{ "name" : "Pitcher", "sections" : [ 0, 1 ] },
|
5 |
+
{ "name" : "Catcher", "sections" : [ 0 ] },
|
6 |
+
{ "name" : "First base", "sections" : [ 0 ] },
|
7 |
+
{ "name" : "Second base", "sections" : [ 0 ] },
|
8 |
+
{ "name" : "Third base", "sections" : [ 0 ] },
|
9 |
+
{ "name" : "Shortstop", "sections" : [ 0 ] },
|
10 |
+
{ "name" : "Left field", "sections" : [ 0 ] },
|
11 |
+
{ "name" : "Center field", "sections" : [ 0 ] },
|
12 |
+
{ "name" : "Right field", "sections" : [ 0 ] }
|
13 |
+
],
|
|
|
|
|
|
|
14 |
"outcomes": [
|
15 |
{ "name" : "Win", "condition" : ">" },
|
16 |
{ "name" : "Loss", "condition" : "<" }
|
72 |
],
|
73 |
"options": {
|
74 |
"event_teams" : "2",
|
75 |
+
"event_hide_child_positions" : "yes",
|
76 |
"event_show_players" : "yes",
|
77 |
"event_show_total" : "yes",
|
78 |
+
"event_reverse_teams" : "yes",
|
79 |
+
"event_performance_mode" : "values",
|
|
|
80 |
"event_show_player_numbers" : "no",
|
81 |
"event_split_players_by_team" : "yes",
|
82 |
"event_split_players_by_position" : "yes",
|
83 |
+
"event_total_performance" : "all"
|
84 |
}
|
85 |
}
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
=== SportsPress -
|
2 |
Contributors: ThemeBoy, brianmiyaji, aylaview, rochesterj
|
3 |
Tags: sport, sports, club, clubs, teams, statistics, stats, metrics, data, fixtures, results, standings, league tables, leagues, shortcodes, sports data, sports club, themeboy, esports, wordpress sports, equations, calculations, events, calendars, players, profiles, staff, seasons, countdowns, club management, football, nfl, footy, afl, baseball, basketball, cricket, darts, handball, hockey, netball, rugby, snooker, soccer, squash, tennis, volleyball, dota 2, league of legends, golf
|
4 |
Donate link: http://tboy.co/donate
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag:
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -49,6 +49,7 @@ Transform your WordPress blog into a fully configurable team, club, or league we
|
|
49 |
More details about each feature are available on the [SportsPress Website](http://tboy.co/pro).
|
50 |
|
51 |
= Free Extensions =
|
|
|
52 |
* [SportsPress for Cricket](https://wordpress.org/plugins/sportspress-for-cricket/)
|
53 |
* [SportsPress for Football (Soccer)](https://wordpress.org/plugins/sportspress-for-soccer/)
|
54 |
* [SportsPress for Golf](https://wordpress.org/plugins/sportspress-for-golf/)
|
@@ -123,6 +124,7 @@ Looking for more advanced sports functionality? Upgrade to [SportsPress Pro](htt
|
|
123 |
* [Football Club](http://tboy.co/fc)
|
124 |
* [Premier](http://tboy.co/premier)
|
125 |
* [Emblem](http://tboy.co/emblem)
|
|
|
126 |
|
127 |
= Documentation =
|
128 |
* [Getting Started](http://tboy.co/installation)
|
@@ -138,7 +140,7 @@ Feel free to share your suggestions with us so we can continue to develop awesom
|
|
138 |
|
139 |
Developers can contribute via the [SportsPress GitHub Repository](https://github.com/ThemeBoy/SportsPress/blob/master/CONTRIBUTING.md).
|
140 |
|
141 |
-
Translators can contribute to SportsPress translations through [
|
142 |
|
143 |
= Stay Current =
|
144 |
To keep up with the latest updates and new features, be sure to do the following:
|
@@ -221,23 +223,108 @@ Limitations? Don't worry, there are no limitations to the number of events, play
|
|
221 |
The current modules that are available exclusively to SportsPress Pro are:
|
222 |
|
223 |
* Tournaments: Create and display tournaments in a bracket/knockout cup format.
|
|
|
224 |
* Sponsors: Add your sponsors on your website and track each of their clicks and impressions.
|
225 |
* Staff Directories: Show contact information of your key personnel so people know who to get in touch with.
|
226 |
* Team Access: Assign users to a specific team and limit their access to data related to that team.
|
227 |
* Team Colors: Make each team's profile page unique by displaying their team colors.
|
228 |
* League Menu: Display a global navigation bar at the top of your website for easy navigation from one team to the next.
|
229 |
-
* Birthdays: Display each player's birthday and their current age.
|
230 |
* Twitter: Add a Twitter feed to team, player, and staff pages.
|
231 |
* Branding: Instantly rebrands your admin panel to reflect your organization's brand.
|
232 |
* Duplicator: Clone anything with just one click. Great for creating multiple events.
|
233 |
-
* Lazy Loading: Load players using Ajax to speed up the event edit screen.
|
234 |
|
235 |
-
There are [
|
236 |
|
237 |
When you upgrade to one of the SportsPress Pro licenses, you can simply activate the Pro version without losing any of your data. Please note that we recommend that you do a complete backup whenever you make big changes to your website.
|
238 |
|
239 |
== Changelog ==
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
= 1.9.20 =
|
242 |
* Tweak - Expand event title section for team logos in countdown widget.
|
243 |
* Tweak - Center align team logo images in event.
|
1 |
+
=== SportsPress - Sports Club & League Manager ===
|
2 |
Contributors: ThemeBoy, brianmiyaji, aylaview, rochesterj
|
3 |
Tags: sport, sports, club, clubs, teams, statistics, stats, metrics, data, fixtures, results, standings, league tables, leagues, shortcodes, sports data, sports club, themeboy, esports, wordpress sports, equations, calculations, events, calendars, players, profiles, staff, seasons, countdowns, club management, football, nfl, footy, afl, baseball, basketball, cricket, darts, handball, hockey, netball, rugby, snooker, soccer, squash, tennis, volleyball, dota 2, league of legends, golf
|
4 |
Donate link: http://tboy.co/donate
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 4.6
|
7 |
+
Stable tag: 2.0.16
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
49 |
More details about each feature are available on the [SportsPress Website](http://tboy.co/pro).
|
50 |
|
51 |
= Free Extensions =
|
52 |
+
* [SportsPress for Baseball](https://wordpress.org/plugins/sportspress-for-baseball/)
|
53 |
* [SportsPress for Cricket](https://wordpress.org/plugins/sportspress-for-cricket/)
|
54 |
* [SportsPress for Football (Soccer)](https://wordpress.org/plugins/sportspress-for-soccer/)
|
55 |
* [SportsPress for Golf](https://wordpress.org/plugins/sportspress-for-golf/)
|
124 |
* [Football Club](http://tboy.co/fc)
|
125 |
* [Premier](http://tboy.co/premier)
|
126 |
* [Emblem](http://tboy.co/emblem)
|
127 |
+
* [Marquee](http://tboy.co/marquee)
|
128 |
|
129 |
= Documentation =
|
130 |
* [Getting Started](http://tboy.co/installation)
|
140 |
|
141 |
Developers can contribute via the [SportsPress GitHub Repository](https://github.com/ThemeBoy/SportsPress/blob/master/CONTRIBUTING.md).
|
142 |
|
143 |
+
Translators can contribute to SportsPress translations through [GlotPress](https://translate.wordpress.org/projects/wp-plugins/sportspress).
|
144 |
|
145 |
= Stay Current =
|
146 |
To keep up with the latest updates and new features, be sure to do the following:
|
223 |
The current modules that are available exclusively to SportsPress Pro are:
|
224 |
|
225 |
* Tournaments: Create and display tournaments in a bracket/knockout cup format.
|
226 |
+
* Scoreboard: Display multiple event results in a horizontal scoreboard.
|
227 |
* Sponsors: Add your sponsors on your website and track each of their clicks and impressions.
|
228 |
* Staff Directories: Show contact information of your key personnel so people know who to get in touch with.
|
229 |
* Team Access: Assign users to a specific team and limit their access to data related to that team.
|
230 |
* Team Colors: Make each team's profile page unique by displaying their team colors.
|
231 |
* League Menu: Display a global navigation bar at the top of your website for easy navigation from one team to the next.
|
|
|
232 |
* Twitter: Add a Twitter feed to team, player, and staff pages.
|
233 |
* Branding: Instantly rebrands your admin panel to reflect your organization's brand.
|
234 |
* Duplicator: Clone anything with just one click. Great for creating multiple events.
|
|
|
235 |
|
236 |
+
There are [3 different licenses](http://tboy.co/pro) that you can choose from: Club, League, and Agency.
|
237 |
|
238 |
When you upgrade to one of the SportsPress Pro licenses, you can simply activate the Pro version without losing any of your data. Please note that we recommend that you do a complete backup whenever you make big changes to your website.
|
239 |
|
240 |
== Changelog ==
|
241 |
|
242 |
+
= 2.0.16 =
|
243 |
+
* Tweak - Add shortcode parameter to override global date in event calendar.
|
244 |
+
|
245 |
+
= 2.0.15 =
|
246 |
+
* Fix - Subversion issues.
|
247 |
+
|
248 |
+
= 2.0.14 =
|
249 |
+
* Fix - Use search mode in maps to prevent invalid parameter error.
|
250 |
+
|
251 |
+
= 2.0.13 =
|
252 |
+
* Fix - Google Maps embed code to reflect selected map type.
|
253 |
+
* Fix - Countdown error when teams are not selected.
|
254 |
+
|
255 |
+
= 2.0.12 =
|
256 |
+
* Tweak - Add API key to Google Maps in admin.
|
257 |
+
|
258 |
+
= 2.0.11 =
|
259 |
+
* Tweak - Embed code to reflect change in Google Maps API.
|
260 |
+
|
261 |
+
= 2.0.10 =
|
262 |
+
* Tweak - Enable sortable tables on all devices.
|
263 |
+
|
264 |
+
= 2.0.9 =
|
265 |
+
* Feature - Display admin notice when user is not allowed to edit an item.
|
266 |
+
|
267 |
+
= 2.0.8 =
|
268 |
+
* Feature - Add shortcode parameter to filter event calendars by player.
|
269 |
+
* Feature - Add text options to change age and birthday labels.
|
270 |
+
|
271 |
+
= 2.0.7 =
|
272 |
+
* Feature - Add option to show or hide logos or photos in event blocks.
|
273 |
+
* Tweak - Combine reverse teams option for results and box score.
|
274 |
+
* Fix - Add filter to template output for extensions.
|
275 |
+
|
276 |
+
= 2.0.6 =
|
277 |
+
* Tweak - Display squad numbers in defense section.
|
278 |
+
* Tweak - Display shared values in both offense and defense sections and sync when editing event.
|
279 |
+
|
280 |
+
= 2.0.5 =
|
281 |
+
* Fix - Hide team column in player statistics for player-vs-player sports.
|
282 |
+
|
283 |
+
= 2.0.4 =
|
284 |
+
* Fix - Title generator in event importer.
|
285 |
+
|
286 |
+
= 2.0.3 =
|
287 |
+
* Tweak - Restore career total tables in player profiles.
|
288 |
+
* Fix - Display sport and timezone selector after first installation.
|
289 |
+
|
290 |
+
= 2.0.2 =
|
291 |
+
* Fix - New events not saving with automatic titles when title is empty.
|
292 |
+
* Fix - Event importer not importing new events.
|
293 |
+
|
294 |
+
= 2.0.1 =
|
295 |
+
* Fix - Some player statistics calculating as zero.
|
296 |
+
|
297 |
+
= 2.0 =
|
298 |
+
* Feature - Integration with [WP REST API](https://wordpress.org/plugins/rest-api/) by adding endpoints for viewing, creating, editing, and deleting SportsPress data.
|
299 |
+
* Feature - New drag-and-drop layout designer for customizing events, teams, players, and staff pages.
|
300 |
+
* Feature - Allow player biography to float next to photo in profile.
|
301 |
+
* Feature - Add option to display separate offensive and defensive statistics in player profiles.
|
302 |
+
* Feature - Add option to display career totals as a footer row in player statistics tables.
|
303 |
+
* Feature - Add option to display event calendar or fixtures & results on team pages.
|
304 |
+
* Feature - Add option to display time in event logos section when results are not ready.
|
305 |
+
* Feature - Add global visibility settings to player statistic columns.
|
306 |
+
* Feature - Add team, competition, league, and venue filter to event calendar, event list, and event blocks shortcodes.
|
307 |
+
* Feature - Automatically re-order competitions, seasons, venues, positions, and jobs by slug.
|
308 |
+
* Feature - New welcome page outlining notable changes to major plugin version.
|
309 |
+
* Refactor - Change parameter for sp_get_next_event function to allow custom templating.
|
310 |
+
* Tweak - Reverse team order also applies to admin.
|
311 |
+
* Tweak - Hide squad number from defense box score.
|
312 |
+
* Tweak - Use more compact labeling in player columns admin meta box.
|
313 |
+
* Tweak - Update modules page to reflect new premium scoreboard module.
|
314 |
+
* Tweak - Remove hardcoded protocol for calls to Google Maps scripts.
|
315 |
+
* Tweak - Limit venue archives to events.
|
316 |
+
* Tweak - Float team profile next to logo on team pages.
|
317 |
+
* Tweak - Display league table and player list option in teams only when modules are active.
|
318 |
+
* Tweak - Load profile and description meta boxes as native editors instead of custom methods.
|
319 |
+
* Tweak - Load team abbreviations independent of post title filter.
|
320 |
+
* Tweak - Add z-index to make header float above other elements.
|
321 |
+
* Fix - Error when league table column has no equation.
|
322 |
+
* Fix - Error when displaying checkboxes for manual event statistics.
|
323 |
+
* Fix - Venues linking automatically in countdown widgets.
|
324 |
+
* Fix - Styling issue where countdown widgets were pushed off-screen in some themes.
|
325 |
+
* Fix - Avoid loading countdown widget if no events are available.
|
326 |
+
* Preset - Update baseball, cricket, floorball, handball, ice hockey, and softball presets.
|
327 |
+
|
328 |
= 1.9.20 =
|
329 |
* Tweak - Expand event title section for team logos in countdown widget.
|
330 |
* Tweak - Center align team logo images in event.
|
sportspress.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Plugin Name: SportsPress
|
4 |
* Plugin URI: http://themeboy.com/sportspress/
|
5 |
* Description: Manage your club and its players, staff, events, league tables, and player lists.
|
6 |
-
* Version:
|
7 |
* Author: ThemeBoy
|
8 |
* Author URI: http://themeboy.com
|
9 |
* Requires at least: 3.8
|
10 |
-
* Tested up to: 4.
|
11 |
*
|
12 |
* Text Domain: sportspress
|
13 |
* Domain Path: /languages/
|
@@ -26,14 +26,14 @@ if ( ! class_exists( 'SportsPress' ) ) :
|
|
26 |
* Main SportsPress Class
|
27 |
*
|
28 |
* @class SportsPress
|
29 |
-
* @version
|
30 |
*/
|
31 |
final class SportsPress {
|
32 |
|
33 |
/**
|
34 |
* @var string
|
35 |
*/
|
36 |
-
public $version = '
|
37 |
|
38 |
/**
|
39 |
* @var SportsPress The single instance of the class
|
@@ -56,6 +56,11 @@ final class SportsPress {
|
|
56 |
*/
|
57 |
public $formats = null;
|
58 |
|
|
|
|
|
|
|
|
|
|
|
59 |
/**
|
60 |
* @var array
|
61 |
*/
|
@@ -223,6 +228,7 @@ final class SportsPress {
|
|
223 |
include_once( 'includes/class-sp-modules.php' ); // Defines available modules
|
224 |
include_once( 'includes/class-sp-countries.php' ); // Defines continents and countries
|
225 |
include_once( 'includes/class-sp-formats.php' ); // Defines custom post type formats
|
|
|
226 |
include_once( 'includes/class-sp-feeds.php' ); // Adds feeds
|
227 |
|
228 |
// Include template functions making them pluggable by plugins and themes.
|
@@ -235,10 +241,10 @@ final class SportsPress {
|
|
235 |
include_once( 'includes/class-sp-wpml.php' );
|
236 |
|
237 |
// REST API
|
238 |
-
|
239 |
|
240 |
// TGMPA
|
241 |
-
|
242 |
}
|
243 |
|
244 |
/**
|
@@ -288,6 +294,7 @@ final class SportsPress {
|
|
288 |
$this->modules = new SP_Modules(); // Modules class
|
289 |
$this->countries = new SP_Countries(); // Countries class
|
290 |
$this->formats = new SP_Formats(); // Formats class
|
|
|
291 |
$this->feeds = new SP_Feeds(); // Feeds class
|
292 |
|
293 |
// Load string options
|
@@ -335,6 +342,14 @@ final class SportsPress {
|
|
335 |
$plugins = array();
|
336 |
|
337 |
switch ( $sport ):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
case 'cricket':
|
339 |
$plugins[] = array(
|
340 |
'name' => 'SportsPress for Cricket',
|
3 |
* Plugin Name: SportsPress
|
4 |
* Plugin URI: http://themeboy.com/sportspress/
|
5 |
* Description: Manage your club and its players, staff, events, league tables, and player lists.
|
6 |
+
* Version: 2.0.16
|
7 |
* Author: ThemeBoy
|
8 |
* Author URI: http://themeboy.com
|
9 |
* Requires at least: 3.8
|
10 |
+
* Tested up to: 4.6
|
11 |
*
|
12 |
* Text Domain: sportspress
|
13 |
* Domain Path: /languages/
|
26 |
* Main SportsPress Class
|
27 |
*
|
28 |
* @class SportsPress
|
29 |
+
* @version 2.0.16
|
30 |
*/
|
31 |
final class SportsPress {
|
32 |
|
33 |
/**
|
34 |
* @var string
|
35 |
*/
|
36 |
+
public $version = '2.0.16';
|
37 |
|
38 |
/**
|
39 |
* @var SportsPress The single instance of the class
|
56 |
*/
|
57 |
public $formats = null;
|
58 |
|
59 |
+
/**
|
60 |
+
* @var SP_Templates $templates
|
61 |
+
*/
|
62 |
+
public $templates = null;
|
63 |
+
|
64 |
/**
|
65 |
* @var array
|
66 |
*/
|
228 |
include_once( 'includes/class-sp-modules.php' ); // Defines available modules
|
229 |
include_once( 'includes/class-sp-countries.php' ); // Defines continents and countries
|
230 |
include_once( 'includes/class-sp-formats.php' ); // Defines custom post type formats
|
231 |
+
include_once( 'includes/class-sp-templates.php' ); // Defines custom post type templates
|
232 |
include_once( 'includes/class-sp-feeds.php' ); // Adds feeds
|
233 |
|
234 |
// Include template functions making them pluggable by plugins and themes.
|
241 |
include_once( 'includes/class-sp-wpml.php' );
|
242 |
|
243 |
// REST API
|
244 |
+
include_once( 'includes/api/class-sp-rest-api.php' );
|
245 |
|
246 |
// TGMPA
|
247 |
+
include_once( 'includes/libraries/class-tgm-plugin-activation.php' );
|
248 |
}
|
249 |
|
250 |
/**
|
294 |
$this->modules = new SP_Modules(); // Modules class
|
295 |
$this->countries = new SP_Countries(); // Countries class
|
296 |
$this->formats = new SP_Formats(); // Formats class
|
297 |
+
$this->templates = new SP_Templates(); // Templates class
|
298 |
$this->feeds = new SP_Feeds(); // Feeds class
|
299 |
|
300 |
// Load string options
|
342 |
$plugins = array();
|
343 |
|
344 |
switch ( $sport ):
|
345 |
+
case 'baseball':
|
346 |
+
$plugins[] = array(
|
347 |
+
'name' => 'SportsPress for Baseball',
|
348 |
+
'slug' => 'sportspress-for-baseball',
|
349 |
+
'required' => false,
|
350 |
+
'version' => '0.9.1',
|
351 |
+
);
|
352 |
+
break;
|
353 |
case 'cricket':
|
354 |
$plugins[] = array(
|
355 |
'name' => 'SportsPress for Cricket',
|
templates/countdown.php
CHANGED
@@ -4,18 +4,21 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
|
12 |
$defaults = array(
|
13 |
'team' => null,
|
|
|
|
|
14 |
'id' => null,
|
15 |
'title' => null,
|
16 |
'live' => get_option( 'sportspress_enable_live_countdowns', 'yes' ) == 'yes' ? true : false,
|
17 |
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
18 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
|
|
19 |
'show_logos' => get_option( 'sportspress_countdown_show_logos', 'no' ) == 'yes' ? true : false,
|
20 |
);
|
21 |
|
@@ -23,14 +26,37 @@ if ( isset( $id ) ):
|
|
23 |
$post = get_post( $id );
|
24 |
else:
|
25 |
$args = array();
|
26 |
-
if ( isset( $team ) )
|
27 |
-
$args = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
$post = sp_get_next_event( $args );
|
29 |
endif;
|
30 |
|
31 |
extract( $defaults, EXTR_SKIP );
|
32 |
|
33 |
-
if ( ! isset( $post ) ) return;
|
34 |
|
35 |
if ( $title )
|
36 |
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
|
@@ -43,7 +69,7 @@ if ( $link_events ) $title = '<a href="' . get_post_permalink( $post->ID, false,
|
|
43 |
<h3 class="event-name">
|
44 |
<?php
|
45 |
if ( $show_logos ) {
|
46 |
-
$teams = array_unique( get_post_meta( $post->ID, 'sp_team' ) );
|
47 |
$i = 0;
|
48 |
|
49 |
if ( is_array( $teams ) ) {
|
@@ -67,7 +93,19 @@ if ( $link_events ) $title = '<a href="' . get_post_permalink( $post->ID, false,
|
|
67 |
$venues = get_the_terms( $post->ID, 'sp_venue' );
|
68 |
if ( $venues ):
|
69 |
?>
|
70 |
-
<h5 class="event-venue"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
<?php
|
72 |
endif;
|
73 |
endif;
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0.13
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
|
12 |
$defaults = array(
|
13 |
'team' => null,
|
14 |
+
'league' => null,
|
15 |
+
'season' => null,
|
16 |
'id' => null,
|
17 |
'title' => null,
|
18 |
'live' => get_option( 'sportspress_enable_live_countdowns', 'yes' ) == 'yes' ? true : false,
|
19 |
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
20 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
21 |
+
'link_venues' => get_option( 'sportspress_link_venues', 'no' ) == 'yes' ? true : false,
|
22 |
'show_logos' => get_option( 'sportspress_countdown_show_logos', 'no' ) == 'yes' ? true : false,
|
23 |
);
|
24 |
|
26 |
$post = get_post( $id );
|
27 |
else:
|
28 |
$args = array();
|
29 |
+
if ( isset( $team ) ) {
|
30 |
+
$args['meta_query'] = array(
|
31 |
+
array(
|
32 |
+
'key' => 'sp_team',
|
33 |
+
'value' => $team,
|
34 |
+
)
|
35 |
+
);
|
36 |
+
}
|
37 |
+
if ( isset( $league ) || isset( $season ) ) {
|
38 |
+
$args['tax_query'] = array( 'relation' => 'AND' );
|
39 |
+
|
40 |
+
if ( isset( $league ) ) {
|
41 |
+
$args['tax_query'][] = array(
|
42 |
+
'taxonomy' => 'sp_league',
|
43 |
+
'terms' => $league,
|
44 |
+
);
|
45 |
+
}
|
46 |
+
|
47 |
+
if ( isset( $season ) ) {
|
48 |
+
$args['tax_query'][] = array(
|
49 |
+
'taxonomy' => 'sp_season',
|
50 |
+
'terms' => $season,
|
51 |
+
);
|
52 |
+
}
|
53 |
+
}
|
54 |
$post = sp_get_next_event( $args );
|
55 |
endif;
|
56 |
|
57 |
extract( $defaults, EXTR_SKIP );
|
58 |
|
59 |
+
if ( ! isset( $post ) || ! $post ) return;
|
60 |
|
61 |
if ( $title )
|
62 |
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
|
69 |
<h3 class="event-name">
|
70 |
<?php
|
71 |
if ( $show_logos ) {
|
72 |
+
$teams = array_unique( (array) get_post_meta( $post->ID, 'sp_team' ) );
|
73 |
$i = 0;
|
74 |
|
75 |
if ( is_array( $teams ) ) {
|
93 |
$venues = get_the_terms( $post->ID, 'sp_venue' );
|
94 |
if ( $venues ):
|
95 |
?>
|
96 |
+
<h5 class="event-venue">
|
97 |
+
<?php
|
98 |
+
if ( $link_venues ) {
|
99 |
+
the_terms( $post->ID, 'sp_venue' );
|
100 |
+
} else {
|
101 |
+
$venue_names = array();
|
102 |
+
foreach ( $venues as $venue ) {
|
103 |
+
$venue_names[] = $venue->name;
|
104 |
+
}
|
105 |
+
echo implode( '/', $venue_names );
|
106 |
+
}
|
107 |
+
?>
|
108 |
+
</h5>
|
109 |
<?php
|
110 |
endif;
|
111 |
endif;
|
templates/event-blocks.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -18,17 +18,22 @@ $defaults = array(
|
|
18 |
'date_to' => 'default',
|
19 |
'league' => null,
|
20 |
'season' => null,
|
|
|
|
|
|
|
21 |
'number' => -1,
|
|
|
22 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
23 |
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
24 |
'paginated' => get_option( 'sportspress_event_blocks_paginated', 'yes' ) == 'yes' ? true : false,
|
25 |
-
'rows' => get_option( 'sportspress_event_blocks_rows',
|
26 |
'order' => 'default',
|
27 |
'show_all_events_link' => false,
|
28 |
'show_title' => get_option( 'sportspress_event_blocks_show_title', 'no' ) == 'yes' ? true : false,
|
29 |
'show_league' => get_option( 'sportspress_event_blocks_show_league', 'no' ) == 'yes' ? true : false,
|
30 |
'show_season' => get_option( 'sportspress_event_blocks_show_season', 'no' ) == 'yes' ? true : false,
|
31 |
'show_venue' => get_option( 'sportspress_event_blocks_show_venue', 'no' ) == 'yes' ? true : false,
|
|
|
32 |
);
|
33 |
|
34 |
extract( $defaults, EXTR_SKIP );
|
@@ -46,10 +51,17 @@ if ( $league )
|
|
46 |
$calendar->league = $league;
|
47 |
if ( $season )
|
48 |
$calendar->season = $season;
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
if ( $order != 'default' )
|
50 |
$calendar->order = $order;
|
51 |
$data = $calendar->data();
|
52 |
-
|
|
|
53 |
|
54 |
if ( $show_title && false === $title && $id ):
|
55 |
$caption = $calendar->caption;
|
@@ -59,10 +71,6 @@ if ( $show_title && false === $title && $id ):
|
|
59 |
$title = get_the_title( $id );
|
60 |
endif;
|
61 |
|
62 |
-
if ( isset( $columns ) ) {
|
63 |
-
$usecolumns = $columns;
|
64 |
-
}
|
65 |
-
|
66 |
if ( $title )
|
67 |
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
|
68 |
?>
|
@@ -87,18 +95,20 @@ if ( $title )
|
|
87 |
$teams = array_filter( $teams, 'sp_filter_positive' );
|
88 |
$logos = array();
|
89 |
|
90 |
-
$
|
91 |
-
|
92 |
-
$
|
93 |
-
|
94 |
-
if ( $
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
98 |
endif;
|
99 |
-
|
100 |
-
|
101 |
-
endforeach;
|
102 |
?>
|
103 |
<tr class="sp-row sp-post<?php echo ( $i % 2 == 0 ? ' alternate' : '' ); ?>">
|
104 |
<td>
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0.8
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
18 |
'date_to' => 'default',
|
19 |
'league' => null,
|
20 |
'season' => null,
|
21 |
+
'venue' => null,
|
22 |
+
'team' => null,
|
23 |
+
'player' => null,
|
24 |
'number' => -1,
|
25 |
+
'show_team_logo' => get_option( 'sportspress_event_blocks_show_logos', 'yes' ) == 'yes' ? true : false,
|
26 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
27 |
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
28 |
'paginated' => get_option( 'sportspress_event_blocks_paginated', 'yes' ) == 'yes' ? true : false,
|
29 |
+
'rows' => get_option( 'sportspress_event_blocks_rows', 5 ),
|
30 |
'order' => 'default',
|
31 |
'show_all_events_link' => false,
|
32 |
'show_title' => get_option( 'sportspress_event_blocks_show_title', 'no' ) == 'yes' ? true : false,
|
33 |
'show_league' => get_option( 'sportspress_event_blocks_show_league', 'no' ) == 'yes' ? true : false,
|
34 |
'show_season' => get_option( 'sportspress_event_blocks_show_season', 'no' ) == 'yes' ? true : false,
|
35 |
'show_venue' => get_option( 'sportspress_event_blocks_show_venue', 'no' ) == 'yes' ? true : false,
|
36 |
+
'hide_if_empty' => false,
|
37 |
);
|
38 |
|
39 |
extract( $defaults, EXTR_SKIP );
|
51 |
$calendar->league = $league;
|
52 |
if ( $season )
|
53 |
$calendar->season = $season;
|
54 |
+
if ( $venue )
|
55 |
+
$calendar->venue = $venue;
|
56 |
+
if ( $team )
|
57 |
+
$calendar->team = $team;
|
58 |
+
if ( $player )
|
59 |
+
$calendar->player = $player;
|
60 |
if ( $order != 'default' )
|
61 |
$calendar->order = $order;
|
62 |
$data = $calendar->data();
|
63 |
+
|
64 |
+
if ( $hide_if_empty && empty( $data ) ) return;
|
65 |
|
66 |
if ( $show_title && false === $title && $id ):
|
67 |
$caption = $calendar->caption;
|
71 |
$title = get_the_title( $id );
|
72 |
endif;
|
73 |
|
|
|
|
|
|
|
|
|
74 |
if ( $title )
|
75 |
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
|
76 |
?>
|
95 |
$teams = array_filter( $teams, 'sp_filter_positive' );
|
96 |
$logos = array();
|
97 |
|
98 |
+
if ( $show_team_logo ):
|
99 |
+
$j = 0;
|
100 |
+
foreach( $teams as $team ):
|
101 |
+
$j++;
|
102 |
+
if ( has_post_thumbnail ( $team ) ):
|
103 |
+
if ( $link_teams ):
|
104 |
+
$logo = '<a class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" href="' . get_permalink( $team, false, true ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</a>';
|
105 |
+
else:
|
106 |
+
$logo = '<span class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</span>';
|
107 |
+
endif;
|
108 |
+
$logos[] = $logo;
|
109 |
endif;
|
110 |
+
endforeach;
|
111 |
+
endif;
|
|
|
112 |
?>
|
113 |
<tr class="sp-row sp-post<?php echo ( $i % 2 == 0 ? ' alternate' : '' ); ?>">
|
114 |
<td>
|
templates/event-calendar.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -19,39 +19,48 @@ $defaults = array(
|
|
19 |
'date_to' => 'default',
|
20 |
'league' => null,
|
21 |
'season' => null,
|
|
|
|
|
|
|
22 |
'initial' => true,
|
23 |
'caption_tag' => 'h4',
|
24 |
'show_all_events_link' => false,
|
|
|
25 |
);
|
26 |
|
27 |
extract( $defaults, EXTR_SKIP );
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
$
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
// week_begins = 0 stands for Sunday
|
57 |
$week_begins = intval(get_option('start_of_week'));
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0.15
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
19 |
'date_to' => 'default',
|
20 |
'league' => null,
|
21 |
'season' => null,
|
22 |
+
'venue' => null,
|
23 |
+
'team' => null,
|
24 |
+
'player' => null,
|
25 |
'initial' => true,
|
26 |
'caption_tag' => 'h4',
|
27 |
'show_all_events_link' => false,
|
28 |
+
'override_global_date' => false,
|
29 |
);
|
30 |
|
31 |
extract( $defaults, EXTR_SKIP );
|
32 |
|
33 |
+
$calendar = new SP_Calendar( $id );
|
34 |
+
if ( $status != 'default' )
|
35 |
+
$calendar->status = $status;
|
36 |
+
if ( $date != 'default' )
|
37 |
+
$calendar->date = $date;
|
38 |
+
if ( $date_from != 'default' )
|
39 |
+
$calendar->from = $date_from;
|
40 |
+
if ( $date_to != 'default' )
|
41 |
+
$calendar->to = $date_to;
|
42 |
+
if ( $league )
|
43 |
+
$calendar->league = $league;
|
44 |
+
if ( $season )
|
45 |
+
$calendar->season = $season;
|
46 |
+
if ( $venue )
|
47 |
+
$calendar->venue = $venue;
|
48 |
+
if ( $team )
|
49 |
+
$calendar->team = $team;
|
50 |
+
if ( $player )
|
51 |
+
$calendar->player = $player;
|
52 |
+
if ($override_global_date) {
|
53 |
+
$year = gmdate('Y', current_time('timestamp'));
|
54 |
+
$monthnum = gmdate('m', current_time('timestamp'));
|
55 |
+
}
|
56 |
+
$events = $calendar->data();
|
57 |
+
|
58 |
+
if ( empty( $events ) ) {
|
59 |
+
$in = 'AND 1 = 0'; // False logic to prevent SQL error
|
60 |
+
} else {
|
61 |
+
$event_ids = wp_list_pluck( $events, 'ID' );
|
62 |
+
$in = 'AND ID IN (' . implode( ', ', $event_ids ) . ')';
|
63 |
+
}
|
64 |
|
65 |
// week_begins = 0 stands for Sunday
|
66 |
$week_begins = intval(get_option('start_of_week'));
|
templates/event-fixtures-results.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Event Blocks
|
4 |
+
*
|
5 |
+
* @author ThemeBoy
|
6 |
+
* @package SportsPress/Templates
|
7 |
+
* @version 2.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
+
|
12 |
+
$defaults = array(
|
13 |
+
'id' => null,
|
14 |
+
'date' => 'default',
|
15 |
+
'date_from' => 'default',
|
16 |
+
'date_to' => 'default',
|
17 |
+
'league' => null,
|
18 |
+
'season' => null,
|
19 |
+
'team' => null,
|
20 |
+
'number' => -1,
|
21 |
+
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
22 |
+
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
23 |
+
'paginated' => get_option( 'sportspress_event_blocks_paginated', 'yes' ) == 'yes' ? true : false,
|
24 |
+
'rows' => get_option( 'sportspress_event_blocks_rows', 5 ),
|
25 |
+
'show_league' => get_option( 'sportspress_event_blocks_show_league', 'no' ) == 'yes' ? true : false,
|
26 |
+
'show_season' => get_option( 'sportspress_event_blocks_show_season', 'no' ) == 'yes' ? true : false,
|
27 |
+
'show_venue' => get_option( 'sportspress_event_blocks_show_venue', 'no' ) == 'yes' ? true : false,
|
28 |
+
);
|
29 |
+
|
30 |
+
extract( $defaults, EXTR_SKIP );
|
31 |
+
|
32 |
+
$calendar = new SP_Calendar( $id );
|
33 |
+
if ( $date != 'default' )
|
34 |
+
$calendar->date = $date;
|
35 |
+
if ( $date_from != 'default' )
|
36 |
+
$calendar->from = $date_from;
|
37 |
+
if ( $date_to != 'default' )
|
38 |
+
$calendar->to = $date_to;
|
39 |
+
if ( $league )
|
40 |
+
$calendar->league = $league;
|
41 |
+
if ( $season )
|
42 |
+
$calendar->season = $season;
|
43 |
+
if ( $team )
|
44 |
+
$calendar->team = $team;
|
45 |
+
|
46 |
+
$args = array(
|
47 |
+
'id' => $id,
|
48 |
+
'title' => __( 'Fixtures', 'sportspress' ),
|
49 |
+
'status' => 'future',
|
50 |
+
'date' => $date,
|
51 |
+
'date_from' => $date_from,
|
52 |
+
'date_to' => $date_to,
|
53 |
+
'league' => $league,
|
54 |
+
'season' => $season,
|
55 |
+
'team' => $team,
|
56 |
+
'number' => $number,
|
57 |
+
'link_teams' => $link_teams,
|
58 |
+
'link_events' => $link_events,
|
59 |
+
'paginated' => $paginated,
|
60 |
+
'rows' => $rows,
|
61 |
+
'order' => 'ASC',
|
62 |
+
'show_all_events_link' => false,
|
63 |
+
'show_title' => true,
|
64 |
+
'show_league' => $show_league,
|
65 |
+
'show_season' => $show_season,
|
66 |
+
'show_venue' => $show_venue,
|
67 |
+
'hide_if_empty' => true,
|
68 |
+
);
|
69 |
+
|
70 |
+
echo '<div class="sp-fixtures-results">';
|
71 |
+
|
72 |
+
echo '<div class="sp-widget-align-left">';
|
73 |
+
sp_get_template( 'event-blocks.php', $args );
|
74 |
+
echo '</div>';
|
75 |
+
|
76 |
+
$args['title'] = __( 'Results', 'sportspress' );
|
77 |
+
$args['status'] = 'publish';
|
78 |
+
$args['order'] = 'DESC';
|
79 |
+
|
80 |
+
echo '<div class="sp-widget-align-right">';
|
81 |
+
sp_get_template( 'event-blocks.php', $args );
|
82 |
+
echo '</div>';
|
83 |
+
|
84 |
+
echo '</div>';
|
templates/event-list.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -18,11 +18,15 @@ $defaults = array(
|
|
18 |
'date_to' => 'default',
|
19 |
'league' => null,
|
20 |
'season' => null,
|
|
|
|
|
|
|
21 |
'number' => -1,
|
22 |
'show_team_logo' => get_option( 'sportspress_event_list_show_logos', 'no' ) == 'yes' ? true : false,
|
23 |
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
24 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
25 |
'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false,
|
|
|
26 |
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
27 |
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
28 |
'paginated' => get_option( 'sportspress_event_list_paginated', 'yes' ) == 'yes' ? true : false,
|
@@ -48,6 +52,12 @@ if ( $league )
|
|
48 |
$calendar->league = $league;
|
49 |
if ( $season )
|
50 |
$calendar->season = $season;
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
if ( $order != 'default' )
|
52 |
$calendar->order = $order;
|
53 |
$data = $calendar->data();
|
@@ -163,7 +173,7 @@ endif;
|
|
163 |
|
164 |
if ( $teams ):
|
165 |
foreach ( $teams as $team ):
|
166 |
-
$name =
|
167 |
if ( $name ):
|
168 |
|
169 |
if ( $show_team_logo ):
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0.8
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
18 |
'date_to' => 'default',
|
19 |
'league' => null,
|
20 |
'season' => null,
|
21 |
+
'venue' => null,
|
22 |
+
'team' => null,
|
23 |
+
'player' => null,
|
24 |
'number' => -1,
|
25 |
'show_team_logo' => get_option( 'sportspress_event_list_show_logos', 'no' ) == 'yes' ? true : false,
|
26 |
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
27 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
28 |
'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false,
|
29 |
+
'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
|
30 |
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
31 |
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
32 |
'paginated' => get_option( 'sportspress_event_list_paginated', 'yes' ) == 'yes' ? true : false,
|
52 |
$calendar->league = $league;
|
53 |
if ( $season )
|
54 |
$calendar->season = $season;
|
55 |
+
if ( $venue )
|
56 |
+
$calendar->venue = $venue;
|
57 |
+
if ( $team )
|
58 |
+
$calendar->team = $team;
|
59 |
+
if ( $player )
|
60 |
+
$calendar->player = $player;
|
61 |
if ( $order != 'default' )
|
62 |
$calendar->order = $order;
|
63 |
$data = $calendar->data();
|
173 |
|
174 |
if ( $teams ):
|
175 |
foreach ( $teams as $team ):
|
176 |
+
$name = sp_get_team_name( $team, $abbreviate_teams );
|
177 |
if ( $name ):
|
178 |
|
179 |
if ( $show_team_logo ):
|
templates/event-logos.php
CHANGED
@@ -4,14 +4,16 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
if ( get_option( 'sportspress_event_show_logos', 'yes' ) === 'no' ) return;
|
12 |
|
13 |
$show_team_names = get_option( 'sportspress_event_logos_show_team_names', 'no' ) === 'yes' ? true : false;
|
|
|
14 |
$show_results = get_option( 'sportspress_event_logos_show_results', 'no' ) === 'yes' ? true : false;
|
|
|
15 |
|
16 |
if ( ! isset( $id ) )
|
17 |
$id = get_the_ID();
|
@@ -20,6 +22,8 @@ if ( $show_results ) {
|
|
20 |
$results = sp_get_main_results( $id );
|
21 |
if ( empty( $results ) ) {
|
22 |
$show_results = false;
|
|
|
|
|
23 |
}
|
24 |
}
|
25 |
|
@@ -40,9 +44,9 @@ if ( $teams ):
|
|
40 |
// Add team name
|
41 |
if ( $show_team_names ) {
|
42 |
if ( $alt ) {
|
43 |
-
$logo .= ' <strong class="sp-team-name">' .
|
44 |
} else {
|
45 |
-
$logo = '<strong class="sp-team-name">' .
|
46 |
}
|
47 |
}
|
48 |
|
@@ -50,7 +54,7 @@ if ( $teams ):
|
|
50 |
if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ) $logo = '<a href="' . get_post_permalink( $team ) . '">' . $logo . '</a>';
|
51 |
|
52 |
// Add result
|
53 |
-
if ( $show_results ) {
|
54 |
$team_result = array_shift( $results );
|
55 |
$team_result = apply_filters( 'sportspress_event_logos_team_result', $team_result, $id, $team );
|
56 |
if ( $alt ) {
|
@@ -60,13 +64,23 @@ if ( $teams ):
|
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
|
64 |
-
$
|
|
|
|
|
|
|
65 |
endforeach;
|
66 |
$team_logos = array_filter( $team_logos );
|
67 |
if ( ! empty( $team_logos ) ):
|
68 |
echo '<div class="sp-template sp-template-event-logos"><div class="sp-event-logos sp-event-logos-' . sizeof( $teams ) . '">';
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
echo implode( ' ' . $delimiter . ' ', $team_logos );
|
71 |
echo '</div></div>';
|
72 |
endif;
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
if ( get_option( 'sportspress_event_show_logos', 'yes' ) === 'no' ) return;
|
12 |
|
13 |
$show_team_names = get_option( 'sportspress_event_logos_show_team_names', 'no' ) === 'yes' ? true : false;
|
14 |
+
$show_time = get_option( 'sportspress_event_logos_show_time', 'no' ) === 'yes' ? true : false;
|
15 |
$show_results = get_option( 'sportspress_event_logos_show_results', 'no' ) === 'yes' ? true : false;
|
16 |
+
$abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
|
17 |
|
18 |
if ( ! isset( $id ) )
|
19 |
$id = get_the_ID();
|
22 |
$results = sp_get_main_results( $id );
|
23 |
if ( empty( $results ) ) {
|
24 |
$show_results = false;
|
25 |
+
} else {
|
26 |
+
$show_time = false;
|
27 |
}
|
28 |
}
|
29 |
|
44 |
// Add team name
|
45 |
if ( $show_team_names ) {
|
46 |
if ( $alt ) {
|
47 |
+
$logo .= ' <strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong>';
|
48 |
} else {
|
49 |
+
$logo = '<strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong> ' . $logo;
|
50 |
}
|
51 |
}
|
52 |
|
54 |
if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ) $logo = '<a href="' . get_post_permalink( $team ) . '">' . $logo . '</a>';
|
55 |
|
56 |
// Add result
|
57 |
+
if ( $show_results && ! empty( $results ) ) {
|
58 |
$team_result = array_shift( $results );
|
59 |
$team_result = apply_filters( 'sportspress_event_logos_team_result', $team_result, $id, $team );
|
60 |
if ( $alt ) {
|
64 |
}
|
65 |
}
|
66 |
|
67 |
+
// Add logo to array
|
68 |
+
if ( '' !== $logo ) {
|
69 |
+
$team_logos[] = '<span class="sp-team-logo">' . $logo . '</span>';
|
70 |
+
$i++;
|
71 |
+
}
|
72 |
endforeach;
|
73 |
$team_logos = array_filter( $team_logos );
|
74 |
if ( ! empty( $team_logos ) ):
|
75 |
echo '<div class="sp-template sp-template-event-logos"><div class="sp-event-logos sp-event-logos-' . sizeof( $teams ) . '">';
|
76 |
+
|
77 |
+
// Assign delimiter
|
78 |
+
if ( $show_time && sizeof( $teams ) <= 2 ) {
|
79 |
+
$delimiter = '<strong class="sp-event-logos-time sp-team-result">' . get_the_time( get_option('time_format'), $id ) . '</strong>';
|
80 |
+
} else {
|
81 |
+
$delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' );
|
82 |
+
}
|
83 |
+
|
84 |
echo implode( ' ' . $delimiter . ' ', $team_logos );
|
85 |
echo '</div></div>';
|
86 |
endif;
|
templates/event-performance-table.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -30,7 +30,7 @@ if ( ! isset( $subs ) ) $subs = array();
|
|
30 |
<thead>
|
31 |
<tr>
|
32 |
<?php if ( $show_players ): ?>
|
33 |
-
<?php if ( $show_numbers ) { ?>
|
34 |
<th class="data-number">#</th>
|
35 |
<?php } ?>
|
36 |
<th class="data-name">
|
@@ -77,7 +77,7 @@ if ( ! isset( $subs ) ) $subs = array();
|
|
77 |
|
78 |
echo '<tr class="' . sp_array_value( $row, 'status', 'lineup' ) . ' ' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
79 |
|
80 |
-
if ( $show_numbers ) {
|
81 |
$number = sp_array_value( $row, 'number', ' ' );
|
82 |
|
83 |
// Player number
|
@@ -171,7 +171,7 @@ if ( ! isset( $subs ) ) $subs = array();
|
|
171 |
<tr class="sp-total-row <?php echo ( $i % 2 == 0 ? 'odd' : 'even' ); ?>">
|
172 |
<?php
|
173 |
if ( $show_players ):
|
174 |
-
if ( $show_numbers ) {
|
175 |
echo '<td class="data-number"> </td>';
|
176 |
}
|
177 |
echo '<td class="data-name">' . __( 'Total', 'sportspress' ) . '</td>';
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0.6
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
30 |
<thead>
|
31 |
<tr>
|
32 |
<?php if ( $show_players ): ?>
|
33 |
+
<?php if ( apply_filters( 'sportspress_event_performance_show_numbers', $show_numbers, $section ) ) { ?>
|
34 |
<th class="data-number">#</th>
|
35 |
<?php } ?>
|
36 |
<th class="data-name">
|
77 |
|
78 |
echo '<tr class="' . sp_array_value( $row, 'status', 'lineup' ) . ' ' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
79 |
|
80 |
+
if ( apply_filters( 'sportspress_event_performance_show_numbers', $show_numbers, $section ) ) {
|
81 |
$number = sp_array_value( $row, 'number', ' ' );
|
82 |
|
83 |
// Player number
|
171 |
<tr class="sp-total-row <?php echo ( $i % 2 == 0 ? 'odd' : 'even' ); ?>">
|
172 |
<?php
|
173 |
if ( $show_players ):
|
174 |
+
if ( apply_filters( 'sportspress_event_performance_show_numbers', $show_numbers, $section ) ) {
|
175 |
echo '<td class="data-number"> </td>';
|
176 |
}
|
177 |
echo '<td class="data-name">' . __( 'Total', 'sportspress' ) . '</td>';
|
templates/event-performance.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -15,7 +15,8 @@ $show_staff = get_option( 'sportspress_event_show_staff', 'yes' ) === 'yes' ? tr
|
|
15 |
$show_total = get_option( 'sportspress_event_show_total', 'yes' ) === 'yes' ? true : false;
|
16 |
$show_numbers = get_option( 'sportspress_event_show_player_numbers', 'yes' ) === 'yes' ? true : false;
|
17 |
$sections = get_option( 'sportspress_event_performance_sections', -1 );
|
18 |
-
$
|
|
|
19 |
$primary = sp_get_main_performance_option();
|
20 |
$total = get_option( 'sportspress_event_total_performance', 'all');
|
21 |
|
@@ -105,7 +106,7 @@ if ( is_array( $teams ) ):
|
|
105 |
'show_players' => $show_players,
|
106 |
'show_numbers' => $show_numbers,
|
107 |
'show_total' => $show_total,
|
108 |
-
'caption' => __( '
|
109 |
'labels' => $labels,
|
110 |
'formats' => $formats,
|
111 |
'mode' => $mode,
|
@@ -212,7 +213,7 @@ if ( is_array( $teams ) ):
|
|
212 |
'show_players' => $show_team_players,
|
213 |
'show_numbers' => $show_numbers,
|
214 |
'show_total' => $show_total,
|
215 |
-
'caption' => 0 == $s && $team_id ?
|
216 |
'labels' => $labels[ $section_id ],
|
217 |
'formats' => $formats,
|
218 |
'mode' => $mode,
|
@@ -247,7 +248,7 @@ if ( is_array( $teams ) ):
|
|
247 |
'show_players' => $show_team_players,
|
248 |
'show_numbers' => $show_numbers,
|
249 |
'show_total' => $show_total,
|
250 |
-
'caption' => $team_id ?
|
251 |
'labels' => $labels,
|
252 |
'formats' => $formats,
|
253 |
'mode' => $mode,
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0.7
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
15 |
$show_total = get_option( 'sportspress_event_show_total', 'yes' ) === 'yes' ? true : false;
|
16 |
$show_numbers = get_option( 'sportspress_event_show_player_numbers', 'yes' ) === 'yes' ? true : false;
|
17 |
$sections = get_option( 'sportspress_event_performance_sections', -1 );
|
18 |
+
$abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
|
19 |
+
$reverse_teams = get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ? true : false;
|
20 |
$primary = sp_get_main_performance_option();
|
21 |
$total = get_option( 'sportspress_event_total_performance', 'all');
|
22 |
|
106 |
'show_players' => $show_players,
|
107 |
'show_numbers' => $show_numbers,
|
108 |
'show_total' => $show_total,
|
109 |
+
'caption' => __( 'Box Score', 'sportspress' ),
|
110 |
'labels' => $labels,
|
111 |
'formats' => $formats,
|
112 |
'mode' => $mode,
|
213 |
'show_players' => $show_team_players,
|
214 |
'show_numbers' => $show_numbers,
|
215 |
'show_total' => $show_total,
|
216 |
+
'caption' => 0 == $s && $team_id ? sp_get_team_name( $team_id, $abbreviate_teams ) : null,
|
217 |
'labels' => $labels[ $section_id ],
|
218 |
'formats' => $formats,
|
219 |
'mode' => $mode,
|
248 |
'show_players' => $show_team_players,
|
249 |
'show_numbers' => $show_numbers,
|
250 |
'show_total' => $show_total,
|
251 |
+
'caption' => $team_id ? sp_get_team_name( $team_id, $abbreviate_teams ) : null,
|
252 |
'labels' => $labels,
|
253 |
'formats' => $formats,
|
254 |
'mode' => $mode,
|
templates/event-results.php
CHANGED
@@ -4,14 +4,12 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
if ( get_option( 'sportspress_event_show_results', 'yes' ) === 'no' ) return;
|
12 |
|
13 |
-
$reverse_teams = get_option( 'sportspress_event_results_reverse_teams', 'no' ) === 'yes' ? true : false;
|
14 |
-
|
15 |
if ( ! isset( $id ) )
|
16 |
$id = get_the_ID();
|
17 |
|
@@ -20,6 +18,8 @@ $status = $event->status();
|
|
20 |
|
21 |
if ( 'results' != $status ) return;
|
22 |
|
|
|
|
|
23 |
// Get event result data
|
24 |
$data = $event->results();
|
25 |
|
@@ -36,6 +36,7 @@ if ( empty( $data ) )
|
|
36 |
|
37 |
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
38 |
$link_teams = get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false;
|
|
|
39 |
$show_outcomes = array_key_exists( 'outcome', $labels );
|
40 |
|
41 |
// Initialize
|
@@ -43,10 +44,6 @@ $output = '';
|
|
43 |
$table_rows = '';
|
44 |
$i = 0;
|
45 |
|
46 |
-
if ( $reverse_teams ) {
|
47 |
-
$data = array_reverse( $data, true );
|
48 |
-
}
|
49 |
-
|
50 |
foreach( $data as $team_id => $result ):
|
51 |
if ( $show_outcomes ):
|
52 |
$outcomes = array();
|
@@ -67,7 +64,7 @@ foreach( $data as $team_id => $result ):
|
|
67 |
|
68 |
$table_rows .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
69 |
|
70 |
-
$team_name =
|
71 |
|
72 |
if ( $link_teams ):
|
73 |
$team_name = '<a href="' . get_post_permalink( $team_id ) . '">' . $team_name . '</a>';
|
@@ -81,7 +78,7 @@ foreach( $data as $team_id => $result ):
|
|
81 |
if ( array_key_exists( $key, $result ) && $result[ $key ] != '' ):
|
82 |
$value = $result[ $key ];
|
83 |
else:
|
84 |
-
$value = '—';
|
85 |
endif;
|
86 |
$table_rows .= '<td class="data-' . $key . '">' . $value . '</td>';
|
87 |
endforeach;
|
@@ -101,7 +98,7 @@ if ( empty( $table_rows ) ):
|
|
101 |
|
102 |
else:
|
103 |
|
104 |
-
$output .= '<h4 class="sp-table-caption">' .
|
105 |
|
106 |
$output .= '<div class="sp-table-wrapper">' .
|
107 |
'<table class="sp-event-results sp-data-table' . ( $scrollable ? ' sp-scrollable-table' : '' ) . '"><thead>' .
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
if ( get_option( 'sportspress_event_show_results', 'yes' ) === 'no' ) return;
|
12 |
|
|
|
|
|
13 |
if ( ! isset( $id ) )
|
14 |
$id = get_the_ID();
|
15 |
|
18 |
|
19 |
if ( 'results' != $status ) return;
|
20 |
|
21 |
+
if ( ! isset( $caption ) ) $caption = __( 'Results', 'sportspress' );
|
22 |
+
|
23 |
// Get event result data
|
24 |
$data = $event->results();
|
25 |
|
36 |
|
37 |
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
38 |
$link_teams = get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false;
|
39 |
+
$abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
|
40 |
$show_outcomes = array_key_exists( 'outcome', $labels );
|
41 |
|
42 |
// Initialize
|
44 |
$table_rows = '';
|
45 |
$i = 0;
|
46 |
|
|
|
|
|
|
|
|
|
47 |
foreach( $data as $team_id => $result ):
|
48 |
if ( $show_outcomes ):
|
49 |
$outcomes = array();
|
64 |
|
65 |
$table_rows .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
66 |
|
67 |
+
$team_name = sp_get_team_name( $team_id, $abbreviate_teams );
|
68 |
|
69 |
if ( $link_teams ):
|
70 |
$team_name = '<a href="' . get_post_permalink( $team_id ) . '">' . $team_name . '</a>';
|
78 |
if ( array_key_exists( $key, $result ) && $result[ $key ] != '' ):
|
79 |
$value = $result[ $key ];
|
80 |
else:
|
81 |
+
$value = apply_filters( 'sportspress_event_empty_result_string', '—' );
|
82 |
endif;
|
83 |
$table_rows .= '<td class="data-' . $key . '">' . $value . '</td>';
|
84 |
endforeach;
|
98 |
|
99 |
else:
|
100 |
|
101 |
+
$output .= '<h4 class="sp-table-caption">' . $caption . '</h4>';
|
102 |
|
103 |
$output .= '<div class="sp-table-wrapper">' .
|
104 |
'<table class="sp-event-results sp-data-table' . ( $scrollable ? ' sp-scrollable-table' : '' ) . '"><thead>' .
|
templates/player-details.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -21,6 +21,7 @@ $defaults = array(
|
|
21 |
'show_leagues' => get_option( 'sportspress_player_show_leagues', 'no' ) == 'yes' ? true : false,
|
22 |
'show_seasons' => get_option( 'sportspress_player_show_seasons', 'no' ) == 'yes' ? true : false,
|
23 |
'show_nationality_flags' => get_option( 'sportspress_player_show_flags', 'yes' ) == 'yes' ? true : false,
|
|
|
24 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
25 |
);
|
26 |
|
@@ -62,7 +63,7 @@ $data = array_merge( $metrics_before, $common, $metrics_after );
|
|
62 |
if ( $show_current_teams && $current_teams ):
|
63 |
$teams = array();
|
64 |
foreach ( $current_teams as $team ):
|
65 |
-
$team_name =
|
66 |
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
67 |
$teams[] = $team_name;
|
68 |
endforeach;
|
@@ -72,7 +73,7 @@ endif;
|
|
72 |
if ( $show_past_teams && $past_teams ):
|
73 |
$teams = array();
|
74 |
foreach ( $past_teams as $team ):
|
75 |
-
$team_name =
|
76 |
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
77 |
$teams[] = $team_name;
|
78 |
endforeach;
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
21 |
'show_leagues' => get_option( 'sportspress_player_show_leagues', 'no' ) == 'yes' ? true : false,
|
22 |
'show_seasons' => get_option( 'sportspress_player_show_seasons', 'no' ) == 'yes' ? true : false,
|
23 |
'show_nationality_flags' => get_option( 'sportspress_player_show_flags', 'yes' ) == 'yes' ? true : false,
|
24 |
+
'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
|
25 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
26 |
);
|
27 |
|
63 |
if ( $show_current_teams && $current_teams ):
|
64 |
$teams = array();
|
65 |
foreach ( $current_teams as $team ):
|
66 |
+
$team_name = sp_get_team_name( $team, $abbreviate_teams );
|
67 |
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
68 |
$teams[] = $team_name;
|
69 |
endforeach;
|
73 |
if ( $show_past_teams && $past_teams ):
|
74 |
$teams = array();
|
75 |
foreach ( $past_teams as $team ):
|
76 |
+
$team_name = sp_get_team_name( $team, $abbreviate_teams );
|
77 |
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
78 |
$teams[] = $team_name;
|
79 |
endforeach;
|
templates/player-list.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -24,6 +24,7 @@ $defaults = array(
|
|
24 |
'show_player_flag' => get_option( 'sportspress_list_show_flags', 'no' ) == 'yes' ? true : false,
|
25 |
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
26 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
|
|
27 |
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
28 |
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
29 |
'paginated' => get_option( 'sportspress_list_paginated', 'yes' ) == 'yes' ? true : false,
|
@@ -170,7 +171,7 @@ foreach ( $groups as $group ):
|
|
170 |
|
171 |
if ( array_key_exists( 'team', $labels ) ):
|
172 |
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_team', true ) );
|
173 |
-
$team_name =
|
174 |
if ( $link_teams ):
|
175 |
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
176 |
endif;
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
24 |
'show_player_flag' => get_option( 'sportspress_list_show_flags', 'no' ) == 'yes' ? true : false,
|
25 |
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
26 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
27 |
+
'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
|
28 |
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
29 |
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
30 |
'paginated' => get_option( 'sportspress_list_paginated', 'yes' ) == 'yes' ? true : false,
|
171 |
|
172 |
if ( array_key_exists( 'team', $labels ) ):
|
173 |
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_team', true ) );
|
174 |
+
$team_name = sp_get_team_name( $team, $abbreviate_teams );
|
175 |
if ( $link_teams ):
|
176 |
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
177 |
endif;
|
templates/player-statistics-league.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Player Statistics for Single Competition
|
4 |
+
*
|
5 |
+
* @author ThemeBoy
|
6 |
+
* @category Admin
|
7 |
+
* @package SportsPress/Admin/Meta_Boxes
|
8 |
+
* @version 2.0.5
|
9 |
+
*/
|
10 |
+
|
11 |
+
// The first row should be column labels
|
12 |
+
$labels = $data[0];
|
13 |
+
|
14 |
+
// Remove the first row to leave us with the actual data
|
15 |
+
unset( $data[0] );
|
16 |
+
|
17 |
+
// Skip if there are no rows in the table
|
18 |
+
if ( empty( $data ) )
|
19 |
+
return;
|
20 |
+
|
21 |
+
$output = '<h4 class="sp-table-caption">' . $caption . '</h4>' .
|
22 |
+
'<div class="sp-table-wrapper">' .
|
23 |
+
'<table class="sp-player-statistics sp-data-table' . ( $scrollable ? ' sp-scrollable-table' : '' ) . '">' . '<thead>' . '<tr>';
|
24 |
+
|
25 |
+
foreach( $labels as $key => $label ):
|
26 |
+
if ( isset( $hide_teams ) && 'team' == $key )
|
27 |
+
continue;
|
28 |
+
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
29 |
+
endforeach;
|
30 |
+
|
31 |
+
$output .= '</tr>' . '</thead>' . '<tbody>';
|
32 |
+
|
33 |
+
$i = 0;
|
34 |
+
|
35 |
+
foreach( $data as $season_id => $row ):
|
36 |
+
|
37 |
+
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
38 |
+
|
39 |
+
foreach( $labels as $key => $value ):
|
40 |
+
if ( isset( $hide_teams ) && 'team' == $key )
|
41 |
+
continue;
|
42 |
+
$output .= '<td class="data-' . $key . ( -1 === $season_id ? ' sp-highlight' : '' ) . '">' . sp_array_value( $row, $key, '' ) . '</td>';
|
43 |
+
endforeach;
|
44 |
+
|
45 |
+
$output .= '</tr>';
|
46 |
+
|
47 |
+
$i++;
|
48 |
+
|
49 |
+
endforeach;
|
50 |
+
|
51 |
+
$output .= '</tbody>' . '</table>' . '</div>';
|
52 |
+
?>
|
53 |
+
<div class="sp-template sp-template-player-statistics">
|
54 |
+
<?php echo $output; ?>
|
55 |
+
</div>
|
templates/player-statistics.php
CHANGED
@@ -4,11 +4,11 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
-
if ( get_option( 'sportspress_player_show_statistics', 'yes' ) === 'no' ) return;
|
12 |
|
13 |
if ( ! isset( $id ) )
|
14 |
$id = get_the_ID();
|
@@ -16,103 +16,60 @@ if ( ! isset( $id ) )
|
|
16 |
$player = new SP_Player( $id );
|
17 |
|
18 |
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
|
|
|
|
19 |
$leagues = get_the_terms( $id, 'sp_league' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
// Loop through statistics for each league
|
22 |
if ( is_array( $leagues ) ):
|
23 |
-
foreach ( $
|
24 |
-
$
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
endforeach;
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
foreach( $labels as $key => $value ):
|
53 |
-
$output .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
54 |
-
endforeach;
|
55 |
-
|
56 |
-
$output .= '</tr>';
|
57 |
-
|
58 |
-
$i++;
|
59 |
-
|
60 |
-
endforeach;
|
61 |
-
|
62 |
-
$output .= '</tbody>' . '</table>' . '</div>';
|
63 |
-
?>
|
64 |
-
<div class="sp-template sp-template-player-statistics">
|
65 |
-
<?php echo $output; ?>
|
66 |
-
</div>
|
67 |
-
<?php
|
68 |
-
endforeach;
|
69 |
-
endif;
|
70 |
-
|
71 |
-
// Career total
|
72 |
-
$data = $player->data( 0 );
|
73 |
-
|
74 |
-
// The first row should be column labels
|
75 |
-
$labels = $data[0];
|
76 |
-
|
77 |
-
// Remove the first row to leave us with the actual data
|
78 |
-
unset( $data[0] );
|
79 |
-
|
80 |
-
// Skip if there are no rows in the table
|
81 |
-
if ( empty( $data ) )
|
82 |
-
return false;
|
83 |
-
|
84 |
-
$output = '<h4 class="sp-table-caption">' . __( 'Career Total', 'sportspress' ) . '</h4>' .
|
85 |
-
'<div class="sp-table-wrapper">' .
|
86 |
-
'<table class="sp-player-statistics sp-data-table' . ( $scrollable ? ' sp-scrollable-table' : '' ) . '">' . '<thead>' . '<tr>';
|
87 |
-
|
88 |
-
foreach( $labels as $key => $label ):
|
89 |
-
if ( 'team' == $key )
|
90 |
-
continue;
|
91 |
-
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
92 |
-
endforeach;
|
93 |
-
|
94 |
-
$output .= '</tr>' . '</thead>' . '<tbody>';
|
95 |
-
|
96 |
-
$i = 0;
|
97 |
-
|
98 |
-
foreach( $data as $season_id => $row ):
|
99 |
-
|
100 |
-
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
101 |
-
|
102 |
-
foreach( $labels as $key => $value ):
|
103 |
-
if ( 'team' == $key )
|
104 |
-
continue;
|
105 |
-
$output .= '<td class="data-' . $key . '">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
106 |
-
endforeach;
|
107 |
-
|
108 |
-
$output .= '</tr>';
|
109 |
-
|
110 |
-
$i++;
|
111 |
-
|
112 |
-
endforeach;
|
113 |
-
|
114 |
-
$output .= '</tbody>' . '</table>' . '</div>';
|
115 |
-
?>
|
116 |
-
<div class="sp-template sp-template-player-statistics sp-template-player-total">
|
117 |
-
<?php echo $output; ?>
|
118 |
-
</div>
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0.5
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
+
if ( 'no' === get_option( 'sportspress_player_show_statistics', 'yes' ) && 'no' === get_option( 'sportspress_player_show_total', 'no' ) ) return;
|
12 |
|
13 |
if ( ! isset( $id ) )
|
14 |
$id = get_the_ID();
|
16 |
$player = new SP_Player( $id );
|
17 |
|
18 |
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
19 |
+
$sections = get_option( 'sportspress_player_performance_sections', -1 );
|
20 |
+
$show_teams = apply_filters( 'sportspress_player_team_statistics', true );
|
21 |
$leagues = get_the_terms( $id, 'sp_league' );
|
22 |
+
$positions = $player->positions();
|
23 |
+
$player_sections = array();
|
24 |
+
if ( $positions ) {
|
25 |
+
foreach ( $positions as $position ) {
|
26 |
+
$player_sections = array_merge( $player_sections, sp_get_term_sections( $position->term_id ) );
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
// Determine order of sections
|
31 |
+
if ( 1 == $sections ) {
|
32 |
+
$section_order = array( 1 => __( 'Defense', 'sportspress' ), 0 => __( 'Offense', 'sportspress' ) );
|
33 |
+
} elseif ( 0 == $sections ) {
|
34 |
+
$section_order = array( __( 'Offense', 'sportspress' ), __( 'Defense', 'sportspress' ) );
|
35 |
+
} else {
|
36 |
+
$section_order = array( -1 => null );
|
37 |
+
}
|
38 |
|
39 |
// Loop through statistics for each league
|
40 |
if ( is_array( $leagues ) ):
|
41 |
+
foreach ( $section_order as $section_id => $section_label ) {
|
42 |
+
if ( -1 !== $section_id && ! empty( $player_sections ) && ! in_array( $section_id, $player_sections ) ) continue;
|
43 |
+
|
44 |
+
if ( sizeof( $leagues ) > 1 ) {
|
45 |
+
printf( '<h3 class="sp-post-caption sp-player-statistics-section">%s</h3>', $section_label );
|
46 |
+
}
|
47 |
+
|
48 |
+
foreach ( $leagues as $league ):
|
49 |
+
$caption = $league->name;
|
50 |
+
|
51 |
+
if ( null !== $section_label ) {
|
52 |
+
if ( sizeof( $leagues ) === 1 ) {
|
53 |
+
$caption = $section_label;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
$args = array(
|
58 |
+
'data' => $player->data( $league->term_id, false, $section_id ),
|
59 |
+
'caption' => $caption,
|
60 |
+
'scrollable' => $scrollable,
|
61 |
+
);
|
62 |
+
if ( ! $show_teams ) {
|
63 |
+
$args['hide_teams'] = true;
|
64 |
+
}
|
65 |
+
sp_get_template( 'player-statistics-league.php', $args );
|
66 |
endforeach;
|
67 |
|
68 |
+
sp_get_template( 'player-statistics-league.php', array(
|
69 |
+
'data' => $player->data( 0, false, $section_id ),
|
70 |
+
'caption' => __( 'Career Total', 'sportspress' ),
|
71 |
+
'scrollable' => $scrollable,
|
72 |
+
'hide_teams' => true,
|
73 |
+
) );
|
74 |
+
}
|
75 |
+
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/staff-details.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
-
* @version
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -19,6 +19,7 @@ $defaults = array(
|
|
19 |
'show_past_teams' => get_option( 'sportspress_staff_show_past_teams', 'yes' ) == 'yes' ? true : false,
|
20 |
'show_nationality_flags' => get_option( 'sportspress_staff_show_flags', 'yes' ) == 'yes' ? true : false,
|
21 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
|
|
22 |
);
|
23 |
|
24 |
extract( $defaults, EXTR_SKIP );
|
@@ -49,7 +50,7 @@ endif;
|
|
49 |
if ( $show_current_teams && $current_teams ):
|
50 |
$teams = array();
|
51 |
foreach ( $current_teams as $team ):
|
52 |
-
$team_name =
|
53 |
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
54 |
$teams[] = $team_name;
|
55 |
endforeach;
|
@@ -59,7 +60,7 @@ endif;
|
|
59 |
if ( $show_past_teams && $past_teams ):
|
60 |
$teams = array();
|
61 |
foreach ( $past_teams as $team ):
|
62 |
-
$team_name =
|
63 |
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
64 |
$teams[] = $team_name;
|
65 |
endforeach;
|
4 |
*
|
5 |
* @author ThemeBoy
|
6 |
* @package SportsPress/Templates
|
7 |
+
* @version 2.0
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
19 |
'show_past_teams' => get_option( 'sportspress_staff_show_past_teams', 'yes' ) == 'yes' ? true : false,
|
20 |
'show_nationality_flags' => get_option( 'sportspress_staff_show_flags', 'yes' ) == 'yes' ? true : false,
|
21 |
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
22 |
+
'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
|
23 |
);
|
24 |
|
25 |
extract( $defaults, EXTR_SKIP );
|
50 |
if ( $show_current_teams && $current_teams ):
|
51 |
$teams = array();
|
52 |
foreach ( $current_teams as $team ):
|
53 |
+
$team_name = sp_get_team_name( $team, $abbreviate_teams );
|
54 |
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
55 |
$teams[] = $team_name;
|
56 |
endforeach;
|
60 |
if ( $show_past_teams && $past_teams ):
|
61 |
$teams = array();
|
62 |
foreach ( $past_teams as $team ):
|
63 |
+
$team_name = sp_get_team_name( $team, $abbreviate_teams );
|
64 |
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
65 |
$teams[] = $team_name;
|
66 |
endforeach;
|
templates/team-events.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Team Events
|
4 |
+
*
|
5 |
+
* @author ThemeBoy
|
6 |
+
* @package SportsPress/Templates
|
7 |
+
* @version 2.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
+
|
12 |
+
if ( ! isset( $id ) )
|
13 |
+
$id = get_the_ID();
|
14 |
+
|
15 |
+
$format = get_option( 'sportspress_team_events_format', 'blocks' );
|
16 |
+
if ( 'calendar' === $format )
|
17 |
+
sp_get_template( 'event-calendar.php', array( 'team' => $id ) );
|
18 |
+
else
|
19 |
+
sp_get_template( 'event-fixtures-results.php', array( 'team' => $id ) );
|
templates/venue-map.php
CHANGED
@@ -2,22 +2,33 @@
|
|
2 |
/**
|
3 |
* Venue Map
|
4 |
*
|
5 |
-
* @author
|
6 |
-
* @package
|
7 |
-
* @version 0.
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
|
12 |
if ( ! isset( $meta ) )
|
13 |
-
|
14 |
|
15 |
$address = sp_array_value( $meta, 'sp_address', null );
|
|
|
16 |
$latitude = sp_array_value( $meta, 'sp_latitude', null );
|
17 |
$longitude = sp_array_value( $meta, 'sp_longitude', null );
|
|
|
|
|
|
|
|
|
18 |
|
19 |
if ( $latitude != null && $longitude != null ):
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
endif;
|
2 |
/**
|
3 |
* Venue Map
|
4 |
*
|
5 |
+
* @author ThemeBoy
|
6 |
+
* @package SportsPress/Templates
|
7 |
+
* @version 2.0.14
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
|
12 |
if ( ! isset( $meta ) )
|
13 |
+
return;
|
14 |
|
15 |
$address = sp_array_value( $meta, 'sp_address', null );
|
16 |
+
$address = urlencode( $address );
|
17 |
$latitude = sp_array_value( $meta, 'sp_latitude', null );
|
18 |
$longitude = sp_array_value( $meta, 'sp_longitude', null );
|
19 |
+
$zoom = get_option( 'sportspress_map_zoom', 15 );
|
20 |
+
$maptype = get_option( 'sportspress_map_type', 'roadmap' );
|
21 |
+
$maptype = strtolower( $maptype );
|
22 |
+
if ( 'satellite' !== $maptype ) $maptype = 'roadmap';
|
23 |
|
24 |
if ( $latitude != null && $longitude != null ):
|
25 |
+
?>
|
26 |
+
<iframe
|
27 |
+
class="sp-google-map<?php if ( is_tax( 'sp_venue' ) ): ?> sp-venue-map<?php endif; ?>"
|
28 |
+
width="600"
|
29 |
+
height="320"
|
30 |
+
frameborder="0" style="border:0"
|
31 |
+
src="https://www.google.com/maps/embed/v1/search?key=AIzaSyAWyt_AG0k_Pgz4LuegtHwesA_OMRnSSAE&q=<?php echo $address; ?>&center=<?php echo $latitude; ?>,<?php echo $longitude; ?>&zoom=<?php echo $zoom; ?>&maptype=<?php echo $maptype; ?>" allowfullscreen>
|
32 |
+
</iframe>
|
33 |
+
<?php
|
34 |
endif;
|
wpml-config.xml
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
<wpml-config>
|
2 |
<admin-texts>
|
3 |
<key name="sportspress_text">
|
|
|
4 |
<key name="Article"/>
|
|
|
|
|
5 |
<key name="Competition"/>
|
6 |
<key name="Current Team"/>
|
7 |
<key name="Current Teams"/>
|
@@ -9,6 +12,7 @@
|
|
9 |
<key name="Details"/>
|
10 |
<key name="Event"/>
|
11 |
<key name="Event Results"/>
|
|
|
12 |
<key name="Nationality"/>
|
13 |
<key name="Outcome"/>
|
14 |
<key name="Past Teams"/>
|
@@ -20,7 +24,6 @@
|
|
20 |
<key name="Preview"/>
|
21 |
<key name="Rank"/>
|
22 |
<key name="Recap"/>
|
23 |
-
<key name="Scorecard"/>
|
24 |
<key name="Season"/>
|
25 |
<key name="Staff"/>
|
26 |
<key name="Substitutes"/>
|
1 |
<wpml-config>
|
2 |
<admin-texts>
|
3 |
<key name="sportspress_text">
|
4 |
+
<key name="Age"/>
|
5 |
<key name="Article"/>
|
6 |
+
<key name="Birthday"/>
|
7 |
+
<key name="Box Score"/>
|
8 |
<key name="Competition"/>
|
9 |
<key name="Current Team"/>
|
10 |
<key name="Current Teams"/>
|
12 |
<key name="Details"/>
|
13 |
<key name="Event"/>
|
14 |
<key name="Event Results"/>
|
15 |
+
<key name="Fixtures"/>
|
16 |
<key name="Nationality"/>
|
17 |
<key name="Outcome"/>
|
18 |
<key name="Past Teams"/>
|
24 |
<key name="Preview"/>
|
25 |
<key name="Rank"/>
|
26 |
<key name="Recap"/>
|
|
|
27 |
<key name="Season"/>
|
28 |
<key name="Staff"/>
|
29 |
<key name="Substitutes"/>
|