Created
February 29, 2012 09:34
-
-
Save michaeltwofish/1939451 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
News::applyFilter('find', function($self, $params, $chain) { | |
$result = $chain->next($self, $params, $chain); | |
$function = function($item) { | |
$item->content = nl2br(htmlspecialchars($item->content, ENT_QUOTES, 'UTF-8')); | |
$item->date_updated_pretty_date = date('j F Y', strtotime($item->date_updated)); | |
$item->date_updated_pretty_time = date('H:i', strtotime($item->date_updated)); | |
$item->date_created = date('F jS, Y', strtotime($item->date_created)); | |
$item->date_updated = date('F jS, Y', strtotime($item->date_updated)); | |
$item->dealer_groups = explode(';', $item->dealer_groups); | |
return $item; | |
} | |
if ($result) { | |
if ($result instanceof \lithium\util\Collection) { | |
$result->map($function); | |
} else { | |
$result = $function($result); | |
} | |
} | |
return $result; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment