GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Static Public Member Functions | Static Public Attributes | Static Private Member Functions
oEmbed Class Reference

If this file is called directly, abort. More...

Static Public Member Functions

static init ()
 Initialize. More...
 
static pre_oembed_result ( $result, $url, $args)
 Internal oEmbed output, shortcircuit without proxying to the provider. More...
 
static render ( $matches, $attr, $url, $rawattr)
 Output the embed HTML. More...
 
static render_provider_request ()
 Output a response as a provider for an entry oEmbed URL. More...
 

Static Public Attributes

static $provider_url = ''
 

Static Private Member Functions

static get_entry_regex ()
 Generate the Regular expression that matches embedded entries. More...
 
static parse_matches ( $matches, $url)
 Parse oEmbed regex matches and return View and Entry. More...
 
static render_admin ( $view, $entry)
 Display a nice placeholder in the admin for the entry. More...
 
static render_frontend ( $view, $entry)
 Render the entry as an oEmbed. More...
 
static render_preview_notice ()
 Generate a warning to users when previewing oEmbed in the Add Media modal. More...
 

Detailed Description

If this file is called directly, abort.

oEmbed functionality for GravityView

Definition at line 12 of file class-gv-oembed.php.

Member Function Documentation

◆ get_entry_regex()

static get_entry_regex ( )
staticprivate

Generate the Regular expression that matches embedded entries.

Generates different regex if using permalinks and if not using permalinks

Returns
string Regex code
Runs Filter:
gravityview_slug Modify the url part for a View. Read the doc
Parameters
string$rewrite_slugThe slug shown in the URL

Definition at line 292 of file class-gv-oembed.php.

References Entry\get_endpoint_name().

◆ init()

static init ( )
static

Initialize.

Register the oEmbed handler and the provider. Fire off the provider handler if detected.

Returns
void

Definition at line 23 of file class-gv-oembed.php.

◆ parse_matches()

static parse_matches (   $matches,
  $url 
)
staticprivate

Parse oEmbed regex matches and return View and Entry.

Parameters
array$matchesThe regex matches.
string$urlThe URL of the embed.
Returns
array (, )

Definition at line 112 of file class-gv-oembed.php.

References $entry, $url, $view_id, View\by_id(), View\from_post(), and gravityview().

◆ pre_oembed_result()

static pre_oembed_result (   $result,
  $url,
  $args 
)
static

Internal oEmbed output, shortcircuit without proxying to the provider.

Definition at line 319 of file class-gv-oembed.php.

References $entry, and $url.

◆ render()

static render (   $matches,
  $attr,
  $url,
  $rawattr 
)
static

Output the embed HTML.

Parameters
array$matchesThe regex matches from the provided regex when calling wp_embed_register_handler()
array$attrEmbed attributes.
string$urlThe original URL that was matched by the regex.
array$rawattrThe original unmodified attributes.
Returns
string The embed HTML.

Render a nice placeholder in the Visual mode.

Prepend a preview notice in Add Media / From URL screen

Definition at line 82 of file class-gv-oembed.php.

References $entry, $url, and gravityview().

◆ render_admin()

static render_admin (   $view,
  $entry 
)
staticprivate

Display a nice placeholder in the admin for the entry.

Parameters
\GV\View$viewThe View.
\GV\Entry$entryThe Entry.
Returns
string A placeholder, with Mr. Floaty :)

Definition at line 168 of file class-gv-oembed.php.

References $entry, $image, and GravityView_Admin\get_floaty().

◆ render_frontend()

static render_frontend (   $view,
  $entry 
)
staticprivate

Render the entry as an oEmbed.

Parameters
\GV\View$viewThe View.
\GV\Entry$entryThe Entry.
Returns
string The rendered oEmbed.

Private, pending, draft, etc.

When this is embedded inside a view we should not display the widgets.

Remove Widgets on a nested embedded View. Also, don't show widgets if we're embedding an entry

Based on code in our unit-tests. Mocks old context, etc.

Remove the back link.

Definition at line 207 of file class-gv-oembed.php.

References $entry, GV\$form, GravityView_View_Data\$instance, GravityView_View\$instance, $output, $template, GVCommon\get_template_settings(), GravityView_Edit_Entry\getInstance(), GravityView_View_Data\getInstance(), GravityView_View\getInstance(), gravityview(), GVCommon\has_cap(), GravityView_Entry_Approval_Status\is_approved(), and GravityView_Entry_Approval\meta_key.

◆ render_preview_notice()

static render_preview_notice ( )
staticprivate

Generate a warning to users when previewing oEmbed in the Add Media modal.

Returns
string HTML notice

Definition at line 192 of file class-gv-oembed.php.

References $title, and GravityView_Admin\get_floaty().

◆ render_provider_request()

static render_provider_request ( )
static

Output a response as a provider for an entry oEmbed URL.

For now we only output the JSON format and don't care about the size (width, height). Our only current use-case is for it to provide output to the Add Media / From URL box in WordPress 4.8.

Returns
void

Parse the URL to an entry and a view

Definition at line 45 of file class-gv-oembed.php.

References $entry, and $url.

Field Documentation

◆ $provider_url

$provider_url = ''
static

Definition at line 13 of file class-gv-oembed.php.


The documentation for this class was generated from the following file: