/**
* Lite Publisher
* Copyright (C) 2010 - 2015 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/
* Dual licensed under the MIT (mit.txt)
* and GPL (gpl.txt) licenses.
**/
function tpolltypesInstall($self)
{
    $lang = tlocal::admin('polls');
    $theme = ttheme::i();
    $res = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'resource' . DIRECTORY_SEPARATOR;
    $self->data['closed'] = $theme->replacelang(file_get_contents($res . 'microformat.tml'), $lang);
    $self->data['itemclosed'] = '';
    $ini = parse_ini_file($res . 'types.ini', true);
    foreach ($ini as $type => $item) {
        foreach ($item as $k => $v) {
            $item[$k] = str_replace("'", '"', $v);
        }
        $item['type'] = $type;
        $item['item'] = $theme->replacelang($item['item'], $lang);
        $item['opened'] = $theme->replacelang($item['opened'], $lang);
        if (isset($item['closed'])) {
            $item['closed'] = $theme->replacelang($item['closed'], $lang);
        }
        if (isset($item['itemclosed'])) {
            $item['itemclosed'] = $theme->replacelang($item['itemclosed'], $lang);
        }
        $self->add($item);
    }
    $self->save();
}
 public function getcontent($id, $sidebar)
 {
     if (litepublisher::$urlmap->is404) {
         return '';
     }
     $result = '';
     $a = array('$url' => urlencode(litepublisher::$site->url . litepublisher::$urlmap->url), '$title' => urlencode(ttemplate::i()->title));
     $redirlink = litepublisher::$site->url . $this->redirlink . litepublisher::$site->q . strtr('url=$url&title=$title&id=', $a);
     $iconurl = litepublisher::$site->files . '/plugins/bookmarks/icons/';
     $theme = ttheme::i();
     $tml = $theme->getwidgetitem('links', $sidebar);
     $args = targs::i();
     $args->subcount = '';
     $args->subitems = '';
     $args->rel = 'link bookmark';
     foreach ($this->items as $id => $item) {
         $args->id = $id;
         $args->title = $item['title'];
         $args->text = $item['title'];
         if ($this->redir) {
             $args->link = $redirlink . $id;
         } else {
             $args->link = strtr($item['url'], $a);
         }
         $args->icon = $item['text'] == '' ? '' : sprintf('<img src="%s%s" alt="%s" />', $iconurl, $item['text'], $item['title']);
         $result .= $theme->parsearg($tml, $args);
     }
     return $theme->getwidgetcontent($result, 'links', $sidebar);
 }
 public function processform()
 {
     $theme = tview::i(tviews::i()->defaults['admin'])->theme;
     $plugin = ttagreplacer::i();
     $plugin->lock();
     $plugin->items = array();
     foreach ($_POST as $name => $value) {
         if (!strbegin($name, 'where-')) {
             continue;
         }
         $id = substr($name, strlen('where-'));
         $where = trim($value);
         if (!isset($theme->templates[$where]) || !is_string($theme->templates[$where])) {
             continue;
         }
         $search = $_POST["search-{$id}"];
         if ($search == '') {
             continue;
         }
         $plugin->items[] = array('where' => $where, 'search' => $search, 'replace' => $_POST["replace-{$id}"]);
     }
     $plugin->unlock();
     ttheme::clearcache();
     return '';
 }
 public function getcontent($id, $sidebar)
 {
     if (count($this->items) == 0) {
         return '';
     }
     $result = '';
     $theme = ttheme::i();
     $tml = $theme->getwidgetitem('links', $sidebar);
     $redirlink = litepublisher::$site->url . $this->redirlink . litepublisher::$site->q . 'id=';
     $url = litepublisher::$site->url;
     $args = targs::i();
     $args->subcount = '';
     $args->subitems = '';
     $args->icon = '';
     $args->rel = 'link';
     foreach ($this->items as $id => $item) {
         $args->add($item);
         $args->id = $id;
         if ($this->redir && !strbegin($item['url'], $url)) {
             $args->link = $redirlink . $id;
         } else {
             $args->link = $item['url'];
         }
         $result .= $theme->parsearg($tml, $args);
     }
     return $theme->getwidgetcontent($result, 'links', $sidebar);
 }
 public function getcont()
 {
     $result = $this->formresult;
     $result .= $this->getcontent();
     $theme = ttheme::i();
     return $theme->simple($result);
 }
 private function getlist()
 {
     $foaf = tfoaf::i();
     $perpage = 20;
     $total = $foaf->getcount();
     $from = $this->getfrom($perpage, $total);
     if ($foaf->dbversion) {
         $items = $foaf->select('', " order by status asc, added desc limit {$from}, {$perpage}");
         if (!$items) {
             $items = array();
         }
     } else {
         $items = array_slice(array_keys($foaf->items), $from, $perpage);
     }
     $html = $this->html;
     $result = $html->tableheader();
     $args = targs::i();
     $args->adminurl = $this->adminurl;
     foreach ($items as $id) {
         $item = $foaf->getitem($id);
         $args->add($item);
         $args->id = $id;
         $args->status = tlocal::get('foaf', $item['status']);
         $result .= $html->itemlist($args);
     }
     $result .= $html->tablefooter();
     $theme = ttheme::i();
     $result .= $theme->getpages('/admin/foaf/', litepublisher::$urlmap->page, ceil($total / $perpage));
     return $result;
 }
 public function getcontent($id, $sidebar)
 {
     $result = '';
     $theme = ttheme::i();
     $tml = $theme->getwidgetitem('meta', $sidebar);
     $metaclasses = $theme->getwidgettml($sidebar, 'meta', 'classes');
     $args = targs::i();
     foreach ($this->items as $name => $item) {
         if (!$item['enabled']) {
             continue;
         }
         $args->add($item);
         $args->icon = '';
         $args->subcount = '';
         $args->subitems = '';
         $args->rel = $name;
         if ($name == 'profile') {
             $args->rel = 'author profile';
         }
         $args->class = isset($metaclasses[$name]) ? $metaclasses[$name] : '';
         $result .= $theme->parsearg($tml, $args);
     }
     if ($result == '') {
         return '';
     }
     return $theme->getwidgetcontent($result, 'meta', $sidebar);
 }
 public function getcont()
 {
     $result = '';
     $theme = ttheme::i();
     if (litepublisher::$urlmap->page == 1 && $this->content != '') {
         $result .= $theme->simple($theme->parse($this->rawcontent));
     }
     $perpage = litepublisher::$options->perpage;
     $downloaditems = tdownloaditems::i();
     $d = litepublisher::$db->prefix . $downloaditems->childtable;
     $p = litepublisher::$db->posts;
     $where = $this->type == '' ? '' : " and {$d}.type = '{$this->type}'";
     $count = $downloaditems->getchildscount($where);
     $from = (litepublisher::$urlmap->page - 1) * $perpage;
     if ($from <= $count) {
         $items = $downloaditems->select("{$p}.status = 'published' {$where}", " order by {$p}.posted desc limit {$from}, {$perpage}");
         ttheme::$vars['lang'] = tlocal::i('downloaditem');
         $tml = $theme->templates['custom']['downloadexcerpt'];
         if (count($items) > 0) {
             $result .= $theme->templates['custom']['siteform'];
             foreach ($items as $id) {
                 ttheme::$vars['post'] = tdownloaditem::i($id);
                 $result .= $theme->parse($tml);
             }
         }
     }
     $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($count / $perpage));
     return $result;
 }
 public function getcontent($id, $sidebar)
 {
     $foaf = tfoaf::i();
     $items = $foaf->getapproved($this->maxcount);
     if (count($items) == 0) {
         return '';
     }
     $result = '';
     $url = litepublisher::$site->url;
     $redirlink = litepublisher::$site->url . $this->redirlink . litepublisher::$site->q . 'id=';
     $theme = ttheme::i();
     $tml = $theme->getwidgetitem('friends', $sidebar);
     $args = targs::i();
     $args->subcount = '';
     $args->subitems = '';
     $args->{$icon} = '';
     $args->rel = 'friend';
     foreach ($items as $id) {
         $item = $foaf->getitem($id);
         $args->add($item);
         $args->anchor = $item['title'];
         if ($this->redir && !strbegin($item['url'], $url)) {
             $args->url = $redirlink . $id;
         }
         $result .= $theme->parsearg($tml, $args);
     }
     return $theme->getwidgetcontent($result, 'friends', $sidebar);
 }
 public function getcontent($id, $sidebar)
 {
     if (litepublisher::$urlmap->is404 || litepublisher::$urlmap->adminpanel || strbegin(litepublisher::$urlmap->url, '/croncron.php') || strend(litepublisher::$urlmap->url, '.xml')) {
         return '';
     }
     $id = litepublisher::$urlmap->itemrequested['id'];
     $filename = litepublisher::$paths->data . 'keywords' . DIRECTORY_SEPARATOR . $id . '.' . litepublisher::$urlmap->page . '.php';
     if (@file_exists($filename)) {
         $links = file_get_contents($filename);
     } else {
         if (count($this->links) < $this->count) {
             return '';
         }
         $arlinks = array_splice($this->links, 0, $this->count);
         $this->save();
         //$links = "\n<li>" . implode("</li>\n<li>", $arlinks)  . "</li>";
         $links = '';
         $text = '';
         foreach ($arlinks as $link) {
             $links .= sprintf('<li><a href="%s">%s</a></li>', $link['url'], $link['text']);
             $text .= $link['text'] . "\n";
         }
         file_put_contents($filename, $links);
         if ($this->notify) {
             $plugin = tkeywordsplugin::i();
             $plugin->added($filename, $text);
         }
     }
     $theme = ttheme::i();
     return $theme->getwidgetcontent($links, $this->template, $sidebar);
 }
