Clean up global ideas from michel_v

git-svn-id: https://develop.svn.wordpress.org/trunk@1994 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg
2004-12-23 00:08:43 +00:00
parent 595851973e
commit 978063ce7c
3 changed files with 92 additions and 95 deletions

View File

@@ -236,7 +236,41 @@ function sanitize_title_with_dashes($title) {
}
function convert_chars($content, $flag = 'obsolete') {
global $wp_htmltranswinuni;
// Translation of invalid Unicode references range to valid range
$wp_htmltranswinuni = array(
'€' => '€', // the Euro sign
'' => '',
'‚' => '‚', // these are Windows CP1252 specific characters
'ƒ' => 'ƒ', // they would look weird on non-Windows browsers
'„' => '„',
'…' => '…',
'†' => '†',
'‡' => '‡',
'ˆ' => 'ˆ',
'‰' => '‰',
'Š' => 'Š',
'‹' => '‹',
'Œ' => 'Œ',
'' => '',
'Ž' => 'ž',
'' => '',
'' => '',
'‘' => '‘',
'’' => '’',
'“' => '“',
'”' => '”',
'•' => '•',
'–' => '–',
'—' => '—',
'˜' => '˜',
'™' => '™',
'š' => 'š',
'›' => '›',
'œ' => 'œ',
'' => '',
'ž' => '',
'Ÿ' => 'Ÿ'
);
// Remove metadata tags
$content = preg_replace('/<title>(.+?)<\/title>/','',$content);
@@ -255,6 +289,49 @@ function convert_chars($content, $flag = 'obsolete') {
return $content;
}
function funky_javascript_fix($text) {
// Fixes for browsers' javascript bugs
global $is_macIE, $is_winIE, $is_gecko;
$wp_macIE_correction['in'] = array(
'/\%uFFD4/', '/\%uFFD5/', '/\%uFFD2/', '/\%uFFD3/',
'/\%uFFA5/', '/\%uFFD0/', '/\%uFFD1/', '/\%uFFBD/',
'/\%uFF83%uFFC0/', '/\%uFF83%uFFC1/', '/\%uFF83%uFFC6/', '/\%uFF83%uFFC9/',
'/\%uFFB9/', '/\%uFF81%uFF8C/', '/\%uFF81%uFF8D/', '/\%uFF81%uFFDA/',
'/\%uFFDB/'
);
$wp_macIE_correction['out'] = array(
'&lsquo;', '&rsquo;', '&ldquo;', '&rdquo;',
'&bull;', '&ndash;', '&mdash;', '&Omega;',
'&beta;', '&gamma;', '&theta;', '&lambda;',
'&pi;', '&prime;', '&Prime;', '&ang;',
'&euro;'
);
$wp_gecko_correction['in'] = array(
'/\/', '/\/', '/\“/', '/\”/',
'/\•/', '/\/', '/\—/', '/\O/',
'/\ß/', '/\?/', '/\?/', '/\?/',
'/\p/', '/\'/', '/\?/', '/\/',
'/\€/', '/\?/'
);
$wp_gecko_correction['out'] = array(
'&8216;', '&rsquo;', '&ldquo;', '&rdquo;',
'&bull;', '&ndash;', '&mdash;', '&Omega;',
'&beta;', '&gamma;', '&theta;', '&lambda;',
'&pi;', '&prime;', '&Prime;', '&ang;',
'&euro;', '&#8201;'
);
if ( $is_macIE )
$text = preg_replace('/'.$wp_macIE_correction["in"].'/', '/'.$wp_macIE_correction["out"].'/', $text);
if ( $is_winIE )
$text = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text);
if ( $is_gecko )
$text = preg_replace('/'.$wp_gecko_correction["in"].'/','/'.$wp_gecko_correction["out"].'/',$text);
return $text;
}
/*
balanceTags