Skip to main content

GravityView_Calendar_Ajax

Source: includes/class-calendar-ajax.php:14

Details​

  • Kind: class
  • Namespace: (global)

Methods​

MethodDescription
__construct()GravityView_Calendar_Ajax constructor.
get_nonce_handle()Return nonce handle used for AJAX requests
verify_nonce()Verify AJAX request nonce
ajax_edit_event()AJAX function to edit events
get_editable_calendar()Returns the calendar feed when the current user may move its events.
get_editable_event()Returns the calendar feed and entry when the current user may move that entry's event.
ajax_get_events()AJAX function to fetch events

Method Reference​

__construct()​

public function __construct()

GravityView_Calendar_Ajax constructor.

Source: includes/class-calendar-ajax.php:23

get_nonce_handle()​

public static function get_nonce_handle( $calendar_id=null, $view_id=0 )

Return nonce handle used for AJAX requests

A calendar shown by a View gets a nonce for that View, so its requests can't leave the View out.

Parameters​

NameTypeDefaultDescription
$calendar_idnull | string | intnullCalendar feed ID
$view_idint0ID of the View showing the calendar. 0 when no View shows it.

Returns​

  • string

Since:

  • 1.5
  • 2.24.0 (Added the $view_id parameter.)

Source: includes/class-calendar-ajax.php:42

verify_nonce()​

public function verify_nonce( $request=[] )

Verify AJAX request nonce

Parameters​

NameTypeDefaultDescription
$request[]

Returns​

  • void — Exit if nonce check fails

Since: 1.5

Source: includes/class-calendar-ajax.php:55

ajax_edit_event()​

public function ajax_edit_event()

AJAX function to edit events

Returns​

  • void

Since: 1.0.0

Source: includes/class-calendar-ajax.php:70

get_editable_calendar()​

public static function get_editable_calendar( $calendar_id )

Returns the calendar feed when the current user may move its events.

The feed must exist and be active, have event editing on and edit roles set, and the user must hold one of those roles.

Parameters​

NameTypeDefaultDescription
$calendar_idintCalendar feed ID.

Returns​

  • array | WP_Error — The feed, or the reason the user may not move its events.

Since: 2.26.0

Source: includes/class-calendar-ajax.php:140

get_editable_event()​

public static function get_editable_event( $calendar_id, $entry_id, $view_id=0 )

Returns the calendar feed and entry when the current user may move that entry's event.

Adds to \get_editable_calendar that the entry exists and is an event on that calendar.

Parameters​

NameTypeDefaultDescription
$calendar_idintCalendar feed ID.
$entry_idintEntry the event belongs to.
$view_idint0ID of the View showing the calendar. 0 when no View shows it.

Returns​

  • array{feed: — array, entry: array}|WP_Error

Since: 2.26.0

Source: includes/class-calendar-ajax.php:189

ajax_get_events()​

public function ajax_get_events()

AJAX function to fetch events

Returns​

  • void

Since: 1.5

Source: includes/class-calendar-ajax.php:468