Make WordPress Core

Changeset 1121


Ignore:
Timestamp:
04/22/2004 07:41:57 AM (20 years ago)
Author:
saxmatt
Message:

Removing some old functions. Cleaning up remaining places where we exposed emails. Consolidated ampersand fixing. Fixed pasting from Word.

Location:
trunk
Files:
7 edited

Legend:

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

    r1118 r1121  
    22
    33function wptexturize($text) {
    4     $output = "";
    5     $textarr = preg_split("/(<.*>)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
     4    $output = '';
     5    // Capture tags and everything inside them
     6    $textarr = preg_split("/(<.*>)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
    67    $stop = count($textarr); $next = true; // loop stuff
    78    for ($i = 0; $i < $stop; $i++) {
     
    3132            $curl = preg_replace("/\(c\)/i", '&#169;', $curl);
    3233            $curl = preg_replace("/\(r\)/i", '&#174;', $curl);
    33             $curl = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $curl);
    3434            $curl = str_replace("''", '&#8221;', $curl);
    3535           
     
    5656    $pee = $pee . "\n"; // just to make things a little easier, pad the end
    5757    $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
    58     $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
    59     $pee = preg_replace('!(</(?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])>)!', "$1\n", $pee); // Space things out a little
    60     $pee = preg_replace("/(\r\n|\r)/", "\n", $pee); // cross-platform newlines
     58    // Space things out a little
     59    $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);
     60    $pee = preg_replace('!(</(?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])>)!', "$1\n", $pee);
     61    $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
    6162    $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
    6263    $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t<p>$1</p>\n", $pee); // make paragraphs, including one at the end
     
    7273    $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee);
    7374    $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') .  clean_pre('$2')  . '</pre>' ", $pee);
    74     $pee = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $pee);
    7575   
    7676    return $pee;
     
    8888}
    8989
    90 function convert_chars($content, $flag='obsolete attribute left there for backwards compatibility') {
    91     // html/unicode entities output
    92     global $wp_htmltrans, $wp_htmltranswinuni;
    93 
    94     // removes metadata tags
     90function convert_chars($content, $flag = 'obsolete') {
     91    global $wp_htmltranswinuni;
     92
     93    // Remove metadata tags
    9594    $content = preg_replace('/<title>(.+?)<\/title>/','',$content);
    9695    $content = preg_replace('/<category>(.+?)<\/category>/','',$content);
    97     // converts lone & characters into &#38; (a.k.a. &amp;)
    98     $content = preg_replace('/&[^#](?![a-z]*;)/ie', '"&#38;".substr("\0",1)', $content);
     96
     97    // Converts lone & characters into &#38; (a.k.a. &amp;)
     98    $content = preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $content);
     99
     100    // Fix Word pasting
    99101    $content = strtr($content, $wp_htmltranswinuni);
    100     if (get_settings('use_htmltrans')) {
    101         // converts HTML-entities to their display values in order to convert them again later
    102         $content = preg_replace('/['.chr(127).'-'.chr(255).']/e', '"&#".ord(\'\0\').";"', $content );
    103         $content = strtr($content, $wp_htmltrans);
    104     }
    105 
    106     // you can delete these 2 lines if you don't like <br /> and <hr />
    107     $content = str_replace('<br>', '<br />',$content);
    108     $content = str_replace('<hr>', '<hr />',$content);
     102
     103    // Just a little XHTML help
     104    $content = str_replace('<br>', '<br />', $content);
     105    $content = str_replace('<hr>', '<hr />', $content);
    109106
    110107    return $content;
     
    210207    }
    211208
    212     # WP fix for the bug with HTML comments
     209    // WP fix for the bug with HTML comments
    213210    $newtext = str_replace("< !--","<!--",$newtext);
    214211    $newtext = str_replace("<    !--","< !--",$newtext);
    215212
    216213    return $newtext;
    217 }
    218 
    219 function autobrize($content) {
    220     $content = preg_replace("/<br>\n/", "\n", $content);
    221     $content = preg_replace("/<br \/>\n/", "\n", $content);
    222     $content = preg_replace("/(\015\012)|(\015)|(\012)/", "<br />\n", $content);
    223     return $content;
    224 }
    225 
    226 function unautobrize($content) {
    227     $content = preg_replace("/<br>\n/", "\n", $content);   //for PHP versions before 4.0.5
    228     $content = preg_replace("/<br \/>\n/", "\n", $content);
    229     return $content;
    230214}
    231215
     
    301285}
    302286
    303 function convert_bbcode($content) { // depreciated
    304     return $content;
    305 }
    306 
    307 function convert_bbcode_email($content) {
    308     global $use_bbcode;
    309     $bbcode_email["in"] = array(
    310         '#\[email](.+?)\[/email]#eis',
    311         '#\[email=(.+?)](.+?)\[/email]#eis'
    312     );
    313     $bbcode_email["out"] = array(
    314         "'<a href=\"mailto:'.antispambot('\\1').'\">'.antispambot('\\1').'</a>'",       // E-mail
    315         "'<a href=\"mailto:'.antispambot('\\1').'\">\\2</a>'"
    316     );
    317 
    318     $content = preg_replace($bbcode_email["in"], $bbcode_email["out"], $content);
    319     return $content;
    320 }
    321 
    322 function convert_gmcode($content) { // depreciated
    323     return $content;
    324 }
    325 
    326287function convert_smilies($text) {
    327288    global $wp_smiliessearch, $wp_smiliesreplace;
  • trunk/wp-includes/functions.php

    r1109 r1121  
    863863        if(($lon != null) && ($lat != null) ) {
    864864            echo "<meta name=\"ICBM\" content=\"".$lat.", ".$lon."\" />\n";
    865             echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")),"unicode")." - ".$title."\" />\n";
     865            echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")))." - ".$title."\" />\n";
    866866            echo "<meta name=\"geo.position\" content=\"".$lat.";".$lon."\" />\n";
    867867            return;
     
    871871            // send the default here
    872872            echo "<meta name=\"ICBM\" content=\"". get_settings('default_geourl_lat') .", ". get_settings('default_geourl_lon') ."\" />\n";
    873             echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")),"unicode")."\" />\n";
     873            echo "<meta name=\"DC.title\" content=\"".convert_chars(strip_tags(get_bloginfo("name")))."\" />\n";
    874874            echo "<meta name=\"geo.position\" content=\"". get_settings('default_geourl_lat') .";". get_settings('default_geourl_lon') ."\" />\n";
    875875        }
     
    10591059function start_wp() {
    10601060    global $post, $id, $postdata, $authordata, $day, $preview, $page, $pages, $multipage, $more, $numpages;
    1061     global $preview_userid,$preview_date,$preview_content,$preview_title,$preview_category,$preview_notify,$preview_make_clickable,$preview_autobr;
    10621061    global $pagenow;
    10631062    if (!$preview) {
  • trunk/wp-includes/template-functions-general.php

    r1108 r1121  
    55function bloginfo($show='') {
    66    $info = get_bloginfo($show);
    7     $info = convert_bbcode($info);
    8     $info = convert_gmcode($info);
    9     $info = convert_smilies($info);
    107    $info = apply_filters('bloginfo', $info);
    11     echo convert_chars($info, 'html');
     8    echo convert_chars($info);
    129}
    1310
    1411function bloginfo_rss($show='') {
    1512    $info = strip_tags(get_bloginfo($show));
    16     echo convert_chars($info, 'unicode');
     13    echo convert_chars($info);
    1714}
    1815
    1916function bloginfo_unicode($show='') {
    2017    $info = get_bloginfo($show);
    21     echo convert_chars($info, 'unicode');
     18    echo convert_chars($info);
    2219}
    2320
  • trunk/wp-includes/vars.php

    r1108 r1121  
    33/* This file sets various arrays and variables for use in WordPress */
    44require(ABSPATH . 'wp-includes/version.php');
    5 
    6 # Translation of HTML entities and special characters
    7 $wp_htmltrans = array_flip(get_html_translation_table(HTML_ENTITIES));
    8 $wp_htmltrans['<'] = '<';   # preserve HTML
    9 $wp_htmltrans['>'] = '>';   # preserve HTML
    10 $wp_htmltransbis = array(
    11     '–' => '&#8211;',
    12     '—' => '&#8212;',
    13     '‘' => '&#8216;',
    14     '’' => '&#8217;',
    15     '“' => '&#8220;',
    16     '”' => '&#8221;',
    17     '•' => '&#8226;',
    18     '€' => '&#8364;',
    19     '&lt;' => '&#60;',  # preserve fake HTML
    20     '&gt;' => '&#62;',  # preserve fake HTML
    21     '&amp;' => '&#038;',    # preserve fake HTML
    22     '&sp;' => '&#32;', '&excl;' => '&#33;', '&quot;' => '&#34;', '&num;' => '&#35;', '&dollar;' => '&#36;', '&percnt;' => '&#37;', '&apos;' => '&#39;', '&lpar;' => '&#40;', '&rpar;' => '&#41;',
    23     '&ast;' => '&#42;', '&plus;' => '&#43;', '&comma;' => '&#44;', '&hyphen;' => '&#45;', '&minus;' => '&#45;', '&period;' => '&#46;', '&sol;' => '&#47;', '&colon;' => '&#58;', '&semi;' => '&#59;', '&lt;' => '&#60;',
    24     '&equals;' => '&#61;', '&gt;' => '&#62;', '&quest;' => '&#63;', '&commat;' => '&#64;', '&lsqb;' => '&#91;', '&bsol;' => '&#92;', '&rsqb;' => '&#93;', '&circ;' => '&#94;', '&lowbar;' => '&#95;', '&horbar;' => '&#95;',
    25     '&grave;' => '&#96;', '&lcub;' => '&#123;', '&verbar;' => '&#124;', '&rcub;' => '&#125;', '&tilde;' => '&#126;', '&lsquor;' => '&#130;', '&ldquor;' => '&#132;',
    26     '&ldots;' => '&#133;', '&Scaron;' => '&#138;', '&lsaquo;' => '&#139;', '&OElig;' => '&#140;', '&lsquo;' => '&#145;', '&rsquor;' => '&#145;', '&rsquo;' => '&#146;',
    27     '&ldquo;' => '&#147;', '&rdquor;' => '&#147;', '&rdquo;' => '&#148;', '&bull;' => '&#149;', '&ndash;' => '&#150;', '&endash;' => '&#150;', '&mdash;' => '&#151;', '&emdash;' => '&#151;', '&tilde;' => '&#152;', '&trade;' => '&#153;',
    28     '&scaron;' => '&#154;', '&rsaquo;' => '&#155;', '&oelig;' => '&#156;', '&Yuml;' => '&#159;', '&nbsp;' => '&#160;', '&iexcl;' => '&#161;', '&cent;' => '&#162;', '&pound;' => '&#163;', '&curren;' => '&#164;', '&yen;' => '&#165;',
    29     '&brvbar;' => '&#166;', '&brkbar;' => '&#166;', '&sect;' => '&#167;', '&uml;' => '&#168;', '&die;' => '&#168;', '&copy;' => '&#169;', '&ordf;' => '&#170;', '&laquo;' => '&#171;', '&not;' => '&#172;', '&shy;' => '&#173;',
    30     '&reg;' => '&#174;', '&macr;' => '&#175;', '&hibar;' => '&#175;', '&deg;' => '&#176;', '&plusmn;' => '&#177;', '&sup2;' => '&#178;', '&sup3;' => '&#179;', '&acute;' => '&#180;', '&micro;' => '&#181;', '&para;' => '&#182;',
    31     '&middot;' => '&#183;', '&cedil;' => '&#184;', '&sup1;' => '&#185;', '&ordm;' => '&#186;', '&raquo;' => '&#187;', '&frac14;' => '&#188;', '&frac12;' => '&#189;', '&half;' => '&#189;', '&frac34;' => '&#190;', '&iquest;' => '&#191;',
    32     '&Agrave;' => '&#192;', '&Aacute;' => '&#193;', '&Acirc;' => '&#194;', '&Atilde;' => '&#195;', '&Auml;' => '&#196;', '&Aring;' => '&#197;', '&AElig;' => '&#198;', '&Ccedil;' => '&#199;', '&Egrave;' => '&#200;', '&Eacute;' => '&#201;',
    33     '&Ecirc;' => '&#202;', '&Euml;' => '&#203;', '&Igrave;' => '&#204;', '&Iacute;' => '&#205;', '&Icirc;' => '&#206;', '&Iuml;' => '&#207;', '&ETH;' => '&#208;', '&Ntilde;' => '&#209;', '&Ograve;' => '&#210;', '&Oacute;' => '&#211;',
    34     '&Ocirc;' => '&#212;', '&Otilde;' => '&#213;', '&Ouml;' => '&#214;', '&times;' => '&#215;', '&Oslash;' => '&#216;', '&Ugrave;' => '&#217;', '&Uacute;' => '&#218;', '&Ucirc;' => '&#219;', '&Uuml;' => '&#220;', '&Yacute;' => '&#221;',
    35     '&THORN;' => '&#222;', '&szlig;' => '&#223;', '&agrave;' => '&#224;', '&aacute;' => '&#225;', '&acirc;' => '&#226;', '&atilde;' => '&#227;', '&auml;' => '&#228;', '&aring;' => '&#229;', '&aelig;' => '&#230;', '&ccedil;' => '&#231;',
    36     '&egrave;' => '&#232;', '&eacute;' => '&#233;', '&ecirc;' => '&#234;', '&euml;' => '&#235;', '&igrave;' => '&#236;', '&iacute;' => '&#237;', '&icirc;' => '&#238;', '&iuml;' => '&#239;', '&eth;' => '&#240;', '&ntilde;' => '&#241;',
    37     '&ograve;' => '&#242;', '&oacute;' => '&#243;', '&ocirc;' => '&#244;', '&otilde;' => '&#245;', '&ouml;' => '&#246;', '&divide;' => '&#247;', '&oslash;' => '&#248;', '&ugrave;' => '&#249;', '&uacute;' => '&#250;', '&ucirc;' => '&#251;',
    38     '&uuml;' => '&#252;', '&yacute;' => '&#253;', '&thorn;' => '&#254;', '&yuml;' => '&#255;', '&OElig;' => '&#338;', '&oelig;' => '&#339;', '&Scaron;' => '&#352;', '&scaron;' => '&#353;', '&Yuml;' => '&#376;', '&fnof;' => '&#402;',
    39     '&circ;' => '&#710;', '&tilde;' => '&#732;', '&Alpha;' => '&#913;', '&Beta;' => '&#914;', '&Gamma;' => '&#915;', '&Delta;' => '&#916;', '&Epsilon;' => '&#917;', '&Zeta;' => '&#918;', '&Eta;' => '&#919;', '&Theta;' => '&#920;',
    40     '&Iota;' => '&#921;', '&Kappa;' => '&#922;', '&Lambda;' => '&#923;', '&Mu;' => '&#924;', '&Nu;' => '&#925;', '&Xi;' => '&#926;', '&Omicron;' => '&#927;', '&Pi;' => '&#928;', '&Rho;' => '&#929;', '&Sigma;' => '&#931;',
    41     '&Tau;' => '&#932;', '&Upsilon;' => '&#933;', '&Phi;' => '&#934;', '&Chi;' => '&#935;', '&Psi;' => '&#936;', '&Omega;' => '&#937;', '&alpha;' => '&#945;', '&beta;' => '&#946;', '&gamma;' => '&#947;', '&delta;' => '&#948;',
    42     '&epsilon;' => '&#949;', '&zeta;' => '&#950;', '&eta;' => '&#951;', '&theta;' => '&#952;', '&iota;' => '&#953;', '&kappa;' => '&#954;', '&lambda;' => '&#955;', '&mu;' => '&#956;', '&nu;' => '&#957;', '&xi;' => '&#958;',
    43     '&omicron;' => '&#959;', '&pi;' => '&#960;', '&rho;' => '&#961;', '&sigmaf;' => '&#962;', '&sigma;' => '&#963;', '&tau;' => '&#964;', '&upsilon;' => '&#965;', '&phi;' => '&#966;', '&chi;' => '&#967;', '&psi;' => '&#968;',
    44     '&omega;' => '&#969;', '&thetasym;' => '&#977;', '&upsih;' => '&#978;', '&piv;' => '&#982;', '&ensp;' => '&#8194;', '&emsp;' => '&#8195;', '&thinsp;' => '&#8201;', '&zwnj;' => '&#8204;', '&zwj;' => '&#8205;', '&lrm;' => '&#8206;',
    45     '&rlm;' => '&#8207;', '&ndash;' => '&#8211;', '&mdash;' => '&#8212;', '&lsquo;' => '&#8216;', '&rsquo;' => '&#8217;', '&sbquo;' => '&#8218;', '&ldquo;' => '&#8220;', '&rdquo;' => '&#8221;', '&bdquo;' => '&#8222;', '&dagger;' => '&#8224;',
    46     '&Dagger;' => '&#8225;', '&bull;' => '&#8226;', '&hellip;' => '&#8230;', '&permil;' => '&#8240;', '&prime;' => '&#8242;', '&Prime;' => '&#8243;', '&lsaquo;' => '&#8249;', '&rsaquo;' => '&#8250;', '&oline;' => '&#8254;', '&frasl;' => '&#8260;',
    47     '&euro;' => '&#8364;', '&image;' => '&#8465;', '&weierp;' => '&#8472;', '&real;' => '&#8476;', '&trade;' => '&#8482;', '&alefsym;' => '&#8501;', '&larr;' => '&#8592;', '&uarr;' => '&#8593;', '&rarr;' => '&#8594;', '&darr;' => '&#8595;',
    48     '&harr;' => '&#8596;', '&crarr;' => '&#8629;', '&lArr;' => '&#8656;', '&uArr;' => '&#8657;', '&rArr;' => '&#8658;', '&dArr;' => '&#8659;', '&hArr;' => '&#8660;', '&forall;' => '&#8704;', '&part;' => '&#8706;', '&exist;' => '&#8707;',
    49     '&empty;' => '&#8709;', '&nabla;' => '&#8711;', '&isin;' => '&#8712;', '&notin;' => '&#8713;', '&ni;' => '&#8715;', '&prod;' => '&#8719;', '&sum;' => '&#8721;', '&minus;' => '&#8722;', '&lowast;' => '&#8727;', '&radic;' => '&#8730;',
    50     '&prop;' => '&#8733;', '&infin;' => '&#8734;', '&ang;' => '&#8736;', '&and;' => '&#8743;', '&or;' => '&#8744;', '&cap;' => '&#8745;', '&cup;' => '&#8746;', '&int;' => '&#8747;', '&there4;' => '&#8756;', '&sim;' => '&#8764;',
    51     '&cong;' => '&#8773;', '&asymp;' => '&#8776;', '&ne;' => '&#8800;', '&equiv;' => '&#8801;', '&le;' => '&#8804;', '&ge;' => '&#8805;', '&sub;' => '&#8834;', '&sup;' => '&#8835;', '&nsub;' => '&#8836;', '&sube;' => '&#8838;',
    52     '&supe;' => '&#8839;', '&oplus;' => '&#8853;', '&otimes;' => '&#8855;', '&perp;' => '&#8869;', '&sdot;' => '&#8901;', '&lceil;' => '&#8968;', '&rceil;' => '&#8969;', '&lfloor;' => '&#8970;', '&rfloor;' => '&#8971;', '&lang;' => '&#9001;',
    53     '&rang;' => '&#9002;', '&loz;' => '&#9674;', '&spades;' => '&#9824;', '&clubs;' => '&#9827;', '&hearts;' => '&#9829;', '&diams;' => '&#9830;'
    54 );
    55 $wp_htmltrans = array_merge($wp_htmltrans,$wp_htmltransbis);
    565
    576# Translation of invalid Unicode references range to valid range
  • trunk/wp-links-opml.php

    r1108 r1121  
    2525    <head>
    2626        <title>Links for <?php echo get_bloginfo('name').$cat_name ?></title>
    27         <ownerName><?php echo antispambot(get_bloginfo('admin_email')) ?></ownerName>
    28         <ownerEmail><?php echo antispambot(get_bloginfo('admin_email')) ?></ownerEmail>
    2927        <dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
    3028    </head>
  • trunk/wp-rdf.php

    r1045 r1121  
    2626    <dc:language><?php echo get_settings('rss_language'); ?></dc:language>
    2727    <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></dc:date>
    28     <dc:creator><?php echo antispambot(get_settings('admin_email')) ?></dc:creator>
    2928    <admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $wp_version ?>"/>
    30     <admin:errorReportsTo rdf:resource="mailto:<?php echo antispambot(get_settings('admin_email')) ?>"/>
    3129    <sy:updatePeriod>hourly</sy:updatePeriod>
    3230    <sy:updateFrequency>1</sy:updateFrequency>
  • trunk/wp-rss.php

    r1046 r1121  
    1919        <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT')); ?></lastBuildDate>
    2020        <docs>http://backend.userland.com/rss092</docs>
    21         <managingEditor><?php echo antispambot(get_settings('admin_email')) ?></managingEditor>
    22         <webMaster><?php echo antispambot(get_settings('admin_email')) ?></webMaster>
    2321        <language><?php echo get_settings('rss_language'); ?></language>
    2422
Note: See TracChangeset for help on using the changeset viewer.