Ignore:
Timestamp:
Apr 19, 2006 3:14:28 AM (18 years ago)
Author:
scdev
Message:

Q - Cleaned up Auth_File to work more like Auth_SQL, and fixed a few bugs here and there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Utilities.inc.php

    r102 r103  
    104104
    105105/**
    106  * Returns text with stylistic modifications.
     106 * Returns text with stylistic modifications. Warning: this will break some HTML attibutes!
     107 * FIXME: Allow a string such as this to be passted: <a href="javascript:openPopup('/foo/bar.php')">Click here</a>
    107108 *
    108109 * @param  string   $txt  Text to clean.
     
    111112function fancyTxt($txt)
    112113{
    113     return $txt; /// FIXME.
    114    
    115 //     $search = array();
    116 //     $replace = array();
    117 //
    118 //     // "double quoted text"  becomes  &ldquo;double quoted text&rdquo;
    119 //     $search['double_quotes']    = '/(^|[^\w=])(?:"|&quot;|&#34;|&#x22;|&ldquo;)([^"]+?)(?:"|&quot;|&#34;|&#x22;|&rdquo;)([^\w]|$)/'; // " is the same as &quot; and &#34; and &#x22;
    120 //     $replace['double_quotes']   = '\\1&ldquo;\\2&rdquo;\\3';
    121 //
    122 //     // text's apostrophes  become  text&rsquo;s apostrophes
    123 //     $search['apostrophe']       = '/(\w)(?:\'|&#39;|&#039;)(\w)/';
    124 //     $replace['apostrophe']      = '\\1&rsquo;\\2';
    125 //
    126 //     // 'single quoted text'  becomes  &lsquo;single quoted text&rsquo;
    127 //     $search['single_quotes']    = '/(^|[^\w=])(?:\'|&#39;|&lsquo;)([^\']+?)(?:\'|&#39;|&rsquo;)([^\w]|$)/';
    128 //     $replace['single_quotes']   = '\\1&lsquo;\\2&rsquo;\\3';
    129 //
    130 //     // em--dashes  become em&mdash;dashes
    131 //     $search['em_dash']          = '/(\s*[^!<-])--([^>-]\s*)/';
    132 //     $replace['em_dash']         = '\\1&mdash;\\2';
    133 //
    134 //     return preg_replace($search, $replace, $txt);
     114    $search = array();
     115    $replace = array();
     116
     117    // "double quoted text"  becomes  &ldquo;double quoted text&rdquo;
     118    $search['double_quotes']    = '/(^|[^\w=])(?:"|&quot;|&#34;|&#x22;|&ldquo;)([^"]+?)(?:"|&quot;|&#34;|&#x22;|&rdquo;)([^\w]|$)/ms'; // " is the same as &quot; and &#34; and &#x22;
     119    $replace['double_quotes']   = '$1&ldquo;$2&rdquo;$3';
     120
     121    // text's apostrophes  become  text&rsquo;s apostrophes
     122    $search['apostrophe']       = '/(\w)(?:\'|&#39;|&#039;)(\w)/ms';
     123    $replace['apostrophe']      = '$1&rsquo;$2';
     124
     125    // 'single quoted text'  becomes  &lsquo;single quoted text&rsquo;
     126    $search['single_quotes']    = '/(^|[^\w=])(?:\'|&#39;|&lsquo;)([^\']+?)(?:\'|&#39;|&rsquo;)([^\w]|$)/ms';
     127    $replace['single_quotes']   = '$1&lsquo;$2&rsquo;$3';
     128
     129    // plural posessives' apostrophes become posessives&rsquo;
     130    $search['apostrophes']      = '/(s)(?:\'|&#39;|&#039;)(\s)/ms';
     131    $replace['apostrophes']     = '$1&rsquo;$2';
     132
     133    // em--dashes  become em&mdash;dashes
     134    $search['em_dash']          = '/(\s*[^!<-])--([^>-]\s*)/';
     135    $replace['em_dash']         = '$1&mdash;$2';
     136
     137    return preg_replace($search, $replace, $txt);
    135138}
    136139
Note: See TracChangeset for help on using the changeset viewer.