Plugin Directory

Changeset 1997526


Ignore:
Timestamp:
12/18/2018 09:21:16 PM (7 years ago)
Author:
martindrapeau
Message:

Use the plugin version as a cache buster to avoid refresh issues by clients.

Location:
amilia-store/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • amilia-store/trunk/amilia-store.php

    r1997512 r1997526  
    66Author: Martin Drapeau <martin.drapeau@amilia.com>
    77Copyright: 2014-2018 Amilia
    8 Version: 2.9.4
     8Version: 2.9.5
    99Author URI: http://www.amilia.com/
    1010License: Apache License 2.0
     
    1212Text Domain: amilia-store
    1313*/
     14
     15define('AMILIA_STORE_PLUGIN_VERSION', '2.9.5');
    1416
    1517// Localization and JS bootstrap
     
    127129            window.Amilia = {
    128130                PLUGIN_NAME: 'amilia_store',
     131                pluginVersion: '<?php echo AMILIA_STORE_PLUGIN_VERSION; ?>',
    129132                pluginUrl: '<?php echo plugin_dir_url( __FILE__ ); ?>',
    130133                objectL10n: <?php echo json_encode($dict); ?>,
     
    133136        </script>
    134137        <?php
    135         wp_enqueue_style('amilia_store_css', plugins_url('amilia-store.css', __FILE__));
    136         wp_enqueue_script('amilia_store_js', plugins_url('amilia-store.js', __FILE__));
     138        wp_enqueue_style('amilia_store_css', plugins_url('amilia-store.css', __FILE__), array(), AMILIA_STORE_PLUGIN_VERSION);
     139        wp_enqueue_script('amilia_store_js', plugins_url('amilia-store.js', __FILE__), array(), AMILIA_STORE_PLUGIN_VERSION);
    137140    }
    138141}
     
    142145// Settings
    143146function register_amilia_store_settings() {
    144     register_setting( 'amilia-store-settings-group', 'amilia_store_url' );
     147    register_setting('amilia-store-settings-group', 'amilia_store_url');
     148    register_setting('amilia-store-settings-group', 'amilia_store_version', array('type' => 'string', 'default' => AMILIA_STORE_PLUGIN_VERSION));
    145149}
    146150function amilia_store_create_menu() {
     
    150154add_action('admin_menu', 'amilia_store_create_menu');
    151155function amilia_store_settings_page() {
    152     wp_enqueue_script('amilia_store_settings_js', plugins_url('amilia-store-settings.js', __FILE__));
     156    wp_enqueue_script('amilia_store_settings_js', plugins_url('amilia-store-settings.js', __FILE__), array(), AMILIA_STORE_PLUGIN_VERSION);
    153157    ?>
    154158    <div class="wrap">
     
    178182// Editor buttons
    179183function amilia_store_add_tinymce_plugins($plugin_array) {
    180     $plugin_array['amilia_store_iframe'] = plugins_url('shortcodes/amilia-store-iframe.js', __FILE__);
    181     $plugin_array['amilia_store_table'] = plugins_url('shortcodes/amilia-store-table.js', __FILE__);
    182     $plugin_array['amilia_store_button'] = plugins_url('shortcodes/amilia-store-button.js', __FILE__);
    183     $plugin_array['amilia_store_calendar'] = plugins_url('shortcodes/amilia-store-calendar.js', __FILE__);
    184     $plugin_array['amilia_store_standings'] = plugins_url('shortcodes/amilia-store-standings.js', __FILE__);
     184    $plugin_array['amilia_store_iframe'] = plugins_url('shortcodes/amilia-store-iframe.js', __FILE__).'?v='.AMILIA_STORE_PLUGIN_VERSION;
     185    $plugin_array['amilia_store_table'] = plugins_url('shortcodes/amilia-store-table.js', __FILE__).'?v='.AMILIA_STORE_PLUGIN_VERSION;
     186    $plugin_array['amilia_store_button'] = plugins_url('shortcodes/amilia-store-button.js', __FILE__).'?v='.AMILIA_STORE_PLUGIN_VERSION;
     187    $plugin_array['amilia_store_calendar'] = plugins_url('shortcodes/amilia-store-calendar.js', __FILE__).'?v='.AMILIA_STORE_PLUGIN_VERSION;
     188    $plugin_array['amilia_store_standings'] = plugins_url('shortcodes/amilia-store-standings.js', __FILE__).'?v='.AMILIA_STORE_PLUGIN_VERSION;
    185189    return $plugin_array;
    186190}
  • amilia-store/trunk/shortcodes/amilia-store-calendar.js

    r1997512 r1997526  
    241241      var tags = getSelectedTags();
    242242      var facilities = getSelectedFacilities();
    243       return '[' + SHORTCODE + " url='{url}' view='{view}' date='{date}' time='{time}' tags='{tags}' tagsfilter='{show-tags-filter}' facilities='{facilities}' facilitiesfilter='{show-facilities-filter}' showstaff='{show-staff}' showhidden='{show-hidden}' api='{api}']"
     243      return '[' + SHORTCODE + " url='{url}' view='{view}' date='{date}' time='{time}' tags='{tags}' tagsfilter='{show-tags-filter}' facilities='{facilities}' facilitiesfilter='{show-facilities-filter}' showstaff='{show-staff}' showhidden='{show-hidden}' api='{api}' version='{version}']"
    244244        .replace('{url}', storeUrl.value)
    245245        .replace('{view}', startView.value)
     
    252252        .replace('{show-staff}', showStaff.checked ? 1 : 0)
    253253        .replace('{show-hidden}', showHidden.checked ? 1 : 0)
    254         .replace('{api}', urlComponents ? urlComponents.apiUrl : '');
     254        .replace('{api}', urlComponents ? urlComponents.apiUrl : '')
     255        .replace('{version}', Amilia.pluginVersion);
    255256    }
    256257
  • amilia-store/trunk/shortcodes/amilia-store-calendar.php

    r1997512 r1997526  
    99        'view' => 'month',
    1010        'date' => '',
    11         'time' => '06:00:00',
     11        'time' => '',
    1212        'showstaff' => 0,
    1313        'showhidden' => 0,
    1414        'url' => 'https://www.amilia.com/store/en/usa-amilia-group/shop/products',
    15         'api' => 'https://www.amilia.com/PublicApi/usa-amilia-group/en/'
     15        'api' => 'https://www.amilia.com/PublicApi/usa-amilia-group/en/',
     16        'version' => '0'
    1617    ), $atts);
    1718
     
    3839    $label_ShowOfficials = __("Show officials", 'amilia-store');
    3940    $label_HideOfficials = __("Hide officials", 'amilia-store');
    40     $clientJSFile = plugins_url('amilia-store-calendar-client.js', __FILE__);
     41    $clientJSFile = plugins_url('amilia-store-calendar-client.js', __FILE__).'?v='.$a['version'];
    4142
    4243    $html = <<<EOD
  • amilia-store/trunk/shortcodes/amilia-store-iframe.js

    r1968084 r1997526  
    8585
    8686    function generateShortCode() {
    87       return '[' + SHORTCODE + " url='{url}' color='{color}']"
     87      return '[' + SHORTCODE + " url='{url}' color='{color}' version='{version}']"
    8888        .replace('{url}', storeUrl.value)
    89         .replace('{color}', Amilia.COLORS[color.value]);
     89        .replace('{color}', Amilia.COLORS[color.value])
     90        .replace('{version}', Amilia.pluginVersion);
    9091    }
    9192
  • amilia-store/trunk/shortcodes/amilia-store-standings.js

    r1996509 r1997526  
    257257      var subCategory = getSelectedSubCategory();
    258258      var tags = getSelectedTags();
    259       return '[' + SHORTCODE + " url='{url}' sport='{sport}' program='{program}' subcategory='{sub-category}' tags='{tags}' showhidden='{show-hidden}' showstaff='{show-staff}' show='{show}' api='{api}']"
     259      return '[' + SHORTCODE + " url='{url}' sport='{sport}' program='{program}' subcategory='{sub-category}' tags='{tags}' showhidden='{show-hidden}' showstaff='{show-staff}' show='{show}' api='{api}' version='{version}']"
    260260        .replace('{url}', storeUrl.value)
    261261        .replace('{sport}', sportSelect.value)
     
    266266        .replace('{show-staff}', showStaff.checked ? 1 : 0)
    267267        .replace('{show}', showSelect.value)
    268         .replace('{api}', urlComponents ? urlComponents.apiUrl : '');
     268        .replace('{api}', urlComponents ? urlComponents.apiUrl : '')
     269        .replace('{version}', Amilia.pluginVersion);
    269270    }
    270271
  • amilia-store/trunk/shortcodes/amilia-store-standings.php

    r1996509 r1997526  
    1111        'show' => 'standings,schedule',
    1212        'url' => 'https://www.amilia.com/store/en/usa-amilia-group/shop/products',
    13         'api' => 'https://www.amilia.com/PublicApi/usa-amilia-group/en/'
     13        'api' => 'https://www.amilia.com/PublicApi/usa-amilia-group/en/',
     14        'version' => '0'
    1415    ), $atts);
    1516
     
    2526    $showStaff = $a['showstaff'] == 1 ? 1 : 0;
    2627    $show = $a['show'];
    27     $clientJSFile = plugins_url('amilia-store-standings-client.js', __FILE__);
     28    $clientJSFile = plugins_url('amilia-store-standings-client.js', __FILE__).'?v='.$a['version'];
    2829
    2930    $lang = __("en", 'amilia-store');
  • amilia-store/trunk/shortcodes/amilia-store-table.js

    r1968084 r1997526  
    162162          columns = getCheckedColumns(),
    163163          urlComponents = Amilia.getUrlComponents(storeUrl.value);
    164       return '[' + SHORTCODE + " url='{url}' tags='{tags}' columns='{columns}' api='{api}']"
     164      return '[' + SHORTCODE + " url='{url}' tags='{tags}' columns='{columns}' api='{api}' version='{version}']"
    165165        .replace('{url}', storeUrl.value)
    166166        .replace('{tags}', tags.join(','))
    167167        .replace('{columns}', columns.join(','))
    168         .replace('{api}', urlComponents ? urlComponents.apiUrl : '');
     168        .replace('{api}', urlComponents ? urlComponents.apiUrl : '')
     169        .replace('{version}', Amilia.pluginVersion);
    169170    }
    170171
Note: See TracChangeset for help on using the changeset viewer.