Skip to content
This repository was archived by the owner on Apr 2, 2020. It is now read-only.

Conversation

@goldenapples
Copy link
Contributor

Since Shortcake added support for URL-encoding attribute values (wp-shortcake/shortcake#496), we can remove the unfriendly admonitions to avoid using quote marks, branckets, or HTML in the alt and caption fields here by passing "encode" => true in the attribute registration.
#42

Since Shortcake added support for URL-encoding attribute values
(wp-shortcake/shortcake#496), we can remove the
unfriendly admonitions to avoid using quote marks, branckets, or HTML in
the alt and caption fields here.
@goldenapples
Copy link
Contributor Author

@danielbachhuber #reviewmerge?

In order to take advantage of the automagickal decoding that Shortcake
gives for free with an encoded field, we have to use `shortcode_atts` to
extract the attribute values, rather than `wp_parse_args()`. Also, I
filed out a missing docblock comment for the filter here.
@danielbachhuber
Copy link
Contributor

@goldenapples build fail-y

@danielbachhuber
Copy link
Contributor

Looks good otherwise.

@danielbachhuber danielbachhuber added this to the next milestone Nov 23, 2015
@goldenapples
Copy link
Contributor Author

Ugh. Not as simple as I was thinking. shortcode_atts(), which I was trying to use here in order to make use of the built-in attribute decoding, requires you to specify the full whitelist of allowed attributes, which if hardcoded would probably break a lot of expected extensibility. I think we should be able to build the defaults from the UI registration args, but I'll need to add some test cases to make sure I'm not breaking anything.

Because the `shortcode_atts()` function requires a whitelist of all
attributes to allow, its necessary to take all the registered attributes
and merge them with a few necessary defaults before passing through that
function.

`src` and `classes` are not yet exposed in the UI, so they're merged in
here.
@goldenapples
Copy link
Contributor Author

Actually, not so tricky at all - fixed in f250552.

danielbachhuber added a commit that referenced this pull request Nov 24, 2015
…elds

Add "encode => true" to alt and caption fields
@danielbachhuber danielbachhuber merged commit f3adcbf into master Nov 24, 2015
@danielbachhuber danielbachhuber deleted the 42-escape-alt-and-caption-fields branch November 24, 2015 23:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants