Plugin Directory

Changeset 3385477


Ignore:
Timestamp:
10/27/2025 09:39:43 PM (5 months ago)
Author:
room34
Message:

Version 11.7.0

Location:
ics-calendar
Files:
196 added
5 edited

Legend:

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

    r3376428 r3385477  
    11=== ICS Calendar Changelog ===
     2
     3= 11.7.0 - 2025.10.27 =
     4
     5* schema.org structured data: _BETA_
     6  * Added `jsonld` shortcode parameter (and related `r34ics_event2jsonld()` function) for adding [JSON-LD structured data](https://schema.org/Event) to calendar output. This is still a beta/experimental feature. We have confirmed that our generated test code passes [validation](https://validator.schema.org), but we need to observe some real-world testing to determine whether or not the output needs additional refinements to match Google's expectations for structured event data. This feature is _off_ by default. To use it, add `jsondl="true"` to your shortcode. And please send your [feedback](https://icscalendar.com/support/) on how it works for you! (See also [Google's documentation](https://developers.google.com/search/docs/appearance/structured-data/event).)
     7* Miscellaneous:
     8  * Bumped 'tested up to' to 6.9.
    29
    310= 11.6.0 - 2025.10.10 =
  • ics-calendar/trunk/class-r34ics.php

    r3376428 r3385477  
    9797            'htmltagtime' => '',
    9898            'htmltagtitle' => '',
     99            'jsonld' => false,
    99100            'legacyparser' => false, // Deprecated
    100101            'legendinline' => false, // Deprecated
     
    15851586   
    15861587        public function r34ics_display_calendar_after_render_template($view, $args, $ics_data) {
     1588            if (!empty($args['jsonld']) && !empty($ics_data['events'])) {
     1589                ?>
     1590                <script>
     1591                [
     1592                <?php
     1593                // @todo Find a less... "deep"... way to do this
     1594                ob_start();
     1595                foreach ((array)$ics_data['events'] as $year => $months) {
     1596                    foreach ((array)$months as $month => $days) {
     1597                        foreach ((array)$days as $day => $day_events) {
     1598                            foreach ((array)$day_events as $time => $events) {
     1599                                foreach ((array)$events as $event_key => $event) {
     1600                                    echo r34ics_event2jsonld($event) . ',';
     1601                                }
     1602                            }
     1603                        }
     1604                    }
     1605                }
     1606                echo rtrim(ob_get_clean(), ',');
     1607                ?>
     1608                ]
     1609                </script>
     1610                <?php
     1611            }
    15871612            return;
    15881613        }
     
    18311856                'hiderecurrence' => r34ics_hiderecurrence_parse($hiderecurrence),
    18321857                'hidetimes' => r34ics_boolean_check($hidetimes),
     1858                'jsonld' => r34ics_boolean_check($jsonld),
    18331859                'legacyparser' => r34ics_boolean_check($legacyparser), // Deprecated
    18341860                'legendinline' => false, // Deprecated
  • ics-calendar/trunk/functions.php

    r3364205 r3385477  
    529529
    530530
     531// Convert a single parsed event array to JSON-LD structured data format
     532// Conforms to specifications at: https://schema.org/Event
     533// More info: https://developers.google.com/search/docs/appearance/structured-data/event
     534function r34ics_event2jsonld($event) {
     535    // Don't return anything if this event is private or confidential
     536    if (!empty($event['class']) && in_array(strtoupper($event['class']), array('PRIVATE', 'CONFIDENTIAL'))) { return ''; }
     537   
     538    // Don't return anything if this event does not have a URL (required for Google's application of JSON-LD)
     539    if (empty($event['url'])) { return ''; }
     540
     541    // Assemble array to be converted to JSON
     542    $json_array = array(
     543        '@context' => 'https://schema.org',
     544        '@type' => 'Event',
     545    );
     546   
     547    // Core fields
     548    $json_array['name'] = wp_strip_all_tags($event['label']);
     549    $json_array['description'] = wp_strip_all_tags($event['eventdesc']);
     550    $json_array['startDate'] = r34ics_date('c', $event['dtstart']);
     551    $json_array['endDate'] = r34ics_date('c', $event['dtend']);
     552    $json_array['url'] = esc_url($event['url']);
     553    $json_array['identifier'] = wp_strip_all_tags($event['uid']);
     554   
     555    // Conditional fields
     556    if (!empty($event['attach'])) {
     557        // This is working with ICS Calendar's logic that incorporates an <img> tag
     558        if (strpos($event['attach'], '<img src=') !== false) {
     559            preg_match_all('/src="([^"]+)"/', $event['attach'], $img_src);
     560            $json_array['image'] = $img_src[1];
     561        }
     562    }
     563    if (!empty($event['location'])) {
     564        $json_array['location'] = array(
     565            '@type' => 'Place',
     566            'name' => wp_strip_all_tags(implode(', ', array_filter((array)$event['location']))), // @todo Break out address array
     567        );
     568    }
     569    if (!empty($event['organizer'])) {
     570        $json_array['organizer'] = array(
     571            '@type' => 'Organization',
     572            'name' => wp_strip_all_tags(implode(', ', array_filter((array)$event['organizer']))), // @todo Break out address array
     573        );
     574    }
     575    if (!empty($event['status']) && strtoupper($event['status']) == 'CANCELLED') {
     576        $json_array['eventStatus'] = 'https://schema.org/EventCancelled';
     577    }
     578   
     579    // Return array, converted to JSON
     580    return json_encode($json_array, JSON_UNESCAPED_SLASHES);
     581}
     582
     583
    531584// Generate dynamic feed colors CSS
    532585function r34ics_feed_colors_css($ics_data, $padding=false, $hover=false) {
  • ics-calendar/trunk/ics-calendar.php

    r3376428 r3385477  
    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.6.0
     6Version: 11.7.0
    77Requires at least: 4.9
    88Requires PHP: 7.2
  • ics-calendar/trunk/readme.txt

    r3376428 r3385477  
    44Tags: iCalendar, Google Calendar, Office 365, events, ICS feed
    55Requires at least: 4.9
    6 Tested up to: 6.8
     6Tested up to: 6.9
    77Requires PHP: 7.2
    8 Stable tag: 11.6.0
     8Stable tag: 11.7.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    9999
    100100== Changelog ==
     101
     102= 11.7.0 - 2025.10.27 =
     103
     104* schema.org structured data: _BETA_
     105  * Added `jsonld` shortcode parameter (and related `r34ics_event2jsonld()` function) for adding [JSON-LD structured data](https://schema.org/Event) to calendar output. This is still a beta/experimental feature. We have confirmed that our generated test code passes [validation](https://validator.schema.org), but we need to observe some real-world testing to determine whether or not the output needs additional refinements to match Google's expectations for structured event data. This feature is _off_ by default. To use it, add `jsondl="true"` to your shortcode. And please send your [feedback](https://icscalendar.com/support/) on how it works for you! (See also [Google's documentation](https://developers.google.com/search/docs/appearance/structured-data/event).)
     106* Miscellaneous:
     107  * Bumped 'tested up to' to 6.9.
    101108
    102109= 11.6.0 - 2025.10.10 =
Note: See TracChangeset for help on using the changeset viewer.