Make WordPress Core

Changeset 1994


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

Clean up global ideas from michel_v

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/bookmarklet.php

    r1993 r1994  
    2121<?php
    2222} else {
    23     $popuptitle = wp_specialchars(stripslashes($popuptitle));
    24     $text = wp_specialchars(stripslashes(urldecode($text)));
    25    
    26     /* big funky fixes for browsers' javascript bugs */
    27    
    28     if (($is_macIE) && (!isset($IEMac_bookmarklet_fix))) {
    29         $popuptitle = preg_replace('/'.$wp_macIE_correction["in"].'/','/'.$wp_macIE_correction["out"].'/',$popuptitle);
    30         $text = preg_replace('/'.$wp_macIE_correction["in"].'/','/'.$wp_macIE_correction["out"].'/',$text);
    31     }
    32    
    33     if (($is_winIE) && (!isset($IEWin_bookmarklet_fix))) {
    34         $popuptitle =  preg_replace("/\%u([0-9A-F]{4,4})/e",  "'&#'.base_convert('\\1',16,10).';'", $popuptitle);
    35         $text =  preg_replace("/\%u([0-9A-F]{4,4})/e",  "'&#'.base_convert('\\1',16,10).';'", $text);
    36     }
    37    
    38     if (($is_gecko) && (!isset($Gecko_bookmarklet_fix))) {
    39         $popuptitle = preg_replace('/'.$wp_gecko_correction["in"].'/','/'.$wp_gecko_correction["out"].'/',$popuptitle);
    40         $text = preg_replace('/'.$wp_gecko_correction["in"].'/','/'.$wp_gecko_correction["out"].'/',$text);
    41     }
    42    
    43     $post_title = wp_specialchars($_REQUEST['post_title']);
    44     if (!empty($post_title)) {
    45         $post_title =  stripslashes($post_title);
    46     } else {
    47         $post_title = $popuptitle;
    48     }
    49 
    50     $edited_post_title = wp_specialchars($post_title);
     23        $popuptitle = wp_specialchars(stripslashes($popuptitle));
     24        $text       = wp_specialchars(stripslashes(urldecode($text)));
     25       
     26        $popuptitle = funky_javascript_fix($popuptitle);
     27        $text       = funky_javascript_fix($text);
     28       
     29        $post_title = wp_specialchars($_REQUEST['post_title']);
     30        if (!empty($post_title)) {
     31                $post_title =  stripslashes($post_title);
     32        } else {
     33                $post_title = $popuptitle;
     34        }
     35       
     36        $edited_post_title = wp_specialchars($post_title);
    5137
    5238// $post_pingback needs to be set in any file that includes edit-form.php
  • 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        '&#128;' => '&#8364;', // the Euro sign
     242        '&#129;' => '',
     243        '&#130;' => '&#8218;', // these are Windows CP1252 specific characters
     244        '&#131;' => '&#402;',  // they would look weird on non-Windows browsers
     245        '&#132;' => '&#8222;',
     246        '&#133;' => '&#8230;',
     247        '&#134;' => '&#8224;',
     248        '&#135;' => '&#8225;',
     249        '&#136;' => '&#710;',
     250        '&#137;' => '&#8240;',
     251        '&#138;' => '&#352;',
     252        '&#139;' => '&#8249;',
     253        '&#140;' => '&#338;',
     254        '&#141;' => '',
     255        '&#142;' => '&#382;',
     256        '&#143;' => '',
     257        '&#144;' => '',
     258        '&#145;' => '&#8216;',
     259        '&#146;' => '&#8217;',
     260        '&#147;' => '&#8220;',
     261        '&#148;' => '&#8221;',
     262        '&#149;' => '&#8226;',
     263        '&#150;' => '&#8211;',
     264        '&#151;' => '&#8212;',
     265        '&#152;' => '&#732;',
     266        '&#153;' => '&#8482;',
     267        '&#154;' => '&#353;',
     268        '&#155;' => '&#8250;',
     269        '&#156;' => '&#339;',
     270        '&#157;' => '',
     271        '&#158;' => '',
     272        '&#159;' => '&#376;'
     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                '&lsquo;', '&rsquo;', '&ldquo;', '&rdquo;',
     304                '&bull;', '&ndash;', '&mdash;', '&Omega;',
     305                '&beta;', '&gamma;', '&theta;', '&lambda;',
     306                '&pi;', '&prime;', '&Prime;', '&ang;',
     307                '&euro;'
     308        );
     309        $wp_gecko_correction['in'] = array(
     310                '/\‘/', '/\’/', '/\“/', '/\”/',
     311                '/\•/', '/\–/', '/\—/', '/\O/',
     312                '/\ß/', '/\?/', '/\?/', '/\?/',
     313                '/\p/', '/\'/', '/\?/', '/\/',
     314                '/\€/', '/\?/'
     315        );
     316        $wp_gecko_correction['out'] = array(
     317                '&8216;', '&rsquo;', '&ldquo;', '&rdquo;',
     318                '&bull;', '&ndash;', '&mdash;', '&Omega;',
     319                '&beta;', '&gamma;', '&theta;', '&lambda;',
     320                '&pi;', '&prime;', '&Prime;', '&ang;',
     321                '&euro;', '&#8201;'
     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
  • trunk/wp-includes/vars.php

    r1974 r1994  
    33/* This file sets various arrays and variables for use in WordPress */
    44require(ABSPATH . 'wp-includes/version.php');
    5 
    6 # Translation of invalid Unicode references range to valid range
    7 $wp_htmltranswinuni = array(
    8         '&#128;' => '&#8364;', // the Euro sign
    9         '&#129;' => '',
    10         '&#130;' => '&#8218;', // these are Windows CP1252 specific characters
    11         '&#131;' => '&#402;',  // they would look weird on non-Windows browsers
    12         '&#132;' => '&#8222;',
    13         '&#133;' => '&#8230;',
    14         '&#134;' => '&#8224;',
    15         '&#135;' => '&#8225;',
    16         '&#136;' => '&#710;',
    17         '&#137;' => '&#8240;',
    18         '&#138;' => '&#352;',
    19         '&#139;' => '&#8249;',
    20         '&#140;' => '&#338;',
    21         '&#141;' => '',
    22         '&#142;' => '&#382;',
    23         '&#143;' => '',
    24         '&#144;' => '',
    25         '&#145;' => '&#8216;',
    26         '&#146;' => '&#8217;',
    27         '&#147;' => '&#8220;',
    28         '&#148;' => '&#8221;',
    29         '&#149;' => '&#8226;',
    30         '&#150;' => '&#8211;',
    31         '&#151;' => '&#8212;',
    32         '&#152;' => '&#732;',
    33         '&#153;' => '&#8482;',
    34         '&#154;' => '&#353;',
    35         '&#155;' => '&#8250;',
    36         '&#156;' => '&#339;',
    37         '&#157;' => '',
    38         '&#158;' => '',
    39         '&#159;' => '&#376;'
    40         );
    415
    426// On which page are we ?
    … …  
    7539}
    7640$is_IE    = (($is_macIE) || ($is_winIE));
    77 
    78 // browser-specific javascript corrections
    79 $wp_macIE_correction['in'] = array(
    80         '/\%uFFD4/', '/\%uFFD5/', '/\%uFFD2/', '/\%uFFD3/',
    81         '/\%uFFA5/', '/\%uFFD0/', '/\%uFFD1/', '/\%uFFBD/',
    82         '/\%uFF83%uFFC0/', '/\%uFF83%uFFC1/', '/\%uFF83%uFFC6/', '/\%uFF83%uFFC9/',
    83         '/\%uFFB9/', '/\%uFF81%uFF8C/', '/\%uFF81%uFF8D/', '/\%uFF81%uFFDA/',
    84         '/\%uFFDB/'
    85 );
    86 $wp_macIE_correction['out'] = array(
    87         '&lsquo;', '&rsquo;', '&ldquo;', '&rdquo;',
    88         '&bull;', '&ndash;', '&mdash;', '&Omega;',
    89         '&beta;', '&gamma;', '&theta;', '&lambda;',
    90         '&pi;', '&prime;', '&Prime;', '&ang;',
    91         '&euro;'
    92 );
    93 $wp_gecko_correction['in'] = array(
    94         '/\‘/', '/\’/', '/\“/', '/\”/',
    95         '/\•/', '/\–/', '/\—/', '/\Ω/',
    96         '/\β/', '/\γ/', '/\θ/', '/\λ/',
    97         '/\π/', '/\′/', '/\″/', '/\/',
    98         '/\€/', '/\ /'
    99 );
    100 $wp_gecko_correction['out'] = array(
    101         '&8216;', '&rsquo;', '&ldquo;', '&rdquo;',
    102         '&bull;', '&ndash;', '&mdash;', '&Omega;',
    103         '&beta;', '&gamma;', '&theta;', '&lambda;',
    104         '&pi;', '&prime;', '&Prime;', '&ang;',
    105         '&euro;', '&#8201;'
    106 );
    10741
    10842// Server detection
Note: See TracChangeset for help on using the changeset viewer.