Plugin Directory

Changeset 2964754


Ignore:
Timestamp:
09/09/2023 12:13:07 PM (2 years ago)
Author:
mtreherne
Message:

Release of Version 3.5

Location:
eh-gms-feed
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • eh-gms-feed/tags/3.5/css/gms-default.css

    r2948451 r2964754  
    55.gms-footnote, .gms-filter { margin: 0 0 2rem }
    66.gms-clubteam { font-weight: 700 }
    7 .gms-clubteam[data-team] { cursor: pointer }
    87.gms-filter > div { margin: 0 0 1rem }
    98.gms-filter fieldset { width: fit-content }
  • eh-gms-feed/tags/3.5/eh-gms-feed.php

    r2958570 r2964754  
    44 * Plugin URI: https://wordpress.org/plugins/eh-gms-feed/
    55 * Description: Show fixtures, results and tables from England Hockey GMS
    6  * Version: 3.4
     6 * Version: 3.5
    77 * Author: Matthew Treherne
    88 * Author URI: https://profiles.wordpress.org/mtreherne
  • eh-gms-feed/tags/3.5/includes/main-class.php

    r2958570 r2964754  
    3838        $html = '<div'.(($comp_count == 0) ? ' style="display: none" ': '').'><label><span class="gms-nomobile">Competition </span><select name="comp_id"><option value="">- All Competitions -</option>';
    3939        foreach ($this->team_comps as $key => $competition) $html .= '<option value="'.$key.'"'.(($this->is_competition() && $this->atts_show['comp_id'] == $key) || ($comp_count == 1) ? ' selected' : '').'>'.esc_html($competition['name']).'</option>';
     40        if ($this->is_competition() && !array_key_exists($this->atts_show['comp_id'], $this->team_comps)) {
     41            $html .= '<option value="'.$this->atts_show['comp_id'].'" selected>Previous Season</option>';
     42        }
    4043        $html .= '</select></label></div>';
    4144        return $html;
     
    9598                else {
    9699                    $valid_json = false;
    97                     $message = sprintf(esc_html__( 'No %s data could be found.', 'eh-gms-feed' ), $this->api[$key]['suffix'] ?? $key);
     100                    $data_type = $this->api[$key]['suffix'] ?? $key;
     101                    switch ($data_type) {
     102                        case 'table' : $data_type = 'league'; break;
     103                        case 'fixturesandresults' : $data_type = 'results/fixtures'; break;
     104                    }
     105                    $message = sprintf(esc_html__( 'No %s data could be found.', 'eh-gms-feed' ), $data_type);
    98106                }
    99107            }
     
    142150        $filter = false;
    143151        if (is_numeric($this->atts_show['whatson'])) {
    144             $diff = (new \DateTime())->diff($fixture_date)->format('%a');
     152            $compare = (clone $fixture_date)->setTime(0,0);
     153            $diff = (new \DateTime())->setTime(0,0)->diff($compare)->format('%a');
    145154            if ($diff > $this->atts_show['whatson']) $filter = true;
    146155        }
     
    357366    private function process_teams ($data) {
    358367        $teams = [];
    359         foreach ($data as $team) $teams[$team->id] = ['teamName' => $team->teamName, 'clubId' => $team->clubId, 'clubName' => $team->clubName, 'slug' => $team->entityUrlSlug, 'clubSlug' => $team->clubUrlSlug, 'gender' => $team->gender];
     368        foreach ($data as $team) $teams[$team->id] = ['teamName' => $team->teamName, 'clubId' => $team->clubId, 'clubName' => $team->clubName, 'slug' => $team->entityUrlSlug, 'clubSlug' => $team->clubUrlSlug, 'gender' => $team->gender, 'clubLogoUrl' => $team->clubLogoUrl ?? null];
    360369        return $teams;
    361370    }
     
    478487
    479488    public function enqueue_scripts () {
    480         wp_register_script('EH_GMS_Feed', plugin_dir_url(__DIR__).'js/eh-gms-feed.js', ['jquery'], '3.4', true);
     489        wp_register_script('EH_GMS_Feed', plugin_dir_url(__DIR__).'js/eh-gms-feed.js', ['jquery'], '3.5', true);
    481490        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')]);
    482         wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3.3');
     491        wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3.5');
    483492        if ($this->settings->default_css == 'yes') wp_enqueue_style('EH_GMS_Feed');
    484493    }
  • eh-gms-feed/tags/3.5/js/eh-gms-feed.js

    r2958570 r2964754  
    88
    99    function club_team (message, filter, wrapper) {
    10         wrapper.find('.gms-clubteam[data-team]').on('click', function(e) {
     10        wrapper.find('.gms-clubteam[data-team]').css('cursor','pointer').on('click', function(e) {
    1111            var team = e.currentTarget.dataset.team;
    1212            filter.find('select[name="team"]').val(team);
    13             team_change(message, filter, wrapper, team, function() { filter.find('button').trigger('click'); });
     13            team_change(message, filter, wrapper, team, function() {
     14                filter.find('select[name="whatson"]').val('');
     15                if (filter.find('select[name="comp_id"]').val() != '- All Competitions -' && filter.find('input[type="checkbox"][name="show"][value="results"]').prop('checked')) {
     16                    filter.find('input[type="checkbox"][name="show"][value="league"]').prop('checked',true);
     17                }
     18                filter.find('button').trigger('click');
    1419            });
     20        });
    1521    }
    1622
     
    2430            if (comp_data[team] !== undefined) {
    2531                comp_div.replaceWith(comp_data[team]);
    26                 wrapper.html(refresh_message);
    2732                if (callback) callback();
    2833            }
     
    3641                    comp_data[team] = data;
    3742                    comp_div.replaceWith(data);
    38                     wrapper.html(refresh_message);
    3943                    if (callback) callback();
    4044                })
     
    5155            comp_field.html(comp_default);
    5256            whatson_default.text('- Next Match Day -');
    53             wrapper.html(refresh_message);
     57            filter.find('input[type="checkbox"][name="show"][value="league"]').prop('checked',false);
    5458        }
    5559    }
     
    111115                        });
    112116                    });
     117                    filter.on('change', function(e) {
     118                        ele.html(refresh_message);
     119                    });
    113120                    club_team(message, filter, ele);
    114121                }
  • eh-gms-feed/tags/3.5/readme.txt

    r2958570 r2964754  
    55Tested up to: 6.2
    66Requires PHP: 5.3
    7 Stable tag: 3.4
     7Stable tag: 3.5
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6363== Changelog ==
    6464
     65= 3.5 =
     66* Deal with previous season competition in dynamic filter
     67* Tweak to whatson calculation
     68* Clicking on club team will show league with results and default whatson
     69* Uncheck league when all club teams selected
     70* Tweak to messages when no data found and when filter changed
     71* Change to default CSS for gms-clubteam
     72
    6573= 3.4 =
    6674* Show gender option for club teams
  • eh-gms-feed/trunk/css/gms-default.css

    r2948451 r2964754  
    55.gms-footnote, .gms-filter { margin: 0 0 2rem }
    66.gms-clubteam { font-weight: 700 }
    7 .gms-clubteam[data-team] { cursor: pointer }
    87.gms-filter > div { margin: 0 0 1rem }
    98.gms-filter fieldset { width: fit-content }
  • eh-gms-feed/trunk/eh-gms-feed.php

    r2958570 r2964754  
    44 * Plugin URI: https://wordpress.org/plugins/eh-gms-feed/
    55 * Description: Show fixtures, results and tables from England Hockey GMS
    6  * Version: 3.4
     6 * Version: 3.5
    77 * Author: Matthew Treherne
    88 * Author URI: https://profiles.wordpress.org/mtreherne
  • eh-gms-feed/trunk/includes/main-class.php

    r2958570 r2964754  
    3838        $html = '<div'.(($comp_count == 0) ? ' style="display: none" ': '').'><label><span class="gms-nomobile">Competition </span><select name="comp_id"><option value="">- All Competitions -</option>';
    3939        foreach ($this->team_comps as $key => $competition) $html .= '<option value="'.$key.'"'.(($this->is_competition() && $this->atts_show['comp_id'] == $key) || ($comp_count == 1) ? ' selected' : '').'>'.esc_html($competition['name']).'</option>';
     40        if ($this->is_competition() && !array_key_exists($this->atts_show['comp_id'], $this->team_comps)) {
     41            $html .= '<option value="'.$this->atts_show['comp_id'].'" selected>Previous Season</option>';
     42        }
    4043        $html .= '</select></label></div>';
    4144        return $html;
     
    9598                else {
    9699                    $valid_json = false;
    97                     $message = sprintf(esc_html__( 'No %s data could be found.', 'eh-gms-feed' ), $this->api[$key]['suffix'] ?? $key);
     100                    $data_type = $this->api[$key]['suffix'] ?? $key;
     101                    switch ($data_type) {
     102                        case 'table' : $data_type = 'league'; break;
     103                        case 'fixturesandresults' : $data_type = 'results/fixtures'; break;
     104                    }
     105                    $message = sprintf(esc_html__( 'No %s data could be found.', 'eh-gms-feed' ), $data_type);
    98106                }
    99107            }
     
    142150        $filter = false;
    143151        if (is_numeric($this->atts_show['whatson'])) {
    144             $diff = (new \DateTime())->diff($fixture_date)->format('%a');
     152            $compare = (clone $fixture_date)->setTime(0,0);
     153            $diff = (new \DateTime())->setTime(0,0)->diff($compare)->format('%a');
    145154            if ($diff > $this->atts_show['whatson']) $filter = true;
    146155        }
     
    357366    private function process_teams ($data) {
    358367        $teams = [];
    359         foreach ($data as $team) $teams[$team->id] = ['teamName' => $team->teamName, 'clubId' => $team->clubId, 'clubName' => $team->clubName, 'slug' => $team->entityUrlSlug, 'clubSlug' => $team->clubUrlSlug, 'gender' => $team->gender];
     368        foreach ($data as $team) $teams[$team->id] = ['teamName' => $team->teamName, 'clubId' => $team->clubId, 'clubName' => $team->clubName, 'slug' => $team->entityUrlSlug, 'clubSlug' => $team->clubUrlSlug, 'gender' => $team->gender, 'clubLogoUrl' => $team->clubLogoUrl ?? null];
    360369        return $teams;
    361370    }
     
    478487
    479488    public function enqueue_scripts () {
    480         wp_register_script('EH_GMS_Feed', plugin_dir_url(__DIR__).'js/eh-gms-feed.js', ['jquery'], '3.4', true);
     489        wp_register_script('EH_GMS_Feed', plugin_dir_url(__DIR__).'js/eh-gms-feed.js', ['jquery'], '3.5', true);
    481490        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')]);
    482         wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3.3');
     491        wp_register_style('EH_GMS_Feed', plugin_dir_url(__DIR__).'css/gms-default.css',[],'3.5');
    483492        if ($this->settings->default_css == 'yes') wp_enqueue_style('EH_GMS_Feed');
    484493    }
  • eh-gms-feed/trunk/js/eh-gms-feed.js

    r2958570 r2964754  
    88
    99    function club_team (message, filter, wrapper) {
    10         wrapper.find('.gms-clubteam[data-team]').on('click', function(e) {
     10        wrapper.find('.gms-clubteam[data-team]').css('cursor','pointer').on('click', function(e) {
    1111            var team = e.currentTarget.dataset.team;
    1212            filter.find('select[name="team"]').val(team);
    13             team_change(message, filter, wrapper, team, function() { filter.find('button').trigger('click'); });
     13            team_change(message, filter, wrapper, team, function() {
     14                filter.find('select[name="whatson"]').val('');
     15                if (filter.find('select[name="comp_id"]').val() != '- All Competitions -' && filter.find('input[type="checkbox"][name="show"][value="results"]').prop('checked')) {
     16                    filter.find('input[type="checkbox"][name="show"][value="league"]').prop('checked',true);
     17                }
     18                filter.find('button').trigger('click');
    1419            });
     20        });
    1521    }
    1622
     
    2430            if (comp_data[team] !== undefined) {
    2531                comp_div.replaceWith(comp_data[team]);
    26                 wrapper.html(refresh_message);
    2732                if (callback) callback();
    2833            }
     
    3641                    comp_data[team] = data;
    3742                    comp_div.replaceWith(data);
    38                     wrapper.html(refresh_message);
    3943                    if (callback) callback();
    4044                })
     
    5155            comp_field.html(comp_default);
    5256            whatson_default.text('- Next Match Day -');
    53             wrapper.html(refresh_message);
     57            filter.find('input[type="checkbox"][name="show"][value="league"]').prop('checked',false);
    5458        }
    5559    }
     
    111115                        });
    112116                    });
     117                    filter.on('change', function(e) {
     118                        ele.html(refresh_message);
     119                    });
    113120                    club_team(message, filter, ele);
    114121                }
  • eh-gms-feed/trunk/readme.txt

    r2958570 r2964754  
    55Tested up to: 6.2
    66Requires PHP: 5.3
    7 Stable tag: 3.4
     7Stable tag: 3.5
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6363== Changelog ==
    6464
     65= 3.5 =
     66* Deal with previous season competition in dynamic filter
     67* Tweak to whatson calculation
     68* Clicking on club team will show league with results and default whatson
     69* Uncheck league when all club teams selected
     70* Tweak to messages when no data found and when filter changed
     71* Change to default CSS for gms-clubteam
     72
    6573= 3.4 =
    6674* Show gender option for club teams
Note: See TracChangeset for help on using the changeset viewer.