forked from symfony/symfony1
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the create_function deprecation. (#20)
- Loading branch information
1 parent
05e3f8e
commit 6596bc8
Showing
15 changed files
with
99 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/* | ||
* This file is part of the symfony package. | ||
* (c) 2004-2006 Fabien Potencier <[email protected]> | ||
* | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
@@ -203,8 +203,12 @@ public function removePattern($pattern) | |
*/ | ||
public function getMany($keys) | ||
{ | ||
$values = array(); | ||
foreach ($this->memcache->get(array_map(create_function('$k', 'return "'.$this->getOption('prefix').'".$k;'), $keys)) as $key => $value) | ||
$values = array(); | ||
$prefixed_keys = array_map(function ($key) { | ||
return $this->getOption('prefix') . $key; | ||
}, $keys); | ||
|
||
foreach ($this->memcache->get($prefixed_keys) as $key => $value) | ||
{ | ||
$values[str_replace($this->getOption('prefix'), '', $key)] = $value; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/* | ||
* This file is part of the symfony package. | ||
* (c) 2004-2006 Fabien Potencier <[email protected]> | ||
* | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
@@ -564,7 +564,13 @@ protected function fixCgi() | |
} | ||
|
||
// close the streams on script termination | ||
register_shutdown_function(create_function('', 'fclose(STDIN); fclose(STDOUT); fclose(STDERR); return true;')); | ||
register_shutdown_function(function () { | ||
fclose(STDIN); | ||
fclose(STDOUT); | ||
fclose(STDERR); | ||
|
||
return true; | ||
}); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -247,34 +247,31 @@ function _auto_link_urls($text, $href_options = array(), $truncate = false, $tru | |
{ | ||
$href_options = _tag_options($href_options); | ||
|
||
$callback_function = ' | ||
if (preg_match("/<a\s/i", $matches[1])) | ||
{ | ||
return $matches[0]; | ||
} | ||
'; | ||
|
||
if ($truncate) | ||
{ | ||
$callback_function .= ' | ||
else if (strlen($matches[2].$matches[3]) > '.$truncate_len.') | ||
$callback_function = function ($matches) use ($truncate, $truncate_len, $href_options, $pad) { | ||
if (preg_match("/<a\s/i", $matches[1])) | ||
{ | ||
return $matches[1].\'<a href="\'.($matches[2] == "www." ? "http://www." : $matches[2]).$matches[3].\'"'.$href_options.'>\'.substr($matches[2].$matches[3], 0, '.$truncate_len.').\''.$pad.'</a>\'.$matches[4]; | ||
return $matches[0]; | ||
} | ||
'; | ||
} | ||
|
||
$callback_function .= ' | ||
else | ||
{ | ||
return $matches[1].\'<a href="\'.($matches[2] == "www." ? "http://www." : $matches[2]).$matches[3].\'"'.$href_options.'>\'.$matches[2].$matches[3].\'</a>\'.$matches[4]; | ||
} | ||
'; | ||
else if ($truncate && strlen($matches[2].$matches[3]) > $truncate_len) | ||
{ | ||
return $matches[1].'<a href="' .($matches[2] === 'www.' | ||
? 'http://www.' | ||
: $matches[2] | ||
).$matches[3].'"'.$href_options.'>'.substr($matches[2].$matches[3], 0, $truncate_len).$pad.'</a>'.$matches[4]; | ||
} | ||
else | ||
{ | ||
return $matches[1].'<a href="'.($matches[2] === 'www.' | ||
? 'http://www.' | ||
: $matches[2] | ||
).$matches[3].'"'.$href_options.'>'.$matches[2].$matches[3].'</a>'.$matches[4]; | ||
} | ||
}; | ||
|
||
return preg_replace_callback( | ||
SF_AUTO_LINK_RE, | ||
create_function('$matches', $callback_function), | ||
$text | ||
return preg_replace_callback( | ||
SF_AUTO_LINK_RE, | ||
$callback_function, | ||
$text | ||
); | ||
} | ||
|
||
|
@@ -286,7 +283,7 @@ function _auto_link_email_addresses($text) | |
// Taken from http://snippets.dzone.com/posts/show/6156 | ||
return preg_replace("#(^|[\n ])([a-z0-9&\-_\.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $text); | ||
|
||
// Removed since it destroys already linked emails | ||
// Removed since it destroys already linked emails | ||
// Example: <a href="mailto:[email protected]">bar</a> gets <a href="mailto:[email protected]">bar</a> gets <a href="mailto:<a href="mailto:[email protected]">bar</a> | ||
//return preg_replace('/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/', '<a href="mailto:\\1">\\1</a>', $text); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/* | ||
* This file is part of the symfony package. | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
@@ -72,18 +72,20 @@ protected function execute($arguments = array(), $options = array()) | |
{ | ||
$this->logBlock(array_merge( | ||
array('Permissions on the following file(s) could not be fixed:', ''), | ||
array_map(create_function('$f', 'return \' - \'.sfDebug::shortenFilePath($f);'), $this->failed) | ||
array_map(function ($f) { | ||
return ' - '.sfDebug::shortenFilePath($f); | ||
}, $this->failed) | ||
), 'ERROR_LARGE'); | ||
} | ||
} | ||
|
||
/** | ||
* Chmod and capture any failures. | ||
* | ||
* | ||
* @param string $file | ||
* @param integer $mode | ||
* @param integer $umask | ||
* | ||
* | ||
* @see sfFilesystem | ||
*/ | ||
protected function chmod($file, $mode, $umask = 0000) | ||
|
@@ -109,7 +111,7 @@ protected function chmod($file, $mode, $umask = 0000) | |
|
||
/** | ||
* Captures those chmod commands that fail. | ||
* | ||
* | ||
* @see http://www.php.net/set_error_handler | ||
*/ | ||
public function handleError($no, $string, $file, $line, $context) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters