redesigned page plugin engine
This commit is contained in:
parent
b7b0f44098
commit
a78b3891e8
6 changed files with 22 additions and 17 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
8
library/DidgeridooArtwork/Page/Plugin/Base.php
Normal file
8
library/DidgeridooArtwork/Page/Plugin/Base.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
class DidgeridooArtwork_Page_Plugin_Base extends DidgeridooArtwork_Page_Plugin_Abstract
|
||||
{
|
||||
public function render($pageName)
|
||||
{
|
||||
return $this->_view->base;
|
||||
}
|
||||
}
|
8
library/DidgeridooArtwork/Page/Plugin/Page.php
Normal file
8
library/DidgeridooArtwork/Page/Plugin/Page.php
Normal 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;
|
||||
}
|
||||
}
|
BIN
public/img/header/1374074370.jpg
Normal file
BIN
public/img/header/1374074370.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 206 KiB |
BIN
public/img/page/1374073671.jpg
Normal file
BIN
public/img/page/1374073671.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 383 KiB |
Loading…
Add table
Add a link
Reference in a new issue