diff --git a/assets/css/activation.css b/assets/css/activation.css index 8c8854d2..2839d1aa 100644 --- a/assets/css/activation.css +++ b/assets/css/activation.css @@ -60,18 +60,18 @@ p.sportspress-actions a.button-primary:focus { .sportspress-steps:before, .sportspress-steps:after { - content: " "; - display: table; + content: " "; + display: table; } .sportspress-steps:after { - clear: both; + clear: both; } .sportspress-steps { - *zoom: 1; + *zoom: 1; } .sportspress-steps .welcome-icon i:before { color: #888; -} \ No newline at end of file +} diff --git a/assets/css/admin.css b/assets/css/admin.css index ada2c019..798cdc8a 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -318,8 +318,8 @@ table.widefat.sp-data-table input[type="text"], table.widefat.sp-data-table input[type="number"] { min-width: 1.25em; width: 100%; - margin: 1px; - padding: 3px 5px; + margin: 1px; + padding: 3px 5px; } table.widefat.sp-data-table input[type="text"]::placeholder, @@ -681,28 +681,28 @@ table.widefat.sp-sortable-table tbody tr .icon { .sp-toggle-switch + label:before, .sp-toggle-switch + label:after { - display: block; - position: absolute; - top: 0; - left: 0; - bottom: 0; - content: ""; + display: block; + position: absolute; + top: 0; + left: 0; + bottom: 0; + content: ""; } .sp-toggle-switch + label:before { - right: 1px; - background-color: #e4e4e4; - border-radius: 16px; - transition: background 0.4s; + right: 1px; + background-color: #e4e4e4; + border-radius: 16px; + transition: background 0.4s; } .sp-toggle-switch + label:after { - width: 16px; - background-color: #fff; - border-radius: 100%; - -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); - transition: margin 0.4s; + width: 16px; + background-color: #fff; + border-radius: 100%; + -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); + transition: margin 0.4s; } .sp-toggle-switch:checked + label:before { @@ -735,7 +735,7 @@ table.widefat.sp-sortable-table tbody tr .icon { clear: both; max-width: 382px; width: 100%; - box-sizing: border-box; + box-sizing: border-box; } .sp-sortable-list .sp-item-float + .sp-item-float { @@ -743,49 +743,49 @@ table.widefat.sp-sortable-table tbody tr .icon { } .sp-item-bar { - clear: both; - line-height: 1.5em; - position: relative; - margin: 9px 0 0; + clear: both; + line-height: 1.5em; + position: relative; + margin: 9px 0 0; } .sp-item-bar .sp-item-handle { background: #fafafa; color: #23282d; - border: 1px solid #dfdfdf; - position: relative; - padding: 10px 15px; - height: auto; - min-height: 20px; - line-height: 30px; - overflow: hidden; - word-wrap: break-word; + border: 1px solid #dfdfdf; + position: relative; + padding: 10px 15px; + height: auto; + min-height: 20px; + line-height: 30px; + overflow: hidden; + word-wrap: break-word; } .sp-item-bar .sp-item-handle:hover { - border-color: #999; - -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1); - box-shadow: 0 1px 2px rgba(0,0,0,.1); + border-color: #999; + -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1); + box-shadow: 0 1px 2px rgba(0,0,0,.1); } .sp-item-bar .sp-item-title { font-size: 13px; - font-weight: 600; - line-height: 20px; - display: block; - margin-right: 13em; + font-weight: 600; + line-height: 20px; + display: block; + margin-right: 13em; } .sp-item-settings { - display: block; - padding: 10px 0 10px 15px; - position: relative; - z-index: 10; - background: #fff; - border: 1px solid #e5e5e5; - border-top: none; - -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04); - box-shadow: 0 1px 1px rgba(0,0,0,.04); + display: block; + padding: 10px 0 10px 15px; + position: relative; + z-index: 10; + background: #fff; + border: 1px solid #e5e5e5; + border-top: none; + -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04); + box-shadow: 0 1px 1px rgba(0,0,0,.04); } .js .sp-item-handle { @@ -793,9 +793,9 @@ table.widefat.sp-sortable-table tbody tr .icon { } .sp-sortable-list .sp-item-placeholder { - border: 1px dashed #b4b9be; - margin: 9px auto 6px; - height: 42px; + border: 1px dashed #b4b9be; + margin: 9px auto 6px; + height: 42px; } /* Logo */ @@ -1225,7 +1225,7 @@ table.sp-status-table td mark.yes { float: none; margin-left: 0; } - + .wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-sp_format, .wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-sp_icon, .wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-sp_number { @@ -1241,7 +1241,7 @@ table.sp-status-table td mark.yes { margin-right: 0; padding-right: 0; } - + .about-sportspress-wrap .sp-badge { float: none; margin: 20px auto 10px; diff --git a/assets/css/chosen.css b/assets/css/chosen.css index 45fee21c..c7cac737 100755 --- a/assets/css/chosen.css +++ b/assets/css/chosen.css @@ -427,9 +427,9 @@ This file is generated by `grunt build`, do not edit it by hand. .chosen-container-multi .chosen-choices .search-choice .search-choice-close, .chosen-container .chosen-results-scroll-down span, .chosen-container .chosen-results-scroll-up span { - background-image: url('../images/chosen/chosen-sprite@2x.png') !important; - background-size: 52px 37px !important; - background-repeat: no-repeat !important; + background-image: url('../images/chosen/chosen-sprite@2x.png') !important; + background-size: 52px 37px !important; + background-repeat: no-repeat !important; } } /* @end */ diff --git a/assets/css/customize.css b/assets/css/customize.css index 96c6560f..2852b55c 100644 --- a/assets/css/customize.css +++ b/assets/css/customize.css @@ -17,4 +17,4 @@ } #available-widgets [class*=sp_countdown] .widget-title:before { content: "\f469"; -} \ No newline at end of file +} diff --git a/assets/css/equation.css b/assets/css/equation.css index 37536d68..c9361b02 100644 --- a/assets/css/equation.css +++ b/assets/css/equation.css @@ -73,4 +73,4 @@ .sp-equation-formula .button .remove:hover { color: #d00; -} \ No newline at end of file +} diff --git a/assets/css/leaflet.css b/assets/css/leaflet.css index 017fa0e4..0791c008 100644 --- a/assets/css/leaflet.css +++ b/assets/css/leaflet.css @@ -22,7 +22,7 @@ .leaflet-marker-shadow { -webkit-user-select: none; -moz-user-select: none; - user-select: none; + user-select: none; -webkit-user-drag: none; } /* Prevents IE11 from highlighting tiles in blue */ @@ -86,7 +86,7 @@ width: 0; height: 0; -moz-box-sizing: border-box; - box-sizing: border-box; + box-sizing: border-box; z-index: 800; } /* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */ @@ -173,15 +173,15 @@ opacity: 0; -webkit-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear; - transition: opacity 0.2s linear; + transition: opacity 0.2s linear; } .leaflet-fade-anim .leaflet-map-pane .leaflet-popup { opacity: 1; } .leaflet-zoom-animated { -webkit-transform-origin: 0 0; - -ms-transform-origin: 0 0; - transform-origin: 0 0; + -ms-transform-origin: 0 0; + transform-origin: 0 0; } .leaflet-zoom-anim .leaflet-zoom-animated { will-change: transform; @@ -189,13 +189,13 @@ .leaflet-zoom-anim .leaflet-zoom-animated { -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1); -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1); - transition: transform 0.25s cubic-bezier(0,0,0.25,1); + transition: transform 0.25s cubic-bezier(0,0,0.25,1); } .leaflet-zoom-anim .leaflet-tile, .leaflet-pan-anim .leaflet-tile { -webkit-transition: none; -moz-transition: none; - transition: none; + transition: none; } .leaflet-zoom-anim .leaflet-zoom-hide { @@ -435,7 +435,7 @@ svg.leaflet-image-layer.leaflet-interactive path { white-space: nowrap; overflow: hidden; -moz-box-sizing: border-box; - box-sizing: border-box; + box-sizing: border-box; background: #fff; background: rgba(255, 255, 255, 0.5); @@ -498,8 +498,8 @@ svg.leaflet-image-layer.leaflet-interactive path { -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); - -ms-transform: rotate(45deg); - transform: rotate(45deg); + -ms-transform: rotate(45deg); + transform: rotate(45deg); } .leaflet-popup-content-wrapper, .leaflet-popup-tip { diff --git a/assets/css/menu.css b/assets/css/menu.css index 9e11a486..c8cf53e9 100644 --- a/assets/css/menu.css +++ b/assets/css/menu.css @@ -371,4 +371,4 @@ i.mce-i-sp_shortcodes_button:before, span.mce_sp_shortcodes_button:before { text-align: center; content: "\f111"; font-size: 20px; -} \ No newline at end of file +} diff --git a/assets/css/setup.css b/assets/css/setup.css index eec50dc6..178efe78 100644 --- a/assets/css/setup.css +++ b/assets/css/setup.css @@ -1,421 +1,421 @@ .sp-setup-content p, .sp-setup-content table { - font-size: 1em; - line-height: 1.75em; - color: #666; + font-size: 1em; + line-height: 1.75em; + color: #666; } body { - margin: 100px auto 24px; - box-shadow: none; - background: #f1f1f1; - padding: 0; + margin: 100px auto 24px; + box-shadow: none; + background: #f1f1f1; + padding: 0; } #sp-logo { - border: 0; - margin: 24px 0; - padding: 0; - text-align: center; + border: 0; + margin: 24px 0; + padding: 0; + text-align: center; } #sp-logo img { - width: auto; - height: auto; - max-width: 100%; - max-height: 50px; + width: auto; + height: auto; + max-width: 100%; + max-height: 50px; } .sp-setup-content { - box-shadow: 0 1px 3px rgba(0, 0, 0, .13); - padding: 24px 24px 0; - background: #fff; - zoom: 1; + box-shadow: 0 1px 3px rgba(0, 0, 0, .13); + padding: 24px 24px 0; + background: #fff; + zoom: 1; } .sp-setup-content:after { - content: ""; - display: table; - clear: both; + content: ""; + display: table; + clear: both; } .sp-setup-content h1, .sp-setup-content h2, .sp-setup-content h3, .sp-setup-content table { - margin: 0 0 24px; - border: 0; - padding: 0; - color: #666; - clear: none; + margin: 0 0 24px; + border: 0; + padding: 0; + color: #666; + clear: none; } .sp-setup-content p { - margin: 0 0 24px; + margin: 0 0 24px; } .sp-setup-content a { - color: #00a69c; + color: #00a69c; } .sp-setup-content a:focus, .sp-setup-content a:hover { - color: #111; + color: #111; } .sp-setup-content .form-table { - width: 100%; - border-top: 1px solid #eee; + width: 100%; + border-top: 1px solid #eee; } .sp-setup-content .form-table th { - width: 30%; - vertical-align: top; - font-weight: 700; + width: 30%; + vertical-align: top; + font-weight: 700; } .sp-setup-content .form-table td { - vertical-align: top; + vertical-align: top; } .sp-setup-content .form-table td input, .sp-setup-content .form-table td select { - width: 100%; - box-sizing: border-box; + width: 100%; + box-sizing: border-box; } .sp-setup-content .form-table td input[size] { - width: auto; + width: auto; } .sp-setup-content .form-table td ol, .sp-setup-content .form-table td ul { - margin: 0; - padding: 0; + margin: 0; + padding: 0; } .sp-setup-content .form-table td ul { - list-style: none; + list-style: none; } .sp-setup-content .form-table td li { - margin-bottom: 10px; + margin-bottom: 10px; } .sp-setup-content .form-table td li:last-child { - margin-bottom: 0; + margin-bottom: 0; } .sp-setup-content .form-table td .description { - line-height: 1.5em; - display: block; - margin: .25em 0 0; - color: #999; - font-style: italic; + line-height: 1.5em; + display: block; + margin: .25em 0 0; + color: #999; + font-style: italic; } .sp-setup-content .form-table td .input-checkbox, .sp-setup-content .form-table td .input-radio { - width: auto; - box-sizing: inherit; - padding: inherit; - margin: 0 .5em 0 0; - box-shadow: none; + width: auto; + box-sizing: inherit; + padding: inherit; + margin: 0 .5em 0 0; + box-shadow: none; } .sp-setup-content .form-table .section_title td { - padding: 0; + padding: 0; } .sp-setup-content .form-table .section_title td h2, .sp-setup-content .form-table .section_title td p { - margin: 12px 0 0; + margin: 12px 0 0; } .sp-setup-content .form-table td, .sp-setup-content .form-table th { - padding: 14px 0; - margin: 0; - border: 0; - border-bottom: 1px solid #eee; + padding: 14px 0; + margin: 0; + border: 0; + border-bottom: 1px solid #eee; } .sp-setup-content .form-table td:first-child, .sp-setup-content .form-table th:first-child { - padding-right: 9px; + padding-right: 9px; } .sp-setup-content .form-table th .sp-desc-tip { - line-height: 1.4; + line-height: 1.4; } .sp-setup-content .form-table .sp-chosen-container { - display: block; + display: block; } .sp-setup-content .form-table .sp-location-picker { - width: 100%; - height: 320px; - margin: 0.5em 0 0; + width: 100%; + height: 320px; + margin: 0.5em 0 0; } .sp-setup-content .twitter-share-button { - float: right; + float: right; } .sp-setup-content .sp-banner { - margin: 0 -24px 24px; + margin: 0 -24px 24px; } .sp-setup-content .sp-banner img { - display: block; - width: auto; - height: auto; - max-width: 100%; + display: block; + width: auto; + height: auto; + max-width: 100%; } .sp-setup-content .sp-setup-next-steps { - overflow: hidden; - margin: 0 0 24px; + overflow: hidden; + margin: 0 0 24px; } .sp-setup-content .sp-setup-next-steps h2 { - margin-bottom: 12px; + margin-bottom: 12px; } .sp-setup-content .sp-setup-next-steps .sp-setup-next-steps-first { - float: left; - width: 50%; - box-sizing: border-box; + float: left; + width: 50%; + box-sizing: border-box; } .sp-setup-content .sp-setup-next-steps .sp-setup-next-steps-last { - float: right; - width: 50%; - box-sizing: border-box; + float: right; + width: 50%; + box-sizing: border-box; } .sp-setup-content .sp-setup-next-steps ul { - padding: 0 2em 0 0; - list-style: none; - margin: 0; + padding: 0 2em 0 0; + list-style: none; + margin: 0; } .sp-setup-content .sp-setup-next-steps ul li .button { - display: block; - padding: 0 0 .75em; + display: block; + padding: 0 0 .75em; } .sp-setup-content .sp-setup-next-steps ul li .button-first-event { - background-color: #3bbab3; - border-color: #15a29a; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; - box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; - text-shadow: 0 -1px 1px #15a29a, 1px 0 1px #15a29a, 0 1px 1px #15a29a, -1px 0 1px #15a29a; - font-size: 1em; - height: auto; - line-height: 1.75em; - margin: 0 0 .75em; - opacity: 1; - padding: 1em; - text-align: center; + background-color: #3bbab3; + border-color: #15a29a; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; + text-shadow: 0 -1px 1px #15a29a, 1px 0 1px #15a29a, 0 1px 1px #15a29a, -1px 0 1px #15a29a; + font-size: 1em; + height: auto; + line-height: 1.75em; + margin: 0 0 .75em; + opacity: 1; + padding: 1em; + text-align: center; } .sp-setup-content .sp-setup-next-steps ul li .button-first-event:active, .sp-setup-content .sp-setup-next-steps ul li .button-first-event:focus, .sp-setup-content .sp-setup-next-steps ul li .button-first-event:hover { - background: #15a29a; - border-color: #15a29a; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; - box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; + background: #15a29a; + border-color: #15a29a; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; } .sp-setup-content .sp-setup-next-steps ul li a:before { - color: #82878c; - font: 400 20px/1 dashicons; - speak: none; - display: inline-block; - padding: 0 10px 0 0; - top: 1px; - position: relative; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - text-decoration: none!important; - vertical-align: top; + color: #82878c; + font: 400 20px/1 dashicons; + speak: none; + display: inline-block; + padding: 0 10px 0 0; + top: 1px; + position: relative; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + text-decoration: none!important; + vertical-align: top; } .sp-setup-content .sp-setup-next-steps ul .learn-more a:before { - content: "\f105"; + content: "\f105"; } .sp-setup-content .sp-setup-next-steps ul .video-walkthrough a:before { - content: "\f126"; + content: "\f126"; } .sp-setup-content .sp-setup-next-steps ul .newsletter a:before { - content: "\f465"; + content: "\f465"; } .sp-setup-content .updated { - padding: 24px 24px 0; - margin: 0 0 24px; - overflow: hidden; - background: #f5f5f5; + padding: 24px 24px 0; + margin: 0 0 24px; + overflow: hidden; + background: #f5f5f5; } .sp-setup-content .updated p { - padding: 0; - margin: 0 0 12px; + padding: 0; + margin: 0 0 12px; } .sp-setup-content .updated p:last-child { - margin: 0 0 24px; + margin: 0 0 24px; } .sp-setup-steps { - padding: 0 0 24px; - margin: 0; - list-style: none; - overflow: hidden; - color: #ccc; - width: 100%; - display: -webkit-inline-flex; - display: -ms-inline-flexbox; - display: inline-flex; + padding: 0 0 24px; + margin: 0; + list-style: none; + overflow: hidden; + color: #ccc; + width: 100%; + display: -webkit-inline-flex; + display: -ms-inline-flexbox; + display: inline-flex; } .sp-setup-steps li { - width: 20%; - float: left; - padding: 0 0 .8em; - margin: 0; - text-align: center; - position: relative; - border-bottom: 4px solid #ccc; - line-height: 1.4em; + width: 20%; + float: left; + padding: 0 0 .8em; + margin: 0; + text-align: center; + position: relative; + border-bottom: 4px solid #ccc; + line-height: 1.4em; } .sp-setup-steps li:before { - content: ""; - border: 4px solid #ccc; - border-radius: 100%; - width: 4px; - height: 4px; - position: absolute; - bottom: 0; - left: 50%; - margin-left: -6px; - margin-bottom: -8px; - background: #fff; + content: ""; + border: 4px solid #ccc; + border-radius: 100%; + width: 4px; + height: 4px; + position: absolute; + bottom: 0; + left: 50%; + margin-left: -6px; + margin-bottom: -8px; + background: #fff; } .sp-setup-steps li.active { - border-color: #00a69c; - color: #00a69c; + border-color: #00a69c; + color: #00a69c; } .sp-setup-steps li.active:before { - border-color: #00a69c; + border-color: #00a69c; } .sp-setup-steps li.done { - border-color: #00a69c; - color: #00a69c; + border-color: #00a69c; + color: #00a69c; } .sp-setup-steps li.done:before { - border-color: #00a69c; - background: #00a69c; + border-color: #00a69c; + background: #00a69c; } .sp-setup .sp-setup-actions:after { - content: ""; - display: table; - clear: both; + content: ""; + display: table; + clear: both; } .sp-setup .sp-setup-actions .button { - float: right; - font-size: 1.25em; - padding: .5em 1em; - line-height: 1em; - margin-right: .5em; - margin-bottom: 2px; - height: auto; - border-radius: 4px; + float: right; + font-size: 1.25em; + padding: .5em 1em; + line-height: 1em; + margin-right: .5em; + margin-bottom: 2px; + height: auto; + border-radius: 4px; } .sp-setup .sp-setup-actions .button-primary { - background-color: #3bbab3; - border-color: #15a29a; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; - box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; - text-shadow: 0 -1px 1px #15a29a, 1px 0 1px #15a29a, 0 1px 1px #15a29a, -1px 0 1px #15a29a; - float: right; - margin: 0 0 0 1em; - opacity: 1; + background-color: #3bbab3; + border-color: #15a29a; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; + text-shadow: 0 -1px 1px #15a29a, 1px 0 1px #15a29a, 0 1px 1px #15a29a, -1px 0 1px #15a29a; + float: right; + margin: 0 0 0 1em; + opacity: 1; } .sp-setup .sp-setup-actions .button-primary:active, .sp-setup .sp-setup-actions .button-primary:focus, .sp-setup .sp-setup-actions .button-primary:hover { - background: #15a29a; - border-color: #15a29a; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; - box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; + background: #15a29a; + border-color: #15a29a; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 #15a29a; } .sp-setup .sp-setup-actions .button-muted { - border: none; - background: transparent; - -webkit-box-shadow: none; - box-shadow: none; - padding: 0; - margin: .55em 0.05em 0.65em; - color: #ccc; + border: none; + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + padding: 0; + margin: .55em 0.05em 0.65em; + color: #ccc; } .sp-setup .sp-setup-actions .button-muted:hover { - color: #999; + color: #999; } .sp-return-to-dashboard { - font-size: .85em; - margin: 1.18em 0; - display: block; - text-align: center; + font-size: .85em; + margin: 1.18em 0; + display: block; + text-align: center; } .sp-return-to-dashboard a { - color: #b5b5b5; + color: #b5b5b5; } .sp-return-to-dashboard a:hover { - color: #888; + color: #888; } /* Media Queries */ @media screen and (max-width: 782px) { - .sp-setup-content .form-table tbody th { - width: auto - }; + .sp-setup-content .form-table tbody th { + width: auto + }; } @media screen and (min-width: 783px) { - .sp-setup-content .form-table td li input { - width: 40%; - } + .sp-setup-content .form-table td li input { + width: 40%; + } - .sp-setup-content .form-table td .player input { - width: 40%; - } + .sp-setup-content .form-table td .player input { + width: 40%; + } - .sp-setup-content .form-table td .player .player-number { - width: 11%; - } + .sp-setup-content .form-table td .player .player-number { + width: 11%; + } - .sp-setup-content .form-table td .staff .staff-name { - width: 52%; - } -} \ No newline at end of file + .sp-setup-content .form-table td .staff .staff-name { + width: 52%; + } +} diff --git a/assets/css/slickmap.css b/assets/css/slickmap.css index dd5a3649..b3c479d6 100644 --- a/assets/css/slickmap.css +++ b/assets/css/slickmap.css @@ -240,4 +240,4 @@ table, .sp-sitemap caption, .sp-sitemap tbody, .sp-sitemap tfoot, .sp-sitemap th .sp-sitemap .sp-utility { max-width: none; } -} \ No newline at end of file +} diff --git a/assets/css/sportspress-style-ltr.css b/assets/css/sportspress-style-ltr.css index a88b3168..7cf31c8a 100644 --- a/assets/css/sportspress-style-ltr.css +++ b/assets/css/sportspress-style-ltr.css @@ -6,28 +6,28 @@ */ .sp-tournament-bracket .sp-team .sp-team-name:before { - border-left-color: #e5e5e5 !important; - border-right-color: #e5e5e5 !important; - left: -10px !important; + border-left-color: #e5e5e5 !important; + border-right-color: #e5e5e5 !important; + left: -10px !important; } .sp-tournament-bracket .sp-team-flip .sp-team-name:before { - left: auto !important; - right: -10px !important; + left: auto !important; + right: -10px !important; } .sp-tournament-bracket .sp-team.sp-first-round .sp-team-name { - margin-left: -1px !important; + margin-left: -1px !important; } .sp-tournament-bracket .sp-team.sp-last-round .sp-team-name { - margin-right: -1px !important; + margin-right: -1px !important; } .sp-template-event-performance-icons .sp-performance-icons { - text-align: right !important; + text-align: right !important; } .sp-data-table .data-name { - text-align: left !important; + text-align: left !important; } diff --git a/assets/css/sportspress-style-rtl.css b/assets/css/sportspress-style-rtl.css index 1361a584..05850408 100644 --- a/assets/css/sportspress-style-rtl.css +++ b/assets/css/sportspress-style-rtl.css @@ -6,28 +6,28 @@ */ .sp-tournament-bracket .sp-team .sp-team-name:before { - border-right-color: #e5e5e5 !important; - border-left-color: #e5e5e5 !important; - right: -10px !important; + border-right-color: #e5e5e5 !important; + border-left-color: #e5e5e5 !important; + right: -10px !important; } .sp-tournament-bracket .sp-team-flip .sp-team-name:before { - right: auto !important; - left: -10px !important; + right: auto !important; + left: -10px !important; } .sp-tournament-bracket .sp-team.sp-first-round .sp-team-name { - margin-right: -1px !important; + margin-right: -1px !important; } .sp-tournament-bracket .sp-team.sp-last-round .sp-team-name { - margin-left: -1px !important; + margin-left: -1px !important; } .sp-template-event-performance-icons .sp-performance-icons { - text-align: left !important; + text-align: left !important; } .sp-data-table .data-name { - text-align: right !important; + text-align: right !important; } diff --git a/assets/css/sportspress-style.css b/assets/css/sportspress-style.css index 46922dc1..90de8f88 100644 --- a/assets/css/sportspress-style.css +++ b/assets/css/sportspress-style.css @@ -3,12 +3,12 @@ .sp-template, .sp-data-table, .sp-table-caption { - font-family: "Roboto", "Helvetica", sans-serif; + font-family: "Roboto", "Helvetica", sans-serif; } .sp-template { - clear: both; - overflow: hidden; + clear: both; + overflow: hidden; } /* @@ -34,34 +34,34 @@ .sp-table-caption h4, .sp-table-caption h5, .sp-table-caption h6 { - font-family: "Roboto", "Helvetica", sans-serif !important; + font-family: "Roboto", "Helvetica", sans-serif !important; } .sp-template { - margin-bottom: 20px !important; + margin-bottom: 20px !important; } .sp-template *, .sp-data-table *, .sp-table-caption { - box-sizing: border-box !important; - font-weight: 400 !important; - text-transform: none !important; - letter-spacing: normal !important; - color: #333 !important; + box-sizing: border-box !important; + font-weight: 400 !important; + text-transform: none !important; + letter-spacing: normal !important; + color: #333 !important; } .sp-table-caption { - margin: 0 !important; - padding: 15px !important; - background: #fff !important; - border: 1px solid #e5e5e5 !important; - border-bottom: none !important; - font-size: 20px !important; - font-weight: 400 !important; - line-height: 1.5 !important; - display: table !important; - width: 100% !important; + margin: 0 !important; + padding: 15px !important; + background: #fff !important; + border: 1px solid #e5e5e5 !important; + border-bottom: none !important; + font-size: 20px !important; + font-weight: 400 !important; + line-height: 1.5 !important; + display: table !important; + width: 100% !important; } /* Color Resets */ @@ -70,177 +70,177 @@ .sp-data-table input, .sp-template .sp-event-logos, .sp-template .sp-event-staff { - color: initial !important; + color: initial !important; } /* Links */ .sp-template a, .sp-data-table a { - box-shadow: none !important; - border: none !important; - text-decoration: none !important; - font-weight: inherit !important; - color: #00a69c !important; + box-shadow: none !important; + border: none !important; + text-decoration: none !important; + font-weight: inherit !important; + color: #00a69c !important; } .sp-template a:hover, .sp-data-table a:hover { - text-decoration: underline !important; + text-decoration: underline !important; } .sp-template a:hover .dashicons, .sp-template a:hover [class^="sp-icon-"], [class*=" sp-icon-"], .sp-data-table a:hover .dashicons, .sp-data-table a:hover [class^="sp-icon-"], [class*=" sp-icon-"] { - text-decoration: none !important; + text-decoration: none !important; } .sp-view-all-link { - padding: 10px 15px !important; - margin: 0 !important; - background: #fff !important; - border: 1px solid #e5e5e5 !important; - border-top: none !important; - overflow: hidden !important; - display: table !important; - width: 100% !important; - text-align: right !important; + padding: 10px 15px !important; + margin: 0 !important; + background: #fff !important; + border: 1px solid #e5e5e5 !important; + border-top: none !important; + overflow: hidden !important; + display: table !important; + width: 100% !important; + text-align: right !important; } .sp-view-all-link a { - font-size: 12px !important; - font-weight: 400 !important; - line-height: 1.5 !important; - text-decoration: none !important; - color: rgba(51,51,51,0.5) !important; + font-size: 12px !important; + font-weight: 400 !important; + line-height: 1.5 !important; + text-decoration: none !important; + color: rgba(51,51,51,0.5) !important; } .sp-view-all-link a:hover { - color: #333 !important; - text-decoration: none !important; + color: #333 !important; + text-decoration: none !important; } .sp-form-events a:hover { - color: #fff !important; - text-decoration: none !important; + color: #fff !important; + text-decoration: none !important; } /* Images */ .sp-template img { - display: inline-block !important; - box-shadow: none !important; + display: inline-block !important; + box-shadow: none !important; } /* Tables */ .sp-data-table { - margin: 0 !important; - background: #fff !important; - border-collapse: collapse !important; - border: 1px solid #e5e5e5 !important; - width: 100% !important; + margin: 0 !important; + background: #fff !important; + border-collapse: collapse !important; + border: 1px solid #e5e5e5 !important; + width: 100% !important; } .sp-data-table tr { - border: none !important; + border: none !important; } .sp-data-table th, .sp-data-table td { - font-size: 13px !important; - font-weight: 400 !important; - line-height: 1.5 !important; - border: 1px solid #e5e5e5 !important; - padding: 5px 10px !important; - text-align: center !important; + font-size: 13px !important; + font-weight: 400 !important; + line-height: 1.5 !important; + border: 1px solid #e5e5e5 !important; + padding: 5px 10px !important; + text-align: center !important; } .sp-data-table th { - font-size: 12px !important; - font-weight: 500 !important; - background: #fff !important; - color: #999 !important; - border: none !important; + font-size: 12px !important; + font-weight: 500 !important; + background: #fff !important; + color: #999 !important; + border: none !important; } .sp-data-table th a { - color: inherit !important; + color: inherit !important; } .sp-data-table .sp-highlight, .sp-data-table .highlighted td { - font-weight: 500 !important; - background: #f9f9f9 !important; + font-weight: 500 !important; + background: #f9f9f9 !important; } /* Galleries */ .sp-template-gallery .sp-gallery-wrapper { - border: 1px solid #e5e5e5 !important; - background: #fff !important; - display: table !important; - width: 100% !important; + border: 1px solid #e5e5e5 !important; + background: #fff !important; + display: table !important; + width: 100% !important; } .sp-template-gallery .gallery-item { - padding: 0 !important; - margin: 0 !important; - position: relative !important; + padding: 0 !important; + margin: 0 !important; + position: relative !important; } .sp-template-gallery .gallery-item a { - display: block !important; - color: #999 !important; + display: block !important; + color: #999 !important; } .sp-template-gallery .gallery-item img { - display: block !important; - border: none !important; - padding: 0 !important; - margin: 0 !important; - border-radius: 0 !important; + display: block !important; + border: none !important; + padding: 0 !important; + margin: 0 !important; + border-radius: 0 !important; } .sp-template-gallery .gallery-caption { - padding: 0 !important; - margin: 0 !important; - font-size: 12px !important; - font-style: normal !important; - font-weight: 500 !important; - text-align: center !important; - color: #999 !important; - line-height: 1.5 !important; - padding: 5px 10px !important; + padding: 0 !important; + margin: 0 !important; + font-size: 12px !important; + font-style: normal !important; + font-weight: 500 !important; + text-align: center !important; + color: #999 !important; + line-height: 1.5 !important; + padding: 5px 10px !important; } .sp-template-gallery .gallery-caption strong { - color: #fff !important; - background: #00a69c !important; - display: block !important; - font-weight: 400 !important; - font-size: 13px !important; - line-height: 1.5 !important; - position: absolute !important; - left: 0 !important; - top: 0 !important; - padding: 5px 10px !important; + color: #fff !important; + background: #00a69c !important; + display: block !important; + font-weight: 400 !important; + font-size: 13px !important; + line-height: 1.5 !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + padding: 5px 10px !important; } .sp-template-staff-gallery .gallery-caption strong { - display: none !important; + display: none !important; } .sp-template-gallery .sp-gallery-group-name { - margin: 0 !important; - padding: 15px !important; - background: #fff !important; - border-bottom: 1px solid #e5e5e5 !important; - font-size: 20px !important; - font-weight: 400 !important; - line-height: 1.5 !important; - display: block !important; + margin: 0 !important; + padding: 15px !important; + background: #fff !important; + border-bottom: 1px solid #e5e5e5 !important; + font-size: 20px !important; + font-weight: 400 !important; + line-height: 1.5 !important; + display: block !important; } /* Countdowns */ @@ -249,472 +249,472 @@ .sp-template-countdown .sp-event-venue, .sp-template-countdown .sp-event-league, .sp-template-countdown .sp-event-date { - margin: 0 !important; - padding: 5px 10px !important; - text-align: center !important; - line-height: 1.5 !important; - display: table !important; - width: 100% !important; - background: #fff !important; - border: 1px solid #e5e5e5 !important; - border-bottom: none !important; + margin: 0 !important; + padding: 5px 10px !important; + text-align: center !important; + line-height: 1.5 !important; + display: table !important; + width: 100% !important; + background: #fff !important; + border: 1px solid #e5e5e5 !important; + border-bottom: none !important; } .sp-template-countdown .sp-event-name { - font-size: 13px !important; - font-weight: 400 !important; - color: #333 !important; + font-size: 13px !important; + font-weight: 400 !important; + color: #333 !important; } .sp-template-countdown .sp-event-venue, .sp-template-countdown .sp-event-league, .sp-template-countdown .sp-event-date { - font-size: 12px !important; - font-weight: 500 !important; - background: #fff !important; - color: #999 !important; + font-size: 12px !important; + font-weight: 500 !important; + background: #fff !important; + color: #999 !important; } .sp-template-countdown .sp-event-venue a, .sp-template-countdown .sp-event-league a { - color: inherit !important; + color: inherit !important; } .sp-countdown time { - display: table !important; - background: #fff !important; - border: 1px solid #e5e5e5 !important; - border-collapse: collapse !important; - width: 100% !important; + display: table !important; + background: #fff !important; + border: 1px solid #e5e5e5 !important; + border-collapse: collapse !important; + width: 100% !important; } .sp-countdown span { - font-size: 20px !important; - font-weight: 400 !important; - line-height: 1.5 !important; - display: table-cell !important; - border: 1px solid #e5e5e5 !important; - padding: 10px 5px !important; - text-align: center !important; + font-size: 20px !important; + font-weight: 400 !important; + line-height: 1.5 !important; + display: table-cell !important; + border: 1px solid #e5e5e5 !important; + padding: 10px 5px !important; + text-align: center !important; } .sp-countdown span small { - font-size: 12px !important; - font-weight: 400 !important; - line-height: 1.5 !important; - font-weight: 500 !important; - color: rgba(51,51,51,0.5) !important; - display: block !important; + font-size: 12px !important; + font-weight: 400 !important; + line-height: 1.5 !important; + font-weight: 500 !important; + color: rgba(51,51,51,0.5) !important; + display: block !important; } /* Event Calendars */ .sp-template-event-calendar .sp-table-caption { - display: table-caption !important; + display: table-caption !important; } .sp-template-event-calendar td { - padding: 10px 5px !important; + padding: 10px 5px !important; } .sp-template-event-calendar tfoot td { - padding: 10px 15px !important; - border: none !important; + padding: 10px 15px !important; + border: none !important; } .sp-template-event-calendar .sp-previous-month { - text-align: left !important; + text-align: left !important; } .sp-template-event-calendar .sp-next-month { - text-align: right !important; + text-align: right !important; } .sp-template-event-calendar tfoot a { - font-size: 12px !important; - font-weight: 400 !important; - line-height: 1.5 !important; - text-decoration: none !important; - color: rgba(51,51,51,0.5) !important; + font-size: 12px !important; + font-weight: 400 !important; + line-height: 1.5 !important; + text-decoration: none !important; + color: rgba(51,51,51,0.5) !important; } .sp-template-event-calendar tfoot a:hover { - color: #333 !important; - text-decoration: none !important; + color: #333 !important; + text-decoration: none !important; } .sp-template-event-calendar tbody td { - position: relative !important; + position: relative !important; } .sp-template-event-calendar tbody td a:before { - content: '•' !important; - position: absolute !important; - font-size: 20px !important; - line-height: 1 !important; - width: 1em !important; - top: 0 !important; - right: 0 !important; + content: '•' !important; + position: absolute !important; + font-size: 20px !important; + line-height: 1 !important; + width: 1em !important; + top: 0 !important; + right: 0 !important; } /* Event Lists */ .sp-template-event-list .data-home { - text-align: right !important; + text-align: right !important; } .sp-template-event-list .data-away { - text-align: left !important; + text-align: left !important; } /* Event Blocks */ .sp-template-event-blocks td { - padding: 0 !important; + padding: 0 !important; } .sp-template-event-blocks .sp-event-date { - color: rgba(51,51,51,0.5) !important; - font-weight: 500 !important; - font-size: 12px !important; - margin: 10px !important; + color: rgba(51,51,51,0.5) !important; + font-weight: 500 !important; + font-size: 12px !important; + margin: 10px !important; } .sp-template-event-blocks .sp-event-date a, .sp-template-event-blocks .sp-event-date a:hover { - color: inherit !important; + color: inherit !important; } .sp-template-event-blocks .sp-event-results { - font-size: 20px !important; - font-weight: 400 !important; - padding: 0 !important; - margin: 0 !important; - color: #333 !important; + font-size: 20px !important; + font-weight: 400 !important; + padding: 0 !important; + margin: 0 !important; + color: #333 !important; } .sp-template-event-blocks .sp-event-results a { - color: inherit !important; + color: inherit !important; } .sp-template-event-blocks .sp-event-results a:hover { - color: inherit !important; - text-decoration: none !important; + color: inherit !important; + text-decoration: none !important; } .sp-template-event-blocks .sp-event-title, .sp-template-event-blocks .sp-event-status { - display: block !important; - padding: 0 !important; - margin: 10px !important; - font-size: 13px !important; - font-weight: 400 !important; + display: block !important; + padding: 0 !important; + margin: 10px !important; + font-size: 13px !important; + font-weight: 400 !important; } /* Event Logos */ .sp-template-event-logos .sp-team-name, .sp-template-event-logos .sp-team-result { - font-size: 20px !important; - font-weight: 400 !important; - padding: 0 !important; - margin: 0 !important; - color: #333 !important; + font-size: 20px !important; + font-weight: 400 !important; + padding: 0 !important; + margin: 0 !important; + color: #333 !important; } .sp-template-event-logos a, .sp-template-event-logos a:hover { - border: none !important; - text-decoration: none !important; + border: none !important; + text-decoration: none !important; } /* Event Performance */ .sp-template-event-performance-icons td { - border: none !important; + border: none !important; } .sp-template-event-performance-icons tr:first-child td { - border-top: 1px solid #e5e5e5 !important; + border-top: 1px solid #e5e5e5 !important; } /* Videos */ .sp-template-event-video iframe { - width: 100% !important; + width: 100% !important; } /* Match Stats */ .sp-template-event-statistics .sp-statistic-label { - font-size: 12px !important; - font-weight: 500 !important; - color: inherit !important; - opacity: 0.5 !important; + font-size: 12px !important; + font-weight: 500 !important; + color: inherit !important; + opacity: 0.5 !important; } .sp-event-statistics { - background: transparent !important; - margin: 0 0 10px !important; + background: transparent !important; + margin: 0 0 10px !important; } .sp-event-statistics, .sp-event-statistics tr, .sp-event-statistics td { - border: none !important; + border: none !important; } .sp-event-statistics .sp-statistic-ratio { - padding: 0 !important; + padding: 0 !important; } .sp-event-statistics .sp-statistic-bar { - border: 1px solid #e5e5e5 !important; - background: #f9f9f9 !important; + border: 1px solid #e5e5e5 !important; + background: #f9f9f9 !important; } /* Venues */ .sp-event-venue-map-row td { - padding: 0 !important; + padding: 0 !important; } .sp-event-venue-map-row .sp-google-map { - display: block !important; - margin: 0 !important; + display: block !important; + margin: 0 !important; } /* Teams */ .sp-template-logo { - float: right !important; - margin: 0 0 20px 20px !important; - clear: none !important; + float: right !important; + margin: 0 0 20px 20px !important; + clear: none !important; } /* Profiles */ .sp-template-details dl { - margin: 0 0 20px !important; - padding: 15px !important; - border: 1px solid #e5e5e5 !important; - background: #fff !important; + margin: 0 0 20px !important; + padding: 15px !important; + border: 1px solid #e5e5e5 !important; + background: #fff !important; } .sp-template-details dt, .sp-template-details dd { - margin: 0 !important; - padding: 0 !important; + margin: 0 !important; + padding: 0 !important; } .sp-template-details dt { - font-size: 12px !important; - font-weight: 500 !important; - color: rgba(51,51,51,0.5) !important; + font-size: 12px !important; + font-weight: 500 !important; + color: rgba(51,51,51,0.5) !important; } .sp-template-details dd { - font-size: 16px !important; - font-weight: 400 !important; - color: #333 !important; - margin-bottom: 10px !important; + font-size: 16px !important; + font-weight: 400 !important; + color: #333 !important; + margin-bottom: 10px !important; } .sp-template-details dd:last-child { - margin-bottom: 0 !important; + margin-bottom: 0 !important; } /* Twitter */ .sp-tweets { - border: 1px solid #e5e5e5 !important; - border-top: none !important; + border: 1px solid #e5e5e5 !important; + border-top: none !important; } /* Scoreboards */ .sp-header-scoreboard .sp-template-scoreboard { - margin-bottom: 0 !important; + margin-bottom: 0 !important; } .sp-template-scoreboard td { - padding: 0 !important; + padding: 0 !important; } .sp-template-scoreboard td:hover { - background: #f9f9f9 !important; + background: #f9f9f9 !important; } .sp-template-scoreboard a, .sp-template-scoreboard a:hover { - text-decoration: none !important; - color: #333 !important; + text-decoration: none !important; + color: #333 !important; } .sp-template-scoreboard .sp-scoreboard-date { - font-size: 12px !important; - font-weight: 500 !important; - color: rgba(51,51,51,0.5) !important; + font-size: 12px !important; + font-weight: 500 !important; + color: rgba(51,51,51,0.5) !important; } .sp-template-scoreboard .sp-scoreboard-nav { - color: #fff !important; - background: #00a69c !important; + color: #fff !important; + background: #00a69c !important; } /* Timelines */ .sp-template-timeline .sp-timeline * { - color: initial !important; + color: initial !important; } /* Tournaments */ .sp-tournament-bracket { - color: #333 !important; - background: transparent !important; - width: 100% !important; - border-collapse: separate !important; + color: #333 !important; + background: transparent !important; + width: 100% !important; + border-collapse: separate !important; } .sp-tournament-bracket a, .sp-tournament-bracket a:hover { - text-decoration: none !important; - color: inherit !important; - border: none! important; + text-decoration: none !important; + color: inherit !important; + border: none! important; } .sp-tournament-bracket tr, .sp-tournament-bracket th, .sp-tournament-bracket td { - border: none !important; + border: none !important; } .sp-tournament-bracket thead th { - font-size: 12px !important; - font-weight: 500 !important; - color: rgba(51,51,51,0.5) !important; - text-align: center !important; - border-bottom: 1px solid #e5e5e5 !important; + font-size: 12px !important; + font-weight: 500 !important; + color: rgba(51,51,51,0.5) !important; + text-align: center !important; + border-bottom: 1px solid #e5e5e5 !important; } .sp-tournament-bracket .sp-team-name { - font-size: 13px !important; - font-weight: 400 !important; - text-align: center !important; - background: #fff !important; - border: 1px solid #e5e5e5 !important; + font-size: 13px !important; + font-weight: 400 !important; + text-align: center !important; + background: #fff !important; + border: 1px solid #e5e5e5 !important; } .sp-tournament-bracket .sp-team-name:hover { - border: 1px solid #e5e5e5 !important; + border: 1px solid #e5e5e5 !important; } .sp-tournament-bracket .sp-heading, .sp-tournament-bracket .sp-heading:hover { - color: #fff !important; - background: #00a69c !important; - border-color: #00a69c !important; + color: #fff !important; + background: #00a69c !important; + border-color: #00a69c !important; } .sp-tournament-bracket .sp-event { - border-color: #e5e5e5 !important; - border-width: 1px !important; + border-color: #e5e5e5 !important; + border-width: 1px !important; } .sp-tournament-bracket .sp-event .sp-event-title { - font-size: 12px !important; - font-weight: 400 !important; - color: rgba(51,51,51,0.5) !important; - text-align: center !important; + font-size: 12px !important; + font-weight: 400 !important; + color: rgba(51,51,51,0.5) !important; + text-align: center !important; } .sp-tournament-bracket .sp-event .sp-event-title:hover { - color: #333 !important; + color: #333 !important; } /* Tabs */ .sp-tab-menu { - display: block !important; - clear: both !important; - margin: 0 0 20px !important; - padding: 0 !important; - list-style: none !important; + display: block !important; + clear: both !important; + margin: 0 0 20px !important; + padding: 0 !important; + list-style: none !important; } .sp-tab-menu-item { - display: inline-block !important; - margin: 0 !important; - padding: 0 !important; + display: inline-block !important; + margin: 0 !important; + padding: 0 !important; } .sp-tab-menu-item a { - margin: 0 !important; - padding: 5px 10px; - border-bottom: 2px solid transparent !important; - box-shadow: none !important; + margin: 0 !important; + padding: 5px 10px; + border-bottom: 2px solid transparent !important; + box-shadow: none !important; } .sp-tab-menu-item a:hover { - text-decoration: none !important; + text-decoration: none !important; } .sp-tab-menu-item-active a, .sp-tab-menu-item-active a:hover { - color: #00a69c !important; - border-bottom-color: #00a69c !important; + color: #00a69c !important; + border-bottom-color: #00a69c !important; } /* Messages */ .sp-template .sp-message { - color: #00a69c !important; - border-color: #00a69c !important; + color: #00a69c !important; + border-color: #00a69c !important; } /* Post Content */ .single-sp_team .has-post-thumbnail .sp-post-content { - clear: none; + clear: none; } /* Media Queries */ @media screen and (min-width: 601px) { - .sp-template-event-calendar tbody td { - padding: 15px 5px !important; - } + .sp-template-event-calendar tbody td { + padding: 15px 5px !important; + } - .sp-template-event-calendar tbody td a:before { - font-size: 25px !important; - } + .sp-template-event-calendar tbody td a:before { + font-size: 25px !important; + } - .widget .sp-template-event-calendar tbody td { - padding: 10px 5px !important; - } + .widget .sp-template-event-calendar tbody td { + padding: 10px 5px !important; + } - .widget .sp-template-event-calendar tbody td a:before { - font-size: 20px !important; - } + .widget .sp-template-event-calendar tbody td a:before { + font-size: 20px !important; + } } @media screen and (min-width: 801px) { - .sp-template-event-calendar tbody td { - padding: 20px 5px !important; - } + .sp-template-event-calendar tbody td { + padding: 20px 5px !important; + } - .sp-template-event-calendar tbody td a:before { - font-size: 30px !important; - } + .sp-template-event-calendar tbody td a:before { + font-size: 30px !important; + } - .widget .sp-template-event-calendar tbody td { - padding: 10px 5px !important; - } + .widget .sp-template-event-calendar tbody td { + padding: 10px 5px !important; + } - .widget .sp-template-event-calendar tbody td a:before { - font-size: 20px !important; - } + .widget .sp-template-event-calendar tbody td a:before { + font-size: 20px !important; + } - .sp-template-event-performance-icons.sp-template-event-performance-section:nth-child(2n) { - padding-top: 61px !important; - } -} \ No newline at end of file + .sp-template-event-performance-icons.sp-template-event-performance-section:nth-child(2n) { + padding-top: 61px !important; + } +} diff --git a/assets/css/sportspress.css b/assets/css/sportspress.css index dbd116de..7d290e45 100644 --- a/assets/css/sportspress.css +++ b/assets/css/sportspress.css @@ -61,10 +61,10 @@ margin: 0 10px; color: inherit; opacity: 0.5; - transition: all .3s; + transition: all .3s; } .sp-tab-menu-item a:focus { - outline: none; + outline: none; } .sp-tab-menu-item-active a, .sp-tab-menu-item a:hover { @@ -90,7 +90,7 @@ .sp-data-table { width: 100%; table-layout: auto; - border-spacing: 0; + border-spacing: 0; } .sp-paginated-table { margin-bottom: 0; @@ -310,12 +310,12 @@ color: #f4d014; } .sp-event-performance .sp-event-star-number { - margin-left: -20px; - width: 20px; - text-align: center; - display: inline-block; - font-size: smaller; - line-height: 20px; + margin-left: -20px; + width: 20px; + text-align: center; + display: inline-block; + font-size: smaller; + line-height: 20px; } /* Event Performance (Icons) */ @@ -335,12 +335,12 @@ } .sp-template-event-performance-icons .sp-player-position { - display: block; + display: block; } /* Event Calendar */ .sp-event-calendar { - border-spacing: 0; + border-spacing: 0; } .sp-event-calendar a { text-decoration: none; @@ -635,11 +635,11 @@ span.sp_event_spec_label { display: inline-block; margin: 0 0.25em; } - + .sp-template-logo + .sp-post-content { clear: left; } - + .sp-template-photo + .sp-post-content { clear: none; } @@ -664,15 +664,15 @@ span.sp_event_spec_label { text-align: right; float: right; } - + .sp-template-event-logos-block .logo-odd img { margin-right: 10px; } - + .sp-template-event-logos-block .logo-even img { margin-left: 10px; } - + .sp-template-event-logos-block .sp-team-name { display: inline; clear: none; diff --git a/assets/css/themes/twentyfourteen.css b/assets/css/themes/twentyfourteen.css index 3fa0c1ed..8bcc54b4 100644 --- a/assets/css/themes/twentyfourteen.css +++ b/assets/css/themes/twentyfourteen.css @@ -6,4 +6,4 @@ .sportspress-page .entry-content h4:first-child { margin-top: 36px; -} \ No newline at end of file +} diff --git a/assets/js/admin/colorpicker.js b/assets/js/admin/colorpicker.js index 95aaa618..7d400fb0 100644 --- a/assets/js/admin/colorpicker.js +++ b/assets/js/admin/colorpicker.js @@ -1,26 +1,38 @@ -jQuery(document).ready(function($){ +jQuery( document ).ready( + function($){ - // Color picker - $('.colorpick').iris( { - change: function(event, ui){ - $(this).css( { backgroundColor: ui.color.toString() } ); - }, - hide: true, - border: true - } ).each( function() { - $(this).css( { backgroundColor: $(this).val() } ); - }) - .click(function(){ - $('.iris-picker').hide(); - $(this).closest('.sp-color-box, td').find('.iris-picker').show(); - }); + // Color picker + $( '.colorpick' ).iris( + { + change: function(event, ui){ + $( this ).css( { backgroundColor: ui.color.toString() } ); + }, + hide: true, + border: true + } + ).each( + function() { + $( this ).css( { backgroundColor: $( this ).val() } ); + } + ) + .click( + function(){ + $( '.iris-picker' ).hide(); + $( this ).closest( '.sp-color-box, td' ).find( '.iris-picker' ).show(); + } + ); - $('body').click(function() { - $('.iris-picker').hide(); - }); + $( 'body' ).click( + function() { + $( '.iris-picker' ).hide(); + } + ); - $('.sp-color-box, .colorpick').click(function(event){ - event.stopPropagation(); - }); + $( '.sp-color-box, .colorpick' ).click( + function(event){ + event.stopPropagation(); + } + ); -}); \ No newline at end of file + } +); diff --git a/assets/js/admin/dashboard.js b/assets/js/admin/dashboard.js index 7ab9f30c..a07e792a 100644 --- a/assets/js/admin/dashboard.js +++ b/assets/js/admin/dashboard.js @@ -1,11 +1,18 @@ -jQuery(document).ready(function($){ +jQuery( document ).ready( + function($){ - // Dashboard countdown - $("#sportspress_dashboard_status .sp_status_list li.countdown").each(function() { - var $this = $(this), finalDate = $(this).data('countdown'); - $this.countdown(finalDate, function(event) { - $this.find('strong').html(event.strftime("%D "+localized_strings.days+" %H:%M:%S")); - }); - }); + // Dashboard countdown + $( "#sportspress_dashboard_status .sp_status_list li.countdown" ).each( + function() { + var $this = $( this ), finalDate = $( this ).data( 'countdown' ); + $this.countdown( + finalDate, + function(event) { + $this.find( 'strong' ).html( event.strftime( "%D " + localized_strings.days + " %H:%M:%S" ) ); + } + ); + } + ); -}); \ No newline at end of file + } +); diff --git a/assets/js/admin/editor-lang.php b/assets/js/admin/editor-lang.php index 0e0e00ca..15ba4487 100644 --- a/assets/js/admin/editor-lang.php +++ b/assets/js/admin/editor-lang.php @@ -3,51 +3,63 @@ $shortcodes = ''; $options = array( - 'event' => array( - 'details', 'results', 'performance', 'venue', 'officials', 'teams', 'full', - ), - 'team' => array(), - 'player' => array( - 'details', 'statistics' - ), + 'event' => array( + 'details', + 'results', + 'performance', + 'venue', + 'officials', + 'teams', + 'full', + ), + 'team' => array(), + 'player' => array( + 'details', + 'statistics', + ), ); $options = apply_filters( 'sportspress_shortcodes', $options ); foreach ( $options as $name => $group ) { - if ( empty( $group ) ) continue; - $shortcodes .= $name . '[' . implode( '|', $group ) . ']'; + if ( empty( $group ) ) { + continue; + } + $shortcodes .= $name . '[' . implode( '|', $group ) . ']'; } -$raw = apply_filters( 'sportspress_tinymce_strings', array( - 'shortcodes' => $shortcodes, - 'insert' => __( 'SportsPress Shortcodes', 'sportspress' ), - 'auto' => __( 'Auto', 'sportspress' ), - 'manual' => __( 'Manual', 'sportspress' ), - 'select' => __( 'Select...', 'sportspress' ), - 'event' => __( 'Event', 'sportspress' ), - 'details' => __( 'Details', 'sportspress' ), - 'results' => __( 'Results', 'sportspress' ), - 'countdown' => __( 'Countdown', 'sportspress' ), - 'performance' => __( 'Box Score', 'sportspress' ), - 'venue' => __( 'Venue', 'sportspress' ), - 'officials' => __( 'Officials', 'sportspress' ), - 'teams' => __( 'Teams', 'sportspress' ), - 'full' => __( 'Full Info', 'sportspress' ), - 'calendar' => __( 'Calendar', 'sportspress' ), - 'statistics' => __( 'Statistics', 'sportspress' ), - 'team' => __( 'Team', 'sportspress' ), - 'standings' => __( 'League Table', 'sportspress' ), - 'player' => __( 'Player', 'sportspress' ), - 'list' => __( 'List', 'sportspress' ), - 'blocks' => __( 'Blocks', 'sportspress' ), - 'gallery' => __( 'Gallery', 'sportspress' ), -)); +$raw = apply_filters( + 'sportspress_tinymce_strings', + array( + 'shortcodes' => $shortcodes, + 'insert' => __( 'SportsPress Shortcodes', 'sportspress' ), + 'auto' => __( 'Auto', 'sportspress' ), + 'manual' => __( 'Manual', 'sportspress' ), + 'select' => __( 'Select...', 'sportspress' ), + 'event' => __( 'Event', 'sportspress' ), + 'details' => __( 'Details', 'sportspress' ), + 'results' => __( 'Results', 'sportspress' ), + 'countdown' => __( 'Countdown', 'sportspress' ), + 'performance' => __( 'Box Score', 'sportspress' ), + 'venue' => __( 'Venue', 'sportspress' ), + 'officials' => __( 'Officials', 'sportspress' ), + 'teams' => __( 'Teams', 'sportspress' ), + 'full' => __( 'Full Info', 'sportspress' ), + 'calendar' => __( 'Calendar', 'sportspress' ), + 'statistics' => __( 'Statistics', 'sportspress' ), + 'team' => __( 'Team', 'sportspress' ), + 'standings' => __( 'League Table', 'sportspress' ), + 'player' => __( 'Player', 'sportspress' ), + 'list' => __( 'List', 'sportspress' ), + 'blocks' => __( 'Blocks', 'sportspress' ), + 'gallery' => __( 'Gallery', 'sportspress' ), + ) +); $formatted = array(); foreach ( $raw as $key => $value ) { - $formatted[] = $key . ': "' . esc_js( $value ) . '"'; + $formatted[] = $key . ': "' . esc_js( $value ) . '"'; } $strings = 'tinyMCE.addI18n({' . _WP_Editors::$mce_locale . ':{ diff --git a/assets/js/admin/editor.js b/assets/js/admin/editor.js index 74555b83..ebd7cd44 100644 --- a/assets/js/admin/editor.js +++ b/assets/js/admin/editor.js @@ -1,42 +1,58 @@ /* global tinymce */ ( function () { - tinymce.PluginManager.add( 'sp_shortcodes_button', function( editor, url ) { - var ed = tinymce.activeEditor; + tinymce.PluginManager.add( + 'sp_shortcodes_button', + function( editor, url ) { + var ed = tinymce.activeEditor; - var groups = ed.getLang( 'sportspress.shortcodes' ).split("]"); - var menu = new Array(); + var groups = ed.getLang( 'sportspress.shortcodes' ).split( "]" ); + var menu = new Array(); - groups.forEach(function(g) { - if ( "" == g ) return; - var p = g.split("["); - var label = p.shift(); - var variations = p.shift(); - var shortcodes = typeof variations!== 'undefined' ? variations.split("|") : []; - var submenu = new Array(); - shortcodes.forEach(function(s) { - submenu.push({ - text: ed.getLang( 'sportspress.' + s ), - onclick: function() { - // triggers the thickbox - var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width; - W = W - 80; - H = H - 84; - tb_show( ed.getLang( 'sportspress.' + label ) + ' - ' + ed.getLang( 'sportspress.' + s ), 'admin-ajax.php?action=sportspress_' + label + '_' + s + '_shortcode&width=' + W + '&height=' + H ); + groups.forEach( + function(g) { + if ( "" == g ) { + return; } - }); - }); - menu.push({ - text: ed.getLang( 'sportspress.' + label ), - menu: submenu - }); - }); + var p = g.split( "[" ); + var label = p.shift(); + var variations = p.shift(); + var shortcodes = typeof variations !== 'undefined' ? variations.split( "|" ) : []; + var submenu = new Array(); + shortcodes.forEach( + function(s) { + submenu.push( + { + text: ed.getLang( 'sportspress.' + s ), + onclick: function() { + // triggers the thickbox + var width = jQuery( window ).width(), H = jQuery( window ).height(), W = ( 720 < width ) ? 720 : width; + W = W - 80; + H = H - 84; + tb_show( ed.getLang( 'sportspress.' + label ) + ' - ' + ed.getLang( 'sportspress.' + s ), 'admin-ajax.php?action=sportspress_' + label + '_' + s + '_shortcode&width=' + W + '&height=' + H ); + } + } + ); + } + ); + menu.push( + { + text: ed.getLang( 'sportspress.' + label ), + menu: submenu + } + ); + } + ); - editor.addButton( 'sp_shortcodes_button', { - title: ed.getLang('sportspress.insert'), - text: false, - icon: false, - type: 'menubutton', - menu: menu - }); - }); + editor.addButton( + 'sp_shortcodes_button', + { + title: ed.getLang( 'sportspress.insert' ), + text: false, + icon: false, + type: 'menubutton', + menu: menu + } + ); + } + ); })(); diff --git a/assets/js/admin/equationbuilder.js b/assets/js/admin/equationbuilder.js index be5e248c..805f1711 100644 --- a/assets/js/admin/equationbuilder.js +++ b/assets/js/admin/equationbuilder.js @@ -1,37 +1,55 @@ -jQuery(document).ready(function($){ - $("#title").keyup(function() { - val = $(this).val(); - if ( val == '' ) val = 'f(x)'; - $(".sp-equation-variable").text( val + ' =' ); - }); +jQuery( document ).ready( + function($){ + $( "#title" ).keyup( + function() { + val = $( this ).val(); + if ( val == '' ) { + val = 'f(x)'; + } + $( ".sp-equation-variable" ).text( val + ' =' ); + } + ); - $(".sp-equation-parts .button").draggable({ - appendTo: "body", - helper: "clone", - cursor: "move", - distance: 10, - containment: "#sp_equationdiv", - }).click(function() { - $("").text( $(this).text() ).append("×").appendTo( $(".sp-equation-formula") ); - }); + $( ".sp-equation-parts .button" ).draggable( + { + appendTo: "body", + helper: "clone", + cursor: "move", + distance: 10, + containment: "#sp_equationdiv", + } + ).click( + function() { + $( "" ).text( $( this ).text() ).append( "×" ).appendTo( $( ".sp-equation-formula" ) ); + } + ); - $(".sp-equation").droppable({ - activeClass: "ui-state-active", - hoverClass: "ui-state-hover", - accept: ".button:not(.ui-sortable-helper)", - drop: function( event, ui ) { - $("").text( ui.draggable.text() ).append("×").appendTo( $(".sp-equation-formula") ); - } - }).sortable({ - items: ".button", - tolerance: "pointer", - containment: "#sp_equationdiv", - sort: function() { - $( this ).removeClass( "ui-state-active" ); - } - }); + $( ".sp-equation" ).droppable( + { + activeClass: "ui-state-active", + hoverClass: "ui-state-hover", + accept: ".button:not(.ui-sortable-helper)", + drop: function( event, ui ) { + $( "" ).text( ui.draggable.text() ).append( "×" ).appendTo( $( ".sp-equation-formula" ) ); + } + } + ).sortable( + { + items: ".button", + tolerance: "pointer", + containment: "#sp_equationdiv", + sort: function() { + $( this ).removeClass( "ui-state-active" ); + } + } + ); - $(".sp-equation-formula").on("click", ".button .remove", function() { - $(this).closest(".button").remove(); - }); -}); \ No newline at end of file + $( ".sp-equation-formula" ).on( + "click", + ".button .remove", + function() { + $( this ).closest( ".button" ).remove(); + } + ); + } +); diff --git a/assets/js/admin/iconpicker.js b/assets/js/admin/iconpicker.js index 565e9dc1..e0816af9 100644 --- a/assets/js/admin/iconpicker.js +++ b/assets/js/admin/iconpicker.js @@ -1,37 +1,52 @@ -jQuery(document).ready(function($){ +jQuery( document ).ready( + function($){ - // Icon picker - $('.sp-icons input').on('change', function() { - if ('' == $(this).val()) { - $('.sp-custom-colors').hide(); - $('.sp-custom-thumbnail').show(); - } else { - $('.sp-custom-thumbnail').hide(); - $('.sp-custom-colors').show(); - } - }); + // Icon picker + $( '.sp-icons input' ).on( + 'change', + function() { + if ('' == $( this ).val()) { + $( '.sp-custom-colors' ).hide(); + $( '.sp-custom-thumbnail' ).show(); + } else { + $( '.sp-custom-thumbnail' ).hide(); + $( '.sp-custom-colors' ).show(); + } + } + ); - // Color picker - $('.colorpick').iris( { - change: function(event, ui){ - $(this).css( { backgroundColor: ui.color.toString() } ); - }, - hide: true, - border: true - } ).each( function() { - $(this).css( { backgroundColor: $(this).val() } ); - }) - .click(function(){ - $('.iris-picker').hide(); - $(this).closest('.sp-color-box-for-icon, td').find('.iris-picker').show(); - }); + // Color picker + $( '.colorpick' ).iris( + { + change: function(event, ui){ + $( this ).css( { backgroundColor: ui.color.toString() } ); + }, + hide: true, + border: true + } + ).each( + function() { + $( this ).css( { backgroundColor: $( this ).val() } ); + } + ) + .click( + function(){ + $( '.iris-picker' ).hide(); + $( this ).closest( '.sp-color-box-for-icon, td' ).find( '.iris-picker' ).show(); + } + ); - $('body').click(function() { - $('.iris-picker').hide(); - }); + $( 'body' ).click( + function() { + $( '.iris-picker' ).hide(); + } + ); - $('.sp-color-box-for-icon, .colorpick').click(function(event){ - event.stopPropagation(); - }); + $( '.sp-color-box-for-icon, .colorpick' ).click( + function(event){ + event.stopPropagation(); + } + ); -}); \ No newline at end of file + } +); diff --git a/assets/js/admin/quickeditor.js b/assets/js/admin/quickeditor.js index f5979e22..762d4b0c 100644 --- a/assets/js/admin/quickeditor.js +++ b/assets/js/admin/quickeditor.js @@ -24,56 +24,72 @@ var $post_row = $( '#post-' + $post_id ); // get the data - var $number = $( '.column-sp_number', $post_row ).text(); - var $current_teams = String( $( '.column-sp_team', $post_row ).find( '.sp-player-teams' ).data( 'current-teams' ) ).split(','); - var $past_teams = String( $( '.column-sp_team', $post_row ).find( '.sp-player-teams' ).data( 'past-teams' ) ).split(','); + var $number = $( '.column-sp_number', $post_row ).text(); + var $current_teams = String( $( '.column-sp_team', $post_row ).find( '.sp-player-teams' ).data( 'current-teams' ) ).split( ',' ); + var $past_teams = String( $( '.column-sp_team', $post_row ).find( '.sp-player-teams' ).data( 'past-teams' ) ).split( ',' ); // populate the data $( ':input[name="sp_number"]', $edit_row ).val( $number ); - $( ':input[name="sp_current_team[]"]', $edit_row ).each(function() { - $(this).prop("checked", ($.inArray($(this).val(), $current_teams ) != -1)); - }); - $( ':input[name="sp_past_team[]"]', $edit_row ).each(function() { - $(this).prop("checked", ($.inArray($(this).val(), $past_teams ) != -1)); - }); + $( ':input[name="sp_current_team[]"]', $edit_row ).each( + function() { + $( this ).prop( "checked", ($.inArray( $( this ).val(), $current_teams ) != -1) ); + } + ); + $( ':input[name="sp_past_team[]"]', $edit_row ).each( + function() { + $( this ).prop( "checked", ($.inArray( $( this ).val(), $past_teams ) != -1) ); + } + ); } }; - $( document ).on( 'click', '#bulk_edit', function() { - // define the bulk edit row - var $bulk_row = $( '#bulk-edit' ); + $( document ).on( + 'click', + '#bulk_edit', + function() { + // define the bulk edit row + var $bulk_row = $( '#bulk-edit' ); - // get the selected post ids that are being edited - var $post_ids = new Array(); - $bulk_row.find( '#bulk-titles' ).children().each( function() { - $post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) ); - }); + // get the selected post ids that are being edited + var $post_ids = new Array(); + $bulk_row.find( '#bulk-titles' ).children().each( + function() { + $post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) ); + } + ); - // get the data - var $current_teams = []; - $bulk_row.find( 'input[name="sp_current_team[]"]:checked' ).each(function() { - $current_teams.push( $(this).val() ); - }); + // get the data + var $current_teams = []; + $bulk_row.find( 'input[name="sp_current_team[]"]:checked' ).each( + function() { + $current_teams.push( $( this ).val() ); + } + ); - var $past_teams = []; - $bulk_row.find( 'input[name="sp_past_team[]"]:checked' ).each(function() { - $past_teams.push( $(this).val() ); - }); + var $past_teams = []; + $bulk_row.find( 'input[name="sp_past_team[]"]:checked' ).each( + function() { + $past_teams.push( $( this ).val() ); + } + ); - // save the data - $.ajax({ - url: ajaxurl, // this is a variable that WordPress has already defined for us - type: 'POST', - async: false, - cache: false, - data: { - action: 'save_bulk_edit_sp_player', - post_ids: $post_ids, - current_teams: $current_teams, - past_teams: $past_teams, - nonce: $("#sp_player_edit_nonce").val() - } - }); - }); + // save the data + $.ajax( + { + url: ajaxurl, // this is a variable that WordPress has already defined for us + type: 'POST', + async: false, + cache: false, + data: { + action: 'save_bulk_edit_sp_player', + post_ids: $post_ids, + current_teams: $current_teams, + past_teams: $past_teams, + nonce: $( "#sp_player_edit_nonce" ).val() + } + } + ); + } + ); -})(jQuery); \ No newline at end of file +})( jQuery ); diff --git a/assets/js/admin/settings.js b/assets/js/admin/settings.js index 0a1d67d4..3e5638a1 100644 --- a/assets/js/admin/settings.js +++ b/assets/js/admin/settings.js @@ -1,64 +1,92 @@ -jQuery(document).ready(function($){ +jQuery( document ).ready( + function($){ - // Display custom sport name field as needed - $("body.toplevel_page_sportspress #sportspress_sport").change(function() { - $target = $("#sportspress_custom_sport_name"); - if ( $(this).val() == "custom" ) - $target.show(); - else - $target.hide(); - }); + // Display custom sport name field as needed + $( "body.toplevel_page_sportspress #sportspress_sport" ).change( + function() { + $target = $( "#sportspress_custom_sport_name" ); + if ( $( this ).val() == "custom" ) { + $target.show(); + } else { + $target.hide(); + } + } + ); - // Color picker - $('.colorpick').iris( { - change: function(event, ui){ - $(this).css( { backgroundColor: ui.color.toString() } ); - }, - hide: true, - border: true - } ).each( function() { - $(this).css( { backgroundColor: $(this).val() } ); - }) - .click(function(){ - $('.iris-picker').hide(); - $(this).closest('.sp-color-box, td').find('.iris-picker').show(); - }); + // Color picker + $( '.colorpick' ).iris( + { + change: function(event, ui){ + $( this ).css( { backgroundColor: ui.color.toString() } ); + }, + hide: true, + border: true + } + ).each( + function() { + $( this ).css( { backgroundColor: $( this ).val() } ); + } + ) + .click( + function(){ + $( '.iris-picker' ).hide(); + $( this ).closest( '.sp-color-box, td' ).find( '.iris-picker' ).show(); + } + ); - $('body').click(function() { - $('.iris-picker').hide(); - }); + $( 'body' ).click( + function() { + $( '.iris-picker' ).hide(); + } + ); - $('.sp-color-box, .colorpick').click(function(event){ - event.stopPropagation(); - }); + $( '.sp-color-box, .colorpick' ).click( + function(event){ + event.stopPropagation(); + } + ); - // Chosen select - $(".chosen-select").chosen({ - allow_single_deselect: true, - single_backstroke_delete: false, - placeholder_text_multiple: localized_strings.none - }); + // Chosen select + $( ".chosen-select" ).chosen( + { + allow_single_deselect: true, + single_backstroke_delete: false, + placeholder_text_multiple: localized_strings.none + } + ); - // Preset field modifier - $(".sp-custom-input-wrapper .preset").click(function() { - val = $(this).val(); - if(val == "\\c\\u\\s\\t\\o\\m") return true; - example = $(this).attr("data-example"); - $(this).closest(".sp-custom-input-wrapper").find(".value").val(val).siblings(".example").html(example); - }); + // Preset field modifier + $( ".sp-custom-input-wrapper .preset" ).click( + function() { + val = $( this ).val(); + if (val == "\\c\\u\\s\\t\\o\\m") { + return true; + } + example = $( this ).attr( "data-example" ); + $( this ).closest( ".sp-custom-input-wrapper" ).find( ".value" ).val( val ).siblings( ".example" ).html( example ); + } + ); - // Select custom preset when field is brought to focus - $(".sp-custom-input-wrapper .value").focus(function() { - $(this).siblings("label").find(".preset").prop("checked", true); - }); + // Select custom preset when field is brought to focus + $( ".sp-custom-input-wrapper .value" ).focus( + function() { + $( this ).siblings( "label" ).find( ".preset" ).prop( "checked", true ); + } + ); - // Adjust example field when custom preset is entered - $(".sp-custom-input-wrapper .value").on("keyup", function() { - val = $(this).val(); - if ( val === undefined ) return true; - format = $(this).attr("data-example-format"); - example = format.replace(/__val__/g, val); - $(this).siblings(".example").html(example); - }); + // Adjust example field when custom preset is entered + $( ".sp-custom-input-wrapper .value" ).on( + "keyup", + function() { + val = $( this ).val(); + if ( val === undefined ) { + return true; + } + format = $( this ).attr( "data-example-format" ); + example = format.replace( /__val__/g, val ); + $( this ).siblings( ".example" ).html( example ); + } + ); -}); \ No newline at end of file + } +); diff --git a/assets/js/admin/sp-geocoder.js b/assets/js/admin/sp-geocoder.js index 00ce4039..1cb26357 100644 --- a/assets/js/admin/sp-geocoder.js +++ b/assets/js/admin/sp-geocoder.js @@ -1,54 +1,76 @@ -//Get variables form input values -latitude = document.getElementById('term_meta[sp_latitude]').value; -longitude = document.getElementById('term_meta[sp_longitude]').value; - -//Initialize the map and add the Search control box -var map = L.map('sp-location-picker').setView([latitude, longitude], 15), +// Get variables form input values +latitude = document.getElementById( 'term_meta[sp_latitude]' ).value; +longitude = document.getElementById( 'term_meta[sp_longitude]' ).value; + +// Initialize the map and add the Search control box +var map = L.map( 'sp-location-picker' ).setView( [latitude, longitude], 15 ), geocoder = L.Control.Geocoder.nominatim(), - control = L.Control.geocoder({ - geocoder: geocoder, - collapsed: false, - defaultMarkGeocode: false - }).addTo(map), - //Add a marker to use from the begining - marker = L.marker([latitude, longitude],{draggable: true, autoPan: true}).addTo(map); - -L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { - attribution: '© OpenStreetMap contributors' -}).addTo(map); - -//Pass the values to the fields after dragging -marker.on('dragend', function (e) { - document.getElementById('term_meta[sp_latitude]').value = marker.getLatLng().lat; - document.getElementById('term_meta[sp_longitude]').value = marker.getLatLng().lng; - geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) { - var r = results[0]; - if (r) { - document.getElementById('term_meta[sp_address]').value = r.name; + control = L.Control.geocoder( + { + geocoder: geocoder, + collapsed: false, + defaultMarkGeocode: false } - }) -}); + ).addTo( map ), + // Add a marker to use from the begining + marker = L.marker( [latitude, longitude],{draggable: true, autoPan: true} ).addTo( map ); -//After searching -control.on('markgeocode', function(e) { - var center = e.geocode.center; - var address = e.geocode.name; - map.setView([center.lat, center.lng], 15); //Center map to the new place - map.removeLayer(marker); //Remove previous marker - marker = L.marker([center.lat, center.lng],{draggable: true, autoPan: true}).addTo(map); //Add new marker to use - //Pass the values to the fields after searching - document.getElementById('term_meta[sp_latitude]').value = center.lat; - document.getElementById('term_meta[sp_longitude]').value = center.lng; - document.getElementById('term_meta[sp_address]').value = address; - //Pass the values to the fields after dragging - marker.on('dragend', function (e) { - document.getElementById('term_meta[sp_latitude]').value = marker.getLatLng().lat; - document.getElementById('term_meta[sp_longitude]').value = marker.getLatLng().lng; - geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) { - var r = results[0]; - if (r) { - document.getElementById('term_meta[sp_address]').value = r.name; +L.tileLayer( + 'http://{s}.tile.osm.org/{z}/{x}/{y}.png', + { + attribution: '© OpenStreetMap contributors' + } +).addTo( map ); + +// Pass the values to the fields after dragging +marker.on( + 'dragend', + function (e) { + document.getElementById( 'term_meta[sp_latitude]' ).value = marker.getLatLng().lat; + document.getElementById( 'term_meta[sp_longitude]' ).value = marker.getLatLng().lng; + geocoder.reverse( + marker.getLatLng(), + map.options.crs.scale( map.getZoom() ), + function(results) { + var r = results[0]; + if (r) { + document.getElementById( 'term_meta[sp_address]' ).value = r.name; + } } - }) - }); -}).addTo(map); \ No newline at end of file + ) + } +); + +// After searching +control.on( + 'markgeocode', + function(e) { + var center = e.geocode.center; + var address = e.geocode.name; + map.setView( [center.lat, center.lng], 15 ); // Center map to the new place + map.removeLayer( marker ); // Remove previous marker + marker = L.marker( [center.lat, center.lng],{draggable: true, autoPan: true} ).addTo( map ); // Add new marker to use + // Pass the values to the fields after searching + document.getElementById( 'term_meta[sp_latitude]' ).value = center.lat; + document.getElementById( 'term_meta[sp_longitude]' ).value = center.lng; + document.getElementById( 'term_meta[sp_address]' ).value = address; + // Pass the values to the fields after dragging + marker.on( + 'dragend', + function (e) { + document.getElementById( 'term_meta[sp_latitude]' ).value = marker.getLatLng().lat; + document.getElementById( 'term_meta[sp_longitude]' ).value = marker.getLatLng().lng; + geocoder.reverse( + marker.getLatLng(), + map.options.crs.scale( map.getZoom() ), + function(results) { + var r = results[0]; + if (r) { + document.getElementById( 'term_meta[sp_address]' ).value = r.name; + } + } + ) + } + ); + } +).addTo( map ); diff --git a/assets/js/admin/sp-setup-geocoder.js b/assets/js/admin/sp-setup-geocoder.js index 504b6329..6ee63b04 100644 --- a/assets/js/admin/sp-setup-geocoder.js +++ b/assets/js/admin/sp-setup-geocoder.js @@ -1,54 +1,76 @@ -//Get variables form input values -latitude = document.getElementById('sp_latitude').value; -longitude = document.getElementById('sp_longitude').value; - -//Initialize the map and add the Search control box -var map = L.map('sp-location-picker').setView([latitude, longitude], 15), +// Get variables form input values +latitude = document.getElementById( 'sp_latitude' ).value; +longitude = document.getElementById( 'sp_longitude' ).value; + +// Initialize the map and add the Search control box +var map = L.map( 'sp-location-picker' ).setView( [latitude, longitude], 15 ), geocoder = L.Control.Geocoder.nominatim(), - control = L.Control.geocoder({ - geocoder: geocoder, - collapsed: false, - defaultMarkGeocode: false - }).addTo(map), - //Add a marker to use from the begining - marker = L.marker([latitude, longitude],{draggable: true, autoPan: true}).addTo(map); - -L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { - attribution: '© OpenStreetMap contributors' -}).addTo(map); - -//Pass the values to the fields after dragging -marker.on('dragend', function (e) { - document.getElementById('sp_latitude').value = marker.getLatLng().lat; - document.getElementById('sp_longitude').value = marker.getLatLng().lng; - geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) { - var r = results[0]; - if (r) { - document.getElementById('sp_address').value = r.name; + control = L.Control.geocoder( + { + geocoder: geocoder, + collapsed: false, + defaultMarkGeocode: false } - }) -}); + ).addTo( map ), + // Add a marker to use from the begining + marker = L.marker( [latitude, longitude],{draggable: true, autoPan: true} ).addTo( map ); -//After searching -control.on('markgeocode', function(e) { - var center = e.geocode.center; - var address = e.geocode.name; - map.setView([center.lat, center.lng], 15); //Center map to the new place - map.removeLayer(marker); //Remove previous marker - marker = L.marker([center.lat, center.lng],{draggable: true, autoPan: true}).addTo(map); //Add new marker to use - //Pass the values to the fields after searching - document.getElementById('sp_latitude').value = center.lat; - document.getElementById('sp_longitude').value = center.lng; - document.getElementById('sp_address').value = address; - //Pass the values to the fields after dragging - marker.on('dragend', function (e) { - document.getElementById('sp_latitude').value = marker.getLatLng().lat; - document.getElementById('sp_longitude').value = marker.getLatLng().lng; - geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) { - var r = results[0]; - if (r) { - document.getElementById('sp_address').value = r.name; +L.tileLayer( + 'http://{s}.tile.osm.org/{z}/{x}/{y}.png', + { + attribution: '© OpenStreetMap contributors' + } +).addTo( map ); + +// Pass the values to the fields after dragging +marker.on( + 'dragend', + function (e) { + document.getElementById( 'sp_latitude' ).value = marker.getLatLng().lat; + document.getElementById( 'sp_longitude' ).value = marker.getLatLng().lng; + geocoder.reverse( + marker.getLatLng(), + map.options.crs.scale( map.getZoom() ), + function(results) { + var r = results[0]; + if (r) { + document.getElementById( 'sp_address' ).value = r.name; + } } - }) - }); -}).addTo(map); \ No newline at end of file + ) + } +); + +// After searching +control.on( + 'markgeocode', + function(e) { + var center = e.geocode.center; + var address = e.geocode.name; + map.setView( [center.lat, center.lng], 15 ); // Center map to the new place + map.removeLayer( marker ); // Remove previous marker + marker = L.marker( [center.lat, center.lng],{draggable: true, autoPan: true} ).addTo( map ); // Add new marker to use + // Pass the values to the fields after searching + document.getElementById( 'sp_latitude' ).value = center.lat; + document.getElementById( 'sp_longitude' ).value = center.lng; + document.getElementById( 'sp_address' ).value = address; + // Pass the values to the fields after dragging + marker.on( + 'dragend', + function (e) { + document.getElementById( 'sp_latitude' ).value = marker.getLatLng().lat; + document.getElementById( 'sp_longitude' ).value = marker.getLatLng().lng; + geocoder.reverse( + marker.getLatLng(), + map.options.crs.scale( map.getZoom() ), + function(results) { + var r = results[0]; + if (r) { + document.getElementById( 'sp_address' ).value = r.name; + } + } + ) + } + ); + } +).addTo( map ); diff --git a/assets/js/admin/sportspress-admin.js b/assets/js/admin/sportspress-admin.js index 10c3f502..ae575fc2 100644 --- a/assets/js/admin/sportspress-admin.js +++ b/assets/js/admin/sportspress-admin.js @@ -1,901 +1,1187 @@ -jQuery(document).ready(function($){ +jQuery( document ).ready( + function($){ - // Tiptip - $(".sp-tip").tipTip({ - delay: 200, - fadeIn: 100, - fadeOut: 100 - }); - $(".sp-desc-tip").tipTip({ - delay: 200, - fadeIn: 100, - fadeOut: 100, - defaultPosition: 'right' - }); - - // Chosen select - $(document).on("postbox-toggled", function() { - $(".chosen-select").filter(":visible").chosen({ - allow_single_deselect: true, - search_contains: true, - single_backstroke_delete: false, - disable_search_threshold: 10, - placeholder_text_multiple: localized_strings.none - }); - }).trigger("postbox-toggled"); - - - // Auto key placeholder - $("#poststuff #title").on("keyup", function() { - val = $(this).val() - lc = val.replace(/[^a-z]/gi,"").toLowerCase(); - $("#sp_key").attr("placeholder", lc); - $("#sp_default_key").val(lc); - $("#sp_singular").attr("placeholder", val); - }); - - // Activate auto key placeholder - $("#poststuff #title").keyup(); - - // Radio input toggle - $(".sp-radio-toggle").click(function() { - if($(this).data("sp-checked")) { - $(this).prop("checked", false ); - $(this).data("sp-checked", false ); - } else { - $(this).data("sp-checked", true ); - } - }); - - // Table switcher - $(".sp-table-panel").siblings(".sp-table-bar").find("a").click(function() { - $(this).closest("li").find("a").addClass("current").closest("li").siblings().find("a").removeClass("current").closest(".sp-table-bar").siblings($(this).attr("href")).show().siblings(".sp-table-panel").hide(); - return false; - }); - - // Tab switcher - $(".sp-tab-panel").siblings(".sp-tab-bar").find("a").click(function() { - $(this).closest("li").addClass("tabs").siblings().removeClass("tabs").closest(".sp-tab-bar").siblings($(this).attr("href")).show().trigger('checkCheck').siblings(".sp-tab-panel").hide(); - return false; - }); - - // Tab filter - $(".sp-tab-filter-panel").siblings(".sp-tab-select").find("select").change(function() { - var val = $(this).val(); - var filter = ".sp-filter-"+val; - var $filters = $(this).closest(".sp-tab-select").siblings(".sp-tab-select"); - if($filters.length) { - $filters.each(function() { - filterval = $(this).find("select").val(); - if(filterval !== undefined) - filter += ".sp-filter-"+filterval; - }); - } - $panel = $(this).closest(".sp-tab-select").siblings(".sp-tab-panel"); - $panel.each(function() { - $(this).find(".sp-post").hide(0, function() { - $(this).find("input").prop("disabled", true); - $(this).filter(filter).show(0, function() { - $(this).find("input").prop("disabled", false); - }); - }); - if($(this).find(".sp-post:visible").length > 0) { - $(this).find(".sp-select-all-container").show(); - $(this).find(".sp-show-all-container").show(); - $(this).find(".sp-not-found-container").hide(); - } else { - $(this).find(".sp-select-all-container").hide(); - $(this).find(".sp-show-all-container").hide(); - $(this).find(".sp-not-found-container").show(); + // Tiptip + $( ".sp-tip" ).tipTip( + { + delay: 200, + fadeIn: 100, + fadeOut: 100 } - }); - }); - - // Trigger tab filter - $(".sp-tab-filter-panel").siblings(".sp-tab-select").find("select").change(); - - // Dropdown filter - $(".sp-dropdown-target").siblings(".sp-dropdown-filter").find("select").change(function() { - var val = $(this).val(); - var filter = ".sp-filter-"+val; - var $filters = $(this).closest(".sp-dropdown-filter").siblings(".sp-dropdown-filter"); - if($filters.length) { - $filters.each(function() { - filterval = $(this).find("select").val(); - if(filterval !== undefined) - filter += ".sp-filter-"+filterval; - }); - } - $target = $(this).closest(".sp-dropdown-filter").siblings(".sp-dropdown-target").find("select"); - $target.find(".sp-post").prop("disabled", true).each(function() { - $(this).filter(filter).prop("disabled", false); - }); - }); - - // Trigger dropdown filter - $(".sp-dropdown-target").siblings(".sp-dropdown-filter").find("select").change(); - - // Filter show all action links - $(".sp-tab-panel").find(".sp-post input:checked").each(function() { - $(this).prop("disabled", false).closest("li").show().siblings(".sp-not-found-container").hide().siblings(".sp-show-all-container").show(); - }); - - // Show all filter - $(".sp-tab-panel").on("click", ".sp-show-all", function() { - $(this).closest("li").hide().siblings(".sp-post, .sp-select-all-container").show().find("input").prop("disabled", false); - }); - - // Self-cloning - $(".sp-clone:last").find("select").change(function() { - $(this).closest(".sp-clone").siblings().find("select").change(function() { - if($(this).val() == "0") $(this).closest(".sp-clone").remove(); - }).find("option:first").text(localized_strings.remove_text); - if($(this).val() != "0") { - $original = $(this).closest(".sp-clone"); - $original.before($original.clone().find("select").attr("name", $original.attr("data-clone-name") + "[]").val($(this).val()).closest(".sp-clone")).attr("data-clone-num", parseInt($original.attr("data-clone-num")) + 1).find("select").val("0").change(); - } - }); - - // Activate self-cloning - $(".sp-clone:last").find("select").change(); - - // Custom value editor - $(".sp-data-table .sp-default-value").click(function() { - $(this).hide().siblings(".sp-custom-value").show().find(".sp-custom-value-input").focus(); - }); - - // Define custom value editor saving - $(".sp-data-table .sp-custom-value .sp-custom-value-input").on("saveInput", function() { - $val = $(this).val(); - if($val == "") $val = $(this).attr("placeholder"); - $(this).closest(".sp-custom-value").hide().siblings(".sp-default-value").show().find(".sp-default-value-input").html($val); - }); - - // Define custom value editor cancellation - $(".sp-data-table .sp-custom-value .sp-custom-value-input").on("cancelInput", function() { - $val = $(this).closest(".sp-custom-value").siblings(".sp-default-value").find(".sp-default-value-input").html(); - if($val == $(this).attr("placeholder")) $(this).val(""); - else $(this).val($val); - $(this).closest(".sp-custom-value").hide().siblings(".sp-default-value").show(); - }); - - // Custom value editor save - $(".sp-data-table .sp-custom-value .sp-save").click(function() { - $(this).siblings(".sp-custom-value-input").trigger("saveInput"); - }); - - // Custom value editor cancel - $(".sp-data-table .sp-custom-value .sp-cancel").click(function() { - $(this).siblings(".sp-custom-value-input").trigger("cancelInput"); - }); - - // Prevent custom value editor input from submitting form - $(".sp-data-table .sp-custom-value .sp-custom-value-input").keypress(function(event) { - if(event.keyCode == 13){ - event.preventDefault(); - $(this).trigger("saveInput"); - return false; - } - }); - - // Cancel custom value editor form on escape - $(".sp-data-table .sp-custom-value .sp-custom-value-input").keyup(function(event) { - if(event.keyCode == 27){ - event.preventDefault(); - $(this).trigger("cancelInput"); - return false; - } - }); - - // Data table adjustments - $(".sp-table-adjustments input").change(function() { - matrix = $(this).attr("data-matrix"); - $el = $(this).closest(".sp-table-adjustments").siblings(".sp-table-values").find("input[data-matrix="+matrix+"]"); - placeholder = $el.attr("data-placeholder"); - current_adjustment = parseFloat($el.attr("data-adjustment")); - adjustment = parseFloat($(this).val()); - if(! isNaN(adjustment) && adjustment != 0) { - placeholder = parseFloat(placeholder); - if(isNaN(placeholder)) placeholder = 0; - if(isNaN(current_adjustment)) current_adjustment = 0; - placeholder += adjustment - current_adjustment; - } - $el.attr("placeholder", placeholder); - }).change(); - - // Data table keyboard navigation - $(".sp-data-table tbody tr td input:text").keydown(function(event) { - if(! $(this).parent().hasClass("chosen-search") && [37,38,39,40].indexOf(event.keyCode) > -1){ - $el = $(this).closest("td"); - var col = $el.parent().children().index($el)+1; - var row = $el.parent().parent().children().index($el.parent())+1; - if(event.keyCode == 37){ - if ( $(this).caret().start != 0 ) - return true; - col -= 1; + ); + $( ".sp-desc-tip" ).tipTip( + { + delay: 200, + fadeIn: 100, + fadeOut: 100, + defaultPosition: 'right' } - if(event.keyCode == 38){ - row -= 1; - } - if(event.keyCode == 39){ - if ( $(this).caret().start != $(this).val().length ) - return true; - col += 1; - } - if(event.keyCode == 40){ - row += 1; - } - $el.closest("tbody").find("tr:nth-child("+row+") td:nth-child("+col+") input:text").first().focus(); - } - }); + ); - // Prevent data table from submitting form - $(".sp-data-table tbody tr td input:text").keypress(function(event) { - if(! $(this).parent().hasClass("chosen-search") && event.keyCode == 13){ - event.preventDefault(); - $el = $(this).closest("td"); - var col = $el.parent().children().index($el)+1; - var row = $el.parent().parent().children().index($el.parent())+2; - $el.closest("tbody").find("tr:nth-child("+row+") td:nth-child("+col+") input:text").focus(); - return false; - } - }); - - // Total stats calculator - $(".sp-data-table .sp-total input[data-sp-format=number][data-sp-total-type!=average]").on("updateTotal", function() { - index = $(this).parent().index(); - var sum = 0; - $(this).closest(".sp-data-table").find(".sp-post").each(function() { - val = $(this).find("td").eq(index).find("input").val(); - if(val == "") { - val = $(this).find("td").eq(index).find("input").attr("placeholder"); - } - if($.isNumeric(val)) { - sum += parseFloat(val, 10); - } - }); - $(this).attr("placeholder", sum); - }); - - // Activate total stats calculator - if($(".sp-data-table .sp-total").length) { - $(".sp-data-table .sp-post td input").on("keyup", function() { - $(this).closest(".sp-data-table").find(".sp-total td").eq($(this).parent().index()).find("input[data-sp-format=number][data-sp-total-type!=average]").trigger("updateTotal"); - }); - } - - // Trigger total stats calculator - $(".sp-data-table .sp-total input[data-sp-format=number][data-sp-total-type!=average]").trigger("updateTotal"); - - // Sync inputs - $(".sp-sync-input").on("keyup", function() { - name = $(this).attr("name"); - $el = $("input[name='"+name+"']"); - if ( $el.length > 1 ) { - val = $(this).val(); - $el.val(val); - } - }); - - // Sync selects - $(".sp-sync-select").on("change", function() { - name = $(this).attr("name"); - $el = $("select[name='"+name+"']") - if ( $el.length > 1 ) { - val = $(this).val(); - $el.val(val); - } - }); - - // Select all checkboxes - $(".sp-select-all-range").on("change", ".sp-select-all", function() { - $range = $(this).closest(".sp-select-all-range"); - $range.find("input[type=checkbox]").prop("checked", $(this).prop("checked")); - }); - - // Check if all checkboxes are checked already - $(".sp-select-all-range").on("checkCheck", function() { - $(this).each(function() { - $(this).find(".sp-select-all").prop("checked", $(this).find("input[type=checkbox]:checked:not(.sp-select-all)").length != 0 && $(this).find("input[type=checkbox]:checked:not(.sp-select-all)").length == $(this).find("input[type=checkbox]:visible:not(.sp-select-all)").length); - }); - }); - - // Activate check check when a checkbox is checked - $(".sp-select-all-range input[type=checkbox]:not(.sp-select-all)").change(function() { - $(this).closest(".sp-select-all-range").trigger("checkCheck"); - }); - - // Activate check check on page load - $(".sp-select-all-range").trigger("checkCheck"); - - // Trigger check check - $(".sp-data-table").trigger("checkCheck"); - - // Sortable tables - $(".sp-sortable-table tbody").sortable({ - handle: ".icon", - axis: "y" - }); - - // Sortable lists - $( ".sp-sortable-list" ).sortable({ - handle: ".sp-item-handle", - placeholder: "sp-item-placeholder", - connectWith: ".sp-connected-list" - }); - - // Autosave - $(".sp-autosave").change(function() { - $(this).attr("readonly", true).closest("form").submit(); - }); - - // Video embed - $(".sp-add-video").click(function() { - $(this).closest("fieldset").hide().siblings(".sp-video-field").show(); - return false; - }); - - // Removing video embed - $(".sp-remove-video").click(function() { - $(this).closest("fieldset").hide().siblings(".sp-video-adder").show().siblings(".sp-video-field").find("input").val(null); - return false; - }); - - // Equation selector - $(".sp-equation-selector select:last").change(function() { - $(this).siblings().change(function() { - if($(this).val() == "") $(this).remove(); - }).find("option:first").text(localized_strings.remove_text); - if($(this).val() != "") { - $(this).before($(this).clone().val($(this).val())).val("").change(); - } - }); - - // Trigger equation selector - $(".sp-equation-selector select:last").change().siblings().change(); - - // Order selector - $(".sp-order-selector select:first").change(function() { - if($(this).val() == "0") { - $(this).siblings().prop( "disabled", true ); - } else { - $(this).siblings().prop( "disabled", false ) - } - }); - - // Trigger order selector - $(".sp-order-selector select:first").change(); - - // Format selector - $(".sp-format-selector select:first").change(function() { - - $precisiondiv = $("#sp_precisiondiv"); - $precisioninput = $("#sp_precision"); - $timeddiv = $("#sp_timeddiv"); - $equationdiv = $("#sp_equationdiv"); - - // Equation settings - if ($(this).val() == "equation") { - $equationdiv.show(); - $precisiondiv.show(); - $timeddiv.hide(); - $precisioninput.prop( "disabled", false ); - } else if ($(this).val() == "number") { - $equationdiv.hide(); - $precisiondiv.hide(); - $timeddiv.show(); - $precisioninput.prop( "disabled", true ); - } else { - $equationdiv.hide(); - $precisiondiv.hide(); - $timeddiv.hide(); - $precisioninput.prop( "disabled", true ); - } - - }); - - // Trigger format selector - $(".sp-format-selector select:first").change(); - - // Team era selector - $(".sp-team-era-selector select:first-child").change(function() { - - $subselector = $(this).siblings(); - - // Sub settings - if($(this).val() == 0) { - $subselector.hide(); - } else { - $subselector.show(); - } - - }); - - // Trigger team era selector - $(".sp-team-era-selector select:first-child").change(); - - // Status selector - $(".sp-status-selector select:first-child").change(function() { - - $subselector = $(this).siblings(); - - // Sub settings - if($(this).val() == "sub") { - $subselector.show(); - } else { - $subselector.hide(); - } - - }); - - // Trigger status selector - $(".sp-status-selector select:first-child").change(); - - // Preset field modifier - $(".sp-custom-input-wrapper .preset").click(function() { - val = $(this).val(); - if(val == "\\c\\u\\s\\t\\o\\m") return true; - example = $(this).attr("data-example"); - $(this).closest(".sp-custom-input-wrapper").find(".value").val(val).siblings(".example").html(example); - }); - - // Select custom preset when field is brought to focus - $(".sp-custom-input-wrapper .value").focus(function() { - $(this).siblings("label").find(".preset").prop("checked", true); - }); - - // Adjust example field when custom preset is entered - $(".sp-custom-input-wrapper .value").on("keyup", function() { - val = $(this).val(); - if ( val === undefined ) return true; - format = $(this).attr("data-example-format"); - example = format.replace("__val__", val); - $(this).siblings(".example").html(example); - }); - - // Prevent address input from submitting form - $(".sp-address").keypress(function(event) { - return event.keyCode != 13; - }); - - // Dashboard countdown - $("#sportspress_dashboard_status .sp_status_list li.countdown").each(function() { - var $this = $(this); - // Get countdown time - var countDownDate = new Date($(this).data('countdown')).getTime(); - // Iterate every second - var x = setInterval(function() { - - // Get todays date and time - var now = new Date(); - - // Convert curent date and time to UTC - var tzDifference = now.getTimezoneOffset(); - var nowutc = new Date(now.getTime() + tzDifference * 60 * 1000); - - // Find the distance between now and the count down date - var distance = countDownDate - nowutc; - if ( distance < 0 ) { - distance = 0; - } - - // Time calculations for days, hours, minutes and seconds - var days = Math.floor(distance / (1000 * 60 * 60 * 24)); - var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); - var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); - var seconds = Math.floor((distance % (1000 * 60)) / 1000); - - // Output the result - $this.find('strong').html(days+" "+localized_strings.days+" "+('0' + hours).slice(-2)+":"+('0' + minutes).slice(-2)+":"+('0' + seconds).slice(-2)); - }, 1000); - }); - - // Event format affects data - $(".post-type-sp_event #post-formats-select").change(function() { - layout = $(".post-type-sp_event #post-formats-select input:checked").val(); - if ( layout == "friendly" ) { - $(".sp_event-sp_league-field").hide().find("select").prop("disabled", true); - $(".sp_event-sp_season-field").hide().find("select").prop("disabled", true); - } else { - $(".sp_event-sp_league-field").show().find("select").prop("disabled", false); - $(".sp_event-sp_season-field").show().find("select").prop("disabled", false); - } - }); - - // Trigger event format change - $(".post-type-sp_event #post-formats-select").trigger("change"); - - // Calendar layout affects data - $(".post-type-sp_calendar #post-formats-select").change(function() { - layout = $(".post-type-sp_calendar #post-formats-select input:checked").val(); - $(".sp-calendar-table tr").each(function() { - if ( layout == "list" ) { - $(this).find("th input[type=checkbox]").show(); - $(this).find("th select").prop("disabled", false); - } else { - $(this).find("th input[type=checkbox]").hide(); - $(this).find("th select").prop('selectedIndex', 0).prop("disabled", true); - } - }); - }); - - // Trigger calendar layout change - $(".post-type-sp_calendar #post-formats-select").trigger("change"); - - // Player list layout affects data - $(".post-type-sp_list #post-formats-select").change(function() { - layout = $(".post-type-sp_list #post-formats-select input:checked").val(); - $(".sp-player-list-table tr").each(function() { - if ( layout == "list" ) { - $(this).find("th input[type=checkbox]").show(); - } else { - $(this).find("th input[type=checkbox]").hide(); - } - }); - }); - - // Trigger player list layout change - $(".post-type-sp_list #post-formats-select").trigger("change"); - - // Configure primary result option (Ajax) - $(".sp-admin-config-table").on("click", ".sp-primary-result-option", function() { - $.post( ajaxurl, { - action: "sp-save-primary-result", - primary_result: $(this).val(), - nonce: $("#sp-primary-result-nonce").val() - }); - }); - - // Configure primary performance option (Ajax) - $(".sp-admin-config-table").on("click", ".sp-primary-performance-option", function() { - $.post( ajaxurl, { - action: "sp-save-primary-performance", - primary_performance: $(this).val(), - nonce: $("#sp-primary-performance-nonce").val() - }); - }); - - // Update importer post count - $(".sp-import-table").on("updatePostCount", function() { - $(".sp-post-count").text(localized_strings.displaying_posts.replace("%s", 1).replace(/%s/g, count = $(this).find("tbody tr").length)); - }); - - // Delete importer row - $(".sp-import-table").on("click", ".sp-delete-row", function() { - $self = $(this); - $self.closest("tr").css("background-color", "#f99").fadeOut(400, function() { - $table = $self.closest(".sp-import-table"); - $(this).remove(); - $table.trigger("updatePostCount"); - }); - return false; - }); - - // Add importer row - $(".sp-import-table").on("click", ".sp-add-row", function() { - $self = $(this); - $table = $self.closest(".sp-import-table"); - if ( $self.hasClass("sp-add-first") ) { - $tr = $table.find("tbody tr:first-child"); - $row = $tr.clone(); - $row.insertBefore($tr).find("input").val(""); - } else { - $tr = $self.closest("tr"); - $row = $tr.clone(); - $tr.find("input").val(""); - $row.insertBefore($tr); - } - $table.trigger("updatePostCount"); - return false; - }); - - // Enable or disable importer inputs based on column label - $(".sp-import-table").on("change", "select", function() { - $self = $(this); - $table = $self.closest(".sp-import-table"); - index = parseInt($self.data("index")); - if ( $self.val() == 0 ) { - $table.find("tbody tr td:nth-child("+parseInt(index+1)+") input").prop("disabled", true); - } else { - $table.find("tbody tr td:nth-child("+parseInt(index+1)+") input").prop("disabled", false); - $self.closest("th").siblings().find("select").each(function() { - if ( $(this).val() == $self.val() ) $(this).val("0").trigger("change"); - }); - } - }); - - // Datepicker - $(".sp-datepicker").datepicker({ - dateFormat : "yy-mm-dd" - }); - $(".sp-datepicker-from").datepicker({ - dateFormat : "yy-mm-dd", - onClose: function( selectedDate ) { - $(this).closest(".sp-date-selector").find(".sp-datepicker-to").datepicker("option", "minDate", selectedDate); - } - }); - $(".sp-datepicker-to").datepicker({ - dateFormat : "yy-mm-dd", - onClose: function( selectedDate ) { - $(this).closest(".sp-date-selector").find(".sp-datepicker-from").datepicker("option", "maxDate", selectedDate); - } - }); - - // Show or hide datepicker - $(".sp-date-selector select").change(function() { - if ( $(this).val() == "range" ) { - $(this).closest(".sp-date-selector").find(".sp-date-range").show(); - } else { - $(this).closest(".sp-date-selector").find(".sp-date-range").hide(); - } - }); - $(".sp-date-selector select").trigger("change"); - - // Toggle date range selectors - $(".sp-date-relative input").change(function() { - $relative = $(this).closest(".sp-date-relative").siblings(".sp-date-range-relative").toggle(0, $(this).attr("checked")); - $absolute = $(this).closest(".sp-date-relative").siblings(".sp-date-range-absolute").toggle(0, $(this).attr("checked")); - - if ($(this).attr("checked")) { - $relative.show(); - $absolute.hide(); - } else { - $absolute.show(); - $relative.hide(); - } - }); - $(".sp-date-selector input").trigger("change"); - - // Apply color scheme - $(".sp-color-option").on("click", function() { - colors = $(this).find("label").data("sp-colors").split(","); - $(".sp-custom-colors").find(".sp-color-box").each(function(index) { - $(this).find("input").val("#"+colors[index]).css("background-color", "#"+colors[index]); - });; - }); - - // Edit inline results - $("#the-list").on("click, focus", ".sp-result, .sp-edit-results", function(){ - team = $(this).data("team"); - $column = $(this).closest(".column-sp_team"); - $column.find(".sp-result, .sp-row-actions").hide(); - $column.find(".sp-edit-result, .sp-inline-edit-save").show(); - if ( team != undefined ) { - $column.find(".sp-edit-result[data-team='"+team+"']").select(); - } - return false; - }); - - // Cancel inline results - $("#the-list").on("click", ".sp-inline-edit-save .cancel", function(){ - $column = $(this).closest(".column-sp_team"); - $column.find(".sp-edit-result, .sp-inline-edit-save").hide(); - $column.find(".sp-result, .sp-row-actions").show(); - return false; - }); - - // Save inline results - $("#the-list").on("click", ".sp-inline-edit-save .save", function(){ - $column = $(this).closest(".column-sp_team"); - results = {}; - $column.find(".sp-edit-result").each(function() { - id = $(this).data("team"); - result = $(this).val(); - results[id] = result; - }); - $.post( ajaxurl, { - action: "sp-save-inline-results", - post_id: $column.find("input[name='sp_post_id']").val(), - results: results, - nonce: $("#sp-inline-nonce").val() - }, function(response) { - $column.find(".sp-edit-result").each(function() { - val = $(this).val(); - $column.find(".sp-result[data-team='"+$(this).data("team")+"']").html(val==''?'-':val); - }); - $column.find(".sp-edit-result, .sp-inline-edit-save").hide(); - $column.find(".sp-result, .sp-row-actions").show(); - return false; - }); - }); - - // Override inline form submission - $("#the-list").on("keypress", ".sp-edit-result", function(e) { - if ( e.which == 13 ) { - $(this).closest(".column-sp_team").find(".sp-inline-edit-save .save").trigger("click"); - return false; - } - }); - - // Fitvids - $(".sp-fitvids").fitVids(); - - // Display configure sport button - $(".sp-select-sport").change(function() { - $(".sp-configure-sport").hide(); - }); - - // Ajax checklist - $(".sp-ajax-checklist").siblings(".sp-tab-select").find("select").change(function() { - $(this).closest(".sp-tab-select").siblings(".sp-ajax-checklist").find("ul").html("
x
'; - head.appendChild(div.childNodes[1]); - } + if ( ! document.getElementById( 'fit-vids-style' )) { + // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js + var head = document.head || document.getElementsByTagName( 'head' )[0]; + var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}'; + var div = document.createElement( "div" ); + div.innerHTML = 'x
'; + head.appendChild( div.childNodes[1] ); + } - if ( options ) { - $.extend( settings, options ); - } + if ( options ) { + $.extend( settings, options ); + } - return this.each(function(){ - var selectors = [ - 'iframe[src*="player.vimeo.com"]', - 'iframe[src*="youtube.com"]', - 'iframe[src*="youtube-nocookie.com"]', - 'iframe[src*="kickstarter.com"][src*="video.html"]', - 'object', - 'embed' - ]; + return this.each( + function(){ + var selectors = [ + 'iframe[src*="player.vimeo.com"]', + 'iframe[src*="youtube.com"]', + 'iframe[src*="youtube-nocookie.com"]', + 'iframe[src*="kickstarter.com"][src*="video.html"]', + 'object', + 'embed' + ]; - if (settings.customSelector) { - selectors.push(settings.customSelector); - } + if (settings.customSelector) { + selectors.push( settings.customSelector ); + } - var ignoreList = '.fitvidsignore'; + var ignoreList = '.fitvidsignore'; - if(settings.ignore) { - ignoreList = ignoreList + ', ' + settings.ignore; - } + if (settings.ignore) { + ignoreList = ignoreList + ', ' + settings.ignore; + } - var $allVideos = $(this).find(selectors.join(',')); - $allVideos = $allVideos.not('object object'); // SwfObj conflict patch - $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. + var $allVideos = $( this ).find( selectors.join( ',' ) ); + $allVideos = $allVideos.not( 'object object' ); // SwfObj conflict patch + $allVideos = $allVideos.not( ignoreList ); // Disable FitVids on this video. - $allVideos.each(function(){ - var $this = $(this); - if($this.parents(ignoreList).length > 0) { - return; // Disable FitVids on this video. - } - if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } - if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) - { - $this.attr('height', 9); - $this.attr('width', 16); - } - var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), - width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), - aspectRatio = height / width; - if(!$this.attr('id')){ - var videoID = 'fitvid' + Math.floor(Math.random()*999999); - $this.attr('id', videoID); - } - $this.wrap('').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%'); - $this.removeAttr('height').removeAttr('width'); - }); - }); - }; -// Works with either jQuery or Zepto + $allVideos.each( + function(){ + var $this = $( this ); + if ($this.parents( ignoreList ).length > 0) { + return; // Disable FitVids on this video. + } + if (this.tagName.toLowerCase() === 'embed' && $this.parent( 'object' ).length || $this.parent( '.fluid-width-video-wrapper' ).length) { + return; } + if (( ! $this.css( 'height' ) && ! $this.css( 'width' )) && (isNaN( $this.attr( 'height' ) ) || isNaN( $this.attr( 'width' ) ))) { + $this.attr( 'height', 9 ); + $this.attr( 'width', 16 ); + } + var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr( 'height' ) && ! isNaN( parseInt( $this.attr( 'height' ), 10 ) )) ) ? parseInt( $this.attr( 'height' ), 10 ) : $this.height(), + width = ! isNaN( parseInt( $this.attr( 'width' ), 10 ) ) ? parseInt( $this.attr( 'width' ), 10 ) : $this.width(), + aspectRatio = height / width; + if ( ! $this.attr( 'id' )) { + var videoID = 'fitvid' + Math.floor( Math.random() * 999999 ); + $this.attr( 'id', videoID ); + } + $this.wrap( '' ).parent( '.fluid-width-video-wrapper' ).css( 'padding-top', (aspectRatio * 100) + '%' ); + $this.removeAttr( 'height' ).removeAttr( 'width' ); + } + ); + } + ); + }; + // Works with either jQuery or Zepto })( window.jQuery || window.Zepto ); diff --git a/assets/js/sportspress.js b/assets/js/sportspress.js index 09ef3fb1..cfedf4d8 100644 --- a/assets/js/sportspress.js +++ b/assets/js/sportspress.js @@ -1,119 +1,138 @@ function sp_viewport() { - var e = window, a = 'inner'; - if (!('innerWidth' in window )) { - a = 'client'; - e = document.documentElement || document.body; - } - return { width : e[ a+'Width' ] , height : e[ a+'Height' ] }; + var e = window, a = 'inner'; + if ( ! ('innerWidth' in window )) { + a = 'client'; + e = document.documentElement || document.body; + } + return { width : e[ a + 'Width' ] , height : e[ a + 'Height' ] }; } (function($) { /* Header */ - if ( ! $('.sp-header').length ) { - $('body').prepend( '' ); + if ( ! $( '.sp-header' ).length ) { + $( 'body' ).prepend( '' ); } /* Countdown */ - $("[data-countdown]").each(function() { - var $this = $(this); - // Get countdown time - var countDownDate = new Date($(this).data('countdown')).getTime(); - // Iterate every second - var x = setInterval(function() { - - // Get todays date and time - var now = new Date(); - - // Convert curent date and time to UTC - var tzDifference = now.getTimezoneOffset(); - var nowutc = new Date(now.getTime() + tzDifference * 60 * 1000); - - // Find the distance between now and the count down date - var distance = countDownDate - nowutc; - if ( distance < 0 ) { - distance = 0; - } - - // Time calculations for days, hours, minutes and seconds - var days = Math.floor(distance / (1000 * 60 * 60 * 24)); - var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); - var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); - var seconds = Math.floor((distance % (1000 * 60)) / 1000); - - // Output the result - $this.html(""+(days < 10 ? '0' + days : days)+" " + localized_strings.days + " " - + ""+('0' + hours).slice(-2)+" " + localized_strings.hrs + " " - + ""+('0' + minutes).slice(-2)+" " + localized_strings.mins + " " - + ""+('0' + seconds).slice(-2)+" " + localized_strings.secs + "" ); - }, 1000); - }); + $( "[data-countdown]" ).each( + function() { + var $this = $( this ); + // Get countdown time + var countDownDate = new Date( $( this ).data( 'countdown' ) ).getTime(); + // Iterate every second + var x = setInterval( + function() { + + // Get todays date and time + var now = new Date(); + + // Convert curent date and time to UTC + var tzDifference = now.getTimezoneOffset(); + var nowutc = new Date( now.getTime() + tzDifference * 60 * 1000 ); + + // Find the distance between now and the count down date + var distance = countDownDate - nowutc; + if ( distance < 0 ) { + distance = 0; + } + + // Time calculations for days, hours, minutes and seconds + var days = Math.floor( distance / (1000 * 60 * 60 * 24) ); + var hours = Math.floor( (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60) ); + var minutes = Math.floor( (distance % (1000 * 60 * 60)) / (1000 * 60) ); + var seconds = Math.floor( (distance % (1000 * 60)) / 1000 ); + + // Output the result + $this.html( + "" + (days < 10 ? '0' + days : days) + " " + localized_strings.days + " " + + "" + ('0' + hours).slice( -2 ) + " " + localized_strings.hrs + " " + + "" + ('0' + minutes).slice( -2 ) + " " + localized_strings.mins + " " + + "" + ('0' + seconds).slice( -2 ) + " " + localized_strings.secs + "" + ); + }, + 1000 + ); + } + ); /* Scrollable Tables */ - $(".sp-scrollable-table").wrap(""); - + $( ".sp-scrollable-table" ).wrap( "" ); + /* Selector Redirect */ - $(".sp-selector-redirect").change(function() { - window.location = $(this).val(); - }); + $( ".sp-selector-redirect" ).change( + function() { + window.location = $( this ).val(); + } + ); /* Template Tabs */ - $(".sp-tab-menu-item a").click(function() { - $template = $(this).data("sp-tab"); - $(this).closest(".sp-tab-menu-item").addClass("sp-tab-menu-item-active").siblings(".sp-tab-menu-item").removeClass("sp-tab-menu-item-active"); - $(this).closest(".sp-tab-group").find(".sp-tab-content-"+$template).show().siblings(".sp-tab-content").hide(); - return false; - }); + $( ".sp-tab-menu-item a" ).click( + function() { + $template = $( this ).data( "sp-tab" ); + $( this ).closest( ".sp-tab-menu-item" ).addClass( "sp-tab-menu-item-active" ).siblings( ".sp-tab-menu-item" ).removeClass( "sp-tab-menu-item-active" ); + $( this ).closest( ".sp-tab-group" ).find( ".sp-tab-content-" + $template ).show().siblings( ".sp-tab-content" ).hide(); + return false; + } + ); /* API method to get paging information */ $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings ) { - return { - "iStart": oSettings._iDisplayStart, - "iEnd": oSettings.fnDisplayEnd(), - "iLength": oSettings._iDisplayLength, - "iTotal": oSettings.fnRecordsTotal(), - "iFilteredTotal": oSettings.fnRecordsDisplay(), - "iPage": oSettings._iDisplayLength === -1 ? - 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ), - "iTotalPages": oSettings._iDisplayLength === -1 ? - 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength ) - }; + return { + "iStart": oSettings._iDisplayStart, + "iEnd": oSettings.fnDisplayEnd(), + "iLength": oSettings._iDisplayLength, + "iTotal": oSettings.fnRecordsTotal(), + "iFilteredTotal": oSettings.fnRecordsDisplay(), + "iPage": oSettings._iDisplayLength === -1 ? + 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ), + "iTotalPages": oSettings._iDisplayLength === -1 ? + 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength ) + }; } /* Data Tables */ - $(".sp-data-table").each(function() { - sortable = $(this).hasClass("sp-sortable-table"); - paginated = $(this).hasClass("sp-paginated-table"); - display_length = parseInt($(this).attr("data-sp-rows")); - if ( display_length == undefined || isNaN( display_length ) ) display_length = 10; - if ( $(this).find("tbody tr").length <= display_length ) paginated = false; - if ( sortable || paginated ) { - $(this).dataTable({ - "order": [], - "autoWidth": false, - "searching": false, - "info": false, - "paging": paginated, - "lengthChange": false, - "pagingType": "simple_numbers", - "pageLength": display_length, - "ordering": sortable, - "language": { - "aria": { - "sortAscending": "", - "sortDescending": "" - }, - "paginate": { - "previous": localized_strings.previous, - "next": localized_strings.next, - } - }, - "columnDefs": [ - { "type": "num-fmt", "targets": [ ".data-number", ".data-rank" ] }, - ] - }); + $( ".sp-data-table" ).each( + function() { + sortable = $( this ).hasClass( "sp-sortable-table" ); + paginated = $( this ).hasClass( "sp-paginated-table" ); + display_length = parseInt( $( this ).attr( "data-sp-rows" ) ); + if ( display_length == undefined || isNaN( display_length ) ) { + display_length = 10; + } + if ( $( this ).find( "tbody tr" ).length <= display_length ) { + paginated = false; + } + if ( sortable || paginated ) { + $( this ).dataTable( + { + "order": [], + "autoWidth": false, + "searching": false, + "info": false, + "paging": paginated, + "lengthChange": false, + "pagingType": "simple_numbers", + "pageLength": display_length, + "ordering": sortable, + "language": { + "aria": { + "sortAscending": "", + "sortDescending": "" + }, + "paginate": { + "previous": localized_strings.previous, + "next": localized_strings.next, + } + }, + "columnDefs": [ + { "type": "num-fmt", "targets": [ ".data-number", ".data-rank" ] }, + ] + } + ); + } } - }); + ); -})(jQuery); +})( jQuery ); diff --git a/feeds/ical.php b/feeds/ical.php index 768bd46b..f2e2a1e2 100644 --- a/feeds/ical.php +++ b/feeds/ical.php @@ -2,13 +2,15 @@ /** * iCal Feed * - * @author ThemeBoy - * @category Feeds - * @package SportsPress/Feeds + * @author ThemeBoy + * @category Feeds + * @package SportsPress/Feeds * @version 2.7.5 */ -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly +} if ( 'sp_calendar' !== get_post_type( $post ) ) { wp_die( __( 'ERROR: This is not a valid feed template.', 'sportspress' ), '', array( 'response' => 404 ) ); @@ -16,7 +18,7 @@ if ( 'sp_calendar' !== get_post_type( $post ) ) { // Get events in calendar $calendar = new SP_Calendar( $post ); -$events = $calendar->data(); +$events = $calendar->data(); // Get blog locale $locale = substr( get_locale(), 0, 2 ); @@ -29,41 +31,43 @@ $timezone = sanitize_option( 'timezone_string', get_option( 'timezone_string' ) // Get the URL $url = add_query_arg( 'feed', 'sp-ical', get_post_permalink( $post ) ); -$url = wordwrap( $url , 60, "\r\n\t", true ); +$url = wordwrap( $url, 60, "\r\n\t", true ); $output = "BEGIN:VCALENDAR\r\n" . "VERSION:2.0\r\n" . -"PRODID:-//ThemeBoy//SportsPress//" . strtoupper( $locale ) . "\r\n" . +'PRODID:-//ThemeBoy//SportsPress//' . strtoupper( $locale ) . "\r\n" . "CALSCALE:GREGORIAN\r\n" . "METHOD:PUBLISH\r\n" . -"URL:" . $url . "\r\n" . -"X-FROM-URL:" . $url . "\r\n" . -"NAME:" . $post->post_title . "\r\n" . -"X-WR-CALNAME:" . $post->post_title . "\r\n" . -"DESCRIPTION:" . $post->post_title . "\r\n" . -"X-WR-CALDESC:" . $post->post_title . "\r\n" . +'URL:' . $url . "\r\n" . +'X-FROM-URL:' . $url . "\r\n" . +'NAME:' . $post->post_title . "\r\n" . +'X-WR-CALNAME:' . $post->post_title . "\r\n" . +'DESCRIPTION:' . $post->post_title . "\r\n" . +'X-WR-CALDESC:' . $post->post_title . "\r\n" . "REFRESH-INTERVAL;VALUE=DURATION:PT2M\r\n" . "X-PUBLISHED-TTL:PT2M\r\n" . -"TZID:" . $timezone . "\r\n" . -"X-WR-TIMEZONE:" . $timezone . "\r\n"; +'TZID:' . $timezone . "\r\n" . +'X-WR-TIMEZONE:' . $timezone . "\r\n"; // Loop through each event -foreach ( $events as $event): +foreach ( $events as $event ) : // Define date format $date_format = 'Ymd\THis'; // Get description - $description = preg_replace( '/([\,;])/','\\\$1', $event->post_content ); - $description = wordwrap( $description , 60, "\n\t" ); + $description = preg_replace( '/([\,;])/', '\\\$1', $event->post_content ); + $description = wordwrap( $description, 60, "\n\t" ); - // Initialize end time + // Initialize end time $end = new DateTime( $event->post_date ); // Get full time minutes $minutes = get_post_meta( $event->ID, 'sp_minutes', true ); - if ( '' === $minutes ) $minutes = get_option( 'sportspress_event_minutes', 90 ); + if ( '' === $minutes ) { + $minutes = get_option( 'sportspress_event_minutes', 90 ); + } // Add full time minutes to end time $end->add( new DateInterval( 'PT' . $minutes . 'M' ) ); @@ -74,7 +78,7 @@ foreach ( $events as $event): // Get venue information $venues = get_the_terms( $event->ID, 'sp_venue' ); if ( $venues ) { - $venue = reset( $venues ); + $venue = reset( $venues ); $location .= $venue->name; // Get venue term meta @@ -84,11 +88,11 @@ foreach ( $events as $event): // Add details to location $address = sp_array_value( $meta, 'sp_address', false ); if ( false !== $address ) { - $location = $venue->name . '\, ' . preg_replace('/([\,;])/','\\\$1', $address); + $location = $venue->name . '\, ' . preg_replace( '/([\,;])/', '\\\$1', $address ); } // Generate geo tag - $latitude = sp_array_value( $meta, 'sp_latitude', false ); + $latitude = sp_array_value( $meta, 'sp_latitude', false ); $longitude = sp_array_value( $meta, 'sp_longitude', false ); if ( false !== $latitude && false !== $longitude ) { $geo = $latitude . ';' . $longitude; @@ -96,17 +100,19 @@ foreach ( $events as $event): $geo = false; } } - $location = wordwrap( $location , 60, "\r\n\t" ); + $location = wordwrap( $location, 60, "\r\n\t" ); // Get title or write summary based on scores $results = array(); - $teams = (array)get_post_meta( $event->ID, 'sp_team', false ); - $teams = array_filter( $teams ); - $teams = array_unique( $teams ); + $teams = (array) get_post_meta( $event->ID, 'sp_team', false ); + $teams = array_filter( $teams ); + $teams = array_unique( $teams ); if ( ! empty( $teams ) ) { $event_results = get_post_meta( $event->ID, 'sp_results', true ); - foreach( $teams as $team_id ) { - if ( ! $team_id ) continue; + foreach ( $teams as $team_id ) { + if ( ! $team_id ) { + continue; + } $team = get_post( $team_id ); if ( $team ) { @@ -134,51 +140,57 @@ foreach ( $events as $event): } else { $summary = $event->post_title; } - - //Convert [0-9]+ entities to UTF-8 - $summary = preg_replace_callback("/([0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $summary); - + + // Convert [0-9]+ entities to UTF-8 + $summary = preg_replace_callback( + '/([0-9]+;)/', + function( $m ) { + return mb_convert_encoding( $m[1], 'UTF-8', 'HTML-ENTITIES' ); + }, + $summary + ); + $summary = apply_filters( 'sportspress_ical_feed_summary', $summary, $event ); - + // Append to output string $output .= "BEGIN:VEVENT\r\n" . - "SUMMARY:" . preg_replace( '/([\,;])/','\\\$1', $summary ) . "\r\n" . + 'SUMMARY:' . preg_replace( '/([\,;])/', '\\\$1', $summary ) . "\r\n" . "UID:$event->ID\r\n" . "STATUS:CONFIRMED\r\n" . - "DTSTAMP:19700101T000000\r\n". - "DTSTART:" . mysql2date( $date_format, $event->post_date ) . "\r\n" . - "DTEND:" . $end->format( $date_format ) . "\r\n" . - "LAST-MODIFIED:" . mysql2date( $date_format, $event->post_modified_gmt ) . "\r\n"; + "DTSTAMP:19700101T000000\r\n" . + 'DTSTART:' . mysql2date( $date_format, $event->post_date ) . "\r\n" . + 'DTEND:' . $end->format( $date_format ) . "\r\n" . + 'LAST-MODIFIED:' . mysql2date( $date_format, $event->post_modified_gmt ) . "\r\n"; if ( $description ) { - $output .= "DESCRIPTION:" . $description . "\r\n"; + $output .= 'DESCRIPTION:' . $description . "\r\n"; } if ( $location ) { - $output .= "LOCATION:" . $location . "\r\n"; + $output .= 'LOCATION:' . $location . "\r\n"; } if ( $geo ) { - $output .= "GEO:" . $geo . "\r\n"; + $output .= 'GEO:' . $geo . "\r\n"; } $output .= "END:VEVENT\r\n"; endforeach; // End output -$output .= "END:VCALENDAR"; +$output .= 'END:VCALENDAR'; // Print headers -header('Content-type: text/calendar; charset=utf-8'); +header( 'Content-type: text/calendar; charset=utf-8' ); // The E-Tag is not being changed when the output file is generated – Some Webdav clients do not like this and // do not then 'see' that the file has changed – updates to the calendars are then not displayed to the user. // Props @garygomm https://wordpress.org/support/topic/calendar-feed-issue-not-updating-after-change/ -$etag = md5($output); -header('Etag:' . '"'.$etag.'"'); +$etag = md5( $output ); +header( 'Etag:' . '"' . $etag . '"' ); -header('Content-Disposition: inline; filename=' . $post->post_name . '.ics'); +header( 'Content-Disposition: inline; filename=' . $post->post_name . '.ics' ); // Print content echo wp_kses_post( $output ); diff --git a/includes/abstracts/abstract-sp-custom-post.php b/includes/abstracts/abstract-sp-custom-post.php index 2abe5dc9..9f4d632e 100644 --- a/includes/abstracts/abstract-sp-custom-post.php +++ b/includes/abstracts/abstract-sp-custom-post.php @@ -4,11 +4,11 @@ * * The SportsPress custom post class handles individual post data. * - * @class SP_Custom_Post - * @version 2.6.5 - * @package SportsPress/Abstracts - * @category Abstract Class - * @author ThemeBoy + * @class SP_Custom_Post + * @version 2.6.5 + * @package SportsPress/Abstracts + * @category Abstract Class + * @author ThemeBoy */ abstract class SP_Custom_Post { @@ -25,11 +25,11 @@ abstract class SP_Custom_Post { * @param mixed $post */ public function __construct( $post ) { - if ( $post instanceof WP_Post || $post instanceof SP_Custom_Post ): + if ( $post instanceof WP_Post || $post instanceof SP_Custom_Post ) : $this->ID = absint( $post->ID ); $this->post = $post; - else: - $this->ID = absint( $post ); + else : + $this->ID = absint( $post ); $this->post = get_post( $this->ID ); endif; } @@ -53,9 +53,9 @@ abstract class SP_Custom_Post { * @return bool */ public function __get( $key ) { - if ( ! isset( $key ) ): + if ( ! isset( $key ) ) : return $this->post; - else: + else : $value = get_post_meta( $this->ID, 'sp_' . $key, true ); endif; @@ -77,7 +77,7 @@ abstract class SP_Custom_Post { * * @access public * @param string $taxonomy The taxonomy. - * @return array|false|WP_Error See `get_the_terms()` + * @return array|false|WP_Error See `get_the_terms()` */ public function get_terms_sorted_by_sp_order( $taxonomy ) { $terms = get_the_terms( $this->ID, $taxonomy ); diff --git a/includes/abstracts/abstract-sp-secondary-post.php b/includes/abstracts/abstract-sp-secondary-post.php index 6294a351..ecfb9bc7 100644 --- a/includes/abstracts/abstract-sp-secondary-post.php +++ b/includes/abstracts/abstract-sp-secondary-post.php @@ -4,70 +4,70 @@ * * The SportsPress secondary post class extends custom posts with handling of secondary post types. * - * @class SP_Secondary_Post + * @class SP_Secondary_Post * @version 2.5.3 - * @package SportsPress/Abstracts - * @category Abstract Class - * @author ThemeBoy + * @package SportsPress/Abstracts + * @category Abstract Class + * @author ThemeBoy */ abstract class SP_Secondary_Post extends SP_Custom_Post { - /** @var string The date filter for events. */ - public $date = 0; + /** @var string The date filter for events. */ + public $date = 0; - /** @var string The date to range from. */ - public $from = 'now'; + /** @var string The date to range from. */ + public $from = 'now'; - /** @var string The date to range to. */ - public $to = 'now'; + /** @var string The date to range to. */ + public $to = 'now'; - /** @var string The number of days to query in the past. */ - public $past = 0; + /** @var string The number of days to query in the past. */ + public $past = 0; - /** @var string The number of days to query in the future. */ - public $future = 0; + /** @var string The number of days to query in the future. */ + public $future = 0; - /** @var boolean Determines whether the date range is relative. */ - public $relative = false; + /** @var boolean Determines whether the date range is relative. */ + public $relative = false; - /** - * __construct function. - * - * @access public - * @param mixed $post - */ - public function __construct( $post ) { - if ( $post instanceof WP_Post || $post instanceof SP_Secondary_Post ): - $this->ID = absint( $post->ID ); - $this->post = $post; - else: - $this->ID = absint( $post ); - $this->post = get_post( $this->ID ); - endif; - } + /** + * __construct function. + * + * @access public + * @param mixed $post + */ + public function __construct( $post ) { + if ( $post instanceof WP_Post || $post instanceof SP_Secondary_Post ) : + $this->ID = absint( $post->ID ); + $this->post = $post; + else : + $this->ID = absint( $post ); + $this->post = get_post( $this->ID ); + endif; + } - public function range( $where = '', $format = 'Y-m-d' ) { - $from = new DateTime( $this->from ); - $to = new DateTime( $this->to ); + public function range( $where = '', $format = 'Y-m-d' ) { + $from = new DateTime( $this->from ); + $to = new DateTime( $this->to ); - $to->modify( '+1 day' ); + $to->modify( '+1 day' ); - $where .= " AND post_date BETWEEN '" . $from->format( $format ) . "' AND '" . $to->format( $format ) . "'"; + $where .= " AND post_date BETWEEN '" . $from->format( $format ) . "' AND '" . $to->format( $format ) . "'"; - return $where; - } + return $where; + } - public function relative( $where = '', $format = 'Y-m-d' ) { - $from = new DateTime( 'now' ); - $to = new DateTime( 'now' ); + public function relative( $where = '', $format = 'Y-m-d' ) { + $from = new DateTime( 'now' ); + $to = new DateTime( 'now' ); - $from->modify( '-' . abs( (int) $this->past ) . ' day' ); - $to->modify( '+' . abs( (int) $this->future ) . ' day' ); + $from->modify( '-' . abs( (int) $this->past ) . ' day' ); + $to->modify( '+' . abs( (int) $this->future ) . ' day' ); - $to->modify( '+1 day' ); + $to->modify( '+1 day' ); - $where .= " AND post_date BETWEEN '" . $from->format( $format ) . "' AND '" . $to->format( $format ) . "'"; + $where .= " AND post_date BETWEEN '" . $from->format( $format ) . "' AND '" . $to->format( $format ) . "'"; - return $where; - } + return $where; + } } diff --git a/includes/admin/class-sp-admin-ajax.php b/includes/admin/class-sp-admin-ajax.php index e0118665..bfbc9fa4 100644 --- a/includes/admin/class-sp-admin-ajax.php +++ b/includes/admin/class-sp-admin-ajax.php @@ -6,10 +6,10 @@ if ( ! defined( 'ABSPATH' ) ) { /** * SportsPress Admin. * - * @class SP_Admin_AJAX - * @author ThemeBoy - * @category Admin - * @package SportsPress/Admin + * @class SP_Admin_AJAX + * @author ThemeBoy + * @category Admin + * @package SportsPress/Admin * @version 1.7 */ class SP_Admin_AJAX { @@ -59,10 +59,10 @@ class SP_Admin_AJAX { function save_inline_results() { check_ajax_referer( 'sp-save-inline-results', 'nonce' ); - $id = sp_array_value( $_POST, 'post_id' ); + $id = sp_array_value( $_POST, 'post_id' ); $results = sp_array_value( $_POST, 'results' ); - if ( sp_update_main_results ( $id, $results ) ) { + if ( sp_update_main_results( $id, $results ) ) { wp_send_json_success(); } else { wp_send_json_error(); diff --git a/includes/admin/class-sp-admin-assets.php b/includes/admin/class-sp-admin-assets.php index ed45b204..d2798874 100755 --- a/includes/admin/class-sp-admin-assets.php +++ b/includes/admin/class-sp-admin-assets.php @@ -2,144 +2,149 @@ /** * Load assets. * - * @author ThemeBoy - * @category Admin - * @package SportsPress/Admin + * @author ThemeBoy + * @category Admin + * @package SportsPress/Admin * @version 2.6.15 */ -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly +} if ( ! class_exists( 'SP_Admin_Assets' ) ) : -/** - * SP_Admin_Assets Class - */ -class SP_Admin_Assets { - /** - * Hook in tabs. + * SP_Admin_Assets Class */ - public function __construct() { - add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ) ); - add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) ); - } + class SP_Admin_Assets { - /** - * Enqueue styles - */ - public function admin_styles( $hook ) { - // Sitewide menu CSS - wp_enqueue_style( 'sportspress-admin-menu-styles', SP()->plugin_url() . '/assets/css/menu.css', array(), SP_VERSION ); - - $screen = get_current_screen(); - - if ( in_array( $screen->id, sp_get_screen_ids() ) ) { - // Admin styles for SP pages only - wp_enqueue_style( 'jquery-chosen', SP()->plugin_url() . '/assets/css/chosen.css', array(), '1.1.0' ); - wp_enqueue_style( 'wp-color-picker' ); - wp_enqueue_style( 'sportspress-admin', SP()->plugin_url() . '/assets/css/admin.css', array(), SP_VERSION ); - } elseif ( strpos( $screen->id, 'sportspress-config' ) !== false ) { - wp_enqueue_style( 'sportspress-admin', SP()->plugin_url() . '/assets/css/admin.css', array(), SP_VERSION ); + /** + * Hook in tabs. + */ + public function __construct() { + add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) ); } - if ( strpos( $screen->id, 'sportspress-overview' ) !== false ) { - wp_enqueue_style( 'sportspress-admin-slickmap', SP()->plugin_url() . '/assets/css/slickmap.css', array(), '1.1.0' ); + /** + * Enqueue styles + */ + public function admin_styles( $hook ) { + // Sitewide menu CSS + wp_enqueue_style( 'sportspress-admin-menu-styles', SP()->plugin_url() . '/assets/css/menu.css', array(), SP_VERSION ); + + $screen = get_current_screen(); + + if ( in_array( $screen->id, sp_get_screen_ids() ) ) { + // Admin styles for SP pages only + wp_enqueue_style( 'jquery-chosen', SP()->plugin_url() . '/assets/css/chosen.css', array(), '1.1.0' ); + wp_enqueue_style( 'wp-color-picker' ); + wp_enqueue_style( 'sportspress-admin', SP()->plugin_url() . '/assets/css/admin.css', array(), SP_VERSION ); + } elseif ( strpos( $screen->id, 'sportspress-config' ) !== false ) { + wp_enqueue_style( 'sportspress-admin', SP()->plugin_url() . '/assets/css/admin.css', array(), SP_VERSION ); + } + + if ( strpos( $screen->id, 'sportspress-overview' ) !== false ) { + wp_enqueue_style( 'sportspress-admin-slickmap', SP()->plugin_url() . '/assets/css/slickmap.css', array(), '1.1.0' ); + } + + if ( in_array( $screen->id, array( 'dashboard' ) ) ) { + wp_enqueue_style( 'sportspress-admin-dashboard-styles', SP()->plugin_url() . '/assets/css/dashboard.css', array(), SP_VERSION ); + } + + if ( in_array( $screen->id, array( 'customize' ) ) ) { + wp_enqueue_style( 'sportspress-admin-customize-styles', SP()->plugin_url() . '/assets/css/customize.css', array(), SP_VERSION ); + } + + if ( in_array( $screen->id, array( 'sp_result', 'sp_performance', 'sp_column', 'sp_statistic' ) ) ) { + wp_enqueue_style( 'sportspress-admin-equation-styles', SP()->plugin_url() . '/assets/css/equation.css', array(), SP_VERSION ); + } + + if ( in_array( $screen->id, apply_filters( 'sportspress_admin_datepicker_screen_ids', array( 'sp_calendar', 'sp_table', 'sp_list', 'widgets' ) ) ) || in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) { + wp_enqueue_style( 'jquery-ui-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' ); + wp_enqueue_style( 'sportspress-admin-datepicker-styles', SP()->plugin_url() . '/assets/css/datepicker.css', array( 'jquery-ui-style' ), SP_VERSION ); + } + + do_action( 'sportspress_admin_css', $screen ); } - if ( in_array( $screen->id, array( 'dashboard' ) ) ) { - wp_enqueue_style( 'sportspress-admin-dashboard-styles', SP()->plugin_url() . '/assets/css/dashboard.css', array(), SP_VERSION ); - } + /** + * Enqueue scripts + */ + public function admin_scripts( $hook ) { + global $wp_query, $post; - if ( in_array( $screen->id, array( 'customize' ) ) ) { - wp_enqueue_style( 'sportspress-admin-customize-styles', SP()->plugin_url() . '/assets/css/customize.css', array(), SP_VERSION ); - } + $screen = get_current_screen(); - if ( in_array( $screen->id, array( 'sp_result', 'sp_performance', 'sp_column', 'sp_statistic' ) ) ) { - wp_enqueue_style( 'sportspress-admin-equation-styles', SP()->plugin_url() . '/assets/css/equation.css', array(), SP_VERSION ); - } + // Register scripts + wp_register_script( 'chosen', SP()->plugin_url() . '/assets/js/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true ); - if ( in_array( $screen->id, apply_filters( 'sportspress_admin_datepicker_screen_ids', array( 'sp_calendar', 'sp_table', 'sp_list', 'widgets' ) ) ) || in_array( $hook, array('post.php', 'post-new.php') ) ) { - wp_enqueue_style( 'jquery-ui-style' , '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' ); - wp_enqueue_style( 'sportspress-admin-datepicker-styles', SP()->plugin_url() . '/assets/css/datepicker.css', array( 'jquery-ui-style' ), SP_VERSION ); - } + wp_register_script( 'jquery-tiptip', SP()->plugin_url() . '/assets/js/jquery.tipTip.min.js', array( 'jquery' ), '1.3', true ); - do_action( 'sportspress_admin_css', $screen ); - } + wp_register_script( 'jquery-caret', SP()->plugin_url() . '/assets/js/jquery.caret.min.js', array( 'jquery' ), '1.02', true ); - /** - * Enqueue scripts - */ - public function admin_scripts($hook) { - global $wp_query, $post; + wp_register_script( 'jquery-fitvids', SP()->plugin_url() . '/assets/js/jquery.fitvids.js', array( 'jquery' ), '1.1', true ); - $screen = get_current_screen(); + wp_register_script( 'sportspress-admin-equationbuilder', SP()->plugin_url() . '/assets/js/admin/equationbuilder.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable' ), SP_VERSION, true ); - // Register scripts - wp_register_script( 'chosen', SP()->plugin_url() . '/assets/js/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true ); + wp_register_script( 'sportspress-admin-colorpicker', SP()->plugin_url() . '/assets/js/admin/colorpicker.js', array( 'jquery', 'wp-color-picker', 'iris' ), SP_VERSION, true ); - wp_register_script( 'jquery-tiptip', SP()->plugin_url() . '/assets/js/jquery.tipTip.min.js', array( 'jquery' ), '1.3', true ); + wp_register_script( 'sportspress-admin-widgets', SP()->plugin_url() . '/assets/js/admin/widgets.js', array( 'jquery' ), SP_VERSION, true ); - wp_register_script( 'jquery-caret', SP()->plugin_url() . '/assets/js/jquery.caret.min.js', array( 'jquery' ), '1.02', true ); + wp_register_script( 'sportspress-admin-quickeditor', SP()->plugin_url() . '/assets/js/admin/quickeditor.js', array( 'jquery' ), SP_VERSION, true ); - wp_register_script( 'jquery-fitvids', SP()->plugin_url() . '/assets/js/jquery.fitvids.js', array( 'jquery' ), '1.1', true ); + // SportsPress admin pages + if ( in_array( $screen->id, sp_get_screen_ids() ) || strpos( $screen->id, 'sportspress-config' ) || in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) { - wp_register_script( 'sportspress-admin-equationbuilder', SP()->plugin_url() . '/assets/js/admin/equationbuilder.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable' ), SP_VERSION, true ); + wp_enqueue_script( 'jquery' ); + wp_enqueue_script( 'chosen' ); + wp_enqueue_script( 'jquery-ui-core' ); + wp_enqueue_script( 'jquery-ui-draggable' ); + wp_enqueue_script( 'jquery-ui-droppable' ); + wp_enqueue_script( 'jquery-ui-sortable' ); + wp_enqueue_script( 'jquery-tiptip' ); + wp_enqueue_script( 'jquery-caret' ); + wp_enqueue_script( 'jquery-fitvids' ); + wp_enqueue_script( 'sportspress-admin', SP()->plugin_url() . '/assets/js/admin/sportspress-admin.js', array( 'jquery', 'chosen', 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-tiptip', 'jquery-caret', 'jquery-fitvids' ), SP_VERSION, true ); - wp_register_script( 'sportspress-admin-colorpicker', SP()->plugin_url() . '/assets/js/admin/colorpicker.js', array( 'jquery', 'wp-color-picker', 'iris' ), SP_VERSION, true ); + $strings = apply_filters( + 'sportspress_localized_strings', + array( + 'none' => __( 'None', 'sportspress' ), + 'remove_text' => __( '— Remove —', 'sportspress' ), + 'days' => __( 'days', 'sportspress' ), + 'hrs' => __( 'hrs', 'sportspress' ), + 'mins' => __( 'mins', 'sportspress' ), + 'secs' => __( 'secs', 'sportspress' ), + 'displaying_posts' => html_entity_decode( __( 'Displaying %1$s–%2$s of %3$s', 'sportspress' ) ), + ) + ); - wp_register_script( 'sportspress-admin-widgets', SP()->plugin_url() . '/assets/js/admin/widgets.js', array( 'jquery' ), SP_VERSION, true ); + // Localize scripts + wp_localize_script( 'sportspress-admin', 'localized_strings', $strings ); + } - wp_register_script( 'sportspress-admin-quickeditor', SP()->plugin_url() . '/assets/js/admin/quickeditor.js', array( 'jquery' ), SP_VERSION, true ); + if ( in_array( $screen->id, array( 'widgets' ) ) ) { + wp_enqueue_script( 'sportspress-admin-widgets' ); + } - // SportsPress admin pages - if ( in_array( $screen->id, sp_get_screen_ids() ) || strpos( $screen->id, 'sportspress-config' ) || in_array($hook, array('post.php', 'post-new.php') ) ) { + // Edit color + if ( in_array( $screen->id, array( 'sp_outcome' ) ) ) { + wp_enqueue_script( 'sportspress-admin-colorpicker' ); + } - wp_enqueue_script( 'jquery' ); - wp_enqueue_script( 'chosen' ); - wp_enqueue_script( 'jquery-ui-core' ); - wp_enqueue_script( 'jquery-ui-draggable' ); - wp_enqueue_script( 'jquery-ui-droppable' ); - wp_enqueue_script( 'jquery-ui-sortable' ); - wp_enqueue_script( 'jquery-tiptip' ); - wp_enqueue_script( 'jquery-caret' ); - wp_enqueue_script( 'jquery-fitvids' ); - wp_enqueue_script( 'sportspress-admin', SP()->plugin_url() . '/assets/js/admin/sportspress-admin.js', array( 'jquery', 'chosen', 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-tiptip', 'jquery-caret', 'jquery-fitvids' ), SP_VERSION, true ); - - $strings = apply_filters( 'sportspress_localized_strings', array( - 'none' => __( 'None', 'sportspress' ), - 'remove_text' => __( '— Remove —', 'sportspress' ), - 'days' => __( 'days', 'sportspress' ), - 'hrs' => __( 'hrs', 'sportspress' ), - 'mins' => __( 'mins', 'sportspress' ), - 'secs' => __( 'secs', 'sportspress' ), - 'displaying_posts' => html_entity_decode( __( 'Displaying %s–%s of %s', 'sportspress' ) ), - ) ); + // Edit equation + if ( in_array( $screen->id, array( 'sp_result', 'sp_performance', 'sp_column', 'sp_statistic' ) ) ) { + wp_enqueue_script( 'sportspress-admin-equationbuilder' ); + } - // Localize scripts - wp_localize_script( 'sportspress-admin', 'localized_strings', $strings ); - } - - if ( in_array( $screen->id, array( 'widgets' ) ) ) { - wp_enqueue_script( 'sportspress-admin-widgets' ); - } - - // Edit color - if ( in_array( $screen->id, array( 'sp_outcome' ) ) ) { - wp_enqueue_script( 'sportspress-admin-colorpicker' ); - } - - // Edit equation - if ( in_array( $screen->id, array( 'sp_result', 'sp_performance', 'sp_column', 'sp_statistic' ) ) ) { - wp_enqueue_script( 'sportspress-admin-equationbuilder' ); - } - - // Quick edit - if ( in_array( $screen->id, array( 'edit-sp_player' ) ) ) { - wp_enqueue_script( 'sportspress-admin-quickeditor' ); + // Quick edit + if ( in_array( $screen->id, array( 'edit-sp_player' ) ) ) { + wp_enqueue_script( 'sportspress-admin-quickeditor' ); + } } } -} endif; diff --git a/includes/admin/class-sp-admin-dashboard.php b/includes/admin/class-sp-admin-dashboard.php index 570ec260..1724df08 100644 --- a/includes/admin/class-sp-admin-dashboard.php +++ b/includes/admin/class-sp-admin-dashboard.php @@ -2,126 +2,130 @@ /** * Admin Dashboard * - * @author ThemeBoy - * @category Admin - * @package SportsPress/Admin + * @author ThemeBoy + * @category Admin + * @package SportsPress/Admin * @version 2.7.9 */ -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly +} if ( ! class_exists( 'SP_Admin_Dashboard' ) ) : -/** - * SP_Admin_Dashboard Class - */ -class SP_Admin_Dashboard { + /** + * SP_Admin_Dashboard Class + */ + class SP_Admin_Dashboard { - /** - * Hook in tabs. - */ - public function __construct() { - // Only hook in admin parts if the user has admin access - if ( current_user_can( 'view_sportspress_reports' ) || current_user_can( 'manage_sportspress' ) || current_user_can( 'publish_sp_events' ) ) { - add_action( 'wp_dashboard_setup', array( $this, 'init' ) ); - } - } + /** + * Hook in tabs. + */ + public function __construct() { + // Only hook in admin parts if the user has admin access + if ( current_user_can( 'view_sportspress_reports' ) || current_user_can( 'manage_sportspress' ) || current_user_can( 'publish_sp_events' ) ) { + add_action( 'wp_dashboard_setup', array( $this, 'init' ) ); + } + } - /** - * Init dashboard widgets - */ - public function init() { - //wp_add_dashboard_widget( 'sportspress_dashboard_news', __( 'Sports News', 'sportspress' ), array( $this, 'news_widget' ), null, null, 'side' ); - wp_add_dashboard_widget( 'sportspress_dashboard_status', __( 'SportsPress', 'sportspress' ), array( $this, 'status_widget' ) ); - add_filter( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 ); - } + /** + * Init dashboard widgets + */ + public function init() { + // wp_add_dashboard_widget( 'sportspress_dashboard_news', __( 'Sports News', 'sportspress' ), array( $this, 'news_widget' ), null, null, 'side' ); + wp_add_dashboard_widget( 'sportspress_dashboard_status', __( 'SportsPress', 'sportspress' ), array( $this, 'status_widget' ) ); + add_filter( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 ); + } - /** - * Add links to At a Glance - */ - function glance_items( $items = array() ) { - $post_types = apply_filters( 'sportspress_glance_items', array( 'sp_event', 'sp_team', 'sp_player', 'sp_staff' ) ); - foreach ( $post_types as $type ): - if ( ! post_type_exists( $type ) ) continue; - $num_posts = wp_count_posts( $type ); - if ( $num_posts ): - $published = intval( $num_posts->publish ); - $post_type = get_post_type_object( $type ); - $text = _n( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $published, 'sportspress' ); - $text = sprintf( $text, number_format_i18n( $published ) ); - if ( current_user_can( $post_type->cap->edit_posts ) ): - $output = '' . $text . ''; - else: - $output = '' . $text . ''; - endif; - echo '' . esc_html( $error ) . '
' . esc_html( $override ) . '
' . esc_html( $message ) . '
' . esc_html( $error ) . '
' . esc_html( $override ) . '
' . esc_html( $message ) . '
' . wp_kses_post( $description ) . '
'; - } elseif ( $description && in_array( $value['type'], array( 'checkbox' ) ) ) { - $description = wp_kses_post( $description ); - } elseif ( $description && in_array( $value['type'], array( 'select' ) ) ) { - $description = '' . wp_kses_post( $description ) . '
'; - } elseif ( $description ) { - $description = '' . wp_kses_post( $description ) . ''; + if ( is_array( $option_value ) ) { + $option_value = array_map( 'stripslashes', $option_value ); + } elseif ( ! is_null( $option_value ) ) { + $option_value = stripslashes( $option_value ); } - if ( $tip && in_array( $value['type'], array( 'checkbox' ) ) ) { + return $option_value === null ? $default : $option_value; + } - $tip = '' . $tip . '
'; + /** + * Output admin fields. + * + * Loops though the sportspress options array and outputs each field. + * + * @access public + * @param array $options Opens array to output + */ + public static function output_fields( $options ) { + foreach ( $options as $value ) { + if ( ! isset( $value['type'] ) ) { + continue; + } + if ( ! isset( $value['id'] ) ) { + $value['id'] = ''; + } + if ( ! isset( $value['title'] ) ) { + $value['title'] = isset( $value['name'] ) ? $value['name'] : ''; + } + if ( ! isset( $value['class'] ) ) { + $value['class'] = ''; + } + if ( ! isset( $value['css'] ) ) { + $value['css'] = ''; + } + if ( ! isset( $value['default'] ) ) { + $value['default'] = ''; + } + if ( ! isset( $value['desc'] ) ) { + $value['desc'] = ''; + } + if ( ! isset( $value['desc_tip'] ) ) { + $value['desc_tip'] = false; + } + if ( ! isset( $value['placeholder'] ) ) { + $value['placeholder'] = ''; + } - } elseif ( $tip ) { + // Custom attribute handling + $custom_attributes = array(); - $tip = ''; + if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) { + foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) { + $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; + } + } - } + // Description handling + if ( $value['desc_tip'] === true ) { + $description = ''; + $tip = $value['desc']; + } elseif ( ! empty( $value['desc_tip'] ) ) { + $description = $value['desc']; + $tip = $value['desc_tip']; + } elseif ( ! empty( $value['desc'] ) ) { + $description = $value['desc']; + $tip = ''; + } else { + $description = $tip = ''; + } - // Switch based on type - switch( $value['type'] ) { + if ( $description && in_array( $value['type'], array( 'textarea', 'radio' ) ) ) { + $description = '' . wp_kses_post( $description ) . '
'; + } elseif ( $description && in_array( $value['type'], array( 'checkbox' ) ) ) { + $description = wp_kses_post( $description ); + } elseif ( $description && in_array( $value['type'], array( 'select' ) ) ) { + $description = '' . wp_kses_post( $description ) . '
'; + } elseif ( $description ) { + $description = '' . wp_kses_post( $description ) . ''; + } - // Section Titles - case 'title': - echo '' . $tip . '
'; - // Standard text inputs and subtypes like 'number' - case 'text': - case 'email': - case 'number': - case 'color' : - case 'password' : + } elseif ( $tip ) { - $type = $value['type']; - $class = ''; - $option_value = self::get_option( $value['id'], $value['default'] ); + $tip = ''; - if ( $value['type'] == 'color' ) { - $type = 'text'; - $value['class'] .= 'colorpick'; - $description .= ''; - } + } - ?>-
It’s completely optional and shouldn’t take longer than five minutes.', 'sportspress' ); ?>
- - - - - - get_next_step_link() ) ); - exit; - } - - /** - * Team Setup. - */ - public function sp_setup_teams() { - $class = 'chosen-select' . ( is_rtl() ? ' chosen-rtl' : '' ); - ?> - - - 0, 'fields' => 'ids' ) ); - }; - wp_insert_post( $post ); - - // Add home team - $post['post_title'] = sanitize_text_field( $_POST['home_team'] ); - wp_insert_post( $post ); - - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); - exit; - } - - /** - * Players & Staff Setup. - */ - public function sp_setup_players_staff() { - $positions = (array) get_terms( 'sp_position', array( 'hide_empty' => 0, 'orderby' => 'slug', 'fields' => 'names' ) ) - ?> - - - 1, 'post_type' => 'sp_team', 'fields' => 'ids' ) ); - $team = reset( $teams ); - - // Add players - $post['post_type'] = 'sp_player'; - $post['post_status'] = 'publish'; - $post['tax_input'] = array(); - $taxonomies = array( 'sp_league', 'sp_season' ); - foreach ( $taxonomies as $taxonomy ) { - $post['tax_input'][ $taxonomy ] = get_terms( $taxonomy, array( 'hide_empty' => 0, 'fields' => 'ids' ) ); - }; - if ( is_array( $_POST['players'] ) ) { - foreach ( $_POST['players'] as $i => $player ) { - if ( empty( $player['name'] ) ) continue; - - $post['post_title'] = $player['name']; - $id = wp_insert_post( $post ); - - // Add squad number - $number = sanitize_text_field( sp_array_value( $player, 'number' ) ); - update_post_meta( $id, 'sp_number', $number ); - - // Add position - wp_set_object_terms( $id, sp_array_value( $player, 'position', __( 'Position', 'sportspress' ) ), 'sp_position', false ); - - // Add team - if ( $team ) { - update_post_meta( $id, 'sp_team', $team ); - update_post_meta( $id, 'sp_current_team', $team ); - } - } - } - - // Add staff - if ( ! empty( $_POST['staff'] ) ) { - - $post['post_type'] = 'sp_staff'; - $post['post_title'] = sanitize_text_field( $_POST['staff'] ); - $id = wp_insert_post( $post ); - - // Add role - wp_set_object_terms( $id, sp_array_value( $_POST, 'role', 'Coach' ), 'sp_role', false ); - - // Add team - if ( $team ) { - update_post_meta( $id, 'sp_team', $team ); - update_post_meta( $id, 'sp_current_team', $team ); - } - } - - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); - exit; - } - - /** - * Venue Step. - */ - public function sp_setup_venue() { - do_action( 'sp_setup_venue_geocoder_scripts' ); - ?> - - - 1, 'post_type' => 'sp_team', 'fields' => 'ids' ) ); - $team = reset( $teams ); - - // Insert venue - $venue = sanitize_text_field( $_POST['venue'] ); - if ( ! is_string( $venue ) || empty( $venue ) ) { - $venue = sp_array_value( $_POST, 'address', __( 'Venue', 'sportspress' ) ); - } - $inserted = wp_insert_term( $venue, 'sp_venue' ); - - // Add address and coordinates to venue - if ( ! is_wp_error( $inserted ) ) { - $t_id = sp_array_value( $inserted, 'term_id', 1 ); - - if ( $team ) { - wp_set_object_terms( $team, $t_id, 'sp_venue', true ); - } - - $meta = array( - 'sp_address' => sanitize_text_field( sp_array_value( $_POST, 'address' ) ), - 'sp_latitude' => sanitize_text_field( sp_array_value( $_POST, 'latitude' ) ), - 'sp_longitude' => sanitize_text_field( sp_array_value( $_POST, 'longitude' ) ), - ); - update_option( "taxonomy_$t_id", $meta ); - } - - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); - exit; - } - - /** - * Pages Step. - */ - public function sp_setup_pages() { - $pages = apply_filters( 'sportspress_setup_pages', array( - 'sp_calendar' => __( 'Organize and publish calendars using different layouts.', 'sportspress' ), - 'sp_table' => __( 'Create automated league tables to keep track of team standings.', 'sportspress' ), - 'sp_list' => __( 'Create team rosters, player galleries, and ranking charts.', 'sportspress' ), - ) ); - ?> - - - __( 'Organize and publish calendars using different layouts.', 'sportspress' ), - 'sp_table' => __( 'Create automated league tables to keep track of team standings.', 'sportspress' ), - 'sp_list' => __( 'Create team rosters, player galleries, and ranking charts.', 'sportspress' ), - ) ); - - // Initialize post - $post = array( 'post_status' => 'publish' ); - $sample_content = _x( 'This is an example %1$s. As a new SportsPress user, you should go to your dashboard to delete this %1$s and create new %2$s for your content. Have fun!', 'example', 'sportspress' ); - - // Insert posts - foreach ( $pages as $post_type => $description ) { - $obj = get_post_type_object( $post_type ); - if ( ! is_object( $obj ) ) continue; - - // Skip if post exists - $posts = get_posts( array( 'posts_per_page' => 1, 'post_type' => $post_type ) ); - if ( $posts ) continue; - - // Add post args - $post['post_title'] = $obj->labels->singular_name; - $post['post_type'] = $post_type; - $post['post_content'] = sprintf( $sample_content, $obj->labels->singular_name, $obj->labels->name, add_query_arg( 'post_type', $post_type, admin_url( 'edit.php' ) ) ); - - // Insert post - $id = wp_insert_post( $post ); - - // Flag as sample - update_post_meta( $id, '_sp_sample', 1 ); - } - - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); - exit; - } - - /** - * Actions on the final step. - */ - private function sp_setup_ready_actions() { - delete_option( '_sp_needs_welcome' ); - update_option( 'sportspress_installed', 1 ); - update_option( 'sportspress_completed_setup', 1 ); - delete_transient( '_sp_activation_redirect' ); - - // Check if first event already exists - $events = get_posts( - array( - 'post_type' => 'sp_event', - 'posts_per_page' => 1, - 'post_status' => 'draft', - 'meta_query' => array( - array( - 'key' => '_sp_first', - 'value' => 1 - ) - ) - ) - ); - - if ( $events ) { - $event = reset( $events ); - return $event->ID; - } - - // Get teams - $team_post_type = 'sp_team'; - if ( 'player' === get_option( 'sportspress_mode', 'team' ) ) { - $team_post_type = 'sp_player'; - } - $teams = get_posts( array( 'posts_per_page' => 2, 'post_type' => $team_post_type ) ); - - // Get players - $players = (array) get_posts( array( 'posts_per_page' => 3, 'post_type' => 'sp_player', 'fields' => 'ids' ) ); - - // Get staff - $staff = (array) get_posts( array( 'posts_per_page' => 1, 'post_type' => 'sp_staff', 'fields' => 'ids' ) ); - - // Initialize post - $post['post_type'] = 'sp_event'; - $post['post_status'] = 'draft'; - $post['tax_input'] = array(); - - // Add taxonomies - $taxonomies = array( 'sp_league', 'sp_season', 'sp_venue' ); - foreach ( $taxonomies as $taxonomy ) { - $post['tax_input'][ $taxonomy ] = get_terms( $taxonomy, array( 'hide_empty' => 0, 'fields' => 'ids', 'number' => 1 ) ); - }; - - // Add post title - if ( is_array( $teams ) && sizeof( $teams ) ) { - $team_names = array(); - foreach ( $teams as $team ) { - if ( ! $team ) continue; - $team_names[] = $team->post_title; - } - $post['post_title'] = implode( ' ' . get_option( 'sportspress_event_teams_delimiter', 'vs' ) . ' ', $team_names ); - } else { - $post['post_title'] = __( 'Event', 'sportspress' ); - } - - // Insert event - $id = wp_insert_post( $post ); - - // Add teams - if ( is_array( $teams ) && sizeof( $teams ) ) { - foreach ( $teams as $team ) { - if ( ! $team ) continue; - add_post_meta( $id, 'sp_team', $team->ID ); - } - } - - // Add players - add_post_meta( $id, 'sp_player', 0 ); - foreach ( $players as $player ) { - if ( ! $player ) continue; - add_post_meta( $id, 'sp_player', $player ); - } - add_post_meta( $id, 'sp_player', 0 ); - - update_post_meta( $id, '_sp_first', 1 ); - - return $id; - } - - /** - * Final step. - */ - public function sp_setup_ready() { - $id = $this->sp_setup_ready_actions(); - shuffle( $this->tweets ); - - $steps = apply_filters( 'sportspress_setup_wizard_next_steps', array( - 'first' => array( - 'label' => __( 'Next Steps', 'sportspress' ), - 'content' => '' . __( 'Schedule your first event!', 'sportspress' ) . '', - ), - 'last' => array( - 'label' => __( 'Upgrade to Pro', 'sportspress' ), - 'content' => __( 'Get SportsPress Pro to get access to all modules. You can upgrade any time without losing any of your data.', 'sportspress' ) . ' ' . __( 'Learn more', 'sportspress' ) . '', - ), - ) ); - ?> - Tweet - - - - - - - - steps = array( + 'introduction' => array( + 'name' => __( 'Introduction', 'sportspress' ), + 'view' => array( $this, 'sp_setup_introduction' ), + 'handler' => '', + ), + 'basics' => array( + 'name' => __( 'Basic Setup', 'sportspress' ), + 'view' => array( $this, 'sp_setup_basics' ), + 'handler' => array( $this, 'sp_setup_basics_save' ), + ), + 'teams' => array( + 'name' => __( 'Teams', 'sportspress' ), + 'view' => array( $this, 'sp_setup_teams' ), + 'handler' => array( $this, 'sp_setup_teams_save' ), + ), + 'players_staff' => array( + 'name' => __( 'Players', 'sportspress' ) . ' & ' . __( 'Staff', 'sportspress' ), + 'view' => array( $this, 'sp_setup_players_staff' ), + 'handler' => array( $this, 'sp_setup_players_staff_save' ), + ), + 'venue' => array( + 'name' => __( 'Venue', 'sportspress' ), + 'view' => array( $this, 'sp_setup_venue' ), + 'handler' => array( $this, 'sp_setup_venue_save' ), + ), + 'pages' => array( + 'name' => __( 'Pages', 'sportspress' ), + 'view' => array( $this, 'sp_setup_pages' ), + 'handler' => array( $this, 'sp_setup_pages_save' ), + ), + 'next_steps' => array( + 'name' => __( 'Ready!', 'sportspress' ), + 'view' => array( $this, 'sp_setup_ready' ), + 'handler' => '', + ), + ); + $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) ); + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; + + wp_enqueue_style( 'jquery-chosen', SP()->plugin_url() . '/assets/css/chosen.css', array(), '1.1.0' ); + wp_enqueue_style( 'sportspress-admin', SP()->plugin_url() . '/assets/css/admin.css', array(), SP_VERSION ); + wp_enqueue_style( 'sportspress-setup', SP()->plugin_url() . '/assets/css/setup.css', array( 'dashicons', 'install' ), SP_VERSION ); + + wp_register_script( 'chosen', SP()->plugin_url() . '/assets/js/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true ); + wp_register_script( 'jquery-tiptip', SP()->plugin_url() . '/assets/js/jquery.tipTip.min.js', array( 'jquery' ), '1.3', true ); + wp_register_script( 'sportspress-setup', SP()->plugin_url() . '/assets/js/admin/sportspress-setup.js', array( 'jquery', 'chosen', 'jquery-tiptip' ), SP_VERSION, true ); + + do_action( 'sp_setup_geocoder_scripts' ); + + $strings = apply_filters( + 'sportspress_localized_strings', + array( + 'none' => __( 'None', 'sportspress' ), + 'remove_text' => __( '— Remove —', 'sportspress' ), + ) + ); + + // Localize scripts + wp_localize_script( 'sportspress-setup', 'localized_strings', $strings ); + + if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { + call_user_func( $this->steps[ $this->step ]['handler'] ); + } + + ob_start(); + $this->setup_wizard_header(); + $this->setup_wizard_steps(); + $this->setup_wizard_content(); + $this->setup_wizard_footer(); + exit; + } + + public function get_next_step_link() { + $keys = array_keys( $this->steps ); + return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ] ); + } + + /** + * Setup Wizard Header. + */ + public function setup_wizard_header() { + ?> + + > + + + +It’s completely optional and shouldn’t take longer than five minutes.', 'sportspress' ); ?>
+ + + + + + get_next_step_link() ) ); + exit; + } + + /** + * Team Setup. + */ + public function sp_setup_teams() { + $class = 'chosen-select' . ( is_rtl() ? ' chosen-rtl' : '' ); + ?> + + + 0, + 'fields' => 'ids', + ) + ); + } + wp_insert_post( $post ); + + // Add home team + $post['post_title'] = sanitize_text_field( $_POST['home_team'] ); + wp_insert_post( $post ); + + wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); + exit; + } + + /** + * Players & Staff Setup. + */ + public function sp_setup_players_staff() { + $positions = (array) get_terms( + 'sp_position', + array( + 'hide_empty' => 0, + 'orderby' => 'slug', + 'fields' => 'names', + ) + ) + ?> + + + 1, + 'post_type' => 'sp_team', + 'fields' => 'ids', + ) + ); + $team = reset( $teams ); + + // Add players + $post['post_type'] = 'sp_player'; + $post['post_status'] = 'publish'; + $post['tax_input'] = array(); + $taxonomies = array( 'sp_league', 'sp_season' ); + foreach ( $taxonomies as $taxonomy ) { + $post['tax_input'][ $taxonomy ] = get_terms( + $taxonomy, + array( + 'hide_empty' => 0, + 'fields' => 'ids', + ) + ); + } + if ( is_array( $_POST['players'] ) ) { + foreach ( $_POST['players'] as $i => $player ) { + if ( empty( $player['name'] ) ) { + continue; + } + + $post['post_title'] = $player['name']; + $id = wp_insert_post( $post ); + + // Add squad number + $number = sanitize_text_field( sp_array_value( $player, 'number' ) ); + update_post_meta( $id, 'sp_number', $number ); + + // Add position + wp_set_object_terms( $id, sp_array_value( $player, 'position', __( 'Position', 'sportspress' ) ), 'sp_position', false ); + + // Add team + if ( $team ) { + update_post_meta( $id, 'sp_team', $team ); + update_post_meta( $id, 'sp_current_team', $team ); + } + } + } + + // Add staff + if ( ! empty( $_POST['staff'] ) ) { + + $post['post_type'] = 'sp_staff'; + $post['post_title'] = sanitize_text_field( $_POST['staff'] ); + $id = wp_insert_post( $post ); + + // Add role + wp_set_object_terms( $id, sp_array_value( $_POST, 'role', 'Coach' ), 'sp_role', false ); + + // Add team + if ( $team ) { + update_post_meta( $id, 'sp_team', $team ); + update_post_meta( $id, 'sp_current_team', $team ); + } + } + + wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); + exit; + } + + /** + * Venue Step. + */ + public function sp_setup_venue() { + do_action( 'sp_setup_venue_geocoder_scripts' ); + ?> + + + 1, + 'post_type' => 'sp_team', + 'fields' => 'ids', + ) + ); + $team = reset( $teams ); + + // Insert venue + $venue = sanitize_text_field( $_POST['venue'] ); + if ( ! is_string( $venue ) || empty( $venue ) ) { + $venue = sp_array_value( $_POST, 'address', __( 'Venue', 'sportspress' ) ); + } + $inserted = wp_insert_term( $venue, 'sp_venue' ); + + // Add address and coordinates to venue + if ( ! is_wp_error( $inserted ) ) { + $t_id = sp_array_value( $inserted, 'term_id', 1 ); + + if ( $team ) { + wp_set_object_terms( $team, $t_id, 'sp_venue', true ); + } + + $meta = array( + 'sp_address' => sanitize_text_field( sp_array_value( $_POST, 'address' ) ), + 'sp_latitude' => sanitize_text_field( sp_array_value( $_POST, 'latitude' ) ), + 'sp_longitude' => sanitize_text_field( sp_array_value( $_POST, 'longitude' ) ), + ); + update_option( "taxonomy_$t_id", $meta ); + } + + wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); + exit; + } + + /** + * Pages Step. + */ + public function sp_setup_pages() { + $pages = apply_filters( + 'sportspress_setup_pages', + array( + 'sp_calendar' => __( 'Organize and publish calendars using different layouts.', 'sportspress' ), + 'sp_table' => __( 'Create automated league tables to keep track of team standings.', 'sportspress' ), + 'sp_list' => __( 'Create team rosters, player galleries, and ranking charts.', 'sportspress' ), + ) + ); + ?> + + + __( 'Organize and publish calendars using different layouts.', 'sportspress' ), + 'sp_table' => __( 'Create automated league tables to keep track of team standings.', 'sportspress' ), + 'sp_list' => __( 'Create team rosters, player galleries, and ranking charts.', 'sportspress' ), + ) + ); + + // Initialize post + $post = array( 'post_status' => 'publish' ); + $sample_content = _x( 'This is an example %1$s. As a new SportsPress user, you should go to your dashboard to delete this %1$s and create new %2$s for your content. Have fun!', 'example', 'sportspress' ); + + // Insert posts + foreach ( $pages as $post_type => $description ) { + $obj = get_post_type_object( $post_type ); + if ( ! is_object( $obj ) ) { + continue; + } + + // Skip if post exists + $posts = get_posts( + array( + 'posts_per_page' => 1, + 'post_type' => $post_type, + ) + ); + if ( $posts ) { + continue; + } + + // Add post args + $post['post_title'] = $obj->labels->singular_name; + $post['post_type'] = $post_type; + $post['post_content'] = sprintf( $sample_content, $obj->labels->singular_name, $obj->labels->name, add_query_arg( 'post_type', $post_type, admin_url( 'edit.php' ) ) ); + + // Insert post + $id = wp_insert_post( $post ); + + // Flag as sample + update_post_meta( $id, '_sp_sample', 1 ); + } + + wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); + exit; + } + + /** + * Actions on the final step. + */ + private function sp_setup_ready_actions() { + delete_option( '_sp_needs_welcome' ); + update_option( 'sportspress_installed', 1 ); + update_option( 'sportspress_completed_setup', 1 ); + delete_transient( '_sp_activation_redirect' ); + + // Check if first event already exists + $events = get_posts( + array( + 'post_type' => 'sp_event', + 'posts_per_page' => 1, + 'post_status' => 'draft', + 'meta_query' => array( + array( + 'key' => '_sp_first', + 'value' => 1, + ), + ), + ) + ); + + if ( $events ) { + $event = reset( $events ); + return $event->ID; + } + + // Get teams + $team_post_type = 'sp_team'; + if ( 'player' === get_option( 'sportspress_mode', 'team' ) ) { + $team_post_type = 'sp_player'; + } + $teams = get_posts( + array( + 'posts_per_page' => 2, + 'post_type' => $team_post_type, + ) + ); + + // Get players + $players = (array) get_posts( + array( + 'posts_per_page' => 3, + 'post_type' => 'sp_player', + 'fields' => 'ids', + ) + ); + + // Get staff + $staff = (array) get_posts( + array( + 'posts_per_page' => 1, + 'post_type' => 'sp_staff', + 'fields' => 'ids', + ) + ); + + // Initialize post + $post['post_type'] = 'sp_event'; + $post['post_status'] = 'draft'; + $post['tax_input'] = array(); + + // Add taxonomies + $taxonomies = array( 'sp_league', 'sp_season', 'sp_venue' ); + foreach ( $taxonomies as $taxonomy ) { + $post['tax_input'][ $taxonomy ] = get_terms( + $taxonomy, + array( + 'hide_empty' => 0, + 'fields' => 'ids', + 'number' => 1, + ) + ); + } + + // Add post title + if ( is_array( $teams ) && sizeof( $teams ) ) { + $team_names = array(); + foreach ( $teams as $team ) { + if ( ! $team ) { + continue; + } + $team_names[] = $team->post_title; + } + $post['post_title'] = implode( ' ' . get_option( 'sportspress_event_teams_delimiter', 'vs' ) . ' ', $team_names ); + } else { + $post['post_title'] = __( 'Event', 'sportspress' ); + } + + // Insert event + $id = wp_insert_post( $post ); + + // Add teams + if ( is_array( $teams ) && sizeof( $teams ) ) { + foreach ( $teams as $team ) { + if ( ! $team ) { + continue; + } + add_post_meta( $id, 'sp_team', $team->ID ); + } + } + + // Add players + add_post_meta( $id, 'sp_player', 0 ); + foreach ( $players as $player ) { + if ( ! $player ) { + continue; + } + add_post_meta( $id, 'sp_player', $player ); + } + add_post_meta( $id, 'sp_player', 0 ); + + update_post_meta( $id, '_sp_first', 1 ); + + return $id; + } + + /** + * Final step. + */ + public function sp_setup_ready() { + $id = $this->sp_setup_ready_actions(); + shuffle( $this->tweets ); + + $steps = apply_filters( + 'sportspress_setup_wizard_next_steps', + array( + 'first' => array( + 'label' => __( 'Next Steps', 'sportspress' ), + 'content' => '' . __( 'Schedule your first event!', 'sportspress' ) . '', + ), + 'last' => array( + 'label' => __( 'Upgrade to Pro', 'sportspress' ), + 'content' => __( 'Get SportsPress Pro to get access to all modules. You can upgrade any time without losing any of your data.', 'sportspress' ) . ' ' . __( 'Learn more', 'sportspress' ) . '', + ), + ) + ); + ?> + Tweet + + + + + + + + array(), + 'team-sports' => array(), 'racket-sports' => array(), - 'water-sports' => array(), + 'water-sports' => array(), 'target-sports' => array(), - 'esports' => array(), - 'other' => array(), + 'esports' => array(), + 'other' => array(), ); foreach ( self::$options as $slug => $options ) { - $dir = scandir( SP()->plugin_path() . '/presets/' . $slug ); + $dir = scandir( SP()->plugin_path() . '/presets/' . $slug ); $files = array(); if ( $dir ) { foreach ( $dir as $key => $value ) { @@ -40,13 +40,15 @@ class SP_Admin_Sports { } } } - foreach( $files as $file ) { + foreach ( $files as $file ) { $json_data = file_get_contents( SP()->plugin_path() . '/presets/' . $slug . '/' . $file ); - $data = json_decode( $json_data, true ); - if ( ! is_array( $data ) ) continue; - $id = preg_replace('/\\.[^.\\s]{3,4}$/', '', $file ); + $data = json_decode( $json_data, true ); + if ( ! is_array( $data ) ) { + continue; + } + $id = preg_replace( '/\\.[^.\\s]{3,4}$/', '', $file ); $presets[ $id ] = $data; - $name = array_key_exists( 'name', $data ) ? __( $data['name'], 'sportspress' ) : $id; + $name = array_key_exists( 'name', $data ) ? __( $data['name'], 'sportspress' ) : $id; // Conditionally append filename in parentheses for clarity if ( false === strpos( str_replace( ' ', '', strtolower( $data['name'] ) ), str_replace( '-', '', $id ) ) ) { @@ -69,15 +71,19 @@ class SP_Admin_Sports { public static function get_preset( $id ) { $json_data = @file_get_contents( SP()->plugin_path() . '/presets/' . $id . '.json', true ); - - if ( $json_data ) return json_decode( $json_data, true ); - + + if ( $json_data ) { + return json_decode( $json_data, true ); + } + $dir = scandir( SP()->plugin_path() . '/presets' ); if ( $dir ) { foreach ( $dir as $key => $value ) { if ( substr( $value, 0, 1 ) !== '.' && strpos( $value, '.' ) === false ) { $json_data = @file_get_contents( SP()->plugin_path() . '/presets/' . $value . '/' . $id . '.json', true ); - if ( $json_data ) return json_decode( $json_data, true ); + if ( $json_data ) { + return json_decode( $json_data, true ); + } } } } @@ -99,19 +105,21 @@ class SP_Admin_Sports { // Positions $positions = sp_array_value( $preset, 'positions', array() ); - $i = 0; + $i = 0; foreach ( $positions as $position ) { if ( is_string( $position ) ) { - $name = $position; + $name = $position; $sections = array( 0, 1 ); } else { - $name = sp_array_value( $position, 'name', __( 'Position', 'sportspress' ) ); + $name = sp_array_value( $position, 'name', __( 'Position', 'sportspress' ) ); $sections = sp_array_value( $position, 'sections', array( 0, 1 ) ); } $term = wp_insert_term( $name, 'sp_position' ); - if ( is_wp_error( $term ) ) continue; - $t_id = $term['term_id']; - $term_meta = get_option( "taxonomy_$t_id" ); + if ( is_wp_error( $term ) ) { + continue; + } + $t_id = $term['term_id']; + $term_meta = get_option( "taxonomy_$t_id" ); $term_meta['sp_sections'] = $sections; update_option( "taxonomy_$t_id", $term_meta ); update_term_meta( $t_id, 'sp_order', $i + 1 ); @@ -120,11 +128,13 @@ class SP_Admin_Sports { // Outcomes $post_type = 'sp_outcome'; - $outcomes = sp_array_value( $preset, 'outcomes', array() ); + $outcomes = sp_array_value( $preset, 'outcomes', array() ); self::delete_preset_posts( $post_type ); foreach ( $outcomes as $index => $outcome ) { $post = self::get_post_array( $outcome, $post_type ); - if ( empty( $post ) ) continue; + if ( empty( $post ) ) { + continue; + } $id = self::insert_preset_post( $post, $index ); update_post_meta( $id, 'sp_abbreviation', sp_array_value( $outcome, 'abbreviation', null ) ); update_post_meta( $id, 'sp_condition', sp_array_value( $outcome, 'condition', null ) ); @@ -132,14 +142,18 @@ class SP_Admin_Sports { // Results $post_type = 'sp_result'; - $results = sp_array_value( $preset, 'results', array() ); + $results = sp_array_value( $preset, 'results', array() ); self::delete_preset_posts( $post_type ); $primary_result = 0; foreach ( $results as $index => $result ) { $post = self::get_post_array( $result, $post_type ); - if ( empty( $post ) ) continue; + if ( empty( $post ) ) { + continue; + } $id = self::insert_preset_post( $post, $index ); - if ( is_array( $result ) && array_key_exists( 'primary', $result ) ) $primary_result = $post['post_name']; + if ( is_array( $result ) && array_key_exists( 'primary', $result ) ) { + $primary_result = $post['post_name']; + } update_post_meta( $id, 'sp_equation', sp_array_value( $result, 'equation', null ) ); } @@ -147,12 +161,14 @@ class SP_Admin_Sports { $i = 0; // Performance - $post_type = 'sp_performance'; + $post_type = 'sp_performance'; $performances = sp_array_value( $preset, 'performance', array() ); self::delete_preset_posts( $post_type ); foreach ( $performances as $index => $performance ) { $post = self::get_post_array( $performance, $post_type ); - if ( empty( $post ) ) continue; + if ( empty( $post ) ) { + continue; + } $id = self::insert_preset_post( $post, $index ); if ( isset( $performance['position'] ) ) { wp_set_object_terms( $id, $performance['position'], 'sp_position', false ); @@ -170,11 +186,13 @@ class SP_Admin_Sports { // Columns $post_type = 'sp_column'; - $columns = sp_array_value( $preset, 'columns', array() ); + $columns = sp_array_value( $preset, 'columns', array() ); self::delete_preset_posts( $post_type ); foreach ( $columns as $index => $column ) { $post = self::get_post_array( $column, $post_type ); - if ( empty( $post ) ) continue; + if ( empty( $post ) ) { + continue; + } $id = self::insert_preset_post( $post, $index ); update_post_meta( $id, 'sp_equation', sp_array_value( $column, 'equation', null ) ); update_post_meta( $id, 'sp_precision', sp_array_value( $column, 'precision', 0 ) ); @@ -184,40 +202,45 @@ class SP_Admin_Sports { // Metrics $post_type = 'sp_metric'; - $metrics = sp_array_value( $preset, 'metrics', array() ); + $metrics = sp_array_value( $preset, 'metrics', array() ); self::delete_preset_posts( $post_type ); foreach ( $metrics as $index => $metric ) { $post = self::get_post_array( $metric, $post_type ); - if ( empty( $post ) ) continue; + if ( empty( $post ) ) { + continue; + } $id = self::insert_preset_post( $post, $i + $index ); $i ++; } - + // Event Specs $post_type = 'sp_spec'; - $specs = sp_array_value( $preset, 'specs', array() ); + $specs = sp_array_value( $preset, 'specs', array() ); self::delete_preset_posts( $post_type ); foreach ( $specs as $index => $spec ) { $post = self::get_post_array( $spec, $post_type ); - if ( empty( $post ) ) continue; + if ( empty( $post ) ) { + continue; + } $id = self::insert_preset_post( $post, $i + $index ); $i ++; } // Statistics - $post_type = 'sp_statistic'; + $post_type = 'sp_statistic'; $statistics = sp_array_value( $preset, 'statistics', array() ); self::delete_preset_posts( $post_type ); foreach ( $statistics as $index => $statistic ) { $post = self::get_post_array( $statistic, $post_type ); - if ( empty( $post ) ) continue; + if ( empty( $post ) ) { + continue; + } $id = self::insert_preset_post( $post, $i + $index ); update_post_meta( $id, 'sp_equation', sp_array_value( $statistic, 'equation', null ) ); update_post_meta( $id, 'sp_precision', sp_array_value( $statistic, 'precision', 0 ) ); update_post_meta( $id, 'sp_type', sp_array_value( $statistic, 'type', 'total' ) ); } - // Options $options = sp_array_value( $preset, 'options', array() ); foreach ( $options as $option => $value ) { @@ -230,20 +253,20 @@ class SP_Admin_Sports { public static function delete_preset_posts( $post_type = null ) { $args = array( - 'post_type' => $post_type, + 'post_type' => $post_type, 'posts_per_page' => -1, - 'post_status' => array( 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash' ), - 'meta_query' => array( + 'post_status' => array( 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash' ), + 'meta_query' => array( array( - 'key' => '_sp_preset', - 'value' => 1 - ) - ) + 'key' => '_sp_preset', + 'value' => 1, + ), + ), ); // Delete posts $old_posts = get_posts( $args ); - foreach( $old_posts as $post ): + foreach ( $old_posts as $post ) : wp_delete_post( $post->ID, true ); endforeach; } @@ -252,15 +275,19 @@ class SP_Admin_Sports { $post_array = array(); if ( is_string( $post ) ) { $post_array['post_title'] = $post; - $post_array['post_name'] = sp_get_eos_safe_slug( $post_array['post_title'] ); + $post_array['post_name'] = sp_get_eos_safe_slug( $post_array['post_title'] ); } elseif ( is_array( $post ) ) { - if ( ! array_key_exists( 'name', $post ) ) $post_array = array(); + if ( ! array_key_exists( 'name', $post ) ) { + $post_array = array(); + } $post_array['post_title'] = $post['name']; - $post_array['post_name'] = sp_array_value( $post, 'id', sp_get_eos_safe_slug( $post_array['post_title'] ) ); + $post_array['post_name'] = sp_array_value( $post, 'id', sp_get_eos_safe_slug( $post_array['post_title'] ) ); } // Return empty array if post with same slug already exists - if ( get_page_by_path( $post_array['post_name'], OBJECT, $post_type ) ) return array(); + if ( get_page_by_path( $post_array['post_name'], OBJECT, $post_type ) ) { + return array(); + } // Set post type $post_array['post_type'] = $post_type; @@ -275,9 +302,9 @@ class SP_Admin_Sports { public static function insert_preset_post( $post, $index = 0 ) { // Increment menu order by 10 and publish post - $post['menu_order'] = $index * 10 + 10; + $post['menu_order'] = $index * 10 + 10; $post['post_status'] = 'publish'; - $id = wp_insert_post( $post ); + $id = wp_insert_post( $post ); // Flag as preset update_post_meta( $id, '_sp_preset', 1 ); @@ -287,21 +314,26 @@ class SP_Admin_Sports { /** * Sport category names + * * @return null */ public static function sport_category_names() { - return apply_filters( 'sportspress_sport_categories', array( - 'team-sports' => __( 'Team Sports', 'sportspress' ), - 'racket-sports' => __( 'Racket Sports', 'sportspress' ), - 'water-sports' => __( 'Water Sports', 'sportspress' ), - 'target-sports' => __( 'Target Sports', 'sportspress' ), - 'esports' => __( 'Esports', 'sportspress' ), - 'other' => __( 'Other', 'sportspress' ), - ) ); + return apply_filters( + 'sportspress_sport_categories', + array( + 'team-sports' => __( 'Team Sports', 'sportspress' ), + 'racket-sports' => __( 'Racket Sports', 'sportspress' ), + 'water-sports' => __( 'Water Sports', 'sportspress' ), + 'target-sports' => __( 'Target Sports', 'sportspress' ), + 'esports' => __( 'Esports', 'sportspress' ), + 'other' => __( 'Other', 'sportspress' ), + ) + ); } /** * Sport preset names for localization + * * @return null */ public static function sport_preset_names() { diff --git a/includes/admin/class-sp-admin-status.php b/includes/admin/class-sp-admin-status.php index 268c101c..e66f46a9 100644 --- a/includes/admin/class-sp-admin-status.php +++ b/includes/admin/class-sp-admin-status.php @@ -2,75 +2,78 @@ /** * Debug/Status page * - * @author ThemeBoy - * @category Admin - * @package SportsPress/Admin + * @author ThemeBoy + * @category Admin + * @package SportsPress/Admin * @version 1.4 */ -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly +} if ( ! class_exists( 'SP_Admin_Status' ) ) : -/** - * SP_Admin_Status Class - */ -class SP_Admin_Status { - /** - * Retrieve metadata from a file. Based on WP Core's get_file_data function - * - * @since 0.8 - * @param string $file Path to the file - * @param array $all_headers List of headers, in the format array('HeaderKey' => 'Header Name') + * SP_Admin_Status Class */ - public function get_file_version( $file ) { - // We don't need to write to the file, so just open for reading. - $fp = fopen( $file, 'r' ); + class SP_Admin_Status { - // Pull only the first 8kiB of the file in. - $file_data = fread( $fp, 8192 ); + /** + * Retrieve metadata from a file. Based on WP Core's get_file_data function + * + * @since 0.8 + * @param string $file Path to the file + * @param array $all_headers List of headers, in the format array('HeaderKey' => 'Header Name') + */ + public function get_file_version( $file ) { + // We don't need to write to the file, so just open for reading. + $fp = fopen( $file, 'r' ); - // PHP will close file handle, but we are good citizens. - fclose( $fp ); + // Pull only the first 8kiB of the file in. + $file_data = fread( $fp, 8192 ); - // Make sure we catch CR-only line endings. - $file_data = str_replace( "\r", "\n", $file_data ); - $version = ''; + // PHP will close file handle, but we are good citizens. + fclose( $fp ); - if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) - $version = _cleanup_header_comment( $match[1] ); + // Make sure we catch CR-only line endings. + $file_data = str_replace( "\r", "\n", $file_data ); + $version = ''; - return $version ; - } - - /** - * Scan the template files - * - * @access public - * @param string $template_path - * @return array - */ - public function scan_template_files( $template_path ) { - $files = scandir( $template_path ); - $result = array(); - if ( $files ) { - foreach ( $files as $key => $value ) { - if ( ! in_array( $value, array( ".",".." ) ) ) { - if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) { - $sub_files = $this->scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value ); - foreach ( $sub_files as $sub_file ) { - $result[] = $value . DIRECTORY_SEPARATOR . $sub_file; + if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) { + $version = _cleanup_header_comment( $match[1] ); + } + + return $version; + } + + /** + * Scan the template files + * + * @access public + * @param string $template_path + * @return array + */ + public function scan_template_files( $template_path ) { + $files = scandir( $template_path ); + $result = array(); + if ( $files ) { + foreach ( $files as $key => $value ) { + if ( ! in_array( $value, array( '.', '..' ) ) ) { + if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) { + $sub_files = $this->scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value ); + foreach ( $sub_files as $sub_file ) { + $result[] = $value . DIRECTORY_SEPARATOR . $sub_file; + } + } else { + $result[] = $value; } - } else { - $result[] = $value; } } } + return $result; } - return $result; } -} endif; diff --git a/includes/admin/class-sp-admin-taxonomies.php b/includes/admin/class-sp-admin-taxonomies.php index ec3aff8a..45070e2c 100644 --- a/includes/admin/class-sp-admin-taxonomies.php +++ b/includes/admin/class-sp-admin-taxonomies.php @@ -6,11 +6,11 @@ if ( ! defined( 'ABSPATH' ) ) { /** * Handles taxonomies in admin * - * @class SP_Admin_Taxonomies - * @version 2.7.9 - * @package SportsPress/Admin - * @category Class - * @author ThemeBoy + * @class SP_Admin_Taxonomies + * @version 2.7.9 + * @package SportsPress/Admin + * @category Class + * @author ThemeBoy */ class SP_Admin_Taxonomies { @@ -71,7 +71,7 @@ class SP_Admin_Taxonomies { * @param mixed $term Term (category) being edited */ public function edit_taxonomy_fields( $term ) { - $t_id = $term->term_id; + $t_id = $term->term_id; ?> @@ -80,7 +80,7 @@ class SP_Admin_Taxonomies {- - - Tweet - -
+ + + Tweet + + -
- Use the newly introduced conditional operators >, <, ≡, ≠, ≥, and ≤ to calculate the relationship between variables, then insert that calculation into more complex equations. Visit the Configure page to edit variables and equations.
-
- Measure and display additional details per event using the new Event Specs variables. They are customizable and can be useful for keeping track of information like player of the match, attendance, and venue weather. -
- Provide a quick overview of who each team is playing next using the new Next Team preset for league table columns. This will automatically display the next team's name or logo that links to the next match for each team in the table.
-
+ Use the newly introduced conditional operators >, <, ≡, ≠, ≥, and ≤ to calculate the relationship between variables, then insert that calculation into more complex equations. Visit the Configure page to edit variables and equations.
+
+ Measure and display additional details per event using the new Event Specs variables. They are customizable and can be useful for keeping track of information like player of the match, attendance, and venue weather. +
+ Provide a quick overview of who each team is playing next using the new Next Team preset for league table columns. This will automatically display the next team's name or logo that links to the next match for each team in the table.
+
- Display matches between home and away team in a grid. Create or select an existing calendar and select the Matrix layout to convert the calendar to an interactive results matrix!
-
- Keep track of players that switched teams during a season by adding one or more extra rows to their statistics table. Display the team and partial statistics before and after the transfer.
-
- Display a match commentary style play-by-play timeline within events. Upgrade to SportsPress Pro to get access to Timelines and other pro features.
-
+ Display matches between home and away team in a grid. Create or select an existing calendar and select the Matrix layout to convert the calendar to an interactive results matrix!
+
+ Keep track of players that switched teams during a season by adding one or more extra rows to their statistics table. Display the team and partial statistics before and after the transfer.
+
+ Display a match commentary style play-by-play timeline within events. Upgrade to SportsPress Pro to get access to Timelines and other pro features.
+
Players will now be saved using a new data format that allows them to belong to multiple leagues, seasons, and teams and be accurately selected in player lists.
-The Team column in player lists will now display only the current team that player belongs to, determined by the Current Team setting of each player.
-It's now possible to import players with the squad number 0 (zero) or any other value that would previously be interpreted as empty.
-Players will now be saved using a new data format that allows them to belong to multiple leagues, seasons, and teams and be accurately selected in player lists.
+The Team column in player lists will now display only the current team that player belongs to, determined by the Current Team setting of each player.
+It's now possible to import players with the squad number 0 (zero) or any other value that would previously be interpreted as empty.
+A new option has been added to the Countdown widget, allowing you to display a featured image from the next event.
-You'll now be able to select a relative date range when inserting calendar-related shortcodes from the visual editor.
-Teams have been given a Short Name setting in addition to the existing Abbreviation for added customizability.
-A new option has been added to the Countdown widget, allowing you to display a featured image from the next event.
+You'll now be able to select a relative date range when inserting calendar-related shortcodes from the visual editor.
+Teams have been given a Short Name setting in addition to the existing Abbreviation for added customizability.
+Contribute to SportsPress.', 'sportspress' ), 'https://github.com/ThemeBoy/SportsPress/blob/master/CONTRIBUTING.md' ); ?>
- /** - * Output the credits. - */ - public function credits_screen() { - ?> -Contribute to SportsPress.', 'sportspress' ), 'https://github.com/ThemeBoy/SportsPress/blob/master/CONTRIBUTING.md' ); ?>
+Translate SportsPress.', 'sportspress' ), 'https://translate.wordpress.org/projects/wp-plugins/sportspress' ); ?>
+- '.sprintf( __( 'Import complete - imported %s events and skipped %s.', 'sportspress' ), $this->imported, $this->skipped ).' + ' . sprintf( __( 'Import complete - imported %1$s events and skipped %2$s.', 'sportspress' ), $this->imported, $this->skipped ) . '
' . __( 'All done!', 'sportspress' ) . ' ' . __( 'View Events', 'sportspress' ) . '' . '
'; + echo '' . __( 'All done!', 'sportspress' ) . ' ' . __( 'View Events', 'sportspress' ) . '' . '
'; do_action( 'import_end' ); } @@ -450,7 +493,7 @@ if ( class_exists( 'WP_Importer' ) ) { */ function greet() { echo '' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'
'; + echo '' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ) . '
'; echo '' . sprintf( __( 'Events need to be defined with columns in a specific order (3+ columns). Click here to download a sample.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/events-sample.csv' ) . '
'; echo '' . sprintf( __( 'Supports CSV files generated by LeagueLobster.', 'sportspress' ), 'http://tboy.co/leaguelobster' ) . '
'; wp_import_upload_form( 'admin.php?import=sp_event_csv&step=1' ); @@ -473,11 +516,11 @@ if ( class_exists( 'WP_Importer' ) ) {' . __( 'None', 'sportspress' ) . '
'; sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; - ?>' . __( 'None', 'sportspress' ) . '
'; sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; - ?>- '.sprintf( __( 'Import complete - imported %s rows and skipped %s.', 'sportspress' ), $this->imported, $this->skipped ).' + ' . sprintf( __( 'Import complete - imported %1$s rows and skipped %2$s.', 'sportspress' ), $this->imported, $this->skipped ) . '
' . __( 'All done!', 'sportspress' ) . ' ' . __( 'View Event', 'sportspress' ) . '' . '
'; + echo '' . __( 'All done!', 'sportspress' ) . ' ' . __( 'View Event', 'sportspress' ) . '' . '
'; do_action( 'import_end' ); } @@ -149,8 +170,14 @@ if ( class_exists( 'WP_Importer' ) ) { echo '' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'
'; + $args = array_merge( + $_REQUEST, + array( + 'import' => 'sp_event_performance_csv', + 'step' => '1', + ) + ); + echo '' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ) . '
'; echo '' . sprintf( __( 'Box scores need to be defined with columns in a specific order. Click here to download a sample.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/event-performance-sample.csv' ) . '
'; wp_import_upload_form( add_query_arg( $args, 'admin.php' ) ); } else { @@ -167,10 +194,10 @@ if ( class_exists( 'WP_Importer' ) ) { * @return void */ function options() { - $event = sp_array_value( $_REQUEST, 'event', 0, 'key' ); - $teams = sp_array_value( $_REQUEST, 'teams', 0, 'key' ); - $index = sp_array_value( $_REQUEST, 'index', 0, 'key' ); - $team = sp_array_value( $_REQUEST, 'team', 0, 'key' ); + $event = sp_array_value( $_REQUEST, 'event', 0, 'key' ); + $teams = sp_array_value( $_REQUEST, 'teams', 0, 'key' ); + $index = sp_array_value( $_REQUEST, 'index', 0, 'key' ); + $team = sp_array_value( $_REQUEST, 'team', 0, 'key' ); $include = get_post_meta( $event, 'sp_team', false ); ?>|
+ 'sp_league',
- 'name' => 'sp_league',
- 'values' => 'slug',
+ 'taxonomy' => 'sp_league',
+ 'name' => 'sp_league',
+ 'values' => 'slug',
'show_option_none' => __( '— Not set —', 'sportspress' ),
);
- if ( ! sp_dropdown_taxonomies( $args ) ):
+ if ( ! sp_dropdown_taxonomies( $args ) ) :
echo ' ' . __( 'None', 'sportspress' ) . ' '; sp_taxonomy_adder( 'sp_league', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; - ?> |
+ ?>
+
||
|
+ 'sp_season',
- 'name' => 'sp_season',
- 'values' => 'slug',
+ 'taxonomy' => 'sp_season',
+ 'name' => 'sp_season',
+ 'values' => 'slug',
'show_option_none' => __( '— Not set —', 'sportspress' ),
);
- if ( ! sp_dropdown_taxonomies( $args ) ):
+ if ( ! sp_dropdown_taxonomies( $args ) ) :
echo ' ' . __( 'None', 'sportspress' ) . ' '; sp_taxonomy_adder( 'sp_season', 'sp_team', __( 'Add New', 'sportspress' ) ); endif; - ?> |
+ ?>
+
||
| - |
-
+ |
- |
- '.sprintf( __( 'Import complete - imported %s officials and skipped %s.', 'sportspress' ), $this->imported, $this->skipped ).' + ' . sprintf( __( 'Import complete - imported %1$s officials and skipped %2$s.', 'sportspress' ), $this->imported, $this->skipped ) . '
' . __( 'All done!', 'sportspress' ) . ' ' . __( 'View Officials', 'sportspress' ) . '' . '
'; + echo '' . __( 'All done!', 'sportspress' ) . ' ' . __( 'View Officials', 'sportspress' ) . '' . '
'; do_action( 'import_end' ); } @@ -108,7 +116,7 @@ if ( class_exists( 'WP_Importer' ) ) { */ function greet() { echo '' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'
'; + echo '' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ) . '
'; echo '' . sprintf( __( 'Officials need to be defined with columns in a specific order. Click here to download a sample.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/officials-sample.csv' ) . '
'; wp_import_upload_form( 'admin.php?import=sp_official_csv&step=1' ); echo '- '.sprintf( __( 'Import complete - imported %s players and skipped %s.', 'sportspress' ), $this->imported, $this->skipped ).' + ' . sprintf( __( 'Import complete - imported %1$s players and skipped %2$s.', 'sportspress' ), $this->imported, $this->skipped ) . '
' . __( 'All done!', 'sportspress' ) . ' ' . __( 'View Players', 'sportspress' ) . '' . '
'; + echo '' . __( 'All done!', 'sportspress' ) . ' ' . __( 'View Players', 'sportspress' ) . '' . '
'; do_action( 'import_end' ); } @@ -223,7 +249,7 @@ if ( class_exists( 'WP_Importer' ) ) { */ function greet() { echo '' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'
'; + echo '' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ) . '
'; echo '' . sprintf( __( 'Players need to be defined with columns in a specific order (8 columns). Click here to download a sample.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/players-sample.csv' ) . '
'; wp_import_upload_form( 'admin.php?import=sp_player_csv&step=1' ); echo '