<?php // plugin needs to work on Nucleus versions <=2.0 as well if (!function_exists('sql_table')){ function sql_table($name) { return 'nucleus_' . $name; } } class NP_PluginList extends NucleusPlugin { function getName() {return 'Plugin List';} function getAuthor() {return 'mas';} function getURL(){return 'http://neconnect.net/';} function getVersion() {return '1.1';} function getDescription() { return 'display installed plugin\'s list'; } function supportsFeature($what) { switch($what){ case 'SqlTablePrefix': return 1; default: return 0; } } function install () { $this->createOption('s_lists','List.','text','<ul class="nobullets">'); $this->createOption('e_lists','List(close).','text','</ul>'); $this->createOption('s_items','List Item.','text','<li>'); $this->createOption('e_items','List Item(close).','text','</li>'); $this->createOption('itemName','How does item name display? yes=from getName() no=from File Name','yesno','yes'); $this->createOption('linkURL','link to author\'s web site?','yesno','yes'); $this->createOption('showVersion','show version?','yesno','yes'); } function doSkinVar($skinType, $mode = 'id', $sort = 'ASC') { global $manager; $query = 'SELECT pfile FROM '.sql_table('plugin'); if($mode == 'order'){ $query .= ' ORDER BY porder'; }else{ $query .= ' ORDER BY pid'; } if($sort == 'DESC') $query .= ' DESC'; $res = mysql_query($query); $num = mysql_num_rows($res); $i = 0; // get item while($row = mysql_fetch_object($res)){ $plug =& $manager->getPlugin($row->pfile); $version[$i] = $plug->getVersion(); $url[$i] = $plug->getURL(); $author[$i] = $plug->getAuthor(); if($this->getOption(itemName) == 'yes'){ $name[$i] = $plug->getName(); }else{ $name[$i] = $row->pfile; } $i++; } // abc sort (ASC|DESC) if ($mode == 'abc'){ if($sort == 'DESC'){ arsort($name, SORT_STRING); }else{ asort($name, SORT_STRING); } } echo $this->getOption(s_lists)."\n"; foreach($name as $key => $val){ $ver = ''; if($this->getOption(showVersion) == 'yes') // Version style $ver = ' <small>(v'.$version[$key].')</small>'; if($this->getOption(linkURL) == 'yes') // Link style $val = '<a href="'.$url[$key].'" title="author: '.$author[$key].'">'. $val .'</a>'; echo $this->getOption(s_items) . $val .$ver. $this->getOption(e_items)."\n"; } echo $this->getOption(e_lists)."\n"; } } ?>