added escaping/unescaping of delimiters
This commit is contained in:
parent
511a0a3d20
commit
0154408499
@ -25,6 +25,7 @@ add_filter('pre_comment_author_url', 'trim');
|
|||||||
|
|
||||||
|
|
||||||
add_filter('pre_comment_content', 'stripslashes', 1);
|
add_filter('pre_comment_content', 'stripslashes', 1);
|
||||||
|
add_filter('pre_comment_content', 'fmt_escape_separator', 1);
|
||||||
//add_filter('pre_comment_content', 'wp_filter_kses');
|
//add_filter('pre_comment_content', 'wp_filter_kses');
|
||||||
add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
|
add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
|
||||||
add_filter('pre_comment_content', 'balanceTags', 30);
|
add_filter('pre_comment_content', 'balanceTags', 30);
|
||||||
@ -46,7 +47,7 @@ add_filter('comment_url', 'clean_url');
|
|||||||
add_filter('comment_text', 'convert_chars');
|
add_filter('comment_text', 'convert_chars');
|
||||||
add_filter('comment_text', 'make_clickable');
|
add_filter('comment_text', 'make_clickable');
|
||||||
add_filter('comment_text', 'wpautop', 30);
|
add_filter('comment_text', 'wpautop', 30);
|
||||||
//add_filter('comment_text', 'convert_smilies', 20);
|
add_filter('comment_text', 'fmt_unescape_separator');
|
||||||
|
|
||||||
add_filter('comment_excerpt', 'convert_chars');
|
add_filter('comment_excerpt', 'convert_chars');
|
||||||
|
|
||||||
@ -55,6 +56,13 @@ add_filter('content_save_pre', 'balanceTags', 50);
|
|||||||
add_filter('excerpt_save_pre', 'balanceTags', 50);
|
add_filter('excerpt_save_pre', 'balanceTags', 50);
|
||||||
add_filter('comment_save_pre', 'balanceTags', 50);
|
add_filter('comment_save_pre', 'balanceTags', 50);
|
||||||
|
|
||||||
|
|
||||||
|
add_filter('title_save_pre', 'fmt_escape_separator');
|
||||||
|
add_filter('content_save_pre', 'fmt_escape_separator');
|
||||||
|
add_filter('excerpt_save_pre', 'fmt_escape_separator');
|
||||||
|
add_filter('comment_save_pre', 'fmt_escape_separator');
|
||||||
|
|
||||||
|
|
||||||
// Clean & add entities (delegated to plugins)
|
// Clean & add entities (delegated to plugins)
|
||||||
/*
|
/*
|
||||||
add_filter('content_save_pre', 'wp_specialchars');
|
add_filter('content_save_pre', 'wp_specialchars');
|
||||||
@ -65,14 +73,18 @@ add_filter('comment_save_pre', 'wp_specialchars');
|
|||||||
// Misc. title, content, and excerpt filters
|
// Misc. title, content, and excerpt filters
|
||||||
add_filter('the_title', 'convert_chars');
|
add_filter('the_title', 'convert_chars');
|
||||||
add_filter('the_title', 'trim');
|
add_filter('the_title', 'trim');
|
||||||
|
add_filter('the_title', 'fmt_unescape_separator');
|
||||||
|
|
||||||
//add_filter('the_content', 'convert_smilies');
|
//add_filter('the_content', 'convert_smilies');
|
||||||
add_filter('the_content', 'convert_chars');
|
add_filter('the_content', 'convert_chars');
|
||||||
add_filter('the_content', 'wpautop');
|
add_filter('the_content', 'wpautop');
|
||||||
|
add_filter('the_content', 'fmt_unescape_separator');
|
||||||
|
|
||||||
//add_filter('the_excerpt', 'convert_smilies');
|
//add_filter('the_excerpt', 'convert_smilies');
|
||||||
add_filter('the_excerpt', 'convert_chars');
|
add_filter('the_excerpt', 'convert_chars');
|
||||||
add_filter('the_excerpt', 'wpautop');
|
add_filter('the_excerpt', 'wpautop');
|
||||||
|
add_filter('the_excerpt', 'fmt_unescape_separator');
|
||||||
|
|
||||||
add_filter('get_the_excerpt', 'wp_trim_excerpt');
|
add_filter('get_the_excerpt', 'wp_trim_excerpt');
|
||||||
|
|
||||||
add_filter('sanitize_title', 'sanitize_title_with_dashes');
|
add_filter('sanitize_title', 'sanitize_title_with_dashes');
|
||||||
@ -92,4 +104,4 @@ add_filter('the_author', 'ent2ncr', 8);
|
|||||||
// Actions
|
// Actions
|
||||||
//add_action('publish_post', 'generic_ping');
|
//add_action('publish_post', 'generic_ping');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -121,24 +121,23 @@
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fmt_escape_separator($text, $sep='|') {
|
||||||
|
|
||||||
|
return str_replace( '|', '|', $text );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function fmt_unescape_separator($text, $sep='|') {
|
||||||
|
|
||||||
|
return str_replace('|', '|', $text );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function wp_specialchars( $text, $quotes = 0 ) {
|
function wp_specialchars( $text, $quotes = 0 ) {
|
||||||
// Like htmlspecialchars except don't double-encode HTML entities
|
// Like htmlspecialchars except don't double-encode HTML entities
|
||||||
// added by NoWhereMan -----
|
|
||||||
|
|
||||||
$text = str_replace( '|', '|', $text );
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
I was drunk, wasn't I? --NWM
|
|
||||||
|
|
||||||
//$text = str_replace(' & ', ' & ', $text);
|
|
||||||
// -------------------------
|
|
||||||
//$text = str_replace('"', '"', $text);
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
$text = preg_replace('/&([^#])(?![a-z12]{1,8};)/', '&$1', $text);
|
$text = preg_replace('/&([^#])(?![a-z12]{1,8};)/', '&$1', $text);
|
||||||
$text = str_replace('<', '<', $text);
|
$text = str_replace('<', '<', $text);
|
||||||
$text = str_replace('>', '>', $text);
|
$text = str_replace('>', '>', $text);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user