Changeset 3073918
- Timestamp:
- 04/19/2024 03:31:37 PM (22 months ago)
- Location:
- eh-gms-feed
- Files:
-
- 10 edited
-
tags/3.15/css/gms-default.css (modified) (3 diffs)
-
tags/3.15/eh-gms-feed.php (modified) (1 diff)
-
tags/3.15/includes/coreAPI.php (modified) (4 diffs)
-
tags/3.15/includes/main-class.php (modified) (2 diffs)
-
tags/3.15/readme.txt (modified) (2 diffs)
-
trunk/css/gms-default.css (modified) (3 diffs)
-
trunk/eh-gms-feed.php (modified) (1 diff)
-
trunk/includes/coreAPI.php (modified) (4 diffs)
-
trunk/includes/main-class.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
eh-gms-feed/tags/3.15/css/gms-default.css
r3066677 r3073918 4 4 .gms-table th, .gms-table td { border: 1px solid; padding: 3px 10px; border-color: silver } 5 5 .gms-footnote, .gms-filter { margin: 0 0 2rem } 6 .gms-clubteam:not(.gms-button) { font-weight: 700 }6 .gms-clubteam:not(.gms-button), .gms-boldteam { font-weight: 700 } 7 7 .gms-filter > div { margin: 0 0 1rem } 8 8 .gms-filter fieldset { width: fit-content } … … 23 23 /* Helps makes GMS feed responsive depending on screen size and input device */ 24 24 @media screen and (max-width: 767px) { .gms-table { overflow-x: auto; display: block; white-space: nowrap } .gms-nomobile { display: none } } 25 @media not screen and (max-width: 767px) { .gms-mobile { display: none } } 25 26 @media (hover: hover) and (pointer: fine) { .gms-detaillink { cursor: pointer } .gms-detaillink:hover { background-color: yellow } } 26 27 … … 44 45 .gms-map-google, .gms-map-apple { background-color: white } 45 46 .gms-map-waze { background-color: #05c8f7 } 46 .gms-fixture .gms-card > * { margin-top: 0.5rem; margin-bottom: 0.5rem }47 .gms-fixture .gms-card > *, .gms-cardform { margin-top: 0.5rem; margin-bottom: 0.5rem } 47 48 .gms-fixturedetails { display: flex; flex-wrap: wrap; gap: 1rem } 48 49 .gms-fixturedetails > div { flex-grow: 1; padding: 0.5rem 0.5rem; border-radius: 0.5rem } -
eh-gms-feed/tags/3.15/eh-gms-feed.php
r3066677 r3073918 4 4 * Plugin URI: https://wordpress.org/plugins/eh-gms-feed/ 5 5 * Description: Show fixtures, results and tables from England Hockey GMS 6 * Version: 3.1 46 * Version: 3.15 7 7 * Author: Matthew Treherne 8 8 * Author URI: https://profiles.wordpress.org/mtreherne -
eh-gms-feed/tags/3.15/includes/coreAPI.php
r3066677 r3073918 222 222 } 223 223 224 pr ivatefunction is_beforetoday($valid_date) {224 protected function is_beforetoday($valid_date) { 225 225 return $valid_date < (new \DateTime())->setTime(0,0); 226 226 } … … 422 422 private function process_table ($data, $custom=false) { 423 423 $html = ''; $link = $this->comp_link; 424 $league_data = ['Team' => 'teamName', 'P layed' => 'gamesPlayed', 'Won' => 'gamesWon', 'Drawn' => 'gamesDrawn', 'Lost' => 'gamesLost', 'For' => 'goalsFor', 'Against' => 'goalsAgainst', 'GD' => 'goalsDifference', 'Points' => 'totalPoints'];424 $league_data = ['Team' => 'teamName', 'P<span class="gms-nomobile">layed</span>' => 'gamesPlayed', 'W<span class="gms-nomobile">on</span>' => 'gamesWon', 'D<span class="gms-nomobile">rawn</span>' => 'gamesDrawn', 'L<span class="gms-nomobile">ost</span>' => 'gamesLost', 'For' => 'goalsFor', 'Against' => 'goalsAgainst', 'GD' => 'goalsDifference', '<span class="gms-mobile">Pts</span><span class="gms-nomobile">Points</span>' => 'totalPoints']; 425 425 if ($custom) { $league_data['PPG'] = 'PPG'; $league_data['Form'] = 'form'; } 426 $html .= '<table class="gms-table gms-table-'.$this->display_name.($custom ? ' gms-table-custom' : '').'"><thead><tr><th></th>'; 427 foreach ($league_data as $column_title => $field_name) $html .= '<th>'.$column_title.'</th>'; 428 $html .= '</tr></thead><tbody>'; 426 if ($custom && $this->show_list) $html .= '<div class="gms-list">'; 427 else { 428 $html .= '<table class="gms-table gms-table-'.$this->display_name.($custom ? ' gms-table-custom' : '').'"><thead><tr><th></th>'; 429 foreach ($league_data as $column_title => $field_name) $html .= '<th'.($column_title == 'For' || $column_title == 'Against' ? ' class="gms-nomobile"' : '').'>'.$column_title.'</th>'; 430 $html .= '</tr></thead><tbody>'; 431 } 429 432 foreach ($data as $position => $team) { 430 433 $class = ''; … … 433 436 if (!$link) $link = $this->get_link('team', $team->teamEntityUrlSlug); 434 437 } 435 $html .= '<tr'.$class.'><td>'.($position+1).'</td>'; 436 foreach ($league_data as $field_name) { 437 $suffix = ''; 438 if ($custom && $field_name == 'teamName' && $this->show_gender && isset($team->gender)) $suffix = ' ('.$team->gender.')'; 439 if ($field_name == 'form') { 440 if (count($team->form) > 5) $team->form = array_slice($team->form, -5, 5); 441 $team->form = implode(' ', $team->form); 442 $html .= '<td>'.$team->form.'</td>'; 443 } 444 else $html .= '<td>'.(isset($team->{$field_name}) ? esc_html($team->{$field_name}.$suffix) : '').'</td>'; 445 } 446 $html .= '</tr>'; 447 } 448 if (empty($data)) $html .= '<tr><td colspan="'.(count($league_data)+1).'">No data for teams found</td></tr>'; 449 $html .= '</tbody></table>'; 438 if ($custom) { 439 if (count($team->form) > 5) $team->form = array_slice($team->form, -5, 5); 440 $team->form = implode(' ', $team->form); 441 if ($this->show_gender && isset($team->gender)) $team->teamName .= ' ('.$team->gender.')'; 442 } 443 if ($custom && $this->show_list) $html .= '<div class="gms-card" data-team="'.$team->teamId.'"><div class="gms-boldteam">'.($position+1).'. '.esc_html($team->teamName).'</div><div>Won: '.$team->gamesWon.' | For: '.$team->goalsFor.' | GD: '.$team->goalsDifference.'</div><div>Points: '.$team->totalPoints.' | PPG: '.$team->PPG.'</div><div class="gms-cardform">'.$team->form.'</div></div>'; 444 else { 445 $html .= '<tr'.$class.' data-team="'.$team->teamId.'"><td>'.($position+1).'</td>'; 446 foreach ($league_data as $field_name) { 447 if ($field_name == 'form') $html .= '<td>'.$team->form.'</td>'; 448 else $html .= '<td'.($field_name == 'goalsFor' || $field_name == 'goalsAgainst' ? ' class="gms-nomobile"' : '').'>'.(isset($team->{$field_name}) ? esc_html($team->{$field_name}) : '').'</td>'; 449 } 450 $html .= '</tr>'; 451 } 452 } 453 if ($custom && $this->show_list) { 454 if (empty($data)) $html .= '<div>No data found for any teams</div>'; 455 $html .= '</div>'; 456 } 457 else { 458 if (empty($data)) $html .= '<tr><td colspan="'.(count($league_data)+1).'">No data found for any teams</td></tr>'; 459 $html .= '</tbody></table>'; 460 } 450 461 $html .= '<div class="gms-footnote">'.($link ? sprintf(esc_html__( '[%5$s%3$s %1$s also found at%4$s %2$s]', 'eh-gms-feed' ), $this->comp_name ? 'for '.$this->comp_name : '', '<a href="'.$link.'" target="_blank">England Hockey Link</a>', '<span class="gms-nomobile">', '</span>', ($custom ? esc_html__('Data') : esc_html__('Table'))) : ($custom ? esc_html__('[League table for selected teams]') : '')).'</div>'; 451 462 return $html; … … 682 693 }); 683 694 $html .= $this->process_table($league_data, true); 684 if ($no_data) $html .= $this->show_api_error(sprintf(esc_html__( ' Failed to retrieve datafor %s of selected team(s)', 'eh-gms-feed' ), $no_data));695 if ($no_data) $html .= $this->show_api_error(sprintf(esc_html__( 'No data found for %s of selected team(s)', 'eh-gms-feed' ), $no_data)); 685 696 } 686 697 else $html .= $this->show_api_error(esc_html__( 'You have selected a custom league table without any teams', 'eh-gms-feed' )); -
eh-gms-feed/tags/3.15/includes/main-class.php
r3066677 r3073918 119 119 $team_count = count($this->multiple_teams); 120 120 if ($team_count > 1 && ($this->atts_show['show'] != 'league' || $team_count > $this->teamlimit || $this->atts_show['method'] == 'api-dynamic')) { 121 $message = sprintf(esc_html__( 'You can only show a static league table with multiple teams (up to %s allowed).', 'eh-gms-feed' ), $this->teamlimit);121 $message = sprintf(esc_html__( 'You can only show a custom league table without filter and up to %s teams.', 'eh-gms-feed' ), $this->teamlimit); 122 122 $this->not_valid .= '<p>'.$message.'</p>'; 123 123 $valid = false; … … 146 146 wp_register_script('EH_GMS_Feed', plugin_dir_url(__DIR__).'js/eh-gms-feed.js', ['jquery'], '3.14', true); 147 147 wp_localize_script('EH_GMS_Feed', 'eh_gms_feed_ajax_obj', ['ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce('get_gms_table')]); 148 wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3.1 4');148 wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3.15'); 149 149 if ($this->settings->default_css == 'yes') wp_enqueue_style('EH_GMS_Feed'); 150 150 } -
eh-gms-feed/tags/3.15/readme.txt
r3066677 r3073918 5 5 Tested up to: 6.5 6 6 Requires PHP: 5.3 7 Stable tag: 3.1 47 Stable tag: 3.15 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 62 62 63 63 == Changelog == 64 65 = 3.15 = 66 * Show as list option added to custom league 67 * League column titles responsive to screen size 68 * Change to default CSS for custom league list view 64 69 65 70 = 3.14 = -
eh-gms-feed/trunk/css/gms-default.css
r3066677 r3073918 4 4 .gms-table th, .gms-table td { border: 1px solid; padding: 3px 10px; border-color: silver } 5 5 .gms-footnote, .gms-filter { margin: 0 0 2rem } 6 .gms-clubteam:not(.gms-button) { font-weight: 700 }6 .gms-clubteam:not(.gms-button), .gms-boldteam { font-weight: 700 } 7 7 .gms-filter > div { margin: 0 0 1rem } 8 8 .gms-filter fieldset { width: fit-content } … … 23 23 /* Helps makes GMS feed responsive depending on screen size and input device */ 24 24 @media screen and (max-width: 767px) { .gms-table { overflow-x: auto; display: block; white-space: nowrap } .gms-nomobile { display: none } } 25 @media not screen and (max-width: 767px) { .gms-mobile { display: none } } 25 26 @media (hover: hover) and (pointer: fine) { .gms-detaillink { cursor: pointer } .gms-detaillink:hover { background-color: yellow } } 26 27 … … 44 45 .gms-map-google, .gms-map-apple { background-color: white } 45 46 .gms-map-waze { background-color: #05c8f7 } 46 .gms-fixture .gms-card > * { margin-top: 0.5rem; margin-bottom: 0.5rem }47 .gms-fixture .gms-card > *, .gms-cardform { margin-top: 0.5rem; margin-bottom: 0.5rem } 47 48 .gms-fixturedetails { display: flex; flex-wrap: wrap; gap: 1rem } 48 49 .gms-fixturedetails > div { flex-grow: 1; padding: 0.5rem 0.5rem; border-radius: 0.5rem } -
eh-gms-feed/trunk/eh-gms-feed.php
r3066677 r3073918 4 4 * Plugin URI: https://wordpress.org/plugins/eh-gms-feed/ 5 5 * Description: Show fixtures, results and tables from England Hockey GMS 6 * Version: 3.1 46 * Version: 3.15 7 7 * Author: Matthew Treherne 8 8 * Author URI: https://profiles.wordpress.org/mtreherne -
eh-gms-feed/trunk/includes/coreAPI.php
r3066677 r3073918 222 222 } 223 223 224 pr ivatefunction is_beforetoday($valid_date) {224 protected function is_beforetoday($valid_date) { 225 225 return $valid_date < (new \DateTime())->setTime(0,0); 226 226 } … … 422 422 private function process_table ($data, $custom=false) { 423 423 $html = ''; $link = $this->comp_link; 424 $league_data = ['Team' => 'teamName', 'P layed' => 'gamesPlayed', 'Won' => 'gamesWon', 'Drawn' => 'gamesDrawn', 'Lost' => 'gamesLost', 'For' => 'goalsFor', 'Against' => 'goalsAgainst', 'GD' => 'goalsDifference', 'Points' => 'totalPoints'];424 $league_data = ['Team' => 'teamName', 'P<span class="gms-nomobile">layed</span>' => 'gamesPlayed', 'W<span class="gms-nomobile">on</span>' => 'gamesWon', 'D<span class="gms-nomobile">rawn</span>' => 'gamesDrawn', 'L<span class="gms-nomobile">ost</span>' => 'gamesLost', 'For' => 'goalsFor', 'Against' => 'goalsAgainst', 'GD' => 'goalsDifference', '<span class="gms-mobile">Pts</span><span class="gms-nomobile">Points</span>' => 'totalPoints']; 425 425 if ($custom) { $league_data['PPG'] = 'PPG'; $league_data['Form'] = 'form'; } 426 $html .= '<table class="gms-table gms-table-'.$this->display_name.($custom ? ' gms-table-custom' : '').'"><thead><tr><th></th>'; 427 foreach ($league_data as $column_title => $field_name) $html .= '<th>'.$column_title.'</th>'; 428 $html .= '</tr></thead><tbody>'; 426 if ($custom && $this->show_list) $html .= '<div class="gms-list">'; 427 else { 428 $html .= '<table class="gms-table gms-table-'.$this->display_name.($custom ? ' gms-table-custom' : '').'"><thead><tr><th></th>'; 429 foreach ($league_data as $column_title => $field_name) $html .= '<th'.($column_title == 'For' || $column_title == 'Against' ? ' class="gms-nomobile"' : '').'>'.$column_title.'</th>'; 430 $html .= '</tr></thead><tbody>'; 431 } 429 432 foreach ($data as $position => $team) { 430 433 $class = ''; … … 433 436 if (!$link) $link = $this->get_link('team', $team->teamEntityUrlSlug); 434 437 } 435 $html .= '<tr'.$class.'><td>'.($position+1).'</td>'; 436 foreach ($league_data as $field_name) { 437 $suffix = ''; 438 if ($custom && $field_name == 'teamName' && $this->show_gender && isset($team->gender)) $suffix = ' ('.$team->gender.')'; 439 if ($field_name == 'form') { 440 if (count($team->form) > 5) $team->form = array_slice($team->form, -5, 5); 441 $team->form = implode(' ', $team->form); 442 $html .= '<td>'.$team->form.'</td>'; 443 } 444 else $html .= '<td>'.(isset($team->{$field_name}) ? esc_html($team->{$field_name}.$suffix) : '').'</td>'; 445 } 446 $html .= '</tr>'; 447 } 448 if (empty($data)) $html .= '<tr><td colspan="'.(count($league_data)+1).'">No data for teams found</td></tr>'; 449 $html .= '</tbody></table>'; 438 if ($custom) { 439 if (count($team->form) > 5) $team->form = array_slice($team->form, -5, 5); 440 $team->form = implode(' ', $team->form); 441 if ($this->show_gender && isset($team->gender)) $team->teamName .= ' ('.$team->gender.')'; 442 } 443 if ($custom && $this->show_list) $html .= '<div class="gms-card" data-team="'.$team->teamId.'"><div class="gms-boldteam">'.($position+1).'. '.esc_html($team->teamName).'</div><div>Won: '.$team->gamesWon.' | For: '.$team->goalsFor.' | GD: '.$team->goalsDifference.'</div><div>Points: '.$team->totalPoints.' | PPG: '.$team->PPG.'</div><div class="gms-cardform">'.$team->form.'</div></div>'; 444 else { 445 $html .= '<tr'.$class.' data-team="'.$team->teamId.'"><td>'.($position+1).'</td>'; 446 foreach ($league_data as $field_name) { 447 if ($field_name == 'form') $html .= '<td>'.$team->form.'</td>'; 448 else $html .= '<td'.($field_name == 'goalsFor' || $field_name == 'goalsAgainst' ? ' class="gms-nomobile"' : '').'>'.(isset($team->{$field_name}) ? esc_html($team->{$field_name}) : '').'</td>'; 449 } 450 $html .= '</tr>'; 451 } 452 } 453 if ($custom && $this->show_list) { 454 if (empty($data)) $html .= '<div>No data found for any teams</div>'; 455 $html .= '</div>'; 456 } 457 else { 458 if (empty($data)) $html .= '<tr><td colspan="'.(count($league_data)+1).'">No data found for any teams</td></tr>'; 459 $html .= '</tbody></table>'; 460 } 450 461 $html .= '<div class="gms-footnote">'.($link ? sprintf(esc_html__( '[%5$s%3$s %1$s also found at%4$s %2$s]', 'eh-gms-feed' ), $this->comp_name ? 'for '.$this->comp_name : '', '<a href="'.$link.'" target="_blank">England Hockey Link</a>', '<span class="gms-nomobile">', '</span>', ($custom ? esc_html__('Data') : esc_html__('Table'))) : ($custom ? esc_html__('[League table for selected teams]') : '')).'</div>'; 451 462 return $html; … … 682 693 }); 683 694 $html .= $this->process_table($league_data, true); 684 if ($no_data) $html .= $this->show_api_error(sprintf(esc_html__( ' Failed to retrieve datafor %s of selected team(s)', 'eh-gms-feed' ), $no_data));695 if ($no_data) $html .= $this->show_api_error(sprintf(esc_html__( 'No data found for %s of selected team(s)', 'eh-gms-feed' ), $no_data)); 685 696 } 686 697 else $html .= $this->show_api_error(esc_html__( 'You have selected a custom league table without any teams', 'eh-gms-feed' )); -
eh-gms-feed/trunk/includes/main-class.php
r3066677 r3073918 119 119 $team_count = count($this->multiple_teams); 120 120 if ($team_count > 1 && ($this->atts_show['show'] != 'league' || $team_count > $this->teamlimit || $this->atts_show['method'] == 'api-dynamic')) { 121 $message = sprintf(esc_html__( 'You can only show a static league table with multiple teams (up to %s allowed).', 'eh-gms-feed' ), $this->teamlimit);121 $message = sprintf(esc_html__( 'You can only show a custom league table without filter and up to %s teams.', 'eh-gms-feed' ), $this->teamlimit); 122 122 $this->not_valid .= '<p>'.$message.'</p>'; 123 123 $valid = false; … … 146 146 wp_register_script('EH_GMS_Feed', plugin_dir_url(__DIR__).'js/eh-gms-feed.js', ['jquery'], '3.14', true); 147 147 wp_localize_script('EH_GMS_Feed', 'eh_gms_feed_ajax_obj', ['ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce('get_gms_table')]); 148 wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3.1 4');148 wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3.15'); 149 149 if ($this->settings->default_css == 'yes') wp_enqueue_style('EH_GMS_Feed'); 150 150 } -
eh-gms-feed/trunk/readme.txt
r3066677 r3073918 5 5 Tested up to: 6.5 6 6 Requires PHP: 5.3 7 Stable tag: 3.1 47 Stable tag: 3.15 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 62 62 63 63 == Changelog == 64 65 = 3.15 = 66 * Show as list option added to custom league 67 * League column titles responsive to screen size 68 * Change to default CSS for custom league list view 64 69 65 70 = 3.14 =
Note: See TracChangeset
for help on using the changeset viewer.