diff --git a/app/code/community/Nexcessnet/Turpentine/Helper/Esi.php b/app/code/community/Nexcessnet/Turpentine/Helper/Esi.php index 8435c57ec..053e0355e 100644 --- a/app/code/community/Nexcessnet/Turpentine/Helper/Esi.php +++ b/app/code/community/Nexcessnet/Turpentine/Helper/Esi.php @@ -405,10 +405,9 @@ protected function _loadEsiCacheClearEvents() { $events = $layoutXml->xpath( '//action[@method=\'setEsiOptions\']/params/flush_events/*' ); if ($events) { - $events = array_unique(array_map( - create_function('$e', - 'return (string)$e->getName();'), - $events )); + $events = array_unique(array_map(function ($e) { + return (string)$e->getName(); + }, $events)); } else { $events = array(); } diff --git a/app/code/community/Nexcessnet/Turpentine/Model/Observer/Ban.php b/app/code/community/Nexcessnet/Turpentine/Model/Observer/Ban.php index 35dbd05f8..f4a00fb52 100644 --- a/app/code/community/Nexcessnet/Turpentine/Model/Observer/Ban.php +++ b/app/code/community/Nexcessnet/Turpentine/Model/Observer/Ban.php @@ -308,9 +308,9 @@ public function banProductReview($eventObject) { $products = $productCollection->addEntityFilter((int) $review->getEntityPkValue())->getItems(); - $productIds = array_unique(array_map( - create_function('$p', 'return $p->getEntityId();'), - $products )); + $productIds = array_unique(array_map(function ($p) { + return $p->getEntityId(); + }, $products)); $patterns[] = sprintf('/review/product/list/id/(?:%s)/category/', implode('|', array_unique($productIds))); $patterns[] = sprintf('/review/product/view/id/%d/', diff --git a/app/code/community/Nexcessnet/Turpentine/Model/Varnish/Configurator/Abstract.php b/app/code/community/Nexcessnet/Turpentine/Model/Varnish/Configurator/Abstract.php index ff007c489..43b344d9c 100644 --- a/app/code/community/Nexcessnet/Turpentine/Model/Varnish/Configurator/Abstract.php +++ b/app/code/community/Nexcessnet/Turpentine/Model/Varnish/Configurator/Abstract.php @@ -164,8 +164,9 @@ protected function _getCustomTemplateFilename() { * @return string */ protected function _formatTemplate($template, array $vars) { - $needles = array_map(create_function('$k', 'return "{{".$k."}}";'), - array_keys($vars)); + $needles = array_map(function ($k) { + return '{{' . $k . '}}'; + }, array_keys($vars)); $replacements = array_values($vars); // do replacements, then delete unused template vars return preg_replace('~{{[^}]+}}~', '', @@ -269,9 +270,9 @@ protected function _vcl_sub_allowed_hosts_regex() { */ public function getBaseUrlPathRegex() { $pattern = '^(%s)(?:(?:index|litespeed)\\.php/)?'; - return sprintf($pattern, implode('|', - array_map(create_function('$x', 'return preg_quote($x,"|");'), - $this->_getBaseUrlPaths()))); + return sprintf($pattern, implode('|', array_map(function ($x) { + return preg_quote($x, '|'); + }, $this->_getBaseUrlPaths()))); } /** @@ -294,8 +295,9 @@ protected function _getBaseUrlPaths() { } } $paths = array_unique($paths); - usort($paths, create_function('$a, $b', - 'return strlen( $b ) - strlen( $a );')); + usort($paths, function ($a, $b) { + return strlen($b) - strlen($a); + }); return array_values($paths); } @@ -794,7 +796,9 @@ protected function _vcl_acl($name, array $hosts) { {{hosts}} } EOS; - $fmtHost = create_function('$h', 'return sprintf(\'"%s";\',$h);'); + $fmtHost = function ($h) { + return sprintf('"%s";', $h); + }; $vars = array( 'name' => $name, 'hosts' => implode("\n ", array_map($fmtHost, $hosts)), diff --git a/util/varnishadm.php b/util/varnishadm.php index efa39c383..972a48914 100755 --- a/util/varnishadm.php +++ b/util/varnishadm.php @@ -29,11 +29,9 @@ class Turpentine_Shell_Varnishadm extends Mage_Shell_Abstract { * @return array */ protected function _parseArgs() { - $this->_args = array_slice( - array_filter($_SERVER['argv'], - create_function('$e', - 'return $e != \'--\';')), - 1 ); + $this->_args = array_slice(array_filter($_SERVER['argv'], function ($e) { + return $e != '--'; + }), 1); return $this; }