public function parse(ttheme $theme) { $filename = litepublisher::$paths->themes . $theme->name . DIRECTORY_SEPARATOR . 'index.tml'; if (!file_exists($filename)) { return false; } if ($theme->name == 'default') { $this->error('Default theme must be in new format'); } $parser = tthemeparser::i(); $about = $parser->getabout($theme->name); if (empty($about['parent'])) { $this->default = ttheme::getinstance('default'); } else { $this->default = ttheme::getinstance($about['parent']); $theme->parent = $about['parent']; } $s = $parser->getfile($filename, $about); $this->theme = $theme; $theme->templates = $this->default->templates; $theme->title = $this->parsetitle($s); $this->parsemenu($s); $this->parsecontent($s); $theme->templates['sidebars'] = $this->parsesidebars($s); $s = $this->fixhead($s); $s = $this->deletespaces($s); $theme->templates['index'] = $s != '' ? $s : $this->default->templates['index']; return true; }
public function uninstall() { $parser = tthemeparser::i(); $parser->unbind($this); $jsmerger = tjsmerger::i(); $jsmerger->deletefile('admin', '/plugins/colorpicker/colorpicker.plugin.min.js'); }
public function processform() { $result = ''; $idview = tadminhtml::getparam('idview', 1); $view = tview::i($idview); if (isset($_POST['reparse'])) { $parser = tthemeparser::i(); try { $parser->reparse($view->theme->name); } catch (Exception $e) { $result = $e->getMessage(); } } else { if (empty($_POST['selection'])) { return ''; } try { $view->themename = $_POST['selection']; $result = $this->html->h2->success; } catch (Exception $e) { $view->themename = 'default'; $result = $e->getMessage(); } } ttheme::clearcache(); return $result; }
public function uninstall() { $template = ttemplate::i(); $template->deletefromhead($this->getjs()); $parser = tthemeparser::i(); $parser->unbind($this); ttheme::clearcache(); }
function tmetatagsUninstall($self) { $t = ttemplate::i(); $t->heads = strtr($t->heads, array('$metatags.keywords' => '$template.keywords', '$metatags.description' => '$template.description')); $t->save(); tthemeparser::i()->unbind($self); ttheme::clearcache(); unset(litepublisher::$classes->classes['metatags']); litepublisher::$classes->save(); }
function tlazybuttonsUninstall($self) { $jsmerger = tjsmerger::i(); $jsmerger->lock(); $jsmerger->deletefile('default', dirname(__FILE__) . '/lazybuttons.min.js'); $jsmerger->deletetext('default', 'lazybuttons'); $jsmerger->unlock(); $parser = tthemeparser::i(); $parser->unbind($self); ttheme::clearcache(); }
function tpagenator3000Uninstall($self) { $name = basename(dirname(__FILE__)); $js = tjsmerger::i(); $js->lock(); $js->deletefile('default', "/plugins/{$name}/paginator3000.min.js"); $js->deletetext('default', 'pagenator'); $js->unlock(); tthemeparser::i()->unbind($self); ttheme::clearcache(); tcssmerger::i()->deletestyle(dirname(__FILE__) . '/paginator3000.css'); }
public function uninstall() { $template = ttemplate::i(); $template->js = '<script type="text/javascript" src="%s"></script>'; $template->save(); $parser = tthemeparser::i(); $parser->unbind($this); $admin = tadminmenus::i(); $admin->heads = $this->restore($admin->heads); $admin->save(); ttheme::clearcache(); }
public static function getsidebarnames(tview $view) { $count = $view->theme->sidebarscount; $result = range(1, $count); $parser = tthemeparser::i(); $about = $parser->getabout($view->theme->name); foreach ($result as $key => $value) { if (isset($about["sidebar{$key}"])) { $result[$key] = $about["sidebar{$key}"]; } } return $result; }
public function uninstall() { $template = ttemplate::i(); $template->js = '<script type="text/javascript" src="%s"></script>'; $template->jsready = '<script type="text/javascript">$(document).ready(function() {%s});</script>'; $template->jsload = '<script type="text/javascript">$.getScript(%s);</script>'; $template->heads = $this->restorehead($template->heads); $template->save(); $parser = tthemeparser::i(); $parser->unsubscribeclass($this); $admin = tadminmenus::i(); $admin->heads = $this->restore($admin->heads); $admin->save(); ttheme::clearcache(); }
function tforumUninstall($self) { tcategories::i()->unbind($self); tthemeparser::i()->unbind($self); ttheme::clearcache(); tlocalmerger::i()->deleteplugin(basename(dirname(__FILE__))); tjsmerger::i()->deletefile('default', '/plugins/forum/forum.min.js'); $item = tcategories::i()->getitem($self->rootcat); $menus = tmenus::i(); while ($menus->deleteurl($item['url'])) { } $adminmenus = tadminmenus::i(); $adminmenus->deletetree($adminmenus->url2id('/admin/plugins/forum/')); litepublisher::$classes->delete('tforumeditor'); $linkgen = tlinkgenerator::i(); unset($linkgen->data['forum']); $linkgen->save(); }
public function parsetheme() { if (!file_exists(litepublisher::$paths->themes . $this->name . DIRECTORY_SEPARATOR . 'about.ini')) { $this->error(sprintf('The %s theme not exists', $this->name)); } $parser = tthemeparser::i(); if ($parser->parse($this)) { self::$instances[$this->name] = $this; $this->save(); } else { $this->error(sprintf('Theme file %s not exists', $filename)); } }
function ttagreplacerUninstall($self) { tthemeparser::i()->unbind($self); ttheme::clearcache(); }
function tsinglecatUninstall($self) { tthemeparser::i()->unbind($self); ttheme::clearcache(); }
function tdownloaditemsUninstall($self) { //die("Warning! You can lost all downloaditems!"); tposts::unsub($self); $adminmenus = tadminmenus::i(); $adminmenus->deletetree($adminmenus->url2id('/admin/downloaditems/')); $menus = tmenus::i(); $menus->deletetree($menus->class2id('tdownloaditemsmenu')); $parser = tthemeparser::i(); $parser->unbind($self); ttheme::clearcache(); $classes = litepublisher::$classes; $classes->lock(); $classes->delete('tdownloaditem'); $classes->delete('tdownloaditemsmenu'); $classes->delete('tdownloaditemeditor'); $classes->delete('tadmindownloaditems'); $classes->delete('tdownloaditemcounter'); $classes->delete('taboutparser'); $classes->unlock(); $merger = tlocalmerger::i(); $merger->deleteplugin(tplugins::getname(__FILE__)); $manager = tdbmanager::i(); $manager->deletetable($self->childtable); $manager->delete_enum('posts', 'class', 'tdownloaditem'); $optimizer = tdboptimizer::i(); $optimizer->lock(); $optimizer->unbind($self); if (false !== ($i = array_search('downloaditems', $optimizer->childtables))) { unset($optimizer->childtables[$i]); } $optimizer->unlock(); tjsmerger::i()->deletefile('default', '/plugins/downloaditem/downloaditem.min.js'); litepublisher::$options->delete('downloaditem_themetag'); litepublisher::$options->delete('downloaditem_plugintag'); litepublisher::$options->savemodified(); }
public function processform() { if ($form = $this->getautoform($this->name)) { return $form->processform(); } extract($_POST, EXTR_SKIP); $options = litepublisher::$options; switch ($this->name) { case 'options': litepublisher::$urlmap->redirdom = isset($redirdom); $site = litepublisher::$site; $site->fixedurl = isset($fixedurl); $site->url = $url; $site->name = $name; $site->description = $description; $site->keywords = $keywords; $site->author = $author; $this->getdb('users')->setvalue(1, 'name', $author); ttemplate::i()->footer = $footer; break; case 'home': $home = thomepage::i(); $home->lock(); $home->image = $image; $home->parsetags = isset($parsetags); $home->showmidle = isset($showmidle); $home->midlecat = (int) $midlecat; $home->showposts = isset($showposts); $home->invertorder = isset($invertorder); $home->includecats = tadminhtml::check2array('category-'); $home->excludecats = tadminhtml::check2array('exclude_category-'); $home->showpagenator = isset($showpagenator); $home->postschanged(); $home->unlock(); $menus = tmenus::i(); $menus->home = isset($homemenu); $menus->save(); break; case 'mail': if (!empty($adminemail)) { $options->email = $adminemail; $this->getdb('users')->setvalue(1, 'email', $adminemail); } if (!empty($fromemail)) { $options->fromemail = $fromemail; } $options->mailer = empty($mailer) ? '' : 'smtp'; if (!empty($subscribeemail)) { $subscribe = tsubscribers::i(); $subscribe->fromemail = $subscribeemail; $subscribe->save(); $options->fromemail = $subscribeemail; } $mailer = TSMTPMailer::i(); $mailer->lock(); $mailer->host = $host; $mailer->login = $smtplogin; $mailer->password = $password; $mailer->port = (int) $port; $mailer->unlock(); break; case 'view': $options->icondisabled = isset($icondisabled); if (!empty($perpage)) { $options->perpage = (int) $perpage; } $options->hidefilesonpage = isset($hidefilesonpage); $filter = tcontentfilter::i(); $filter->usefilter = isset($usefilter); $filter->automore = isset($automore); $filter->automorelength = (int) $automorelength; $filter->autolinks = isset($autolinks); $filter->commentautolinks = isset($commentautolinks); $filter->save(); $themeparser = tthemeparser::i(); $themeparser->replacelang = isset($replacelang); $themeparser->stylebefore = isset($stylebefore); $themeparser->save(); // restore style after if (!$themeparser->stylebefore) { $css = '<link type="text/css" href="$site.files$template.cssmerger_default" rel="stylesheet" />'; $t = ttemplate::i(); if (false !== strpos($t->heads, "<!--{$css}-->")) { $t->heads = str_replace("<!--{$css}-->", $css, $t->heads); $t->save(); } } break; case 'files': $parser = tmediaparser::i(); $parser->enablepreview = isset($enablepreview); $parser->ratio = isset($ratio); $parser->clipbounds = isset($clipbounds); $parser->previewwidth = (int) trim($previewwidth); $parser->previewheight = (int) trim($previewheight); $parser->maxwidth = (int) trim($maxwidth); $parser->maxheight = (int) trim($maxheight); $parser->alwaysresize = isset($alwaysresize); $parser->quality_snapshot = (int) trim($quality_snapshot); $parser->quality_original = (int) trim($quality_original); $parser->audioext = trim($audioext); $parser->videoext = trim($videoext); $parser->save(); litepublisher::$site->video_width = $video_width; litepublisher::$site->video_height = $video_height; break; case 'links': $linkgen = tlinkgenerator::i(); $linkgen->urlencode = isset($urlencode); if (!empty($post)) { $linkgen->post = $post; } if (!empty($menu)) { $linkgen->menu = $menu; } if (!empty($category)) { $linkgen->category = $category; } if (!empty($tag)) { $linkgen->tag = $tag; } if (!empty($archive)) { $linkgen->archive = $archive; } $linkgen->save(); break; case 'cache': if (isset($clearcache)) { ttheme::clearcache(); } else { $classes = litepublisher::$classes; if ($classes->memcache != isset($memcache_classes)) { if (isset($memcache_classes)) { $classes->revision_memcache++; } $classes->memcache = isset($memcache_classes); $classes->save(); } $options->lock(); $options->cache = isset($enabledcache); $options->admincache = isset($admincache); if (!empty($expiredcache)) { $options->expiredcache = (int) $expiredcache; } $options->ob_cache = isset($ob_cache); $options->compress = isset($compress); $options->commentspull = isset($commentspull); $options->unlock(); } break; case 'lite': case 'catstags': litepublisher::$classes->archives->lite = isset($litearch); $cats = litepublisher::$classes->categories; $cats->lite = isset($litecats); $cats->includeparents = isset($parentcats); $cats->includechilds = isset($childcats); $cats->save(); $tags = litepublisher::$classes->tags; $tags->lite = isset($litetags); $tags->includeparents = isset($parenttags); $tags->includechilds = isset($childtags); $tags->save(); break; case 'robots': $robo = trobotstxt::i(); $robo->text = $robots; $robo->save(); $appcache_manifest = appcache_manifest::i(); $appcache_manifest->text = $appcache; $appcache_manifest->save(); break; case 'secure': if (isset($_POST['oldpassword'])) { $h2 = $this->html->h2; if ($oldpassword == '') { return $h2->badpassword; } if ($newpassword == '' || $newpassword != $repassword) { return $h2->difpassword; } if (!$options->auth($options->email, $oldpassword)) { return $h2->badpassword; } $options->changepassword($newpassword); $options->logout(); return $h4->passwordchanged; } else { $options->echoexception = isset($echoexception); $options->reguser = isset($reguser); $this->usersenabled = isset($usersenabled); $options->parsepost = isset($parsepost); $options->show_draft_post = isset($show_draft_post); $options->xxxcheck = isset($xxxcheck); $filter = tcontentfilter::i(); $filter->phpcode = isset($phpcode); $filter->save(); $parser = tthemeparser::i(); $parser->removephp = isset($removephp); $parser->save(); $backuper = tbackuper::i(); if ($backuper->filertype != $filertype) { $backuper->filertype = $filertype; $backuper->save(); } $useshell = isset($useshell); $updater = tupdater::i(); if ($useshell !== $updater->useshell) { $updater->useshell = $useshell; $updater->save(); } } break; } return ''; }
private function get_view_sidebars($idview, $html, $lang, $args) { $view = tview::i($idview); $widgets = twidgets::i(); $args->idview = $idview; $args->adminurl = tadminhtml::getadminlink('/admin/views/widgets/', 'idwidget'); $count = count($view->sidebars); $sidebarnames = range(1, 3); $about = tthemeparser::i()->getabout($view->theme->name); foreach ($sidebarnames as $k => $v) { if (isset($about["sidebar{$k}"])) { $sidebarnames[$k] = $about["sidebar{$k}"]; } } $sidebars = ''; if ($idview > 1 && !$view->customsidebar) { $view = tview::i(1); } $sitems = array(); foreach ($view->sidebars as $index => $sidebar) { $args->index = $index; $widgetlist = ''; $idwidgets = array(); foreach ($sidebar as $_item) { $id = $_item['id']; $idwidgets[] = $id; $sitems[$id] = $_item; $args->id = $id; $args->add($widgets->items[$id]); $widgetlist .= $html->widgetitem($args); } $args->sidebarname = $sidebarnames[$index]; $args->widgetlist = $widgetlist; $args->idwidgets = implode(',', $idwidgets); $sidebars .= $html->sidebar($args); } $woptions = ''; $allwidgets = ''; foreach ($widgets->items as $id => $item) { $args->id = $id; $args->add($item); $enabled = $item['cache'] == 'cache' || $item['cache'] == 'nocache'; $args->enabled = $enabled ? 'enabled' : 'disabled'; if (isset($sitems[$id])) { $sitem = $sitems[$id]; } else { $allwidgets .= $html->widgetitem($args); $sitem = array('ajax' => $enabled ? 'inline' : false); } $args->add($sitem); $args->controls = $html->getinput('checkbox', "ajax{$id}", $sitem['ajax'] ? 'checked="checked"' : '', $lang->ajax) . $html->getinput('checkbox', "inline{$id}", ($enabled ? '' : 'disabled="disabled" ') . ($sitem['ajax'] === 'inline' ? 'checked="checked"' : ''), $lang->inline) . $html->getinput('submit', "delete{$id}", '', $lang->widget_delete); $woptions .= $html->woptions($args); } $args->sidebars = $sidebars; $args->woptions = $woptions; $args->allwidgets = $allwidgets; return $html->sidebars($args); }
function textrasidebarsUninstall($self) { tthemeparser::i()->unbind($self); ttheme::clearcache(); }
function tclearcacheUninstall($self) { litepublisher::$urlmap->unbind($self); $parser = tthemeparser::i(); $parser->unbind($self); }