Changeset 103 for trunk/lib/Utilities.inc.php
- Timestamp:
- Apr 19, 2006 3:14:28 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r102 r103 104 104 105 105 /** 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> 107 108 * 108 109 * @param string $txt Text to clean. … … 111 112 function fancyTxt($txt) 112 113 { 113 return $txt; /// FIXME. 114 115 // $search = array(); 116 // $replace = array(); 117 // 118 // // "double quoted text" becomes “double quoted text” 119 // $search['double_quotes'] = '/(^|[^\w=])(?:"|"|"|"|“)([^"]+?)(?:"|"|"|"|”)([^\w]|$)/'; // " is the same as " and " and " 120 // $replace['double_quotes'] = '\\1“\\2”\\3'; 121 // 122 // // text's apostrophes become text’s apostrophes 123 // $search['apostrophe'] = '/(\w)(?:\'|'|')(\w)/'; 124 // $replace['apostrophe'] = '\\1’\\2'; 125 // 126 // // 'single quoted text' becomes ‘single quoted text’ 127 // $search['single_quotes'] = '/(^|[^\w=])(?:\'|'|‘)([^\']+?)(?:\'|'|’)([^\w]|$)/'; 128 // $replace['single_quotes'] = '\\1‘\\2’\\3'; 129 // 130 // // em--dashes become em—dashes 131 // $search['em_dash'] = '/(\s*[^!<-])--([^>-]\s*)/'; 132 // $replace['em_dash'] = '\\1—\\2'; 133 // 134 // return preg_replace($search, $replace, $txt); 114 $search = array(); 115 $replace = array(); 116 117 // "double quoted text" becomes “double quoted text” 118 $search['double_quotes'] = '/(^|[^\w=])(?:"|"|"|"|“)([^"]+?)(?:"|"|"|"|”)([^\w]|$)/ms'; // " is the same as " and " and " 119 $replace['double_quotes'] = '$1“$2”$3'; 120 121 // text's apostrophes become text’s apostrophes 122 $search['apostrophe'] = '/(\w)(?:\'|'|')(\w)/ms'; 123 $replace['apostrophe'] = '$1’$2'; 124 125 // 'single quoted text' becomes ‘single quoted text’ 126 $search['single_quotes'] = '/(^|[^\w=])(?:\'|'|‘)([^\']+?)(?:\'|'|’)([^\w]|$)/ms'; 127 $replace['single_quotes'] = '$1‘$2’$3'; 128 129 // plural posessives' apostrophes become posessives’ 130 $search['apostrophes'] = '/(s)(?:\'|'|')(\s)/ms'; 131 $replace['apostrophes'] = '$1’$2'; 132 133 // em--dashes become em—dashes 134 $search['em_dash'] = '/(\s*[^!<-])--([^>-]\s*)/'; 135 $replace['em_dash'] = '$1—$2'; 136 137 return preg_replace($search, $replace, $txt); 135 138 } 136 139
Note: See TracChangeset
for help on using the changeset viewer.