From 9439a575f6d52f1e63fefde0953e70b55e8db046 Mon Sep 17 00:00:00 2001 From: saxmatt Date: Thu, 22 Apr 2004 07:41:57 +0000 Subject: [PATCH] Removing some old functions. Cleaning up remaining places where we exposed emails. Consolidated ampersand fixing. Fixed pasting from Word. git-svn-id: http://svn.automattic.com/wordpress/trunk@1121 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions-formatting.php | 79 ++++++---------------- wp-includes/functions.php | 5 +- wp-includes/template-functions-general.php | 9 +-- wp-includes/vars.php | 51 -------------- wp-links-opml.php | 2 - wp-rdf.php | 2 - wp-rss.php | 2 - 7 files changed, 25 insertions(+), 125 deletions(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 31efd738f2..922e11eb39 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -1,8 +1,9 @@ )/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between + $output = ''; + // Capture tags and everything inside them + $textarr = preg_split("/(<.*>)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE); $stop = count($textarr); $next = true; // loop stuff for ($i = 0; $i < $stop; $i++) { $curl = $textarr[$i]; @@ -30,7 +31,6 @@ function wptexturize($text) { $curl = preg_replace("/\(tm\)/i", '™', $curl); $curl = preg_replace("/\(c\)/i", '©', $curl); $curl = preg_replace("/\(r\)/i", '®', $curl); - $curl = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $curl); $curl = str_replace("''", '”', $curl); $curl = preg_replace('/(d+)x(\d+)/', "$1×$2", $curl); @@ -55,9 +55,10 @@ function clean_pre($text) { function wpautop($pee, $br = 1) { $pee = $pee . "\n"; // just to make things a little easier, pad the end $pee = preg_replace('|
\s*
|', "\n\n", $pee); - $pee = preg_replace('!(<(?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "\n$1", $pee); // Space things out a little - $pee = preg_replace('!()!', "$1\n", $pee); // Space things out a little - $pee = preg_replace("/(\r\n|\r)/", "\n", $pee); // cross-platform newlines + // Space things out a little + $pee = preg_replace('!(<(?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "\n$1", $pee); + $pee = preg_replace('!()!', "$1\n", $pee); + $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t

$1

\n", $pee); // make paragraphs, including one at the end $pee = preg_replace('|

\s*?

|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace @@ -71,7 +72,6 @@ function wpautop($pee, $br = 1) { $pee = preg_replace('!(]*>)\s*
!', "$1", $pee); $pee = preg_replace('!
(\s*)!', '$1', $pee); $pee = preg_replace('!()(.*?)!ise', " stripslashes('$1') . clean_pre('$2') . '' ", $pee); - $pee = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $pee); return $pee; } @@ -87,25 +87,22 @@ function sanitize_title($title) { return $title; } -function convert_chars($content, $flag='obsolete attribute left there for backwards compatibility') { - // html/unicode entities output - global $wp_htmltrans, $wp_htmltranswinuni; +function convert_chars($content, $flag = 'obsolete') { + global $wp_htmltranswinuni; - // removes metadata tags + // Remove metadata tags $content = preg_replace('/(.+?)<\/title>/','',$content); $content = preg_replace('/<category>(.+?)<\/category>/','',$content); - // converts lone & characters into & (a.k.a. &) - $content = preg_replace('/&[^#](?![a-z]*;)/ie', '"&".substr("\0",1)', $content); - $content = strtr($content, $wp_htmltranswinuni); - if (get_settings('use_htmltrans')) { - // converts HTML-entities to their display values in order to convert them again later - $content = preg_replace('/['.chr(127).'-'.chr(255).']/e', '"&#".ord(\'\0\').";"', $content ); - $content = strtr($content, $wp_htmltrans); - } - // you can delete these 2 lines if you don't like <br /> and <hr /> - $content = str_replace('<br>', '<br />',$content); - $content = str_replace('<hr>', '<hr />',$content); + // Converts lone & characters into & (a.k.a. &) + $content = preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&$1', $content); + + // Fix Word pasting + $content = strtr($content, $wp_htmltranswinuni); + + // Just a little XHTML help + $content = str_replace('<br>', '<br />', $content); + $content = str_replace('<hr>', '<hr />', $content); return $content; } @@ -209,26 +206,13 @@ function balanceTags($text, $is_comment = 0) { $newtext = $newtext . '</' . $x . '>'; // Add remaining tags to close } - # WP fix for the bug with HTML comments + // WP fix for the bug with HTML comments $newtext = str_replace("< !--","<!--",$newtext); $newtext = str_replace("< !--","< !--",$newtext); return $newtext; } -function autobrize($content) { - $content = preg_replace("/<br>\n/", "\n", $content); - $content = preg_replace("/<br \/>\n/", "\n", $content); - $content = preg_replace("/(\015\012)|(\015)|(\012)/", "<br />\n", $content); - return $content; -} - -function unautobrize($content) { - $content = preg_replace("/<br>\n/", "\n", $content); //for PHP versions before 4.0.5 - $content = preg_replace("/<br \/>\n/", "\n", $content); - return $content; -} - function format_to_edit($content) { $content = stripslashes($content); @@ -300,29 +284,6 @@ function make_clickable($text) { // original function: phpBB, extended here for return $ret; } -function convert_bbcode($content) { // depreciated - return $content; -} - -function convert_bbcode_email($content) { - global $use_bbcode; - $bbcode_email["in"] = array( - '#\[email](.+?)\[/email]#eis', - '#\[email=(.+?)](.+?)\[/email]#eis' - ); - $bbcode_email["out"] = array( - "'<a href=\"mailto:'.antispambot('\\1').'\">'.antispambot('\\1').'</a>'", // E-mail - "'<a href=\"mailto:'.antispambot('\\1').'\">\\2</a>'" - ); - - $content = preg_replace($bbcode_email["in"], $bbcode_email["out"], $content); - return $content; -} - -function convert_gmcode($content) { // depreciated - return $content; -} - function convert_smilies($text) { global $wp_smiliessearch, $wp_smiliesreplace; $output = ''; diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 5731164660..2475a1d911 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -862,7 +862,7 @@ function doGeoUrlHeader($posts) { $title = $row->post_title; if(($lon != null) && ($lat != null) ) { echo "<meta name=\"ICBM\" content=\"".$lat.", ".$lon."\" />\n"; - echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")),"unicode")." - ".$title."\" />\n"; + echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")))." - ".$title."\" />\n"; echo "<meta name=\"geo.position\" content=\"".$lat.";".$lon."\" />\n"; return; } @@ -870,7 +870,7 @@ function doGeoUrlHeader($posts) { if(get_settings('use_default_geourl')) { // send the default here echo "<meta name=\"ICBM\" content=\"". get_settings('default_geourl_lat') .", ". get_settings('default_geourl_lon') ."\" />\n"; - echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")),"unicode")."\" />\n"; + echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")))."\" />\n"; echo "<meta name=\"geo.position\" content=\"". get_settings('default_geourl_lat') .";". get_settings('default_geourl_lon') ."\" />\n"; } } @@ -1058,7 +1058,6 @@ function wp_notify_moderator($comment_id) { function start_wp() { global $post, $id, $postdata, $authordata, $day, $preview, $page, $pages, $multipage, $more, $numpages; - global $preview_userid,$preview_date,$preview_content,$preview_title,$preview_category,$preview_notify,$preview_make_clickable,$preview_autobr; global $pagenow; if (!$preview) { $id = $post->ID; diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index 146bb73bb1..5f1b858fef 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -4,21 +4,18 @@ function bloginfo($show='') { $info = get_bloginfo($show); - $info = convert_bbcode($info); - $info = convert_gmcode($info); - $info = convert_smilies($info); $info = apply_filters('bloginfo', $info); - echo convert_chars($info, 'html'); + echo convert_chars($info); } function bloginfo_rss($show='') { $info = strip_tags(get_bloginfo($show)); - echo convert_chars($info, 'unicode'); + echo convert_chars($info); } function bloginfo_unicode($show='') { $info = get_bloginfo($show); - echo convert_chars($info, 'unicode'); + echo convert_chars($info); } function get_bloginfo($show='') { diff --git a/wp-includes/vars.php b/wp-includes/vars.php index 7e7ecb9b26..bfe9b2c272 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -3,57 +3,6 @@ /* This file sets various arrays and variables for use in WordPress */ require(ABSPATH . 'wp-includes/version.php'); -# Translation of HTML entities and special characters -$wp_htmltrans = array_flip(get_html_translation_table(HTML_ENTITIES)); -$wp_htmltrans['<'] = '<'; # preserve HTML -$wp_htmltrans['>'] = '>'; # preserve HTML -$wp_htmltransbis = array( - '–' => '–', - '—' => '—', - '‘' => '‘', - '’' => '’', - '“' => '“', - '”' => '”', - '•' => '•', - '€' => '€', - '<' => '<', # preserve fake HTML - '>' => '>', # preserve fake HTML - '&' => '&', # preserve fake HTML - '&sp;' => ' ', '!' => '!', '"' => '"', '#' => '#', '$' => '$', '%' => '%', ''' => ''', '(' => '(', ')' => ')', - '*' => '*', '+' => '+', ',' => ',', '‐' => '-', '−' => '-', '.' => '.', '/' => '/', ':' => ':', ';' => ';', '<' => '<', - '=' => '=', '>' => '>', '?' => '?', '@' => '@', '[' => '[', '\' => '\', ']' => ']', 'ˆ' => '^', '_' => '_', '―' => '_', - '`' => '`', '{' => '{', '|' => '|', '}' => '}', '˜' => '~', '‚' => '‚', '„' => '„', - '&ldots;' => '…', 'Š' => 'Š', '‹' => '‹', 'Œ' => 'Œ', '‘' => '‘', '’' => '‘', '’' => '’', - '“' => '“', '”' => '“', '”' => '”', '•' => '•', '–' => '–', '&endash;' => '–', '—' => '—', '&emdash;' => '—', '˜' => '˜', '™' => '™', - 'š' => 'š', '›' => '›', 'œ' => 'œ', 'Ÿ' => 'Ÿ', ' ' => ' ', '¡' => '¡', '¢' => '¢', '£' => '£', '¤' => '¤', '¥' => '¥', - '¦' => '¦', '&brkbar;' => '¦', '§' => '§', '¨' => '¨', '¨' => '¨', '©' => '©', 'ª' => 'ª', '«' => '«', '¬' => '¬', '­' => '­', - '®' => '®', '¯' => '¯', '&hibar;' => '¯', '°' => '°', '±' => '±', '²' => '²', '³' => '³', '´' => '´', 'µ' => 'µ', '¶' => '¶', - '·' => '·', '¸' => '¸', '¹' => '¹', 'º' => 'º', '»' => '»', '¼' => '¼', '½' => '½', '½' => '½', '¾' => '¾', '¿' => '¿', - 'À' => 'À', 'Á' => 'Á', 'Â' => 'Â', 'Ã' => 'Ã', 'Ä' => 'Ä', 'Å' => 'Å', 'Æ' => 'Æ', 'Ç' => 'Ç', 'È' => 'È', 'É' => 'É', - 'Ê' => 'Ê', 'Ë' => 'Ë', 'Ì' => 'Ì', 'Í' => 'Í', 'Î' => 'Î', 'Ï' => 'Ï', 'Ð' => 'Ð', 'Ñ' => 'Ñ', 'Ò' => 'Ò', 'Ó' => 'Ó', - 'Ô' => 'Ô', 'Õ' => 'Õ', 'Ö' => 'Ö', '×' => '×', 'Ø' => 'Ø', 'Ù' => 'Ù', 'Ú' => 'Ú', 'Û' => 'Û', 'Ü' => 'Ü', 'Ý' => 'Ý', - 'Þ' => 'Þ', 'ß' => 'ß', 'à' => 'à', 'á' => 'á', 'â' => 'â', 'ã' => 'ã', 'ä' => 'ä', 'å' => 'å', 'æ' => 'æ', 'ç' => 'ç', - 'è' => 'è', 'é' => 'é', 'ê' => 'ê', 'ë' => 'ë', 'ì' => 'ì', 'í' => 'í', 'î' => 'î', 'ï' => 'ï', 'ð' => 'ð', 'ñ' => 'ñ', - 'ò' => 'ò', 'ó' => 'ó', 'ô' => 'ô', 'õ' => 'õ', 'ö' => 'ö', '÷' => '÷', 'ø' => 'ø', 'ù' => 'ù', 'ú' => 'ú', 'û' => 'û', - 'ü' => 'ü', 'ý' => 'ý', 'þ' => 'þ', 'ÿ' => 'ÿ', 'Œ' => 'Œ', 'œ' => 'œ', 'Š' => 'Š', 'š' => 'š', 'Ÿ' => 'Ÿ', 'ƒ' => 'ƒ', - 'ˆ' => 'ˆ', '˜' => '˜', 'Α' => 'Α', 'Β' => 'Β', 'Γ' => 'Γ', 'Δ' => 'Δ', 'Ε' => 'Ε', 'Ζ' => 'Ζ', 'Η' => 'Η', 'Θ' => 'Θ', - 'Ι' => 'Ι', 'Κ' => 'Κ', 'Λ' => 'Λ', 'Μ' => 'Μ', 'Ν' => 'Ν', 'Ξ' => 'Ξ', 'Ο' => 'Ο', 'Π' => 'Π', 'Ρ' => 'Ρ', 'Σ' => 'Σ', - 'Τ' => 'Τ', 'Υ' => 'Υ', 'Φ' => 'Φ', 'Χ' => 'Χ', 'Ψ' => 'Ψ', 'Ω' => 'Ω', 'α' => 'α', 'β' => 'β', 'γ' => 'γ', 'δ' => 'δ', - 'ε' => 'ε', 'ζ' => 'ζ', 'η' => 'η', 'θ' => 'θ', 'ι' => 'ι', 'κ' => 'κ', 'λ' => 'λ', 'μ' => 'μ', 'ν' => 'ν', 'ξ' => 'ξ', - 'ο' => 'ο', 'π' => 'π', 'ρ' => 'ρ', 'ς' => 'ς', 'σ' => 'σ', 'τ' => 'τ', 'υ' => 'υ', 'φ' => 'φ', 'χ' => 'χ', 'ψ' => 'ψ', - 'ω' => 'ω', 'ϑ' => 'ϑ', 'ϒ' => 'ϒ', 'ϖ' => 'ϖ', ' ' => ' ', ' ' => ' ', ' ' => ' ', '‌' => '‌', '‍' => '‍', '‎' => '‎', - '‏' => '‏', '–' => '–', '—' => '—', '‘' => '‘', '’' => '’', '‚' => '‚', '“' => '“', '”' => '”', '„' => '„', '†' => '†', - '‡' => '‡', '•' => '•', '…' => '…', '‰' => '‰', '′' => '′', '″' => '″', '‹' => '‹', '›' => '›', '‾' => '‾', '⁄' => '⁄', - '€' => '€', 'ℑ' => 'ℑ', '℘' => '℘', 'ℜ' => 'ℜ', '™' => '™', 'ℵ' => 'ℵ', '←' => '←', '↑' => '↑', '→' => '→', '↓' => '↓', - '↔' => '↔', '↵' => '↵', '⇐' => '⇐', '⇑' => '⇑', '⇒' => '⇒', '⇓' => '⇓', '⇔' => '⇔', '∀' => '∀', '∂' => '∂', '∃' => '∃', - '∅' => '∅', '∇' => '∇', '∈' => '∈', '∉' => '∉', '∋' => '∋', '∏' => '∏', '∑' => '∑', '−' => '−', '∗' => '∗', '√' => '√', - '∝' => '∝', '∞' => '∞', '∠' => '∠', '∧' => '∧', '∨' => '∨', '∩' => '∩', '∪' => '∪', '∫' => '∫', '∴' => '∴', '∼' => '∼', - '≅' => '≅', '≈' => '≈', '≠' => '≠', '≡' => '≡', '≤' => '≤', '≥' => '≥', '⊂' => '⊂', '⊃' => '⊃', '⊄' => '⊄', '⊆' => '⊆', - '⊇' => '⊇', '⊕' => '⊕', '⊗' => '⊗', '⊥' => '⊥', '⋅' => '⋅', '⌈' => '⌈', '⌉' => '⌉', '⌊' => '⌊', '⌋' => '⌋', '⟨' => '〈', - '⟩' => '〉', '◊' => '◊', '♠' => '♠', '♣' => '♣', '♥' => '♥', '♦' => '♦' -); -$wp_htmltrans = array_merge($wp_htmltrans,$wp_htmltransbis); - # Translation of invalid Unicode references range to valid range $wp_htmltranswinuni = array( '€' => '€', // the Euro sign diff --git a/wp-links-opml.php b/wp-links-opml.php index 82a1ab8669..7e697b856f 100644 --- a/wp-links-opml.php +++ b/wp-links-opml.php @@ -24,8 +24,6 @@ if ((empty($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) { <opml version="1.0"> <head> <title>Links for <?php echo get_bloginfo('name').$cat_name ?> - - GMT diff --git a/wp-rdf.php b/wp-rdf.php index 1559154d87..c841106b10 100644 --- a/wp-rdf.php +++ b/wp-rdf.php @@ -25,9 +25,7 @@ add_filter('the_content', 'trim'); - - hourly 1 2000-01-01T12:00+00:00 diff --git a/wp-rss.php b/wp-rss.php index f10dc4a9c8..06c5409734 100644 --- a/wp-rss.php +++ b/wp-rss.php @@ -18,8 +18,6 @@ header('Content-type: text/xml', true); http://backend.userland.com/rss092 - -