public static function editsidebars(array &$sidebars)
 {
     // collect all id from checkboxes
     $items = array();
     foreach ($_POST as $key => $value) {
         if (strbegin($key, 'widgetcheck-')) {
             $items[] = (int) $value;
         }
     }
     foreach ($items as $id) {
         if ($pos = tsidebars::getpos($sidebars, $id)) {
             list($i, $j) = $pos;
             if (isset($_POST['deletewidgets'])) {
                 array_delete($sidebars[$i], $j);
             } else {
                 $i2 = (int) $_POST["sidebar-{$id}"];
                 $j2 = (int) $_POST["order-{$id}"];
                 if ($j2 > count($sidebars[$i2])) {
                     $j2 = count($sidebars[$i2]);
                 }
                 if ($i != $i2 || $j != $j2) {
                     $item = $sidebars[$i][$j];
                     array_delete($sidebars[$i], $j);
                     array_insert($sidebars[$i2], $item, $j2);
                 }
                 $sidebars[$i2][$j2]['ajax'] = isset($_POST["inlinecheck-{$id}"]) ? 'inline' : isset($_POST["ajaxcheck-{$id}"]);
             }
         }
     }
     //    return $this->html->h2->success;
 }
 public function add($idtag)
 {
     $tag = $this->tags->getitem($idtag);
     $widgets = twidgets::i();
     $id = $widgets->addext($this, $tag['title'], 'widget');
     $this->items[$id] = array('idtag' => $idtag, 'maxcount' => 10, 'invertorder' => false);
     $sidebars = tsidebars::i();
     $sidebars->add($id);
     $this->save();
     //$this->added($id);
     return $id;
 }
Example #3
0
 public function add($idtag)
 {
     $tag = $this->tags->getitem($idtag);
     $widgets = twidgets::i();
     $id = $widgets->addext($this, $tag['title'], 'categories');
     $this->items[$id] = array('idtag' => $idtag, 'sortname' => 'count', 'showsubitems' => true, 'showcount' => true, 'maxcount' => 0, 'template' => 'categories');
     $sidebars = tsidebars::i();
     $sidebars->add($id);
     $this->save();
     //$this->added($id);
     return $id;
 }
 public function add($idview, $title, $content, $template)
 {
     $widgets = twidgets::i();
     $widgets->lock();
     $id = $widgets->addext($this, $title, $template);
     $this->items[$id] = array('title' => $title, 'content' => $content, 'template' => $template);
     $sidebars = tsidebars::i($idview);
     $sidebars->add($id);
     $widgets->unlock();
     $this->save();
     $this->added($id);
     return $id;
 }
/**
* 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 tkeywordspluginInstall($self)
{
    @mkdir(litepublisher::$paths->data . 'keywords', 0777);
    @chmod(litepublisher::$paths->data . 'keywords', 0777);
    $item = litepublisher::$classes->items[get_class($self)];
    litepublisher::$classes->add('tkeywordswidget', 'keywords.widget.php', $item[1]);
    $widget = tkeywordswidget::i();
    $widgets = twidgets::i();
    $widgets->lock();
    $id = $widgets->add($widget);
    $sidebars = tsidebars::i();
    $sidebars->insert($id, false, 1, -1);
    $widgets->unlock();
    $urlmap = turlmap::i();
    $urlmap->lock();
    $urlmap->afterrequest = $self->parseref;
    $urlmap->deleted = $self->urldeleted;
    $urlmap->unlock();
}
function install_std_widgets($widgets)
{
    $widgets->lock();
    $sidebars = tsidebars::i();
    $id = $widgets->add(tcategorieswidget::i());
    $sidebars->insert($id, 'inline', 0, -1);
    $id = $widgets->add(ttagswidget::i());
    $id = $widgets->add(tarchiveswidget::i());
    $sidebars->insert($id, 'inline', 0, -1);
    $id = $widgets->add(tlinkswidget::i());
    $sidebars->insert($id, 'inline', 0, -1);
    $id = $widgets->add(tpostswidget::i());
    $sidebars->insert($id, 'inline', 1, -1);
    $id = $widgets->add(tcommentswidget::i());
    $sidebars->insert($id, true, 1, -1);
    $id = $widgets->add(tmetawidget::i());
    $sidebars->insert($id, 'inline', 1, -1);
    $widgets->unlock();
}
Example #7
0
 public function getpos($id)
 {
     return tsidebars::getpos($this->sidebars, $id);
 }
Example #8
0
 public function update()
 {
     $log = $this->log;
     false;
     if ($log) {
         tfiler::log("begin update", 'update');
     }
     tlocal::clearcache();
     $this->versions = self::getversions();
     $nextver = $this->nextversion;
     if ($log) {
         tfiler::log("update started from litepublisher::{$options->version} to {$this->version}", 'update');
     }
     $v = litepublisher::$options->version + 0.01;
     while (version_compare($v, $nextver) <= 0) {
         $ver = (string) $v;
         if (strlen($ver) == 3) {
             $ver .= '0';
         }
         if (strlen($ver) == 1) {
             $ver .= '.00';
         }
         if ($log) {
             tfiler::log("{$v} selected to update", 'update');
         }
         $this->run($v);
         litepublisher::$options->version = $ver;
         litepublisher::$options->savemodified();
         $v = $v + 0.01;
     }
     ttheme::clearcache();
     tlocal::clearcache();
     tsidebars::fix();
     if ($log) {
         tfiler::log("update finished", 'update');
     }
 }