OSDN Git Service

FIX: NP_ThumbnailをNucleus 3.65/PHP5.4/MySQL5.5で動作するよう修正
[nucleus-jp/nucleus-plugins.git] / trunk / NP_QuickMenu / NP_QuickMenu.php
1 <?php
2 /*
3         Quick Menu
4         by yu (http://nucleus.datoka.jp)
5         
6         This program is free software; you can redistribute it and/or
7         modify it under the terms of the GNU General Public License
8         as published by the Free Software Foundation; either version 2
9         of the License, or (at your option) any later version.
10         (see nucleus/documentation/index.html#license for more info)
11         
12 */
13
14
15 class NP_QuickMenu extends NucleusPlugin {
16
17         function getName() { return 'QuickMenu'; }
18         function getAuthor()  { return 'yu'; }
19         function getURL() { return 'http://nucleus.datoka.jp/'; }
20         function getVersion() { return '0.1'; }
21         function getMinNucleusVersion() { return '250'; }
22         function getEventList() { return array('QuickMenu'); }  
23         function getTableList() { return array(); }
24
25         function getDescription() { 
26                 return "You can make links in Quick Menu. ";
27         }
28
29         function supportsFeature($what) {
30                 switch($what){
31                         case 'SqlTablePrefix':
32                                 return 1;
33                         default:
34                                 return 0;
35                 }
36         }
37
38         function init() {
39                 $this->max = 5;
40         }
41         
42         function install() {
43                 //set initial value
44                 $title[1]   = "NucleusCMS(JP)";
45                 $url[1]     = "http://japan.nucleuscms.org/";
46                 $tooltip[1] = "Nucleus CMS Japanese Official";
47                 for ($i = 1; $i <= $this->max; $i++) {
48                         $this->createOption("title{$i}",   "Title {$i}",   "text", $title[$i]);
49                         $this->createOption("url{$i}",     "URL {$i}",     "text", $url[$i]);
50                         $this->createOption("tooltip{$i}", "ToolTip {$i}", "text", $tooltip[$i]);
51                 }
52         }
53
54         function uninstall() {
55         }
56
57         function event_QuickMenu(&$data) {
58                 global $member;
59                 
60                 // only show to admins
61                 if (!($member->isLoggedIn() && $member->isAdmin())) return;
62                 
63                 for ($i = 1; $i <= $this->max; $i++) {
64                         if ( $this->getOption("title{$i}") and $this->getOption("url{$i}") ) {
65                                 array_push(
66                                         $data['options'], 
67                                         array(
68                                                 'title'   => $this->getOption("title{$i}"),
69                                                 'url'     => $this->getOption("url{$i}"),
70                                                 'tooltip' => $this->getOption("tooltip{$i}")
71                                         )
72                                 );
73                         }
74                 }
75         }
76
77 }
78 ?>