/**
* Lite Publisher
* Copyright (C) 2010 - 2015 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/
* Dual licensed under the MIT (mit.txt)
* and GPL (gpl.txt) licenses.
**/
function tpasswordpageInstall($self)
{
    litepublisher::$urlmap->delete('/check-password.php');
    tlocal::usefile('install');
    $lang = tlocal::i('passwordpage');
    $form = '<h3>$lang.formtitle</h3>
  <form name="form" action="" method="post" >
  <p><input type="password" name="password" id="password-password" value="" size="22" />
  <label for="password-password"><strong>$lang.password</strong></label></p>
  
  <p><input type="checkbox" name="remember" id="checkbox-remember" $remember />
  <label for="checkbox-remember"><strong>$lang.remember</strong></label></p>
  
  <p>
  <input type="hidden" name="antispam" id="hidden-antispam" value="$antispam" />
  <input type="submit" name="submitbutton" id="submitbutton" value="$lang.send" />
  </p>
  </form>';
    $self->data['form'] = ttheme::i()->parse($form);
    $self->data['title'] = $lang->reqpassword;
    $self->data['invalidpassword'] = $lang->invalidpassword;
    $self->save();
    trobotstxt::i()->AddDisallow('/check-password.php');
    litepublisher::$urlmap->addget('/check-password.php', get_class($self));
}
function tthemegeneratorInstall($self)
{
    if (!ttheme::exists('generator')) {
        die('Theme "generator" not exists');
    }
    //litepublisher::$urlmap->addget('/theme-generator.htm', get_class($self));
    $about = tplugins::getabout(tplugins::getname(__FILE__));
    $name = basename(dirname(__FILE__));
    $merger = tlocalmerger::i();
    $merger->lock();
    $merger->add('themegenerator', "plugins/{$name}/res/scheme.ini");
    $merger->add('themegenerator', sprintf('plugins/%s/res/%s.ini', $name, litepublisher::$options->language));
    $merger->unlock();
    $js = tjsmerger::i();
    $js->lock();
    $js->add('themegenerator', '/plugins/colorpicker/js/colorpicker.js');
    $js->add('themegenerator', '/js/swfupload/swfupload.js');
    $js->add('themegenerator', sprintf('/plugins/%s/themegenerator.min.js', basename(dirname(__FILE__))));
    $js->addlang('themegenerator', 'lang', array('upload_header' => $about['upload_header'], 'upload_logo' => $about['upload_logo']));
    $js->unlock();
    $dir = litepublisher::$paths->files . 'themegen';
    if (!is_dir($dir)) {
        mkdir($dir, 0777);
        @chmod($dir, 0777);
        file_put_contents($dir . DIRECTORY_SEPARATOR . 'index.htm', ' ');
        @chmod($dir . DIRECTORY_SEPARATOR . 'index.htm', 0666);
    }
    tcron::i()->addnightly(get_class($self), 'cron', null);
    $self->lock();
    $self->title = $about['name'];
    $views = tviews::i();
    $self->idview = $views->add($about['name']);
    $view = tview::i($self->idview);
    $view->themename = 'generator';
    $self->leftview = $views->add($about['left']);
    $view = tview::i($self->leftview);
    $view->themename = 'generator-left';
    $self->rightview = $views->add($about['right']);
    $view = tview::i($self->rightview);
    $view->themename = 'generator-right';
    $self->url = '/theme-generator.htm';
    $self->content = get_themegen_content($self);
    $self->parseselectors();
    $menus = tmenus::i();
    $menus->lock();
    $menus->add($self);
    $fake = new tfakemenu();
    $fake->title = $about['left'];
    $fake->url = $self->url . '?type=left';
    $fake->parent = $self->id;
    $menus->add($fake);
    $fake = new tfakemenu();
    $fake->title = $about['right'];
    $fake->url = $self->url . '?type=right';
    $fake->parent = $self->id;
    $menus->add($fake);
    $menus->unlock();
    $self->unlock();
    litepublisher::$urlmap->setvalue($self->idurl, 'type', 'get');
}
 public function getcontent()
 {
     $result = '';
     $this->basename = 'authors';
     $users = tusers::i();
     $lang = $this->lang;
     $html = $this->html;
     if ('delete' == $this->action) {
         $id = $this->idget();
         if (!$users->itemexists($id)) {
             return $this->notfound();
         }
         if (!$this->confirmed) {
             return $html->confirmdelete($id, $this->adminurl, $lang->confirmdelete);
         }
         if (!$this->deleteauthor($id)) {
             return $this->notfount;
         }
         $result .= $html->h4->deleted;
     }
     $args = new targs();
     $perpage = 20;
     $total = $users->db->getcount("status = 'comuser'");
     $from = $this->getfrom($perpage, $total);
     $res = $users->db->query("select * from {$users->thistable} where status = 'comuser' order by id desc limit {$from}, {$perpage}");
     $items = litepublisher::$db->res2assoc($res);
     $result .= sprintf($html->h4->listhead, $from, $from + count($items), $total);
     $adminurl = $this->adminurl;
     $editurl = tadminhtml::getadminlink('/admin/users/', 'id');
     $result .= $html->buildtable($items, array(array('left', $lang->author, '$name'), array('left', 'E-Mail', '$email'), array('left', $lang->website, '$website'), array('center', $lang->edit, "<a href='{$editurl}=\$id&action=edit'>{$lang->edit}</a>"), array('center', $lang->delete, "<a href='{$adminurl}=\$id&action=delete'>{$lang->delete}</a>")));
     $theme = ttheme::i();
     $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($total / $perpage));
     return $result;
 }
