6 * configuration by option
8 * subcategory link bug fix
12 class NP_Dtree extends NucleusPlugin
17 return 'Navigation Tree';
22 return 'nakahara21 + shizuki';
27 return 'http://nakahara21.com/';
35 function getDescription()
37 return _DTREE_DESCRIPTION; //'Show Navigation Tree. Usage: <%Dtree()%>';
40 function supportsFeature($what)
43 case 'SqlTablePrefix':
52 $this->createOption('folderLinks', _DTREE_DIR_LINK, 'yesno', 'yes');
53 $this->createOption('useSelection', _DTREE_SELECTION, 'yesno', 'no');
54 $this->createOption('useCookies', _DTREE_COOKIE, 'yesno', 'no');
55 $this->createOption('useLines', _DTREE_LINE, 'yesno', 'yes');
56 $this->createOption('useIcons', _DTREE_ICON, 'yesno', 'yes');
57 $this->createOption('useStatusText', _DTREE_ST_TEXT, 'yesno', 'no');
58 $this->createOption('closeSameLevel', _DTREE_CL_SLEVEL, 'yesno', 'no');
59 $this->createOption('inOrder', _DTREE_IN_ORDER, 'yesno', 'no');
65 $language = ereg_replace( '[\\|/]', '', getLanguageName());
66 if (file_exists($this->getDirectory().'language/'.$language.'.php')) {
67 include_once($this->getDirectory().'language/'.$language.'.php');
69 include_once($this->getDirectory().'language/english.php');
73 function doSkinVar($skinType, $itemid = 0)
75 global $blogid, $catid, $subcatid;
76 $adminURL = htmlspecialchars($this->getAdminURL(), ENT_QUOTES, _CHARSET);
77 if (is_numeric($blogid)) {
78 $blogid = intval($blogid);
80 $id = getBlogIDFromName($blogid);
81 $blogid = intval($id);
83 $itemid = intval($itemid);
84 $catid = intval($catid);
85 $subcatid = intval($subcatid);
87 // $randomID = 'tree' . uniqid(rand());
88 $randomID = 'tree' . preg_replace('|[^0-9a-f]|i', '', uniqid(rand()));
90 echo '<script type="text/javascript" src="' . $adminURL . 'dtree.php"></script>' . "\n";
92 if ($skinType == 'template') {
93 $data = '<script type="text/javascript"' . ' src="' . $adminURL
95 . 'o=' . $randomID . 'a'
100 . '"></script>' . "\n";
102 $data = '<a href="javascript: ' . $randomID . 'a.openAll();">' . _DTREE_OPENALL . '</a>' . "\n"
104 . '<a href="javascript: ' . $randomID . 'a.closeAll();">' . _DTREE_CLOSEALL . '</a>' . "\n";
110 if (!empty($catid)) {
111 } $eq .= '&cid=' . $catid;
112 if (!empty($subcatid)) {
113 $eq .= '&sid=' . $subcatid;
116 $data = '<script type="text/javascript" src="' . $adminURL
118 . 'o=' . $randomID . 'd'
120 . 'bid=' . $blogid . $eq . '">'
123 $data = '<a href="javascript: ' . $randomID . 'd.openAll();">' . _DTREE_OPENALL . '</a>' . "\n"
125 . '<a href="javascript: ' . $randomID . 'd.closeAll();">' . _DTREE_CLOSEALL . '</a>' . "\n";
130 function doTemplateVar(&$item)
132 $this->doSkinVar('template', $item->itemid);