WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 11 months ago

#24381 closed enhancement (fixed)

A little more abstraction in the WP_oEmbed class

Reported by: johnbillion Owned by: johnbillion
Milestone: 4.0 Priority: normal
Severity: normal Version: 2.9
Component: Embeds Keywords: has-patch
Focuses: Cc:

Description

The logic for determining the oEmbed provider for a given URL is contained within the get_html() method of the WP_oEmbed class.

I'd like to be able to determine whether or not a given URL has a supported oEmbed provider. There's no method in the WP_oEmbed class to do this, and I've copied the logic from get_html() into my own function.

Patch coming up shortly.

Attachments (2)

24381.patch (1.6 KB) - added by johnbillion 2 years ago.
24381.2.patch (1.9 KB) - added by johnbillion 14 months ago.

Download all attachments as: .zip

Change History (7)

@johnbillion2 years ago

comment:1 @johnbillion2 years ago

  • Keywords has-patch added

24381.patch simply moves the logic for determining the provider for a URL into a new method, get_provider().

comment:2 @DrewAPicture14 months ago

  • Keywords needs-docs added

Abstracting this seems logical, though I'm surprised we currently do a return false followed a filterable return.

I guess an argument can be made that the "oembed_result" filter should apply if there's actually a result though.

Also, might as well add hook docs while we're in there.

@johnbillion14 months ago

comment:3 @johnbillion14 months ago

  • Keywords needs-docs removed
  • Milestone changed from Awaiting Review to Future Release

24381.2.patch refreshes the patch to take into account the hook docs that have since been added. Also adds the new get_provider() method above get_html() so the diff is clearer.

comment:4 @wonderboymusic11 months ago

  • Milestone changed from Future Release to 4.0
  • Owner set to johnbillion
  • Status changed from new to reviewing

Drop this in if you still want it

comment:5 @johnbillion11 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 28728:

A little more abstraction in the WP_oEmbed class. Fixes #24381.

Note: See TracTickets for help on using tickets.