Make WordPress Core

Ticket #1032: cockney.diff

File cockney.diff, 1.5 KB (added by markjaquith, 18 years ago)

Patch for /trunk/

  • wp-includes/formatting.php

     
    11<?php
    22
    33function wptexturize($text) {
     4        global $wp_cockneyreplace;
    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");
     20                        // if a plugin has provided an autocorrect array, use it
     21                        if ( isset($wp_cockneyreplace) ) {
     22                                $cockney = array_keys($wp_cockneyreplace);
     23                                $cockney_replace = array_values($wp_cockneyreplace);
     24                        } else {
     25                                $cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause");
     26                                $cockneyreplace = array("&#8217;tain&#8217;t","&#8217;twere","&#8217;twas","&#8217;tis","&#8217;twill","&#8217;til","&#8217;bout","&#8217;nuff","&#8217;round","&#8217;cause");
     27                        }
     28
    2229                        $curl = str_replace($cockney, $cockneyreplace, $curl);
    2330
    2431                        $curl = preg_replace("/'s/", '&#8217;s', $curl);