Plugin Directory

Changeset 3094834

Timestamp:
05/29/2024 09:01:23 PM (2 months ago)
Author:
room34
Message:

Version 11.2.0

Location:
ics-calendar
Files:
144 added
4 edited

Legend:

Unmodified
Added
Removed
  • ics-calendar/trunk/changelog.txt

    r3091100 r3094834  
    11=== ICS Calendar Changelog ===
     2
     3
     4
     5
     6
     7
     8
     9
     10
     11
     12
     13
     14
    215
    316= 11.1.0 - 2024.05.22 =
  • ics-calendar/trunk/class-r34ics.php

    r3094815 r3094834  
    5353    protected $scripts_registered = false;
    5454   
    55     protected $list_style_views = array('basic', 'list');
    56 
    5755    protected $shortcode_defaults = array(
    5856        'ajax' => false,
     
    156154    protected $shortcode_dynamic_values = array('guid', 'startdate');
    157155   
     156
     157
     158
    158159   
    159160    public function __construct() {
     
    171172        $this->ical_legacy_path = $this->r34ics_path . $this->ical_legacy_path;
    172173        $this->event_legacy_path = $this->r34ics_path . $this->event_legacy_path;
    173         $this->list_style_views = apply_filters('r34ics_list_style_views', $this->list_style_views);
     174
     175        // Define allowed views (must load later so filters can be applied by other plugins)
     176        add_action('init', function() {
     177            $this->views = apply_filters('r34ics_views', $this->views);
     178            $this->list_style_views = apply_filters('r34ics_list_style_views', $this->list_style_views);
     179        }, 11);
    174180       
    175181        // WP settings
     
    17041710            'tz' => $tz,
    17051711            'url' => $url,
    1706             'view' => (
    1707                 (!empty($currentweek) || $view == 'currentweek') // Deprecated option
    1708                     ? 'week'
    1709                     : $view
    1710             ),
     1712            'view' => (in_array($view, (array)$this->views) ? $view : 'month'),
    17111713            'weeknumbers' => r34ics_boolean_check($weeknumbers),
    17121714            'whitetext' => r34ics_boolean_check($whitetext),
  • ics-calendar/trunk/ics-calendar.php

    r3094815 r3094834  
    44Plugin URI: https://icscalendar.com
    55Description: Turn your Google Calendar, Microsoft Office 365 or Apple iCloud Calendar into a seamlessly integrated, auto-updating, zero-maintenance WordPress experience.
    6 Version: 11.2.0-beta-1
     6Version: 11.2.0
    77Requires at least: 4.9
    88Requires PHP: 7.0
     
    3535
    3636
    37 // Load required files
    38 require_once(plugin_dir_path(__FILE__) . 'class-r34ics.php');
    39 require_once(plugin_dir_path(__FILE__) . 'functions.php');
    40 require_once(plugin_dir_path(__FILE__) . 'r34ics-ajax.php');
    41 
    42 
    43 // Backward compatibility for WP < 5.3
    44 if (!function_exists('wp_date')) {
    45     require_once(plugin_dir_path(__FILE__) . 'compatibility.php');
    46 }
    47 
    48 
    49 // Initialize plugin functionality
    50 add_action('plugins_loaded', 'r34ics_plugins_loaded');
    51 function r34ics_plugins_loaded() {
    52 
    53     // Instantiate class
    54     global $R34ICS;
    55     $R34ICS = new R34ICS();
     37// Check if embedded version is already been loaded, to prevent fatal error on activation
     38if (!class_exists('R34ICS')) {
    5639   
    57     // Load text domain
    58     load_plugin_textdomain('r34ics', false, basename(plugin_dir_path(__FILE__)) . '/i18n/languages/');
     40    // Load required files
     41    require_once(plugin_dir_path(__FILE__) . 'class-r34ics.php');
     42    require_once(plugin_dir_path(__FILE__) . 'functions.php');
     43    require_once(plugin_dir_path(__FILE__) . 'r34ics-ajax.php');
    5944   
    60     // Conditionally run update function
    61     if (is_admin() && version_compare(get_option('r34ics_version'), $R34ICS->version, '!=')) { r34ics_update(); }
    6245   
    63 }
    64 
    65 
    66 // Install
    67 register_activation_hook(__FILE__, 'r34ics_install');
    68 function r34ics_install() {
    69     global $R34ICS;
    70 
    71     // Flush rewrite rules
    72     flush_rewrite_rules();
    73    
    74     // Remember previous version
    75     $previous_version = get_option('r34ics_version');
    76     update_option('r34ics_previous_version', $previous_version);
    77    
    78     // Set version
    79     if (isset($R34ICS->version)) {
    80         update_option('r34ics_version', $R34ICS->version);
     46    // Backward compatibility for WP < 5.3
     47    if (!function_exists('wp_date')) {
     48        require_once(plugin_dir_path(__FILE__) . 'compatibility.php');
    8149    }
    8250   
    83     // New installation; write option to use new defaults
    84     if (empty($previous_version)) {
    85         update_option('r34ics_use_new_defaults_10_6', true);
    86     }
    87 
    88     // Prepare deferred admin notices
    89     $notices = get_option('r34ics_deferred_admin_notices', array());
    90 
    91     // Admin notice with link to settings
    92     $notices['r34ics_first_load'] = array(
    93         'content' => '<p>' . sprintf(__('Thank you for installing %1$s. Before creating your first calendar shortcode, please visit your %2$sGeneral Settings%3$s page and verify that your site language, timezone and date/time format settings are correct. See our %4$sUser Guide%5$s for more information.', 'r34ics'), '<strong>ICS Calendar</strong>', '<a href="' . admin_url('options-general.php') . '">', '</a>', '<a href="https://icscalendar.com/general-wordpress-settings/" target="_blank">', '</a>') . '</p>',
    94         'status' => 'info',
    95     );
    9651   
    97     // Save deferred admin notices
    98     update_option('r34ics_deferred_admin_notices', $notices);
    99 }
    100 
    101 
    102 // Updates
    103 function r34ics_update() {
    104     global $R34ICS;
    105 
    106     // Remember previous version
    107     $previous_version = get_option('r34ics_version');
    108     update_option('r34ics_previous_version', $previous_version);
     52    // Initialize plugin functionality
     53    add_action('plugins_loaded', 'r34ics_plugins_loaded');
     54    function r34ics_plugins_loaded() {
    10955   
    110     // Update version
    111     if (isset($R34ICS->version)) {
    112         update_option('r34ics_version', $R34ICS->version);
     56        // Instantiate class
     57        global $R34ICS;
     58        $R34ICS = new R34ICS();
     59       
     60        // Load text domain
     61        load_plugin_textdomain('r34ics', false, basename(plugin_dir_path(__FILE__)) . '/i18n/languages/');
     62       
     63        // Conditionally run update function
     64        if (is_admin() && version_compare(get_option('r34ics_version'), $R34ICS->version, '!=')) { r34ics_update(); }
     65       
    11366    }
    11467   
    115     // Version-specific updates
    116     // v. 6.11.1 renamed option from 'r34ics_transient_expiration' to 'r34ics_transient_expiration' so it's not a transient itself
    117     if (version_compare($previous_version, '6.11.1', '<')) {
    118         $transients_expiration = get_option('r34ics_transient_expiration') ? get_option('r34ics_transient_expiration') : 3600;
    119         update_option('r34ics_transients_expiration', $transients_expiration);
    120         delete_option('r34ics_transient_expiration');
     68   
     69    // Install
     70    register_activation_hook(__FILE__, 'r34ics_install');
     71    function r34ics_install() {
     72        global $R34ICS;
     73   
     74        // Flush rewrite rules
     75        flush_rewrite_rules();
     76       
     77        // Remember previous version
     78        $previous_version = get_option('r34ics_version');
     79        update_option('r34ics_previous_version', $previous_version);
     80       
     81        // Set version
     82        if (isset($R34ICS->version)) {
     83            update_option('r34ics_version', $R34ICS->version);
     84        }
     85       
     86        // New installation; write option to use new defaults
     87        if (empty($previous_version)) {
     88            update_option('r34ics_use_new_defaults_10_6', true);
     89        }
     90   
     91        // Prepare deferred admin notices
     92        $notices = get_option('r34ics_deferred_admin_notices', array());
     93   
     94        // Admin notice with link to settings
     95        $notices['r34ics_first_load'] = array(
     96            'content' => '<p>' . sprintf(__('Thank you for installing %1$s. Before creating your first calendar shortcode, please visit your %2$sGeneral Settings%3$s page and verify that your site language, timezone and date/time format settings are correct. See our %4$sUser Guide%5$s for more information.', 'r34ics'), '<strong>ICS Calendar</strong>', '<a href="' . admin_url('options-general.php') . '">', '</a>', '<a href="https://icscalendar.com/general-wordpress-settings/" target="_blank">', '</a>') . '</p>',
     97            'status' => 'info',
     98        );
     99       
     100        // Save deferred admin notices
     101        update_option('r34ics_deferred_admin_notices', $notices);
    121102    }
    122103   
    123     // v. 10.7.1 replaces "Load JS and CSS files on wp_enqueue_scripts action" option with check for block themes
    124     // Block themes support conditionally enqueuing JS and CSS when the page contains the ICS Calendar shortcode
    125     if (version_compare($previous_version, '10.7.1', '<')) {
    126         delete_option('r34ics_load_css_js_on_wp_enqueue_scripts');
     104   
     105    // Updates
     106    function r34ics_update() {
     107        global $R34ICS;
     108   
     109        // Remember previous version
     110        $previous_version = get_option('r34ics_version');
     111        update_option('r34ics_previous_version', $previous_version);
     112       
     113        // Update version
     114        if (isset($R34ICS->version)) {
     115            update_option('r34ics_version', $R34ICS->version);
     116        }
     117       
     118        // Version-specific updates
     119        // v. 6.11.1 renamed option from 'r34ics_transient_expiration' to 'r34ics_transient_expiration' so it's not a transient itself
     120        if (version_compare($previous_version, '6.11.1', '<')) {
     121            $transients_expiration = get_option('r34ics_transient_expiration') ? get_option('r34ics_transient_expiration') : 3600;
     122            update_option('r34ics_transients_expiration', $transients_expiration);
     123            delete_option('r34ics_transient_expiration');
     124        }
     125       
     126        // v. 10.7.1 replaces "Load JS and CSS files on wp_enqueue_scripts action" option with check for block themes
     127        // Block themes support conditionally enqueuing JS and CSS when the page contains the ICS Calendar shortcode
     128        if (version_compare($previous_version, '10.7.1', '<')) {
     129            delete_option('r34ics_load_css_js_on_wp_enqueue_scripts');
     130        }
     131   
     132        // Prepare deferred admin notices
     133        $notices = get_option('r34ics_deferred_admin_notices', array());
     134   
     135        // Admin notice about refactored R34ICS::_url_get_contents() method
     136        if (version_compare($previous_version, '11.0.0', '<')) {
     137            $notices['r34ics_refactoring_in_v_11'] = array(
     138                'content' => '<p>' . sprintf(__('%1$sPlease note:%2$s %3$s version 11.0 streamlines the way ICS feed URLs are retrieved. This change uses a standard built-in WordPress function, so it should be fully compatible with all existing installations. If you encounter any new issues after upgrading to version 11 or later, please visit the %4$sWordPress Support Forums%5$s for assistance.', 'r34ics'), '<strong>', '</strong>', 'ICS Calendar', '<a href="https://wordpress.org/support/plugin/ics-calendar/" target="_blank">', '</a>') . '</p>',
     139                'status' => 'info',
     140            );
     141        }
     142        else {
     143            unset($notices['r34ics_refactoring_in_v_11']);
     144        }
     145        // Admin notice about new default options
     146        if (version_compare($previous_version, '10.6.0', '<')) {
     147            $notices['r34ics_new_parameter_defaults_10_6'] = array(
     148                'content' => '<p>' . sprintf(__('%1$sPlease note:%2$s %3$s version 10.6 changes the default options for several shortcode settings. In order to maintain consistency, these new defaults are %4$snot%5$s enabled when upgrading from an earlier version. If you would like to learn more about the changes please read our %6$sblog post%7$s, or to switch to the new defaults, turn on the %8$s option on the %9$s settings%10$s page.', 'r34ics'), '<strong>', '</strong>', 'ICS Calendar', '<em>', '</em>', '<a href="https://icscalendar.com/updated-parameter-defaults-in-ics-calendar-10-6/" target="_blank">', '</a>', '<strong>' . __('Use new parameter defaults (v.10.6)', 'r34ics') . '</strong>', '<a href="' . esc_url(r34ics_get_admin_url('settings')) . '">ICS Calendar', '</a>') . '</p>',
     149                'status' => 'info',
     150            );
     151        }
     152        else {
     153            unset($notices['r34ics_new_parameter_defaults_10_6']);
     154        }
     155   
     156        // Save deferred admin notices
     157        update_option('r34ics_deferred_admin_notices', $notices);
     158   
     159        // Purge calendar transients
     160        r34ics_purge_calendar_transients();
     161       
    127162    }
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
    128179
    129     // Prepare deferred admin notices
    130     $notices = get_option('r34ics_deferred_admin_notices', array());
    131 
    132     // Admin notice about refactored R34ICS::_url_get_contents() method
    133     if (version_compare($previous_version, '11.0.0', '<')) {
    134         $notices['r34ics_refactoring_in_v_11'] = array(
    135             'content' => '<p>' . sprintf(__('%1$sPlease note:%2$s %3$s version 11.0 streamlines the way ICS feed URLs are retrieved. This change uses a standard built-in WordPress function, so it should be fully compatible with all existing installations. If you encounter any new issues after upgrading to version 11 or later, please visit the %4$sWordPress Support Forums%5$s for assistance.', 'r34ics'), '<strong>', '</strong>', 'ICS Calendar', '<a href="https://wordpress.org/support/plugin/ics-calendar/" target="_blank">', '</a>') . '</p>',
    136             'status' => 'info',
    137         );
    138     }
    139     else {
    140         unset($notices['r34ics_refactoring_in_v_11']);
    141     }
    142     // Admin notice about new default options
    143     if (version_compare($previous_version, '10.6.0', '<')) {
    144         $notices['r34ics_new_parameter_defaults_10_6'] = array(
    145             'content' => '<p>' . sprintf(__('%1$sPlease note:%2$s %3$s version 10.6 changes the default options for several shortcode settings. In order to maintain consistency, these new defaults are %4$snot%5$s enabled when upgrading from an earlier version. If you would like to learn more about the changes please read our %6$sblog post%7$s, or to switch to the new defaults, turn on the %8$s option on the %9$s settings%10$s page.', 'r34ics'), '<strong>', '</strong>', 'ICS Calendar', '<em>', '</em>', '<a href="https://icscalendar.com/updated-parameter-defaults-in-ics-calendar-10-6/" target="_blank">', '</a>', '<strong>' . __('Use new parameter defaults (v.10.6)', 'r34ics') . '</strong>', '<a href="' . esc_url(r34ics_get_admin_url('settings')) . '">ICS Calendar', '</a>') . '</p>',
    146             'status' => 'info',
    147         );
    148     }
    149     else {
    150         unset($notices['r34ics_new_parameter_defaults_10_6']);
    151     }
    152 
    153     // Save deferred admin notices
    154     update_option('r34ics_deferred_admin_notices', $notices);
    155 
    156     // Purge calendar transients
    157     r34ics_purge_calendar_transients();
    158    
    159180}
    160 
    161 
    162 // Deferred install/update admin notices
    163 add_action('admin_notices', 'r34ics_deferred_admin_notices');
    164 function r34ics_deferred_admin_notices() {
    165     if ($notices = get_option('r34ics_deferred_admin_notices', array())) {
    166         foreach ((array)$notices as $notice) {
    167             echo '<div class="notice notice-' . esc_attr($notice['status']) . ' is-dismissible r34ics-admin-notice"><div>' . wp_kses_post($notice['content']) . '</div></div>';
    168         }
    169     }
    170     delete_option('r34ics_deferred_admin_notices');
    171 }
    172 
    173 
    174 // Purge transients on certain option updates
    175 add_action('update_option_timezone_string', 'r34ics_purge_calendar_transients');
  • ics-calendar/trunk/readme.txt

    r3094815 r3094834  
    66Tested up to: 6.5.3
    77Requires PHP: 7.0
    8 Stable tag: 11.1.0
     8Stable tag: 11..0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    100100== Changelog ==
    101101
    102 = 11.2.0-beta-1 - 2024.05.29 =
     102= 11.2.0 - 2024.05.29 =
    103103
    104104* Admin:
     
    108108  * Added `fulldateintable` parameter. By default, month and list views show only the day number in the table on desktop breakpoints, and use the date format defined by the `format` parameter for mobile breakpoints. When `fulldateintable="true"` is set, the `format` value will be used to display the date in the table on desktop as well.
    109109* Miscellaneous:
     110
     111
    110112  * Modified loading logic to run `r34ics_update()` if the version number has *changed*, not just if it has increased.
    111113  * Updated protected properties of the `R34ICS` class.
Note: See TracChangeset for help on using the changeset viewer.