rtCamp / wordpress-preview-revisions

WordPress Preview Revisions Plugin help editors to preview the revisions with exact same content that would look like on the frontend.
Other
9 stars 1 forks source link

Use `wp_json_encode()` to safely render text inside `script` tag #2

Closed hbhalodia closed 1 year ago

hbhalodia commented 1 year ago

What?

Given this existing code:

button.innerText = '<?php esc_html_e( 'Preview', 'preview-revisions' ); ?>';

It could be that a translation string incorporates an apostrophe, either because the language uses apostrophes:

image

Which would result in a syntax error here:

button.innerText = 'mua'i va'aiga';
// --------------------^
hbhalodia commented 1 year ago

This issue is done in PR - https://github.com/rtCamp/wordpress-preview-revisions/pull/1

hbhalodia commented 1 year ago

The issue is successfully tested and merged into master.