Changeset 518 for trunk/lib/Utilities.inc.php
- Timestamp:
- May 1, 2015 1:15:16 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r507 r518 82 82 if (!empty($var)) { 83 83 ?> 84 <script type="text/javascript" charset="utf-8">84 <script type="text/javascript"> 85 85 /* <![CDATA[ */ 86 window.console &&console.log('<?php printf('%s: %s (on line %s of %s)', $prefix, str_replace("'", "\\'", getDump($var, true)), $line, $file); ?>');86 console.log('<?php printf('%s: %s (on line %s of %s)', $prefix, str_replace("'", "\\'", getDump($var, true)), $line, $file); ?>'); 87 87 /* ]]> */ 88 88 </script> … … 536 536 } 537 537 538 /** 539 * Removes non-latin characters from file name, using htmlentities to convert known weirdos into regular squares. 540 * 541 * @access public 542 * @param string $file_name A name of a file. 543 * @return string The same name, but cleaned. 544 */ 545 function cleanFileName($file_name) 546 { 547 $app =& App::getInstance(); 548 549 $file_name = preg_replace(array( 550 '/&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);/ui', 551 '/&(?:amp);/ui', 552 '/[&;]+/u', 553 '/[^a-zA-Z0-9()@._=+-]+/u', 554 '/^_+|_+$/u' 555 ), array( 556 '$1', 557 'and', 558 '', 559 '_', 560 '' 561 ), htmlentities($file_name, ENT_NOQUOTES | ENT_IGNORE, $app->getParam('character_set'))); 562 return mb_substr($file_name, 0, 250); 563 } 564 538 565 /* 539 566 * Convert a php.ini value (8M, 512K, etc), into integer value of bytes.
Note: See TracChangeset
for help on using the changeset viewer.