コード例 #1
0
 /**
  * Создает новый дочерний блок и возвращает указатель не его объект.
  * @param string $name
  * @param bool   $enabled
  * @param bool   $poly
  * @param string $alias
  * @param string $templatefile
  * @param string $plaintext
  * @return StarkytBlock
  */
 public function NewBlock($name, $enabled = true, $poly = false, $alias = '', $templatefile = '', $plaintext = '')
 {
     $this->block['child'][$name] = Starkyt::CreateBlock($enabled, $poly, $alias, $templatefile, $plaintext, array(), $this);
     if ($templatefile != '') {
         $this->starkyt->GetSBlocks($templatefile);
     }
     return new StarkytBlock($this->block['child'][$name], $this->starkyt, $name);
 }
コード例 #2
0
    } elseif ($page['type'] == 'link') {
        $link = SafeDB($page['text'], 255, str);
        if (substr($link, 0, 6) == 'mod://') {
            $link = Ufu('index.php?name=' . substr($link, 6), 'system:mod');
        }
    }
    $link = str_replace('&', '&', $link);
    $item_vars = array('title' => $page['title'], 'link' => $link, 'selected' => false, 'subitems' => false);
    if (isset($catsPid[$page['id']])) {
        foreach ($catsPid[$page['id']] as $subpage) {
            if ($subpage['type'] == 'page') {
                $link = Ufu('index.php?name=pages&file=' . SafeDB($subpage['link'], 255, str), 'pages:page');
            } elseif ($subpage['type'] == 'link') {
                $link = SafeDB($subpage['text'], 255, str);
                if (substr($link, 0, 6) == 'mod://') {
                    $link = Ufu('index.php?name=' . substr($link, 6), 'system:mod');
                }
            } else {
                continue;
            }
            $link = str_replace('&', '&', $link);
            $subitem_vars = array('title' => $subpage['title'], 'link' => $link, 'selected' => false);
            $subitems['sub'][] = Starkyt::CreateSubBlock(true, $subitem_vars);
        }
    }
    $item_vars['subitems'] = count($subitems['sub']) > 0;
    $items['sub'][] = Starkyt::CreateSubBlock(true, $item_vars, array(), '', '', array('block_menu_subitems' => $subitems));
}
System::cache()->Write('block', $bcache_name, $items);
BlockMenuSelectItem($items, $uri);
$childs['block_menu_items'] = $items;