Make WordPress Core

Ticket #1032: autocorrect.diff

File autocorrect.diff, 2.2 KB (added by slebog, 19 years ago)
  • wp-includes/functions-formatting.php

    old new  
    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);
     
    1516                        $curl = str_replace('...', '&#8230;', $curl);
    1617                        $curl = str_replace('``', '&#8220;', $curl);
    1718
    18                         // This is a hack, look at this more later. It works pretty well though.
    19                         $cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round");
    20                         $cockneyreplace = array("&#8217;tain&#8217;t","&#8217;twere","&#8217;twas","&#8217;tis","&#8217;twill","&#8217;til","&#8217;bout","&#8217;nuff","&#8217;round");
    21                         $curl = str_replace($cockney, $cockneyreplace, $curl);
     19                        // Replacement for cockneyreplace
     20                        // Array now set in wp-config.php or wp-includes/vars.php
     21                        $curl = str_replace( array_keys($wpautocorrect), array_values($wpautocorrect), $curl );
    2222
    2323                        $curl = preg_replace("/'s/", '&#8217;s', $curl);
    2424                        $curl = preg_replace("/'(\d\d(?:&#8217;|')?s)/", "&#8217;$1", $curl);
  • wp-includes/vars.php

    Only in trunk/wp-includes: languages
    diff -u --recursive trunk-svn/wp-includes/vars.php trunk/wp-includes/vars.php
    old new  
    105105        $wp_smiliesreplace[] = " <img src='" . get_settings('siteurl') . "/wp-images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
    106106}
    107107
     108// if the config file does not provide the autocorrect array, let's define it here
     109if (!isset($wpautocorrect)) {
     110        $wpautocorrect = array(
     111        "'tain't" => '&#8217;tain&#8217;t',
     112        "'twere"  => '&#8217;twere',
     113        "'twas"   => '&#8217;twas',
     114        "'tis"    => '&#8217;tis',
     115        "'twill"  => '&#8217;twill',
     116        "'til"    => '&#8217;til',
     117        "'bout"   => '&#8217;bout',
     118        "'nuff"   => '&#8217;nuff',
     119        "'round"  => '&#8217;round',
     120        );
     121}
     122
    108123// Path for cookies
    109124define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('home') . '/' ) );
    110125define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('siteurl') . '/' ) );