- Timestamp:
- Nov 28, 2018 1:40:13 AM (5 years ago)
- Location:
- trunk/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Prefs.inc.php
r644 r653 518 518 // User_id must not be empty. 519 519 if ('' == $this->getParam('user_id')) { 520 $app->logMsg(sprintf('Cannot saveprefs because user_id not set.', null), LOG_WARNING, __FILE__, __LINE__);520 $app->logMsg(sprintf('Cannot load prefs because user_id not set.', null), LOG_WARNING, __FILE__, __LINE__); 521 521 return false; 522 522 } … … 591 591 // Skip this method if not using the db. 592 592 if ('database' != $this->getParam('storagetype')) { 593 $app->logMsg('Prefs->save() does nothing unless using a database storagetype.', LOG_ NOTICE, __FILE__, __LINE__);593 $app->logMsg('Prefs->save() does nothing unless using a database storagetype.', LOG_DEBUG, __FILE__, __LINE__); 594 594 return true; 595 595 } … … 597 597 // User_id must not be empty. 598 598 if ('' == $this->getParam('user_id')) { 599 $app->logMsg(sprintf('Cannot save prefs because user_id not set.', null), LOG_ WARNING, __FILE__, __LINE__);599 $app->logMsg(sprintf('Cannot save prefs because user_id not set.', null), LOG_DEBUG, __FILE__, __LINE__); 600 600 return false; 601 601 } -
trunk/lib/Utilities.inc.php
r652 r653 221 221 * @return string Cleaned text. 222 222 */ 223 function fancyTxt($text )223 function fancyTxt($text, $extra_search=null, $extra_replace=null) 224 224 { 225 225 $search = array(); 226 226 $replace = array(); 227 227 228 // "double quoted text" becomes “double quoted text” 229 $search['double_quotes'] = '/(^|[^\w=])(?:"|"|"|"|“)([^"]+?)(?:"|"|"|"|”)([^\w]|$)/ms'; // " is the same as " and " and " 230 $replace['double_quotes'] = '$1“$2”$3'; 231 232 // text's apostrophes become text’s apostrophes 233 $search['apostrophe'] = '/(\w)(?:\'|'|')(\w)/ms'; 234 $replace['apostrophe'] = '$1’$2'; 235 236 // 'single quoted text' becomes ‘single quoted text’ 237 $search['single_quotes'] = '/(^|[^\w=])(?:\'|'|‘)([^\']+?)(?:\'|'|’)([^\w]|$)/ms'; 238 $replace['single_quotes'] = '$1‘$2’$3'; 239 240 // plural posessives' apostrophes become posessives’ 241 $search['apostrophes'] = '/(s)(?:\'|'|')(\s)/ms'; 242 $replace['apostrophes'] = '$1’$2'; 243 244 // em--dashes become em—dashes 245 $search['em_dash'] = '/(\s*[^!<-])--([^>-]\s*)/'; 246 $replace['em_dash'] = '$1—$2'; 247 248 return preg_replace($search, $replace, $text); 228 // "double quoted text" â âdouble quoted textâ 229 $search['_double_quotes'] = '/(?<=^|[^\w=(])(?:"|"|�?34;|"|“)([\w\'.âŠ(ââ-][^"]*?)(?:"|"|�?34;|"|”)(?=[^)\w]|$)/imsu'; // " is the same as " and " and " and " 230 $replace['_double_quotes'] = 'â$1â'; 231 232 // text's apostrophes â textâs apostrophes (except foot marks: 6'3") 233 $search['_apostrophe'] = '/(?<=[a-z])(?:\'|�?39;)(?=\w)/imsu'; 234 $replace['_apostrophe'] = 'â'; 235 236 // 'single quoted text' â âsingle quoted textâ 237 $search['_single_quotes'] = '/(?<=^|[^\w=(])(?:\'|�?39;|‘)([\w"][^\']+?)(?:\'|�?39;|’)(?=[^)\w]|$)/imsu'; 238 $replace['_single_quotes'] = 'â$1â'; 239 240 // plural posessives' apostrophes â posessivesâ (except foot marks: 6') 241 $search['_apostrophes'] = '/(?<=s)(?:\'|�?39;|’)(?=\s)/imsu'; 242 $replace['_apostrophes'] = 'â'; 243 244 // double--hyphens â en â dashes 245 $search['_em_dash'] = '/(?<=[\w\s"\'ââ)])--(?=[\w\sâââ"\'(?])/imsu'; 246 $replace['_em_dash'] = ' â '; 247 248 // ... â ⊠249 $search['_elipsis'] = '/(?<=^|[^.])\.\.\.(?=[^.]|$)/imsu'; 250 $replace['_elipsis'] = 'âŠ'; 251 252 if (is_array($extra_search) && is_array($extra_replace) && sizeof($extra_search) == sizeof($extra_replace)) { 253 // Append additional search replacements. 254 $search = array_merge($search, $extra_search); 255 $replace = array_merge($replace, $extra_replace); 256 } 257 258 return trim(preg_replace($search, $replace, $text)); 249 259 } 250 260
Note: See TracChangeset
for help on using the changeset viewer.