public function parsetheme() { if ($this->name == '') { return false; } if (!isset($this->source)) { $this->source = new ttheme(); } if (!isset($this->replace)) { $this->replace = titemsreplacer::i()->items[$this->idview]; } $this->source->name = $this->name; $this->source->load(); self::$instances[$this->name] = $this; $this->templates = $this->replace + $this->source->templates; $this->save(); return true; }
public function processform() { $plugin = titemsreplacer::i(); if (!empty($_GET['id'])) { $id = (int) $_GET['id']; if (isset($plugin->items[$id])) { $plugin->lock(); $i = 0; foreach ($plugin->items[$id] as $tag => $replace) { $k = "replace-{$i}"; if (!isset($_POST[$k])) { continue; } $v = trim($_POST[$k]); if ($v) { $plugin->items[$id][$tag] = $v; } else { unset($plugin->items[$id][$tag]); } $i++; } if (!empty($_POST['addtag'])) { $tag = trim($_POST['addtag']); $theme = tview::i(tviews::i()->defaults['admin'])->theme; if (isset($theme->templates[$tag])) { $plugin->items[$id][$tag] = trim($_POST['addreplace']); } } $plugin->unlock(); } } if (isset($_GET['action']) && 'add' == $_GET['action']) { $views = tviews::i(); $view = new tviewthemereplacer(); $view->name = trim($_POST['viewname']); $id = $views->addview($view); $plugin->add($id); $view->themename = tview::i(1)->themename; $adminurl = tadminhtml::getadminlink('/admin/plugins/', 'plugin=' . basename(dirname(__FILE__))); return litepublisher::$urlmap->redir("{$adminurl}&id={$id}"); } ttheme::clearcache(); return ''; }