redesigned page plugin engine

This commit is contained in:
Logsol 2013-07-17 19:16:32 +02:00
parent b7b0f44098
commit a78b3891e8
6 changed files with 22 additions and 17 deletions

View file

@ -3,13 +3,11 @@ class DidgeridooArtwork_Page_Plugin
{
public static function render($content)
{
preg_match_all("~\{plugin\=([^\}| ]*)([^\}]*)~", $content, $findings);
$findings[1] = array_reverse($findings[1]);
$findings[2] = array_reverse($findings[2]);
preg_match_all('~\{\@([^\}| ]*) ?([^\}]*)\}~', $content, $findings);
foreach($findings[1] as $key => $item)
{
$instanceName = "DidgeridooArtwork_Page_Plugin_" . ucfirst($findings[1][$key]);
if(!Katharsis_Autoload::findClass($instanceName))
{
@ -18,7 +16,8 @@ class DidgeridooArtwork_Page_Plugin
$object = new $instanceName;
$plugincontent = (string) $object->render(trim($findings[2][$key]));
$content = preg_replace("~(.*)\{plugin\=" . $findings[1][$key] . "[^\}]*\}(.*)~", '${1}' . $plugincontent . '${2}', $content);
$content = str_replace($findings[0][$key], $plugincontent, $content);
}
return $content;