Automattic / pym-shortcode

A WordPress solution to embed iframes that are responsive horizontally and vertically using the NPR Visuals Team's https://blog.apps.npr.org/pym.js/
https://wordpress.org/plugins/pym-shortcode/
GNU General Public License v2.0
14 stars 7 forks source link

Provide a setting to allow site admins to opt into using the CDN version of Pym #31

Closed benlk closed 6 years ago

benlk commented 6 years ago

Wordpress' plugin guidelines require that we include pym.js locally, and that that version be used by default. This is because WordPress forbids loading executable code from CDNs: https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#8-plugins-may-not-send-executable-code-via-third-party-systems

However, if we created a setting that allowed people to opt into using the NPR-CDN-provided version of Pym.js, and that setting page included sufficient warnings and explanations, we would be able to provide the option of enabling the CDN version to people who are interested in using it without having to set the pymsrc attribute on every single shortcode.

benlk commented 6 years ago

A fast solution here would be to create a filter that, if outputting true, forces the use of the CDN.

The settings page proposed in #32 would be backwards-compatible with the filter by the expedient of disabling the field on the settings page if the filter is set to force the CDN.