Make WordPress Core

Ticket #1032: 1032.diff

File 1032.diff, 2.0 KB (added by Nazgul, 18 years ago)
  • wp-includes/formatting.php

     
    11<?php
    22
    33function wptexturize($text) {
     4        global $wpautocorrect;
    45        $output = '';
    56        // Capture tags and everything inside them
    67        $textarr = preg_split("/(<.*>)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
     
    1617                        $curl = str_replace('...', '&#8230;', $curl);
    1718                        $curl = str_replace('``', '&#8220;', $curl);
    1819
    19                         // This is a hack, look at this more later. It works pretty well though.
    20                         $cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause");
    21                         $cockneyreplace = array("&#8217;tain&#8217;t","&#8217;twere","&#8217;twas","&#8217;tis","&#8217;twill","&#8217;til","&#8217;bout","&#8217;nuff","&#8217;round","&#8217;cause");
    22                         $curl = str_replace($cockney, $cockneyreplace, $curl);
     20                        // Replacement for cockneyreplace
     21                        // Array now set in wp-config.php or wp-includes/vars.php
     22                        $curl = str_replace(array_keys($wpautocorrect), array_values($wpautocorrect), $curl);
    2323
    2424                        $curl = preg_replace("/'s/", '&#8217;s', $curl);
    2525                        $curl = preg_replace("/'(\d\d(?:&#8217;|')?s)/", "&#8217;$1", $curl);
  • wp-includes/vars.php

     
    9292        $wp_smiliesreplace[] = " <img src='" . get_option('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
    9393}
    9494
     95// if the config file does not provide the autocorrect array, let's define it here
     96if (!isset($wpautocorrect)) {
     97        $wpautocorrect = array(
     98        "'tain't" => '&#8217;tain&#8217;t',
     99        "'twere"  => '&#8217;twere',
     100        "'twas"   => '&#8217;twas',
     101        "'tis"    => '&#8217;tis',
     102        "'twill"  => '&#8217;twill',
     103        "'til"    => '&#8217;til',
     104        "'bout"   => '&#8217;bout',
     105        "'nuff"   => '&#8217;nuff',
     106        "'round"  => '&#8217;round',
     107        "'cause"  => '&#8217;cause',
     108        );
     109}
     110
    95111?>