From 1b841134fa4d257d1aa681ebdd0fca9f40f68595 Mon Sep 17 00:00:00 2001 From: gitlost Date: Mon, 22 Jan 2018 21:15:17 +0000 Subject: [PATCH] Prerelease: update readme; test framework. --- README.md | 86 +++++++++++++++++++++--------------- features/bootstrap/utils.php | 64 +++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 7395262..89d2802 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,14 @@ wp embed Attempts to convert a URL into embed HTML. ~~~ -wp embed fetch [--width=] [--height=] [--post-id=] [--skip-cache] [--raw] [--discover] [--limit-response-size=] [--format=] +wp embed fetch [--width=] [--height=] [--post-id=] [--discover] [--skip-cache] [--skip-sanitization] [--do-shortcode] [--limit-response-size=] [--raw] [--raw-format=] ~~~ -Starts by checking the URL against the regex of the registered embed handlers. +In non-raw mode, starts by checking the URL against the regex of the registered embed handlers. If none of the regex matches and it's enabled, then the URL will be given to the WP_oEmbed class. +In raw mode, checks the providers directly and returns the data. + **OPTIONS** @@ -48,21 +50,26 @@ If none of the regex matches and it's enabled, then the URL will be given to the [--post-id=] Cache oEmbed response for a given post. + [--discover] + Enable oEmbed discovery. Defaults to true. + [--skip-cache] - Ignore already cached oEmbed responses. + Ignore already cached oEmbed responses. Has no effect if using the 'raw' option, which doesn't use the cache. - [--raw] - Return the raw oEmbed response instead of the resulting HTML. Only - possible when there's no internal handler for the given URL. + [--skip-sanitization] + Remove the filter that WordPress from 4.4 onwards uses to sanitize oEmbed responses. Has no effect if using the 'raw' option, which by-passes sanitization. - [--discover] - Enable oEmbed discovery. Defaults to true. + [--do-shortcode] + If the URL is handled by a registered embed handler and returns a shortcode, do shortcode and return result. Has no effect if using the 'raw' option, which by-passes handlers. [--limit-response-size=] - Limit the size of the resulting HTML when using discovery. Default 150 KB. + Limit the size of the resulting HTML when using discovery. Default 150 KB (the standard WordPress limit). Not compatible with 'no-discover'. - [--format=] - Which data format to prefer when requesting oEmbed data. + [--raw] + Return the raw oEmbed response instead of the resulting HTML. Ignores the cache and does not sanitize responses or use registered embed handlers. + + [--raw-format=] + Render raw oEmbed data in a particular format. Defaults to json. Can only be specified in conjunction with the 'raw' option. --- options: - json @@ -73,9 +80,11 @@ If none of the regex matches and it's enabled, then the URL will be given to the # Get embed HTML for a given URL. $ wp embed fetch https://www.youtube.com/watch?v=dQw4w9WgXcQ +