GV_Extension_Calendar_Feed
Source: includes/class-calendar-feed.php:24
Details
- Kind:
class - Namespace:
(global) - Extends: GFFeedAddOn
Methods
| Method | Description |
|---|---|
get_members_caps() | Lists this add-on's own capabilities in the Members plugin's UI. |
__construct() | Creates the add-on instance. |
get_instance() | Returns an instance of this class. |
get_form_fields_as_choices() | Adds our Entry Date and Entry Time options to the field mapping <select> dropdowns. |
is_admin() | Determines if the current request is for an administrative interface page; logic re-used from \GV\Request. |
is_gutenberg_editor() | Determines if the current page is a Gutenberg editor. |
get_min_suffix() | Returns the filename suffix for the plugin's minified assets. |
scripts() | Returns the scripts which should be enqueued. |
localize_admin_script() | Localizes the admin script that has been added via self::scripts(). |
styles() | Returns the stylesheets which should be enqueued. |
feed_settings_init() | Renders settings and adds calendar data inline in GF v2.5+ |
settings() | Renders settings and adds calendar data inline |
feed_settings_fields() | Configures the settings which should be rendered on the feed edit page in the Form Settings > Calendar Feed Add-On area. |
attach_file_to_notification() | Attach ics file to a notification. |
get_notifications_fields() | Get notifications fields for the feed. |
validate_html_content() | Validate type="text" fields that may contain HTML content on save. |
settings_button() | Output a <button> field in the feed settings |
get_shortcode_for_feed() | Returns shortcode for the current feed. |
settings_calendar_embed() | Adds Calendar Preview placeholder in GF v2.5+ |
settings_calendar_preview() | Adds Calendar Preview placeholder in GF v2.5+ |
single_setting_row_calendar_preview() | Adds Calendar Preview placeholder |
single_setting_row_select() | Overrides select row to check if it has a requirement |
single_setting_row_text() | Overrides text row to check if it has a requirement |
single_setting_row_calendar_options() | Overrides textarea row to check if it has a requirement |
render_requires() | Adds a data-requires attribute to the field |
settings_calendar_controls() | Render calendar control setting field markup |
settings_calendar_options() | Render calendar options setting field markup |
control_button_markup() | Returns markup for each control button type |
feed_list_columns() | Configures which columns should be displayed on the feed list page. |
get_column_value_shortcode() | Formats the value to be displayed in the shortcode column. |
get_column_value_previewlink() | Formats the value to be displayed in the preview column. |
is_rest_request() | Checks whether the current request is called from the Block Editor |
get_calendar_instance_options() | Gets calendar options that are used to configure each calendar instance. |
output_calendar_scripts() | Generates and outputs <script> tags for calendars. |
gv_calendar_clipboard_frontend_scripts() | Adds clipboard scripts for frontend use. |
output_calendar_styles() | Outputs styles for calendars. |
sanitize_height() | Normalizes a per-embed height into a value FullCalendar accepts. |
get_embed_height() | Returns the height one embed of a feed should render at. |
calendar_options() | Generates FullCalendar options data for the feed. |
get_feed() | Reduces queries by only fetching feeds from the database once per request. |
user_has_edit_roles() | Checks whether the user has required roles for editing events. |
generate_controls_option() | Generates array of control data based on settings value. |
calendar_events() | Returns event data, or sample data when none exists. |
calendar_events_for_entry() | Returns the event for a single entry, if the feed has one for it. |
validate_event_url() | Validates the event URL. |
set_origin_post_id() | Sets the page single entry event URLs should point back to. |
maybe_use_calendar_origin_back_link() | Points the single entry back link to the calendar page the visitor came from. |
map_fields() | Maps fields from settings. |
get_sample_events() | Generates some sample events to display. |
get_fc_locales() | Returns an array of available FullCalendar locales and, where available, their WP equivalent. |
get_roles_as_choices() | Returns roles as a choices list for use with Event Editing. |
get_menu_icon() | Returns calendar icon for the form settings menu. |
feed_list_no_item_message() | {@inheritdoc} |
empty_feeds_message_string() | Generates an empty feeds message with a dynamic URL. |
is_feed_edit_page() | Determines if the current view is the screen for editing a form's feed settings.. |
is_feed_list_page() | |
define_gform_hooks_before_gravityforms_script() | Attaches Gravity Forms' JavaScript hook API to the front of gravityforms.js on the feed settings screen. |
register_noconflict_scripts() | |
register_noconflict_styles() | |
register_routes() | Registers REST API routes. |
proxy_icalendar_feed() | Regenerates calendar feed from url to avoid CORS policy error. |
ics_export_route() | Exports calendar feed REST route. |
discard_cached_ics_on_save() | Discards a feed's cached calendar when its settings are saved. |
invalidate_on_entry_status_change() | Discards affected calendars when an entry is trashed, spammed or restored. |
invalidate_on_entry_saved() | Invalidates a feed's calendar after an entry is saved from an editing screen. |
invalidate_on_inline_edit() | Invalidates a feed's calendar after GravityEdit changes an entry in place. |
invalidate_on_revision_restored() | Invalidates a feed's calendar after GravityRevisions restores an entry. |
invalidate_on_revision_restored_legacy() | Invalidates a feed's calendar on a GravityRevisions without the restore action. |
invalidate_on_entry_deleted() | Discards affected calendars when an entry is removed. |
discard_cached_ics_on_feed_toggle() | Discards a feed's stored calendar when it is activated or deactivated. |
discard_cached_ics_on_feed_delete() | Discards a feed's stored calendar before the feed itself is deleted. |
mark_ics_cache_stale() | Records that a feed's stored calendar no longer reflects its entries. |
is_ics_cache_stale() | Whether a feed's entries have changed since its calendar was built. |
invalidate_feeds_for_entry() | Marks every feed an entry can appear in as stale. |
get_ics_cache_file() | Returns the path of the file holding a feed's generated calendar. |
get_cached_ics_body() | Returns a feed's cached calendar, if one is present and still current. |
may_serve_stored_calendar() | Whether a request may answer with the stored calendar instead of building one. |
read_ics_cache() | Returns a feed's stored calendar whatever its age. |
store_ics_body() | Stores a feed's generated calendar for subsequent requests to serve. |
delete_ics_cache() | Discards a feed's cached calendar so the next request rebuilds it. |
generate_ics_file() | Generates an ICS file for calendar feed. |
maybe_display_helpscout_beacon() | Conditionally displays Help Scout beacon on certain pages. |
is_secure() | Whether the provided feed is secured. |
get_validation_secret() | Calculates and returns the calendar feed's validation secret. |
is_valid_secret() | Returns whether the provided secret validates for a calendar feed. |
logger() | Returns the logger for this plugin. |
Method Reference
get_members_caps()
public function get_members_caps()
Lists this add-on's own capabilities in the Members plugin's UI.
\GFAddOn::get_members_caps() only lists the form settings and uninstall capabilities
when they are stored as strings, and both are arrays here so that a second capability can act
as a fallback. Without this override they vanish from Members, leaving a site owner no way to
grant a role calendar access — which is the one manual remedy for anyone the fallback misses.
Returns
array— Capability name => label, as Members expects.
Since: 2.22.0
Source: includes/class-calendar-feed.php:96
__construct()
public function __construct()
Creates the add-on instance.
Throws
Exception
Since: 1.5.7
Source: includes/class-calendar-feed.php:258
get_instance()
public static function get_instance()
Returns an instance of this class.
Returns
Since: 1.0.0
Source: includes/class-calendar-feed.php:302
get_form_fields_as_choices()
public function get_form_fields_as_choices( $form, $args=[] )
Adds our Entry Date and Entry Time options to the field mapping <select> dropdowns.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | ||
$args | array | [] |
Returns
array
Since: 1.2
Source: includes/class-calendar-feed.php:321
is_admin()
public function is_admin()
Determines if the current request is for an administrative interface page; logic re-used from \GV\Request.
Returns
boolean
Since: 1.5.1
Source: includes/class-calendar-feed.php:410
is_gutenberg_editor()
public function is_gutenberg_editor()
Determines if the current page is a Gutenberg editor.
Returns
boolean
Since: 1.5.1
Source: includes/class-calendar-feed.php:424
get_min_suffix()
public static function get_min_suffix()
Returns the filename suffix for the plugin's minified assets.
Returns
string—.min, or an empty string whenSCRIPT_DEBUGor?gform_debugasks for the sources.
Since: 2.22.0
Source: includes/class-calendar-feed.php:441
scripts()
public function scripts()
Returns the scripts which should be enqueued.
Returns
array
Since: 1.0.0
Source: includes/class-calendar-feed.php:452
localize_admin_script()
public function localize_admin_script()
Localizes the admin script that has been added via self::scripts().
Returns
void
Source: includes/class-calendar-feed.php:566
styles()
public function styles( $options=[] )
Returns the stylesheets which should be enqueued.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$options | [] |
Returns
array
Since: 1.0.0
Source: includes/class-calendar-feed.php:582
feed_settings_init()
public function feed_settings_init()
Renders settings and adds calendar data inline in GF v2.5+
Returns
void
Since: 1.4
Source: includes/class-calendar-feed.php:637
settings()
public function settings( $sections=[] )
Renders settings and adds calendar data inline
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$sections | array | [] | Configuration array containing all fields to be rendered grouped into sections |
Returns
void
Since: 1.0.0
Source: includes/class-calendar-feed.php:653
feed_settings_fields()
public function feed_settings_fields()
Configures the settings which should be rendered on the feed edit page in the Form Settings > Calendar Feed Add-On area.
Returns
array
Since: 1.0.0
Source: includes/class-calendar-feed.php:802
attach_file_to_notification()
public function attach_file_to_notification( $notification, $form, $entry )
Attach ics file to a notification.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$notification | array | ||
$form | array | ||
$entry | array |
Returns
array
Source: includes/class-calendar-feed.php:1785
get_notifications_fields()
public function get_notifications_fields()
Get notifications fields for the feed.
Returns
array
Source: includes/class-calendar-feed.php:1872
validate_html_content()
public function validate_html_content( $field, $value )
Validate type="text" fields that may contain HTML content on save.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | Text | Setting field being validated. | |
$value | string | Value of the setting field. |
Since: 2.13.0
Source: includes/class-calendar-feed.php:1932
settings_button()
public function settings_button( $field, $echo=true )
Output a <button> field in the feed settings
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | Field configuration array | |
$echo | bool | true |
Returns
string— HTML output for the <button>
Source: includes/class-calendar-feed.php:1998
get_shortcode_for_feed()
public function get_shortcode_for_feed( array $feed=[] ): string
Returns shortcode for the current feed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | [] | The feed to get the shortcode for. |
Returns
string— The shortcode.
Since: 2.6
Source: includes/class-calendar-feed.php:2032
settings_calendar_embed()
public function settings_calendar_embed( $field=[] )
Adds Calendar Preview placeholder in GF v2.5+
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | [] | Section field data |
Returns
void
Since: 2.0
Source: includes/class-calendar-feed.php:2069
settings_calendar_preview()
public function settings_calendar_preview( $field=[] )
Adds Calendar Preview placeholder in GF v2.5+
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | [] | Section field data |
Returns
void
Since: 1.4
Source: includes/class-calendar-feed.php:2106
single_setting_row_calendar_preview()
public function single_setting_row_calendar_preview( $field=[] )
Adds Calendar Preview placeholder
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | [] | Section field data |
Returns
void
Since: 1.0.0
Source: includes/class-calendar-feed.php:2119
single_setting_row_select()
public function single_setting_row_select( $field )
Overrides select row to check if it has a requirement
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | field data |
Returns
void
Since: 1.0.0
Source: includes/class-calendar-feed.php:2140
single_setting_row_text()
public function single_setting_row_text( $field )
Overrides text row to check if it has a requirement
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | field data |
Returns
void
Since: 1.0.0
Source: includes/class-calendar-feed.php:2159
single_setting_row_calendar_options()
public function single_setting_row_calendar_options( $field )
Overrides textarea row to check if it has a requirement
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | field data |
Returns
void
Since: 1.0.0
Source: includes/class-calendar-feed.php:2180
render_requires()
public function render_requires( $field=[] )
Adds a data-requires attribute to the field
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | [] | field data |
Returns
void
Since: 1.0.0
Source: includes/class-calendar-feed.php:2201
settings_calendar_controls()
public function settings_calendar_controls( $field=[] )
Render calendar control setting field markup
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | [] | Array of field data |
Returns
void
Since: 1.0.0
Source: includes/class-calendar-feed.php:2248
settings_calendar_options()
public function settings_calendar_options( $field=[], $echo=true )
Render calendar options setting field markup
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | array | [] | Array of field data |
$echo | true |
Returns
string— HTML of the "calendar_options" field type
Since: 1.0.0
Source: includes/class-calendar-feed.php:2465
control_button_markup()
public function control_button_markup( $type='', $echo=true )
Returns markup for each control button type
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$type | string | '' | Type of control button |
$echo | boolean | true | Echo markup or return |
Returns
mixed— Echo markup if $echo is true, otherwise return markup
Since: 1.0.0
Source: includes/class-calendar-feed.php:2498
feed_list_columns()
public function feed_list_columns()
Configures which columns should be displayed on the feed list page.
Returns
array
Since: 1.0.0
Source: includes/class-calendar-feed.php:2552
get_column_value_shortcode()
public function get_column_value_shortcode( $feed )
Formats the value to be displayed in the shortcode column.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | false | The feed being included in the feed list. False if we are in a new feed. |
Returns
string
Since: 1.0.0
Source: includes/class-calendar-feed.php:2573
get_column_value_previewlink()
public function get_column_value_previewlink( $feed )
Formats the value to be displayed in the preview column.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | The feed being included in the feed list. |
Returns
string
Since: 1.0.0
Source: includes/class-calendar-feed.php:2589
is_rest_request()
public function is_rest_request()
Checks whether the current request is called from the Block Editor
Returns
bool— True: doing a REST request; false: not doing a REST request.
See Also
Since: 1.0.0
Source: includes/class-calendar-feed.php:2606
get_calendar_instance_options()
public function get_calendar_instance_options( $feed_id=0, $form_id=0, $view_id=0, $height='' )
Gets calendar options that are used to configure each calendar instance.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | 0 | View ID. |
$form_id | int | 0 | ID of the form. |
$view_id | 0 | ||
$height | mixed | '' | Per-embed height override. Empty means the feed's own Sizing/Height settings decide. |
Returns
array[]
Since:
1.5.12.22.0(Added the $height parameter.)
Source: includes/class-calendar-feed.php:2623
output_calendar_scripts()
public function output_calendar_scripts( $feed_id=0, $form_id=0, $view_id=0, $height='' )
Generates and outputs <script> tags for calendars.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | 0 | Feed ID. |
$form_id | int | 0 | ID of the form. |
$view_id | int | 0 | View ID. |
$height | mixed | '' | Per-embed height override. Empty means the feed's own Sizing/Height settings decide. |
Returns
void
Since:
1.0.01.5(Added $view_id parameter.)2.22.0(Added $height parameter.)
Source: includes/class-calendar-feed.php:2855
gv_calendar_clipboard_frontend_scripts()
public static function gv_calendar_clipboard_frontend_scripts()
Adds clipboard scripts for frontend use.
Returns
void
Since: 2.0
Source: includes/class-calendar-feed.php:2898
output_calendar_styles()
public function output_calendar_styles( $feed_id=0 )
Outputs styles for calendars.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | 0 | Feed ID. |
Returns
void
Since:
1.0.01.5(Added $view_id parameter.)
Source: includes/class-calendar-feed.php:2945
sanitize_height()
public static function sanitize_height( $height )
Normalizes a per-embed height into a value FullCalendar accepts.
The value reaches FullCalendar as height, which it writes into the calendar element's inline
style, and it is echoed back as the element's data-height attribute. Both are why this is a
whitelist rather than a filter: only a number with an optional CSS length unit, or the keyword
auto, survives. Anything carrying a space, semicolon, quote, bracket, parenthesis or a
function call (calc(), expression(), url()) fails the pattern and returns an empty
string, which every caller reads as "no override — use the feed's own setting".
A bare number is normalized to pixels. FullCalendar accepts an integer as pixels but assigns a
plain string straight to style.height, where "400" is invalid CSS and silently does nothing.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$height | mixed | Raw height, from a shortcode attribute, block attribute or widget setting. |
Returns
string— A FullCalendar height value, or an empty string when there is no usable override.
Since: 2.22.0
Source: includes/class-calendar-feed.php:2985
get_embed_height()
public function get_embed_height( $feed_id=0, $height='' )
Returns the height one embed of a feed should render at.
A height on the embed implies fixed sizing. Sizing is a feed-level setting that defaults to
auto and is not exposed per placement, so deferring to it would make an override a silent
no-op on every feed whose Sizing was never switched to Fixed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | 0 | Feed ID. |
$height | mixed | '' | Per-embed height override. Empty means the feed's own settings decide. |
Returns
string— A FullCalendar height value. Never empty;autowhen nothing sets a height.
Since: 2.22.0
Source: includes/class-calendar-feed.php:3024
calendar_options()
public function calendar_options( $feed_id=0, $height='' )
Generates FullCalendar options data for the feed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | integer | 0 | Feed ID. |
$height | mixed | '' | Per-embed height override. Empty means the feed's own Sizing/Height settings decide. |
Returns
array— Array of options data.
Since:
1.0.02.22.0(Added the $height parameter.)
Source: includes/class-calendar-feed.php:3053
get_feed()
public function get_feed( $id )
Reduces queries by only fetching feeds from the database once per request.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$id | int | Feed ID. |
Returns
array|false
Since: 2.5
Source: includes/class-calendar-feed.php:3155
user_has_edit_roles()
public function user_has_edit_roles( $edit_roles=[] )
Checks whether the user has required roles for editing events.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$edit_roles | array | [] | Array of role keys. |
Returns
bool— True: user can edit events.
Since: 1.0.0
Source: includes/class-calendar-feed.php:3178
generate_controls_option()
public function generate_controls_option( $location='header', $controls_settings=[] )
Generates array of control data based on settings value.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$location | string | 'header' | Location name. |
$controls_settings | array | [] | Control settings values. |
Returns
array|false— Array of setting data or false if not set.
Since: 1.0.0
Source: includes/class-calendar-feed.php:3210
calendar_events()
public function calendar_events( $feed_id=0, $from_date=null, $to_date=null )
Returns event data, or sample data when none exists.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | integer | 0 | ID of the calendar feed. |
$from_date | string | false | null | null | Start date timestamp used to filter events. False if error creating timestamp. Null if not set. |
$to_date | string | false | null | null | End date timestamp used to filter events. False if error creating timestamp. Null if not set. |
Returns
array— Array of event data.
Throws
Exception
Since:
1.0.01.5(Added $from_date and $to_date parameters.)
Source: includes/class-calendar-feed.php:3258
calendar_events_for_entry()
public function calendar_events_for_entry( $feed_id=0, $entry_id=0 )
Returns the event for a single entry, if the feed has one for it.
Produces the same event \calendar_events would, narrowed to the one entry while
the entries are read rather than after every event has been built. A per-entry download
and a notification attachment each need one event out of a calendar that can hold
thousands, and building the rest of it costs ~30 ms an entry that nobody reads.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | 0 | ID of the calendar feed. |
$entry_id | int | 0 | ID of the entry to build the event from. |
Returns
array— The entry's event data as a single-element array, empty when it has none.
Throws
Exception
Since: 2.21.0
Source: includes/class-calendar-feed.php:3279
validate_event_url()
public function validate_event_url( $field, $event_url )
Validates the event URL.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | Text | The field object. | |
$event_url | string | The URL to validate. |
Returns
void
Since: 2.11.0
Source: includes/class-calendar-feed.php:3869
set_origin_post_id()
public function set_origin_post_id( $post_id )
Sets the page single entry event URLs should point back to.
Only calendar rendering and the calendar events AJAX endpoint set this; other flows that build event URLs (ICS export, notification attachments) must leave it at 0.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$post_id | mixed | Post ID of the page displaying the calendar. |
Returns
void
Since: 2.18.0
Source: includes/class-calendar-feed.php:3994
maybe_use_calendar_origin_back_link()
public function maybe_use_calendar_origin_back_link( $href, $context=null )
Points the single entry back link to the calendar page the visitor came from.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$href | string | Existing back link URL. | |
$context | \GV\Template_Context | null | null | The template context. |
Returns
string— Back link URL.
Since: 2.18.0
Source: includes/class-calendar-feed.php:4008
map_fields()
public function map_fields( $feed=[], $entry=false )
Maps fields from settings.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | [] | Array of feed settings. |
$entry | array | false | Form entry. |
Returns
array— Array of mapped fields, filtered for empty status.
Since: 1.0.0
Source: includes/class-calendar-feed.php:4109
get_sample_events()
public function get_sample_events( $meta=null )
Generates some sample events to display.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$meta | string | null | null | Metadata to add to each sample event. |
Returns
array— Array of sample event data.
Since: 1.0.0
Source: includes/class-calendar-feed.php:4138
get_fc_locales()
public function get_fc_locales()
Returns an array of available FullCalendar locales and, where available, their WP equivalent.
Returns
array[]— FullCalendar locales.
Since: 1.3
Source: includes/class-calendar-feed.php:4220
get_roles_as_choices()
public function get_roles_as_choices()
Returns roles as a choices list for use with Event Editing.
Returns
array[]— Each user role has alabelandvalue.
Since: 1.0.0
Source: includes/class-calendar-feed.php:4645
get_menu_icon()
public function get_menu_icon()
Returns calendar icon for the form settings menu.
Returns
string
Since: 1.5
Source: includes/class-calendar-feed.php:4671
feed_list_no_item_message()
public function feed_list_no_item_message(): string
{@inheritdoc}
Returns
string
Since: 2.9.0
Source: includes/class-calendar-feed.php:4682
empty_feeds_message_string()
public function empty_feeds_message_string(): string
Generates an empty feeds message with a dynamic URL.
Returns
string— The message string with the URL.
Since: 2.9.0
Source: includes/class-calendar-feed.php:4700
is_feed_edit_page()
public function is_feed_edit_page()
Determines if the current view is the screen for editing a form's feed settings..
Returns
bool
Since: 1.5.7
Source: includes/class-calendar-feed.php:4735
is_feed_list_page()
public function is_feed_list_page()
Returns
bool
Since: 2.2
Source: includes/class-calendar-feed.php:4750
define_gform_hooks_before_gravityforms_script()
public function define_gform_hooks_before_gravityforms_script()
Attaches Gravity Forms' JavaScript hook API to the front of gravityforms.js on the feed settings screen.
gforms_hooks.js defines gform.addFilter() and gform.applyFilters() only if ( ! gform ), and
every Gravity Forms bundle opens with var gform = window.gform || {}, so the hook API exists only
when that file runs before the first bundle. Gravity Forms prints it in front of
gform_gravityforms_libraries, assuming that is the first bundle on an admin screen. On this screen
it is not: the add-on framework enqueues gform_form_admin before Gravity Forms enqueues its own admin
scripts, so gravityforms.js prints first, defines an empty gform, and the hook file becomes a
no-op. The merge tag script then throws on gform.applyFilters before attaching a picker to any field.
Attaching the same code to gform_gravityforms with before prints it immediately ahead of
gravityforms.js wherever WordPress places that script, which is what Gravity Forms itself does on the
front end. Its own copy still prints later and hits the guard, which is what the guard is for.
Returns
void
See Also
\GFForms::load_hooks_with_inline_script()Where Gravity Forms picks the script it attaches to.
Since: 2.22.0
Source: includes/class-calendar-feed.php:4775
register_noconflict_scripts()
public function register_noconflict_scripts( $scripts )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$scripts |
Since: 1.5.7
Source: includes/class-calendar-feed.php:4810
register_noconflict_styles()
public function register_noconflict_styles( $styles )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$styles |
Since: 1.5.7
Source: includes/class-calendar-feed.php:4822
register_routes()
public function register_routes()
Registers REST API routes.
Returns
void
Source: includes/class-calendar-feed.php:4834
proxy_icalendar_feed()
public function proxy_icalendar_feed( $request )
Regenerates calendar feed from url to avoid CORS policy error.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$request | \WP_REST_Request |
Returns
void|mixed
Source: includes/class-calendar-feed.php:4880
ics_export_route()
public function ics_export_route( $data )
Exports calendar feed REST route.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$data | array |
Returns
void| WP_Error
Source: includes/class-calendar-feed.php:4988
discard_cached_ics_on_save()
public function discard_cached_ics_on_save( $feed_id, $form_id, $settings, $addon )
Discards a feed's cached calendar when its settings are saved.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | bool | Saved feed ID, or false when the save failed. | |
$form_id | int | Form ID. | |
$settings | array | Saved settings. | |
$addon | object | Add-on instance. |
Returns
void
Since: 2.21.0
Source: includes/class-calendar-feed.php:5034
invalidate_on_entry_status_change()
public function invalidate_on_entry_status_change( $entry_id, $status, $previous_status )
Discards affected calendars when an entry is trashed, spammed or restored.
The hook fires after the write, so reading the entry back reports the new status and a trashed entry would look as though it had never been in the calendar. The previous value is what says whether it was.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry_id | int | Entry ID. | |
$status | string | Status after the change. | |
$previous_status | string | Status before it. |
Returns
void
Since: 2.21.0
Source: includes/class-calendar-feed.php:5057
invalidate_on_entry_saved()
public function invalidate_on_entry_saved( $form, $entry_id, $original_entry=[] )
Invalidates a feed's calendar after an entry is saved from an editing screen.
Gravity Forms' entry detail screen and GravityView's Edit Entry both write through GFFormsModel::save_lead(), which fires no entry hook at all — this action is the whole announcement. GravityView's bulk edit writes fields directly and then fires it by hand, so those arrive here too. Where gform_post_update_entry also fires, the second call is a no-op: a feed already stale is not marked again.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | Form the entry belongs to. | |
$entry_id | int | Entry that was saved. | |
$original_entry | array | [] | Entry before the save, where the caller provides it. |
Returns
void
Since: 2.21.0
Source: includes/class-calendar-feed.php:5090
invalidate_on_inline_edit()
public function invalidate_on_inline_edit( $result, $entry, $form_id=0, $field=null, $original_entry=[] )
Invalidates a feed's calendar after GravityEdit changes an entry in place.
GravityEdit removes every gform_post_update_entry action before its own update, so this filter is the only thing left that reports the change. Its value is passed through untouched: this reads the result, it does not decide it.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$result | bool | WP_Error | Whether the entry was updated. | |
$entry | array | Entry after the change. | |
$form_id | int | 0 | Form ID. |
$field | GF_Field | null | null | Field that changed, or null for entry meta. |
$original_entry | array | [] | Entry before the change. |
Returns
bool| WP_Error — The result, unchanged.
Since: 2.21.0
Source: includes/class-calendar-feed.php:5117
invalidate_on_revision_restored()
public function invalidate_on_revision_restored( $entry_id, $prior_entry=[], $restored=[] )
Invalidates a feed's calendar after GravityRevisions restores an entry.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry_id | int | Entry that was restored. | |
$prior_entry | array | [] | Entry before the restore. |
$restored | array | [] | Entry as restored. |
Returns
void
Since: 2.21.0
Source: includes/class-calendar-feed.php:5137
invalidate_on_revision_restored_legacy()
public function invalidate_on_revision_restored_legacy( $add_new, $prior_entry=[], $restored=[] )
Invalidates a feed's calendar on a GravityRevisions without the restore action.
Released versions announce nothing after restoring an entry, and they remove every gform_post_update_entry action before writing it — so on those sites a restored event would sit outside the calendar until the lifetime lapsed. This filter runs immediately after the restore is written, which makes it the only signal those sites can give. Its value is passed through untouched: whether a revision is added is not this plugin's decision.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$add_new | bool | Whether GravityRevisions will store the prior state. | |
$prior_entry | array | [] | Entry before the restore. |
$restored | array | [] | Entry as restored, without its id and status. |
Returns
bool— The value, unchanged.
Since: 2.21.0
Source: includes/class-calendar-feed.php:5165
invalidate_on_entry_deleted()
public function invalidate_on_entry_deleted( $entry_id )
Discards affected calendars when an entry is removed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry_id | int | array | Entry ID, or the entry itself. |
Returns
void
Since: 2.21.0
Source: includes/class-calendar-feed.php:5184
discard_cached_ics_on_feed_toggle()
public function discard_cached_ics_on_feed_toggle( $feed_id, $active, $addon=null )
Discards a feed's stored calendar when it is activated or deactivated.
A deactivated feed is skipped by the route, so its stored calendar is unreachable until it comes back — at which point the calendar it kept may be months old.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | Feed ID. | |
$active | bool | New state. | |
$addon | object | null | Add-on instance. |
Returns
void
Since: 2.21.0
Source: includes/class-calendar-feed.php:5208
discard_cached_ics_on_feed_delete()
public function discard_cached_ics_on_feed_delete( $feed_id, $addon=null )
Discards a feed's stored calendar before the feed itself is deleted.
Deleted last, nothing would ever reclaim the file: the cache path is derived from the feed ID, and no request can arrive for a feed that no longer exists.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | Feed ID. | |
$addon | object | null | Add-on instance. |
Returns
void
Since: 2.21.0
Source: includes/class-calendar-feed.php:5229
mark_ics_cache_stale()
public function mark_ics_cache_stale( $feed_id )
Records that a feed's stored calendar no longer reflects its entries.
Writes nothing when there is no stored calendar, and nothing when the feed is already stale. An import changes thousands of entries; without that second guard the invalidation would cost more than the rebuild it defers.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | Feed ID. |
Returns
bool— Whether this call recorded the change.
Since: 2.21.0
Source: includes/class-calendar-feed.php:5287
is_ics_cache_stale()
public function is_ics_cache_stale( $feed_id )
Whether a feed's entries have changed since its calendar was built.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | Feed ID. |
Returns
bool
Since: 2.21.0
Source: includes/class-calendar-feed.php:5313
invalidate_feeds_for_entry()
public function invalidate_feeds_for_entry( $entry, $original=null )
Marks every feed an entry can appear in as stale.
Checked before and after the change: an entry that stops qualifying has left the calendar, and a calendar still listing it is as wrong as one missing a new entry.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | array | Entry after the change, or the deleted entry. | |
$original | array | null | null | Entry before the change, where one exists. |
Returns
void
Since: 2.21.0
Source: includes/class-calendar-feed.php:5357
get_ics_cache_file()
public function get_ics_cache_file( $feed_id )
Returns the path of the file holding a feed's generated calendar.
Named from a private hash rather than the feed's public URL hash: the REST route re-checks on every request that the feed still exists and is still enabled, and a guessable path would keep serving a calendar after either stopped being true.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | Feed ID. |
Returns
string— Absolute path, or an empty string where uploads are unavailable.
Since: 2.21.0
Source: includes/class-calendar-feed.php:5568
get_cached_ics_body()
public function get_cached_ics_body( $feed_id )
Returns a feed's cached calendar, if one is present and still current.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | Feed ID. |
Returns
string|null— Calendar body, or null when there is nothing current to serve.
Since: 2.21.0
Source: includes/class-calendar-feed.php:5593
may_serve_stored_calendar()
public function may_serve_stored_calendar( $feed_id )
Whether a request may answer with the stored calendar instead of building one.
A current copy is always served. An out-of-date copy is served too, with the rebuild following the response: a subscriber polling every fifteen minutes is better served slightly-old events now than correct events after a timeout. That trade needs something to run the rebuild once the response has gone, which is fastcgi_finish_request(). Where it is missing the out-of-date copy is refused and the request rebuilds inline, as it did before the stored copy existed. Serving it anyway would leave nothing to rebuild the calendar at all, and the subscription would answer with its first build forever.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | Feed ID. |
Returns
bool
Since: 2.21.0
Source: includes/class-calendar-feed.php:5614
read_ics_cache()
public function read_ics_cache( $feed_id )
Returns a feed's stored calendar whatever its age.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | Feed ID. |
Returns
string|null— Calendar body, or null when there is nothing stored or it cannot be read.
Since: 2.21.0
Source: includes/class-calendar-feed.php:5648
store_ics_body()
public function store_ics_body( $feed_id, $body, $built_at=null )
Stores a feed's generated calendar for subsequent requests to serve.
Written to a sibling temporary file and renamed into place. Rename within a directory is atomic, so a subscriber reading concurrently sees either the previous complete calendar or the new one, never a partial write.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | Feed ID. | |
$body | string | Calendar body. | |
$built_at | int | null | null | When the build read its data; stamped as the file's mtime and compared against the stale marker so a change raised mid-build is not cleared. Null skips both. |
Returns
bool— Whether the calendar was stored.
Since: 2.21.0
Source: includes/class-calendar-feed.php:5912
delete_ics_cache()
public function delete_ics_cache( $feed_id )
Discards a feed's cached calendar so the next request rebuilds it.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_id | int | Feed ID. |
Returns
void
Since: 2.21.0
Source: includes/class-calendar-feed.php:6072
generate_ics_file()
public function generate_ics_file( $feed, $download=false, $single_entry=false )
Generates an ICS file for calendar feed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | ||
$download | boolean | false | |
$single_entry | integer | false |
Returns
void|string| WP_Error
Source: includes/class-calendar-feed.php:6166
maybe_display_helpscout_beacon()
public function maybe_display_helpscout_beacon( $display )
Conditionally displays Help Scout beacon on certain pages.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$display | bool |
Returns
bool
Since: 2.2
Source: includes/class-calendar-feed.php:6679
is_secure()
final public function is_secure( array $feed ): bool
Whether the provided feed is secured.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | The feed object. |
Returns
bool
Since: 2.6
Source: includes/class-calendar-feed.php:6696
get_validation_secret()
final public function get_validation_secret( array $feed, $skip_feed_security_check=false ): ?string
Calculates and returns the calendar feed's validation secret.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | The feed object. | |
$skip_feed_security_check | bool | false | Whether to skip the security check. Default is false. |
Returns
string|null— The calendar feed's secret.
Throws
InvalidArgumentException— When the feed object is not valid.
Since: 2.6
Source: includes/class-calendar-feed.php:6716
is_valid_secret()
final public function is_valid_secret( array $feed, string $secret ): bool
Returns whether the provided secret validates for a calendar feed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | The feed object. | |
$secret | string | The provided secret. |
Returns
bool
Throws
InvalidArgumentException— When the feed object is not valid.
Since: 2.6
Source: includes/class-calendar-feed.php:6754
logger()
final public static function logger()
Returns the logger for this plugin.
Returns
LoggerInterface
Since: 2.6
Source: includes/class-calendar-feed.php:6775