Changeset 2782901
- Timestamp:
- 09/11/2022 05:11:43 AM (4 years ago)
- Location:
- wysiwyg-comments-trix
- Files:
-
- 2 edited
- 10 copied
-
tags/1.1 (copied) (copied from wysiwyg-comments-trix/trunk)
-
tags/1.1/readme.txt (copied) (copied from wysiwyg-comments-trix/trunk/readme.txt) (2 diffs)
-
tags/1.1/trix.js (copied) (copied from wysiwyg-comments-trix/trunk/trix.js)
-
tags/1.1/trixcomments.js (copied) (copied from wysiwyg-comments-trix/trunk/trixcomments.js)
-
tags/1.1/trixcomments.php (copied) (copied from wysiwyg-comments-trix/trunk/trixcomments.php) (4 diffs)
-
tags/1.1/trunk (copied) (copied from wysiwyg-comments-trix/trunk)
-
tags/1.1/trunk/readme.txt (copied) (copied from wysiwyg-comments-trix/trunk/readme.txt) (2 diffs)
-
tags/1.1/trunk/trix.js (copied) (copied from wysiwyg-comments-trix/trunk/trix.js)
-
tags/1.1/trunk/trixcomments.js (copied) (copied from wysiwyg-comments-trix/trunk/trixcomments.js)
-
tags/1.1/trunk/trixcomments.php (copied) (copied from wysiwyg-comments-trix/trunk/trixcomments.php) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/trixcomments.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wysiwyg-comments-trix/tags/1.1/readme.txt
r2735982 r2782901 5 5 Requires at least: 2.7 6 6 Tested up to: 6.0 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 License: MIT 9 9 License URI: https://github.com/basecamp/trix/blob/main/LICENSE … … 31 31 * Created 32 32 33 = 1.1 = 34 * Reject comments that appear to have been typed using raw HTML. The elderly will get used to the new way eventually. 35 -
wysiwyg-comments-trix/tags/1.1/trixcomments.php
r2735978 r2782901 3 3 Plugin Name: WYSIWYG Comments with Trix Editor 4 4 Plugin URI: https://www.jwz.org/wysiwyg-comments-trix/ 5 Version: 1. 05 Version: 1.1 6 6 Description: Replaces the comment submission form with a WYSIWYG rich-text editor. 7 7 Author: Jamie Zawinski … … 22 22 */ 23 23 24 $trixcomments_plugin_version = "1. 0";24 $trixcomments_plugin_version = "1.1"; 25 25 $trixcomments_plugin_title = 'WYSIWYG Comments with Trix Editor'; 26 26 $trixcomments_plugin_name = 'trixcomments'; … … 189 189 190 190 // If there is a DIV with no tags inside it, that can go too. 191 $html = preg_replace ('@<div>([^<>]*)</div>@si', "$1", $html); 191 // $html = preg_replace ('@<div>([^<>]*)</div>@si', "$1", $html); 192 193 // I think that any remaining <div> or </div> can be converted to a newline. 194 // Trix does not emit <div style>. 195 $html = preg_replace ('@\n</?div\b[^<>]*>@si', "\n", $html); 196 $html = preg_replace ('@</?div\b[^<>]*>\n?@si', "\n", $html); 192 197 193 198 // At most 2 consecutive blank lines. … … 195 200 196 201 // Remove trailing blank lines. 197 $html = preg_replace ('@\n+((</div>)*)$@si', '$1', $html); 202 // $html = preg_replace ('@\n+((</div>)*)$@si', '$1', $html); 203 204 // Remove leading and trailing blank lines. 205 $html = preg_replace ('/^\n+|\n+$/si', '', $html); 198 206 199 207 return $html; 208 } 209 210 211 // If someone appears to be typing raw HTML, make them go back and try again. 212 // Many long-time readers are are in the habit of doing that... 213 // 214 add_filter ('preprocess_comment', 'trixcomments_forbid_raw_html'); 215 function trixcomments_forbid_raw_html ($commentdata) { 216 $body = $commentdata['comment_content']; 217 $body = wp_kses_stripslashes ($body); 218 $body = preg_replace ('/ /', ' ', $body); 219 if (preg_match ('@&lt;@si', $body) || // Literal < 220 preg_match ('@<\s*(A|IMG)\s+(HREF|SRC)\s*=@si', $body) || // <A HREF= 221 preg_match ('@<\s*(VIDEO|IFRAME)\s+@si', $body) || // <IFRAME 222 preg_match ( 223 '@<\s*(B|I|EM|STRONG|TT|PRE|CODE|P|BR|BLOCKQUOTE)\s*&@si', // <B> 224 $body)) { 225 wp_die (__('It looks like you are typing raw HTML. ' . 226 'Go back and format using the toolbar instead.')); 227 } 228 return $commentdata; 200 229 } 201 230 -
wysiwyg-comments-trix/tags/1.1/trunk/readme.txt
r2735982 r2782901 5 5 Requires at least: 2.7 6 6 Tested up to: 6.0 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 License: MIT 9 9 License URI: https://github.com/basecamp/trix/blob/main/LICENSE … … 31 31 * Created 32 32 33 = 1.1 = 34 * Reject comments that appear to have been typed using raw HTML. The elderly will get used to the new way eventually. 35 -
wysiwyg-comments-trix/tags/1.1/trunk/trixcomments.php
r2735978 r2782901 3 3 Plugin Name: WYSIWYG Comments with Trix Editor 4 4 Plugin URI: https://www.jwz.org/wysiwyg-comments-trix/ 5 Version: 1. 05 Version: 1.1 6 6 Description: Replaces the comment submission form with a WYSIWYG rich-text editor. 7 7 Author: Jamie Zawinski … … 22 22 */ 23 23 24 $trixcomments_plugin_version = "1. 0";24 $trixcomments_plugin_version = "1.1"; 25 25 $trixcomments_plugin_title = 'WYSIWYG Comments with Trix Editor'; 26 26 $trixcomments_plugin_name = 'trixcomments'; … … 189 189 190 190 // If there is a DIV with no tags inside it, that can go too. 191 $html = preg_replace ('@<div>([^<>]*)</div>@si', "$1", $html); 191 // $html = preg_replace ('@<div>([^<>]*)</div>@si', "$1", $html); 192 193 // I think that any remaining <div> or </div> can be converted to a newline. 194 // Trix does not emit <div style>. 195 $html = preg_replace ('@\n</?div\b[^<>]*>@si', "\n", $html); 196 $html = preg_replace ('@</?div\b[^<>]*>\n?@si', "\n", $html); 192 197 193 198 // At most 2 consecutive blank lines. … … 195 200 196 201 // Remove trailing blank lines. 197 $html = preg_replace ('@\n+((</div>)*)$@si', '$1', $html); 202 // $html = preg_replace ('@\n+((</div>)*)$@si', '$1', $html); 203 204 // Remove leading and trailing blank lines. 205 $html = preg_replace ('/^\n+|\n+$/si', '', $html); 198 206 199 207 return $html; 208 } 209 210 211 // If someone appears to be typing raw HTML, make them go back and try again. 212 // Many long-time readers are are in the habit of doing that... 213 // 214 add_filter ('preprocess_comment', 'trixcomments_forbid_raw_html'); 215 function trixcomments_forbid_raw_html ($commentdata) { 216 $body = $commentdata['comment_content']; 217 $body = wp_kses_stripslashes ($body); 218 $body = preg_replace ('/ /', ' ', $body); 219 if (preg_match ('@&lt;@si', $body) || // Literal < 220 preg_match ('@<\s*(A|IMG)\s+(HREF|SRC)\s*=@si', $body) || // <A HREF= 221 preg_match ('@<\s*(VIDEO|IFRAME)\s+@si', $body) || // <IFRAME 222 preg_match ( 223 '@<\s*(B|I|EM|STRONG|TT|PRE|CODE|P|BR|BLOCKQUOTE)\s*&@si', // <B> 224 $body)) { 225 wp_die (__('It looks like you are typing raw HTML. ' . 226 'Go back and format using the toolbar instead.')); 227 } 228 return $commentdata; 200 229 } 201 230 -
wysiwyg-comments-trix/trunk/readme.txt
r2735982 r2782901 5 5 Requires at least: 2.7 6 6 Tested up to: 6.0 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 License: MIT 9 9 License URI: https://github.com/basecamp/trix/blob/main/LICENSE … … 31 31 * Created 32 32 33 = 1.1 = 34 * Reject comments that appear to have been typed using raw HTML. The elderly will get used to the new way eventually. 35 -
wysiwyg-comments-trix/trunk/trixcomments.php
r2735978 r2782901 3 3 Plugin Name: WYSIWYG Comments with Trix Editor 4 4 Plugin URI: https://www.jwz.org/wysiwyg-comments-trix/ 5 Version: 1. 05 Version: 1.1 6 6 Description: Replaces the comment submission form with a WYSIWYG rich-text editor. 7 7 Author: Jamie Zawinski … … 22 22 */ 23 23 24 $trixcomments_plugin_version = "1. 0";24 $trixcomments_plugin_version = "1.1"; 25 25 $trixcomments_plugin_title = 'WYSIWYG Comments with Trix Editor'; 26 26 $trixcomments_plugin_name = 'trixcomments'; … … 189 189 190 190 // If there is a DIV with no tags inside it, that can go too. 191 $html = preg_replace ('@<div>([^<>]*)</div>@si', "$1", $html); 191 // $html = preg_replace ('@<div>([^<>]*)</div>@si', "$1", $html); 192 193 // I think that any remaining <div> or </div> can be converted to a newline. 194 // Trix does not emit <div style>. 195 $html = preg_replace ('@\n</?div\b[^<>]*>@si', "\n", $html); 196 $html = preg_replace ('@</?div\b[^<>]*>\n?@si', "\n", $html); 192 197 193 198 // At most 2 consecutive blank lines. … … 195 200 196 201 // Remove trailing blank lines. 197 $html = preg_replace ('@\n+((</div>)*)$@si', '$1', $html); 202 // $html = preg_replace ('@\n+((</div>)*)$@si', '$1', $html); 203 204 // Remove leading and trailing blank lines. 205 $html = preg_replace ('/^\n+|\n+$/si', '', $html); 198 206 199 207 return $html; 208 } 209 210 211 // If someone appears to be typing raw HTML, make them go back and try again. 212 // Many long-time readers are are in the habit of doing that... 213 // 214 add_filter ('preprocess_comment', 'trixcomments_forbid_raw_html'); 215 function trixcomments_forbid_raw_html ($commentdata) { 216 $body = $commentdata['comment_content']; 217 $body = wp_kses_stripslashes ($body); 218 $body = preg_replace ('/ /', ' ', $body); 219 if (preg_match ('@&lt;@si', $body) || // Literal < 220 preg_match ('@<\s*(A|IMG)\s+(HREF|SRC)\s*=@si', $body) || // <A HREF= 221 preg_match ('@<\s*(VIDEO|IFRAME)\s+@si', $body) || // <IFRAME 222 preg_match ( 223 '@<\s*(B|I|EM|STRONG|TT|PRE|CODE|P|BR|BLOCKQUOTE)\s*&@si', // <B> 224 $body)) { 225 wp_die (__('It looks like you are typing raw HTML. ' . 226 'Go back and format using the toolbar instead.')); 227 } 228 return $commentdata; 200 229 } 201 230
Note: See TracChangeset
for help on using the changeset viewer.