Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの
Revision | 53e616ab55c71d8a3f859f9d259f44f8859c830c (tree) |
---|---|
Time | 2006-10-02 14:28:50 |
Author | shizuki <shizuki@1ca2...> |
Commiter | shizuki |
original file
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@393 1ca29b6e-896d-4ea0-84a5-967f57386b96
@@ -0,0 +1,269 @@ | ||
1 | +<? | |
2 | + | |
3 | +class NP_ArchiveListEX extends NucleusPlugin { | |
4 | + | |
5 | + // name of plugin | |
6 | + function getName() { | |
7 | + return 'ArchiveListEX'; | |
8 | + } | |
9 | + | |
10 | + // author of plugin | |
11 | + function getAuthor() { | |
12 | + return 'nakahara21'; | |
13 | + } | |
14 | + | |
15 | + // an URL to the plugin website | |
16 | + function getURL() | |
17 | + { | |
18 | + return 'http://xx.nakahara21.net/'; | |
19 | + } | |
20 | + | |
21 | + // version of the plugin | |
22 | + function getVersion() { | |
23 | + return '0.6'; | |
24 | + } | |
25 | + | |
26 | + // a description to be shown on the installed plugins listing | |
27 | + function getDescription() { | |
28 | + return 'Show all item title on each archive list. <br />[Required] template: name of the template to use <br />[Optional] mode: [month]shows an entry for each month , [day]shows an entry for each day <br />[Optional] limit: limits the amount of links shown (e.g. if you only want to show links to the past 3 months)<br /><br />Usage1: <%ArchiveListEX(default)%> or <%ArchiveListEX(default,month)%> instead of <%archivelist(default)%>,<br />Usage2: <%ArchiveListEX(default,day,5)%> instead of <%archivedaylist(default,5)%>,<br />Usage3: <%ArchiveListEX(default,5)%>'; | |
29 | + } | |
30 | + | |
31 | + function doSkinVar($skinType, $template = 'default', $mode = 'month', $limit = 0) { | |
32 | + global $manager, $blog, $CONF, $catid, $itemid; | |
33 | + | |
34 | + $params = func_get_args(); | |
35 | + if ($params[1]){ $template = $params[1]; } | |
36 | + if ($params[2]){ | |
37 | + if ($params[2] == 'month' | $params[2] == 'day'){ $mode = $params[2]; } | |
38 | + else{ $limit = intval($params[2]); } | |
39 | + } | |
40 | + if ($params[3]){ $limit = intval($params[3]); } | |
41 | + | |
42 | + if ($blog) { | |
43 | + $b =& $blog; | |
44 | + } else { | |
45 | + $b =& $manager->getBlog($CONF['DefaultBlog']); | |
46 | + } | |
47 | + $blogid = $b->getID(); | |
48 | + | |
49 | + if ($catid) { | |
50 | + $this->linkparams = array('catid' => $catid); | |
51 | + } | |
52 | + | |
53 | +switch($skinType) { | |
54 | + case 'archivelist': | |
55 | + | |
56 | +//********************************************** | |
57 | +if($_REQUEST['mode'] == "remarks"){ | |
58 | + | |
59 | + $numberOfWritebacks = 50; // defaults to 50 | |
60 | + | |
61 | + // select | |
62 | + $query = "SELECT c.cnumber, c.cuser, c.cbody, c.citem, c.cmember, c.ctime ,UNIX_TIMESTAMP(c.ctime) as ctimest ,i.inumber, i.ititle | |
63 | + FROM nucleus_comment c ,nucleus_item i | |
64 | + WHERE c.citem = i.inumber | |
65 | + ORDER by ctime DESC | |
66 | + LIMIT 0,".$numberOfWritebacks; | |
67 | + | |
68 | + $comments = mysql_query($query); | |
69 | +// echo ' <ul class="nobullets"> '; | |
70 | + | |
71 | + while($row = mysql_fetch_object($comments)) { | |
72 | + $cid = $row->cnumber; | |
73 | + $ititle = htmlspecialchars(strip_tags($row->ititle)); | |
74 | + $ct = $row->ctimest; | |
75 | + $ctst = date("Y-m-d H:i",$ct); | |
76 | + $ctext = $row->cbody; | |
77 | +// $ctext = strip_tags($text); | |
78 | +// $ctext = substr($text, 0, $numberOfCharacters); | |
79 | +// $ctext = mb_substr($ctext, 0, -1); | |
80 | + | |
81 | + if (!$row->cmember) $myname = $row->cuser; | |
82 | + else { | |
83 | + $mem = new MEMBER; | |
84 | + $mem->readFromID(intval($row->cmember)); | |
85 | + $myname = $mem->getDisplayName(); | |
86 | + } | |
87 | + $itemid= $row->citem; | |
88 | + $itemlink = createItemLink($row->citem, ''); | |
89 | + $l_comments = "<li class=itembody>■ <span class=\"iteminfo\"><a href=\"".$b->getURL().$itemlink."#c".$cid."\">『".$ititle."』 へのコメント</a></span><br />".$ctext."<br /><span class=\"iteminfo\">".$myname." posted on $ctst</span></li>" ; | |
90 | +// echo $l_comments; | |
91 | + | |
92 | + if(!$arr_res){$arr_res = array();} | |
93 | +// array_push($arr_res,array($ct => $l_comments)); | |
94 | + $arr_res[$ct] = $l_comments; | |
95 | + | |
96 | + } | |
97 | + | |
98 | + | |
99 | +//========================= | |
100 | + | |
101 | + $query = "SELECT t.title, t.excerpt, t.tb_id, t.blog_name, t.timestamp ,UNIX_TIMESTAMP(t.timestamp) as ttimest ,t.url ,i.inumber, i.ititle | |
102 | + FROM nucleus_plugin_tb t ,nucleus_item i | |
103 | + WHERE t.tb_id = i.inumber | |
104 | + ORDER by timestamp DESC | |
105 | + LIMIT 0,".$numberOfWritebacks; | |
106 | + | |
107 | + $comments = mysql_query($query); | |
108 | + | |
109 | + while($row = mysql_fetch_object($comments)) { | |
110 | + $text = $row->excerpt; | |
111 | +// $text = strip_tags($text); | |
112 | +// $ctext = mb_substr($text, 0, $numberOfCharacters); | |
113 | + | |
114 | + $title = $row->title; | |
115 | +// $ctitle = substr($title, 0, $numberOfTitleCharacters+1); | |
116 | +// $ctitle = mb_substr($ctitle, 0, -1); | |
117 | + | |
118 | + $blogname = $row->blog_name; | |
119 | + $tbtime = $row->ttimest; | |
120 | + $ititle = htmlspecialchars(strip_tags($row->ititle)); | |
121 | + $url = $row->url; | |
122 | + $ttst = date("Y-m-d H:i",$tbtime); | |
123 | + | |
124 | + $itemlink = createItemLink($row->tb_id, ''); | |
125 | +// echo "<li><a href=\"".$b->getURL().$itemlink."#trackback\">■".$tbtime.":"; | |
126 | +// echo $blogname."から"; | |
127 | +// echo $ctitle.$ctext; | |
128 | +// echo "....</a></li>"; | |
129 | + | |
130 | + $l_tbs = "<li class=itembody>◆ <span class=\"iteminfo\"><a href=\"".$b->getURL().$itemlink."#trackback\">『".$ititle."』へのトラックバック</a></span><br />## ".$title." ##<br />".$text."<br /><span class=\"iteminfo\">『<a href=\"$url\">{$blogname}</a>』 pinged on ".$ttst."</span></li>"; | |
131 | + | |
132 | +// if(!$arr_res){$arr_res = array();} | |
133 | +// array_push($arr_res,$l_tbs); | |
134 | + $arr_res[$tbtime] = $l_tbs; | |
135 | + | |
136 | + | |
137 | + | |
138 | + } | |
139 | +//========================= | |
140 | + | |
141 | + | |
142 | + | |
143 | +krsort ($arr_res); | |
144 | +$output = array_slice ($arr_res, 0, $numberOfWritebacks); | |
145 | +// print_r($output); | |
146 | + | |
147 | + echo '<h3>コメントとトラックバック 最新'.$numberOfWritebacks.'件</h3>'; | |
148 | + echo ' <ul class="nobullets"> '; | |
149 | + | |
150 | + foreach($output as $key => $value){ | |
151 | + echo $value."\n"; | |
152 | + } | |
153 | + echo " </ul> "; | |
154 | + | |
155 | +//********************************************** | |
156 | +}else{ | |
157 | + | |
158 | + $template = TEMPLATE::read($template); | |
159 | + $data['blogid'] = $blogid; | |
160 | +//=================================== | |
161 | + echo TEMPLATE::fill($template['ARCHIVELIST_HEADER'],$data); | |
162 | +//=================================== | |
163 | + echo '<a href="http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'">HOME</a> '; | |
164 | + if($catid){ | |
165 | + $catName = $blog->getCategoryName($catid); //カテゴリの名前をget | |
166 | +// $catName = $blog->getCategoryDesc($catid); //カテゴリの説明をget | |
167 | + $archivealllistlink = createArchiveListLink($blogid,""); | |
168 | + echo ' > <a href="'.$archivealllistlink.'">Archive List</a>'; | |
169 | + echo ' > Category : <u> '.$catName.' </u> '; | |
170 | + }else{ | |
171 | +// echo 'Category : 選択していません'; | |
172 | + echo ' > Archive List'; | |
173 | + echo ''; | |
174 | + } | |
175 | +//=================================== | |
176 | + echo TEMPLATE::fill($template['ARCHIVELIST_FOOTER'],$data); | |
177 | +//=================================== | |
178 | + echo TEMPLATE::fill($template['ARCHIVELIST_HEADER'],$data); | |
179 | + $now = time(); | |
180 | + $query = 'SELECT UNIX_TIMESTAMP(itime) as itime, SUBSTRING(itime,1,4) AS Year, SUBSTRING(itime,6,2) AS Month, SUBSTRING(itime,9,2) as Day FROM nucleus_item' | |
181 | + . ' WHERE iblog=' . $blogid | |
182 | + . ' and UNIX_TIMESTAMP(itime)<=' . $now // don't show future items! | |
183 | + . ' and idraft=0'; // don't show draft items | |
184 | + | |
185 | + if ($catid) | |
186 | + $query .= ' and icat=' . intval($catid); | |
187 | + | |
188 | + $query .= ' GROUP BY Year, Month'; | |
189 | + if ($mode == 'day') | |
190 | + $query .= ', Day'; | |
191 | + | |
192 | + | |
193 | +// $query .= ' ORDER BY itime ASC'; //アーカイブリスト昇順 | |
194 | + $query .= ' ORDER BY itime DESC'; //アーカイブリスト降順 | |
195 | + | |
196 | + if ($limit > 0) | |
197 | + $query .= ' LIMIT ' . $limit; | |
198 | + | |
199 | + $res = sql_query($query); | |
200 | + | |
201 | + while ($current = mysql_fetch_object($res)) { | |
202 | + if ($mode == 'day') { | |
203 | + $archivedate = date('Y-m-d',$current->itime); | |
204 | + $archive['day'] = date('d',$current->itime); | |
205 | + } else { | |
206 | + $archivedate = date('Y-m',$current->itime); | |
207 | + } | |
208 | + $data['month'] = date('m',$current->itime); | |
209 | + $data['year'] = date('Y',$current->itime); | |
210 | + $data['archivelink'] = createArchiveLink($blogid,$archivedate,$this->linkparams); | |
211 | + | |
212 | + $temp = TEMPLATE::fill($template['ARCHIVELIST_LISTITEM'],$data); | |
213 | + echo strftime($temp,$current->itime); | |
214 | + | |
215 | + //====================================================== | |
216 | + echo '<ul>'; | |
217 | + $adquery = 'SELECT inumber, ititle, icat FROM nucleus_item' | |
218 | + . ' WHERE iblog=' . $blogid | |
219 | + . ' and UNIX_TIMESTAMP(itime)<=' . $now // don't show future items! | |
220 | + . ' and idraft=0' // don't show draft items | |
221 | + . ' and SUBSTRING(itime,1,4)=' . $data['year'] // year | |
222 | + . ' and SUBSTRING(itime,6,2)=' . $data['month']; // month | |
223 | + if ($mode == 'day') | |
224 | + $adquery .= ' and SUBSTRING(itime,9,2)=' . $archive['day']; //day | |
225 | + | |
226 | + if ($catid) | |
227 | + $adquery .= ' and icat=' . intval($catid); | |
228 | + | |
229 | +// $adquery .= ' ORDER BY itime ASC'; //タイトル一覧昇順 | |
230 | + $adquery .= ' ORDER BY itime DESC'; //タイトル一覧降順 | |
231 | + | |
232 | +// if ($limit > 0) | |
233 | +// $adquery .= ' LIMIT ' . $limit; | |
234 | + | |
235 | + $adres = sql_query($adquery); | |
236 | + | |
237 | + while ($adcurrent = mysql_fetch_object($adres)) { | |
238 | + $ititle = htmlspecialchars(strip_tags($adcurrent->ititle)); | |
239 | + $inumber = $adcurrent->inumber; | |
240 | + $itemlink = createItemLink($inumber,$this->linkparams); | |
241 | + | |
242 | + if($catid){ | |
243 | + echo '<li><a href="'.$itemlink.'">'. $ititle . '</a></li>'."\n"; | |
244 | + }else{ | |
245 | + $icatName = $blog->getCategoryName($adcurrent->icat); //カテゴリの名前をget | |
246 | +// $icatName = $blog->getCategoryDesc($adcurrent->icat); //カテゴリの説明をget | |
247 | + //タイトル一覧に続いてカテゴリ名を表示 | |
248 | +// echo '<li><a href="'.$itemlink.'">'. $ititle . ' <small>::' . $icatName .'</small></a></li>'."\n"; | |
249 | + //タイトル一覧にマウスをあわせるとカテゴリ名をフロート表示 | |
250 | + echo '<li><a href="'.$itemlink.'" title="Category:'.$icatName.'">'. $ititle . '</a></li>'."\n"; | |
251 | + } | |
252 | + } | |
253 | + mysql_free_result($adres); | |
254 | + echo '</ul>'; | |
255 | + //====================================================== | |
256 | + } | |
257 | + mysql_free_result($res); | |
258 | + echo TEMPLATE::fill($template['ARCHIVELIST_FOOTER'],$data); | |
259 | + | |
260 | +} | |
261 | + | |
262 | + break; | |
263 | +//=================================== | |
264 | + default: | |
265 | +// echo "tttt"; | |
266 | + } | |
267 | + } | |
268 | +} | |
269 | +?> | |
\ No newline at end of file |
@@ -0,0 +1,98 @@ | ||
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 | + | |
9 | +/* | |
10 | + Version history: | |
11 | + - 0.1 (2003-08-13): initial version | |
12 | +*/ | |
13 | +class NP_BlogList extends NucleusPlugin { | |
14 | + | |
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() { | |
20 | + return 'List can be shown using <%BlogList%> OR <%BlogList(bpublic = 1)%>. <br /> It has following parameters : filter, header, list, footer)'; | |
21 | + } | |
22 | + function supportsFeature($what) { | |
23 | + switch($what){ | |
24 | + case 'SqlTablePrefix': | |
25 | + return 1; | |
26 | + default: | |
27 | + return 0; | |
28 | + } | |
29 | + } | |
30 | + | |
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() { | |
42 | + } | |
43 | + | |
44 | + function doSkinVar($skinType, $filter ='', $header ='', $list='', $footer='') | |
45 | + { | |
46 | + global $CONF, $blog; | |
47 | + | |
48 | + // determine arguments next to catids | |
49 | + // I guess this can be done in a better way, but it works | |
50 | + if (!$header) { | |
51 | + $header = $this->getOption('Header'); | |
52 | + } | |
53 | + if (!$list) { | |
54 | + $list = $this->getOption('List'); | |
55 | + } | |
56 | + if (!$footer) { | |
57 | + $footer = $this->getOption('Footer'); | |
58 | + } | |
59 | + | |
60 | + //$blogurl = $this->getURL() . $qargs; | |
61 | + $blogurl = createBlogLink($this->getURL(), $linkparams); | |
62 | + | |
63 | + $template = TEMPLATE::read($template); | |
64 | + | |
65 | + echo TEMPLATE::fill($header, | |
66 | + array( | |
67 | + )); | |
68 | + | |
69 | + $where = ''; | |
70 | + if ($filter <> '') { | |
71 | + $where = 'WHERE '.$filter; | |
72 | + } | |
73 | + | |
74 | +// $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'); | |
76 | + | |
77 | + $res = sql_query($query); | |
78 | + 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! | |
84 | + } | |
85 | + | |
86 | + $temp = TEMPLATE::fill($list,$data); | |
87 | + echo strftime($temp,$current->itime); | |
88 | + | |
89 | + } | |
90 | + | |
91 | + mysql_free_result($res); | |
92 | + | |
93 | + echo TEMPLATE::fill($footer, | |
94 | + array( | |
95 | + )); | |
96 | + } | |
97 | +} | |
98 | +?> | |
\ No newline at end of file |