function installClasses()
{
    litepublisher::$urlmap = turlmap::i();
    litepublisher::$urlmap->lock();
    $posts = tposts::i();
    $posts->lock();
    $xmlrpc = TXMLRPC::i();
    $xmlrpc->lock();
    ttheme::$defaultargs = array();
    $theme = ttheme::getinstance('default');
    //  $html = tadminhtml::i();
    //      $html->loadinstall();
    foreach (litepublisher::$classes->items as $class => $item) {
        //echo "$class<br>\n";
        if (preg_match('/^(titem|titem_storage|titemspostsowner|tcomment|IXR_Client|IXR_Server|tautoform|tchildpost|tchildposts|tlitememcache)$/', $class)) {
            continue;
        }
        $obj = getinstance($class);
        if (method_exists($obj, 'install')) {
            $obj->install();
        }
    }
    $xmlrpc->unlock();
    $posts->unlock();
    litepublisher::$urlmap->unlock();
}
 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;
 }
 private function getpingbackslist()
 {
     $result = '';
     $pingbacks = tpingbacks::i();
     $perpage = 20;
     $total = $pingbacks->getcount();
     $from = $this->getfrom($perpage, $total);
     $db = $pingbacks->db;
     $t = $pingbacks->thistable;
     $items = $db->res2assoc($db->query("select {$t}.*, {$db->posts}.title as posttitle, {$db->urlmap}.url as posturl\n    from {$t}, {$db->posts}, {$db->urlmap}\n    where {$t}.status <> 'deleted' and {$db->posts}.id = {$t}.post and {$db->urlmap}.id = {$db->posts}.idurl\n    order by {$t}.posted desc limit {$from}, {$perpage}"));
     $html = $this->html;
     $lang = tlocal::i();
     $args = new targs();
     $form = new adminform($args);
     $form->items = $html->getitemscount($from, $from + count($items), $total);
     ttheme::$vars['pingitem'] = new pingitem();
     $form->items .= $html->buildtable($items, array($html->get_table_checkbox('id'), array('left', $lang->date, '$pingitem.date'), array('left', $lang->status, '$pingitem.status'), array('left', $lang->title, '$title'), array('left', $lang->url, '<a href="$url">$url</a>'), array('left', 'IP', '$ip'), array('left', $lang->post, '<a href="$posturl">$posttitle</a>'), array('center', $lang->edit, "<a href='{$this->adminurl}=\$id&action=edit'>{$lang->edit}</a>")));
     unset(ttheme::$vars['pingitem']);
     $form->items .= $html->div($html->getsubmit('approve', 'hold', 'delete'));
     $form->submit = false;
     $result = $form->get();
     $theme = ttheme::i();
     $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($total / $perpage));
     return $result;
 }
 public function getcont()
 {
     $dir = $this->item['dir'];
     $filename = $this->item['filename'];
     $updir = $filename == '' ? '' : ($dir == '' ? '' : sprintf('<ul><li><a href="%1$s/source/%2$s/" title="%2$s">..</a></li></ul>', litepublisher::$site->url, $dir));
     $theme = ttheme::i();
     return $theme->simple($updir . $this->getcachecontent($dir, $filename));
 }
 public function uninstall()
 {
     $template = ttemplate::i();
     $template->deletefromhead($this->getjs());
     $parser = tthemeparser::i();
     $parser->unbind($this);
     ttheme::clearcache();
 }
 public function sendpost($id)
 {
     if ($this->host == '' || $this->login == '') {
         return false;
     }
     $post = tpost::i($id);
     ttheme::$vars['post'] = $post;
     $theme = ttheme::i();
     $content = $theme->parse($this->template);
     $date = getdate($post->posted);
     if ($post->status != 'published') {
         return;
     }
     $meta = $post->meta;
     $client = new IXR_Client($this->host, '/interface/xmlrpc');
     //$client = new IXR_Client($this->host, '/rpc.xml');
     if (!$client->query('LJ.XMLRPC.getchallenge')) {
         if (litepublisher::$debug) {
             tfiler::log('live journal: error challenge');
         }
         return false;
     }
     $response = $client->getResponse();
     $challenge = $response['challenge'];
     $args = array('username' => $this->login, 'auth_method' => 'challenge', 'auth_challenge' => $challenge, 'auth_response' => md5($challenge . md5($this->password)), 'ver' => "1", 'event' => $content, 'subject' => $post->title, 'year' => $date['year'], 'mon' => $date['mon'], 'day' => $date['mday'], 'hour' => $date['hours'], 'min' => $date['minutes'], 'props' => array('opt_nocomments' => !$post->commentsenabled, 'opt_preformatted' => true, 'taglist' => $post->tagnames));
     switch ($this->privacy) {
         case "public":
             $args['security'] = "public";
             break;
         case "private":
             $args['security'] = "private";
             break;
         case "friends":
             $args['security'] = "usemask";
             $args['allowmask'] = 1;
     }
     if ($this->community != '') {
         $args['usejournal'] = $this->community;
     }
     if (isset($meta->ljid)) {
         $method = 'LJ.XMLRPC.editevent';
         $args['itemid'] = $meta->ljid;
     } else {
         $method = 'LJ.XMLRPC.postevent';
     }
     if (!$client->query($method, $args)) {
         if (litepublisher::$debug) {
             tfiler::log('Something went wrong - ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage());
         }
         return false;
     }
     if (!isset($meta->ljid)) {
         $response = $client->getResponse();
         $meta->ljid = $response['itemid'];
     }
     return $meta->ljid;
 }
 public function getcontent($id, $sidebar)
 {
     if (!isset($this->items[$id])) {
         return '';
     }
     $item = $this->items[$id];
     $theme = ttheme::i();
     return $this->tags->getsortedcontent(array('item' => $theme->getwidgetitem($item['template'], $sidebar), 'subcount' => $theme->getwidgettml($sidebar, $item['template'], 'subcount'), 'subitems' => $item['showsubitems'] ? $theme->getwidgettml($sidebar, $item['template'], 'subitems') : ''), $item['idtag'], $item['sortname'], $item['maxcount'], $item['showcount']);
 }
 public function processform()
 {
     $plugin = textrasidebars::i();
     $plugin->beforepost = isset($_POST['beforepost']);
     $plugin->afterpost = isset($_POST['afterpost']);
     $plugin->themes = tadminhtml::check2array('theme-');
     $plugin->save();
     ttheme::clearcache();
 }
 public function request($arg)
 {
     $s = '<?php
 header(\'Content-Type: text/cache-manifest\');
 header(\'Last-Modified: ' . date('r') . '\');
 ?>';
     $s .= "CACHE MANIFEST\r\n";
     $s .= ttheme::i()->parse($this->text);
     return $s;
 }
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();
}
 public function merge()
 {
     $lang = getinstance('tlocal');
     $lang->ini = array();
     ttheme::$inifiles = array();
     foreach ($this->items as $name => $items) {
         $this->parse($name);
     }
     $this->parsehtml();
 }
 public static function getcombo($idperm, $name = 'idperm')
 {
     $lang = tlocal::admin();
     $section = $lang->section;
     $lang->section = 'perms';
     $theme = ttheme::i();
     $result = strtr($theme->templates['content.admin.combo'], array('$lang.$name' => $lang->perm, '$name' => $name, '$value' => self::getcomboitems($idperm)));
     $lang->section = $section;
     return $result;
 }
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();
}
 private function sendmail()
 {
     $args = new targs();
     $args->url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $args->ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     tlocal::usefile('mail');
     $lang = tlocal::i('notfound');
     $theme = ttheme::i();
     $subject = $theme->parsearg($lang->subject, $args);
     $body = $theme->parsearg($lang->body, $args);
     tmailer::sendtoadmin($subject, $body, true);
 }
 public function getwidget($id, $sidebar)
 {
     if (!isset($this->items[$id])) {
         return '';
     }
     $item = $this->items[$id];
     if ($item['template'] == '') {
         return $item['content'];
     }
     $theme = ttheme::i();
     return $theme->getwidget($item['title'], $item['content'], $item['template'], $sidebar);
 }
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();
 }