More optimization refactoring.

Fix cache but causing  object_map to be created and deleted on each request.
Replacing function and method calls with better performing code.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7596 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2008-09-12 05:11:34 +00:00
parent c9c18741fb
commit cb487bd6e6
37 changed files with 183 additions and 182 deletions

View file

@ -211,7 +211,7 @@ class File extends Object {
*/
function prepare($data, $forceWindows = false) {
$lineBreak = "\n";
if (substr(PHP_OS,0,3) == "WIN" || $forceWindows === true) {
if (DIRECTORY_SEPARATOR == '\\' || $forceWindows === true) {
$lineBreak = "\r\n";
}
return strtr($data, array("\r\n" => $lineBreak, "\n" => $lineBreak, "\r" => $lineBreak));
@ -341,7 +341,7 @@ class File extends Object {
if (!$ext) {
$ext = $this->ext();
}
return preg_replace( "/[^\w\.-]+/", "_", basename($name, $ext));
return preg_replace( "/(?:[^\w\.-]+)/", "_", basename($name, $ext));
}
/**
* Get md5 Checksum of file with previous check of Filesize