Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの
Revision | 86d2bd89fc39cc90befd89a1ea2135a306b3bc2b (tree) |
---|---|
Time | 2006-10-02 23:16:07 |
Author | shizuki <shizuki@1ca2...> |
Commiter | shizuki |
動作テスト 未
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@401 1ca29b6e-896d-4ea0-84a5-967f57386b96
@@ -1,10 +1,4 @@ | ||
1 | 1 | <? |
2 | -// plugin needs to work on Nucleus versions <=2.0 as well | |
3 | -if (!function_exists('sql_table')){ | |
4 | - function sql_table($name) { | |
5 | - return 'nucleus_' . $name; | |
6 | - } | |
7 | -} | |
8 | 2 | |
9 | 3 | /* |
10 | 4 | Version history: |
@@ -12,15 +6,34 @@ if (!function_exists('sql_table')){ | ||
12 | 6 | */ |
13 | 7 | class NP_BlogList extends NucleusPlugin { |
14 | 8 | |
15 | - function getName() { return 'Blog List'; } | |
16 | - function getAuthor() { return 'Ben Osman + nakahara21'; } | |
17 | - function getURL() { return 'http://www.justletgo.org/'; } | |
18 | - function getVersion() { return '0.2'; } | |
19 | - function getDescription() { | |
9 | + function getName() | |
10 | + { | |
11 | + return 'Blog List'; | |
12 | + } | |
13 | + | |
14 | + function getAuthor() | |
15 | + { | |
16 | + return 'Ben Osman + nakahara21 + shizuki'; | |
17 | + } | |
18 | + | |
19 | + function getURL() | |
20 | + { | |
21 | + return 'http://www.justletgo.org/'; | |
22 | + } | |
23 | + | |
24 | + function getVersion() | |
25 | + { | |
26 | + return '0.3'; | |
27 | + } | |
28 | + | |
29 | + function getDescription() | |
30 | + { | |
20 | 31 | return 'List can be shown using <%BlogList%> OR <%BlogList(bpublic = 1)%>. <br /> It has following parameters : filter, header, list, footer)'; |
21 | 32 | } |
22 | - function supportsFeature($what) { | |
23 | - switch($what){ | |
33 | + | |
34 | + function supportsFeature($what) | |
35 | + { | |
36 | + switch ($what) { | |
24 | 37 | case 'SqlTablePrefix': |
25 | 38 | return 1; |
26 | 39 | default: |
@@ -28,43 +41,44 @@ class NP_BlogList extends NucleusPlugin { | ||
28 | 41 | } |
29 | 42 | } |
30 | 43 | |
31 | - function install() { | |
32 | - $this->createOption('OrderBy','Field that list is sorted by','text','bnumber ASC'); | |
33 | - $this->createOption('Header','Header Template','text','<ul class="nobullets">'); | |
34 | - $this->createOption('List','List Template ','text','<li><a href="<%bloglink%>"><%blogname%></a><%flag%></li>'); | |
35 | - $this->createOption('Footer','Footer Template','text','</ul>'); | |
36 | - } | |
37 | - | |
38 | - function unInstall() { | |
39 | - } | |
40 | - | |
41 | - function init() { | |
44 | + function install() | |
45 | + { | |
46 | + $this->createOption('OrderBy', 'Field that list is sorted by', 'text', 'bnumber ASC'); | |
47 | + $this->createOption('Header', 'Header Template', 'text', '<ul class="nobullets">'); | |
48 | + $this->createOption('List', 'List Template ', 'text', '<li><a href="<%bloglink%>"><%blogname%></a><%flag%></li>'); | |
49 | + $this->createOption('Footer', 'Footer Template', 'text', '</ul>'); | |
42 | 50 | } |
43 | 51 | |
44 | 52 | function doSkinVar($skinType, $filter ='', $header ='', $list='', $footer='') |
45 | 53 | { |
46 | - global $CONF, $blog; | |
47 | - | |
54 | +// global $CONF, $blog; | |
55 | + global $CONF, $blogid; | |
56 | + if (is_numeric($blogid)) { | |
57 | + $blogid = intval($blogid); | |
58 | + } else { | |
59 | + $blog_id = getBlogIDFromName($blogid); | |
60 | + $blogid = intval($blogid); | |
61 | + } | |
48 | 62 | // determine arguments next to catids |
49 | 63 | // I guess this can be done in a better way, but it works |
50 | - if (!$header) { | |
64 | + if (empty($header)) { | |
51 | 65 | $header = $this->getOption('Header'); |
52 | 66 | } |
53 | - if (!$list) { | |
67 | + if (empty($list)) { | |
54 | 68 | $list = $this->getOption('List'); |
55 | 69 | } |
56 | - if (!$footer) { | |
70 | + if (empty($footer)) { | |
57 | 71 | $footer = $this->getOption('Footer'); |
58 | 72 | } |
59 | 73 | |
60 | 74 | //$blogurl = $this->getURL() . $qargs; |
61 | - $blogurl = createBlogLink($this->getURL(), $linkparams); | |
75 | + //$blogurl = createBlogLink($this->getURL(), $linkparams); | |
76 | + $blogurl = createBlogLink($blogid); | |
62 | 77 | |
63 | 78 | $template = TEMPLATE::read($template); |
64 | 79 | |
65 | - echo TEMPLATE::fill($header, | |
66 | - array( | |
67 | - )); | |
80 | +// echo TEMPLATE::fill($header, array()); | |
81 | + echo $header; | |
68 | 82 | |
69 | 83 | $where = ''; |
70 | 84 | if ($filter <> '') { |
@@ -72,27 +86,33 @@ class NP_BlogList extends NucleusPlugin { | ||
72 | 86 | } |
73 | 87 | |
74 | 88 | // $query = 'SELECT *,b.bnumber as blogid, b.bname as blogname, b.burl as bloglink FROM nucleus_blog as b ' . $where . ' ORDER BY ' . $this->getOption('OrderBy'); |
75 | - $query = 'SELECT *,b.bnumber as blogid, b.bname as blogname FROM '.sql_table('blog').' as b ' . $where . ' ORDER BY ' . $this->getOption('OrderBy'); | |
89 | +// $query = 'SELECT *,b.bnumber as blogid, b.bname as blogname FROM '.sql_table('blog').' as b ' . $where . ' ORDER BY ' . $this->getOption('OrderBy'); | |
90 | + $query = 'SELECT bnumber, bname FROM ' . sql_table('blog') . ' ORDER BY ' . $this->getOption('OrderBy'); | |
76 | 91 | |
77 | 92 | $res = sql_query($query); |
78 | 93 | while ($data = mysql_fetch_assoc($res)) { |
79 | - $data['self'] = $CONF['Self']; | |
80 | - $data['bloglink'] = createBlogidLink($data['blogid'], ''); | |
81 | - | |
82 | - if( $data['blogid'] == $blog->getID() ){ | |
83 | - $data['flag'] = " «"; //mark this blog! | |
94 | +// $data['self'] = $CONF['Self']; | |
95 | +// $data['bloglink'] = createBlogidLink($data['blogid'], ''); | |
96 | + $listdata = array( | |
97 | + bloglink => createBlogLink($data['bnumber']), | |
98 | + blogname => $data['bname'] | |
99 | + ); | |
100 | +// if ( $data['blogid'] == $blog->getID() ){ | |
101 | + if ($data['bnumber'] == $blogid) { | |
102 | +// $data['flag'] = " «"; //mark this blog! | |
103 | + $listdata['flag'] = " «"; //mark this blog! | |
84 | 104 | } |
85 | 105 | |
86 | - $temp = TEMPLATE::fill($list,$data); | |
87 | - echo strftime($temp,$current->itime); | |
106 | +// $temp = TEMPLATE::fill($list, $data); | |
107 | + echo TEMPLATE::fill($list, $listdata); | |
108 | +// echo strftime($temp, $current->itime); | |
88 | 109 | |
89 | 110 | } |
90 | 111 | |
91 | 112 | mysql_free_result($res); |
92 | 113 | |
93 | - echo TEMPLATE::fill($footer, | |
94 | - array( | |
95 | - )); | |
114 | +// echo TEMPLATE::fill($footer, array()); | |
115 | + echo $footer; | |
96 | 116 | } |
97 | 117 | } |
98 | 118 | ?> |
\ No newline at end of file |