Make WordPress Core


Ignore:
Timestamp:
12/23/2004 12:08:43 AM (22 years ago)
Author:
saxmatt
Message:

Clean up global ideas from michel_v

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions-formatting.php

    r1984 r1994  
    237237
    238238function convert_chars($content, $flag = 'obsolete') {
    239         global $wp_htmltranswinuni;
     239        // Translation of invalid Unicode references range to valid range
     240        $wp_htmltranswinuni = array(
     241        '€' => '€', // the Euro sign
     242        '' => '',
     243        '‚' => '‚', // these are Windows CP1252 specific characters
     244        'ƒ' => 'ƒ',  // they would look weird on non-Windows browsers
     245        '„' => '„',
     246        '…' => '…',
     247        '†' => '†',
     248        '‡' => '‡',
     249        'ˆ' => 'ˆ',
     250        '‰' => '‰',
     251        'Š' => 'Š',
     252        '‹' => '‹',
     253        'Œ' => 'Œ',
     254        '' => '',
     255        'Ž' => 'ž',
     256        '' => '',
     257        '' => '',
     258        '‘' => '‘',
     259        '’' => '’',
     260        '“' => '“',
     261        '”' => '”',
     262        '•' => '•',
     263        '–' => '–',
     264        '—' => '—',
     265        '˜' => '˜',
     266        '™' => '™',
     267        'š' => 'š',
     268        '›' => '›',
     269        'œ' => 'œ',
     270        '' => '',
     271        'ž' => '',
     272        'Ÿ' => 'Ÿ'
     273        );
    240274
    241275        // Remove metadata tags
     
    254288
    255289        return $content;
     290}
     291
     292function funky_javascript_fix($text) {
     293        // Fixes for browsers' javascript bugs
     294        global $is_macIE, $is_winIE, $is_gecko;
     295        $wp_macIE_correction['in'] = array(
     296                '/\%uFFD4/', '/\%uFFD5/', '/\%uFFD2/', '/\%uFFD3/',
     297                '/\%uFFA5/', '/\%uFFD0/', '/\%uFFD1/', '/\%uFFBD/',
     298                '/\%uFF83%uFFC0/', '/\%uFF83%uFFC1/', '/\%uFF83%uFFC6/', '/\%uFF83%uFFC9/',
     299                '/\%uFFB9/', '/\%uFF81%uFF8C/', '/\%uFF81%uFF8D/', '/\%uFF81%uFFDA/',
     300                '/\%uFFDB/'
     301        );
     302        $wp_macIE_correction['out'] = array(
     303                '‘', '’', '“', '”',
     304                '•', '–', '—', 'Ω',
     305                'β', 'γ', 'θ', 'λ',
     306                'π', '′', '″', '∠',
     307                '€'
     308        );
     309        $wp_gecko_correction['in'] = array(
     310                '/\‘/', '/\’/', '/\“/', '/\”/',
     311                '/\•/', '/\–/', '/\—/', '/\O/',
     312                '/\ß/', '/\?/', '/\?/', '/\?/',
     313                '/\p/', '/\'/', '/\?/', '/\/',
     314                '/\€/', '/\?/'
     315        );
     316        $wp_gecko_correction['out'] = array(
     317                '&8216;', '’', '“', '”',
     318                '•', '–', '—', 'Ω',
     319                'β', 'γ', 'θ', 'λ',
     320                'π', '′', '″', '∠',
     321                '€', ' '
     322        );
     323        if ( $is_macIE )
     324                $text = preg_replace('/'.$wp_macIE_correction["in"].'/', '/'.$wp_macIE_correction["out"].'/', $text);
     325       
     326        if ( $is_winIE )
     327                $text =  preg_replace("/\%u([0-9A-F]{4,4})/e",  "'&#'.base_convert('\\1',16,10).';'", $text);
     328       
     329        if ( $is_gecko )
     330                $text = preg_replace('/'.$wp_gecko_correction["in"].'/','/'.$wp_gecko_correction["out"].'/',$text);
     331       
     332        return $text;
    256333}
    257334
Note: See TracChangeset for help on using the changeset viewer.