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

@ -19,18 +19,8 @@ class Upload extends Katharsis_Model_Abstract
}
protected function _uploadFile($id, $file, $dir, $name = null)
{
if($name === null)
{
$name = time();
}
else
{
if($nameparts = explode(".", $name))
{
$name = $nameparts[0];
}
}
if (!is_dir($dir)) {
mkdir($dir);

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;

View file

@ -0,0 +1,8 @@
<?php
class DidgeridooArtwork_Page_Plugin_Base extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($pageName)
{
return $this->_view->base;
}
}

View file

@ -0,0 +1,8 @@
<?php
class DidgeridooArtwork_Page_Plugin_Page extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($pageName)
{
return $this->_view->base . "/page/" . $pageName;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB