wp-cli / embed-command

Inspects oEmbed providers, clears embed cache, and more.
MIT License
7 stars 11 forks source link

Don't always return clickable link; add 2 new options; misc other fixes. #31

Closed gitlost closed 6 years ago

gitlost commented 6 years ago

Moves the skip-cache option to before the new skip-sanitation option.

Adds 2 new non-raw options skip-sanitation and do-shortcode, the first if set removes the wp_filter_oembed_result() filter (added WP 4.4) and the second if set executes the shortcode returned by the 'audio' and 'video' embed handlers and returns the results.

Makes sure $oembed_args['discover'] is set when not calling WP_Embed::shortcode() as it's not ignored by other functions/methods (though usually defaults to true I think).

In non-raw mode only:

Always sets the 'embed_oembed_discover' filter depending on $discover as the default was false for WP < 4.4.

Checks providers not only when WP < 4.9 and no post_id but also when WP < 4.4 and no 'unfiltered_html' privileges on the post as that was also part of the discovery check.

Removes always returning a clickable link (added for WP 4.9 compat in https://github.com/wp-cli/embed-command/pull/29) and just fails instead (see https://github.com/wp-cli/embed-command/pull/29#issuecomment-355042624).

Other:

Corrects some comments.

Adjusts and adds tests. In particular uses the fab new @less-than-wp tag (which actually works, thanks to @schlessera).

Also adds testing WP 4.5.3 and WP 4.3.1 to the Travis matrix so all tests get run. (Although .travis.yml will be overwritten if the scaffolded tests get updated I've a cunning plan to deal with this.)

Re the 2 new options, these may go against the "Decisions, not options" philosophy so could be left out.

Anyway the fixes here aren't that major so as soon as this is merged we should begin integrating the command I think.