Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの
Revision | ca8e79769f9162f9e5b0beaceb42bb8485c72c41 (tree) |
---|---|
Time | 2006-10-01 23:33:36 |
Author | shizuki <shizuki@1ca2...> |
Commiter | shizuki |
function PageSwitch() への引数変更
動作未確認 多分問題ないはず
todo どうやったらDESC に警告出せるでしょう?
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@391 1ca29b6e-896d-4ea0-84a5-967f57386b96
@@ -4,6 +4,12 @@ | ||
4 | 4 | * SHOWING BLOGS PLUG-IN FOR NucleusCMS |
5 | 5 | * PHP versions 4 and 5 |
6 | 6 | * |
7 | + * This program is free software; you can redistribute it and/or | |
8 | + * modify it under the terms of the GNU General Public License | |
9 | + * as published by the Free Software Foundation; either version 2 | |
10 | + * of the License, or (at your option) any later version. | |
11 | + * (see nucleus/documentation/index.html#license for more info) | |
12 | + * | |
7 | 13 | * @author Original Author nakahara21 |
8 | 14 | * @copyright 2005-2006 nakahara21 |
9 | 15 | * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991 |
@@ -14,35 +20,42 @@ | ||
14 | 20 | * 2.61 security fix |
15 | 21 | * 2.6 security fix |
16 | 22 | * |
17 | - */ | |
18 | - | |
19 | -/** | |
23 | + **************************************************************************** | |
20 | 24 | * |
21 | 25 | * THESE PLUG-INS ARE DEDICATED TO ALL THOSE NucleusCMS USERS |
22 | 26 | * WHO FIGHT CORRUPTION AND IRRATIONAL IN EVERY DAY OF THEIR LIVES. |
23 | 27 | * |
24 | - */ | |
28 | + ****************************************************************************/ | |
25 | 29 | |
26 | 30 | class NP_ShowBlogs extends NucleusPlugin |
27 | 31 | { |
28 | 32 | function getName() |
29 | 33 | { |
30 | 34 | return 'Show Blogs'; } |
35 | + | |
36 | + function getMinNucleusVersion() | |
37 | + { | |
38 | + return '322'; | |
39 | + } | |
40 | + | |
31 | 41 | function getAuthor() |
32 | 42 | { |
33 | 43 | return 'Taka + nakahara21 + kimitake + shizuki'; |
34 | 44 | } |
45 | + | |
35 | 46 | function getURL() |
36 | 47 | { |
37 | 48 | return 'http://nakahara21.com/'; |
38 | 49 | } |
50 | + | |
39 | 51 | function getVersion() |
40 | 52 | { |
41 | - return '2.62'; | |
53 | + return '2.63'; | |
42 | 54 | } |
55 | + | |
43 | 56 | function getDescription() |
44 | 57 | { |
45 | - return 'This plugin displays items of ALL or EACH blogs, and the link to other pages. <br />"MultipleCategories" supported! (NP_MultipleCategories v0.15 is required.)<br />Usage: <%ShowBlogs(default/index, 15, all, 2, DESC, 6/15/56/186, default/stick)%>'; | |
58 | + return _SHOWB_DESC; | |
46 | 59 | } |
47 | 60 | |
48 | 61 | function supportsFeature($what) |
@@ -55,7 +68,7 @@ class NP_ShowBlogs extends NucleusPlugin | ||
55 | 68 | } |
56 | 69 | } |
57 | 70 | |
58 | -/* function init() | |
71 | + function init() | |
59 | 72 | { |
60 | 73 | $language = ereg_replace( '[\\|/]', '', getLanguageName()); |
61 | 74 | if (file_exists($this->getDirectory() . $language . '.php')) { |
@@ -63,20 +76,38 @@ class NP_ShowBlogs extends NucleusPlugin | ||
63 | 76 | }else { |
64 | 77 | include_once($this->getDirectory() . 'english.php'); |
65 | 78 | } |
66 | - }*/ | |
79 | + } | |
67 | 80 | |
68 | 81 | function install() |
69 | 82 | { |
70 | - $this->createOption('catformat', 'category name disp format', 'text', '<%category%> on <%blogname%>'); | |
71 | 83 | // $this->createOption('catnametoshow', '[allblog mode only] category name to show (0:catname on blogname, 1:catname only, 2:blogname only)','text','0'); |
72 | - $this->createOption('stickmode', '[currentblog mode only] 0:show all stickyID, 1:show current blog stickyID only', 'text', '1'); | |
73 | - $this->createOption('ads', '[Ads code_1] code displayed under first and second item of the page', 'textarea', '' . "\n"); | |
74 | -// $this->createOption('ads2', '[Ads code_2] code displayed under second and third item of the page', 'textarea', '' . "\n"); | |
75 | -// $this->createOption('catformat', _CAT_FORMAT, 'text', '<%category%> on <%blogname%>'); // <mod by shizuki> | |
84 | +// $this->createOption('stickmode', '[currentblog mode only] 0:show all stickyID, 1:show current blog stickyID only', 'text', '1'); | |
85 | +// $this->createOption('ads', '[Ads code] code displayed under first and second item of the page', 'textarea', '' . "\n"); | |
86 | +// <mod by shizuki> | |
87 | + $this->createOption('catformat', _CAT_FORMAT, 'text', '<%category%> on <%blogname%>'); | |
76 | 88 | // $this->createOption('catnametoshow', _CATNAME_SHOW, 'text', '0'); |
77 | -// $this->createOption('stickmode', _STICKMODE, 'text', '1'); | |
78 | -// $this->createOption('ads', _ADCODE_1, 'textarea', '' . "\n"); | |
79 | -// $this->createOption('ads2', _ADCODE_2, 'textarea', '' . "\n"); // <mod by shizuki> | |
89 | + $this->createOption('stickmode', _STICKMODE, 'text', '1'); | |
90 | + $this->createOption('ads', _ADCODE_1, 'textarea', '' . "\n"); | |
91 | +// $this->createOption('ads2', _ADCODE_2, 'textarea', '' . "\n"); | |
92 | +/* todo can't install ? only warning ? | |
93 | + * douyatte 'desc' ni keikoku wo daseba iinoka wakaranai desu | |
94 | + $ver_min = (getNucleusVersion() < $this->getMinNucleusVersion()); | |
95 | + $pat_min = ((getNucleusVersion() == $this->getMinNucleusVersion()) && | |
96 | + (getNucleusPatchLevel() < $this->getMinNucleusPatchLevel())); | |
97 | + if ($ver_min) { // || $pat_min) { | |
98 | + global $DIR_LIBS; | |
99 | + // uninstall plugin again... | |
100 | + include_once($DIR_LIBS . 'ADMIN.php'); | |
101 | + $admin = new ADMIN(); | |
102 | + $admin->deleteOnePlugin($this->getID()); | |
103 | + | |
104 | + // ...and show error | |
105 | + $admin->error(_ERROR_NUCLEUSVERSIONREQ . | |
106 | + $this->getMinNucleusVersion() . ' patch ' . | |
107 | + $this->getMinNucleusPatchLevel()); | |
108 | + } | |
109 | +*/ | |
110 | +// </mod by shizuki> | |
80 | 111 | } |
81 | 112 | |
82 | 113 | function doSkinVar($skinType, $template = 'default/index', $amount = 10, $bmode = '', $type = 1, $sort = 'DESC', $sticky = '', $sticktemplate = '') |
@@ -105,7 +136,7 @@ $pagelimit = 0; | ||
105 | 136 | $monthlimit = 0; |
106 | 137 | $catformat = $this->getOption('catformat'); |
107 | 138 | |
108 | -/**************************************/ | |
139 | +/**************************************************************************************/ | |
109 | 140 | |
110 | 141 | $type = (float) $type; |
111 | 142 | $typeExp = intval(($type - floor($type))*10); //0 or 1 or 9 |
@@ -167,12 +198,11 @@ $monthlimit = 0; | ||
167 | 198 | |
168 | 199 | if ($skinType == 'item' || $skinType == 'index' || $skinType == 'archive') { |
169 | 200 | $catformat = '"' . addslashes($catformat) . '"'; |
170 | - $catformat = preg_replace(array('/<%category%>/','/<%blogname%>/', '/<%catdesc%>/'), array('",c.cname,"', '",b.bname,"', '",c.cdesc,"'), $catformat); | |
201 | + $catformat = preg_replace(array('/<%category%>/', '/<%blogname%>/', '/<%catdesc%>/'), array('",c.cname,"', '",b.bname,"', '",c.cdesc,"'), $catformat); | |
171 | 202 | $mtable = ""; |
172 | 203 | if ($manager->pluginInstalled('NP_TagEX')) { |
173 | 204 | $t_where = $this->_getTagsInum($where, $skinType, $bmode, $amount); |
174 | 205 | $where .= $t_where['where']; |
175 | - $inumsres = $t_where['inumsres']; | |
176 | 206 | } |
177 | 207 | |
178 | 208 | if ($skinType == 'item') { |
@@ -187,8 +217,9 @@ $monthlimit = 0; | ||
187 | 217 | } |
188 | 218 | |
189 | 219 | $hidden = ''; |
220 | + $temp = $y = $m = $d = ''; | |
190 | 221 | if ($archive) { |
191 | -// $hidden .= '<input type="hidden" name="archive" value="'.htmlspecialchars($archive).'" />'."\n"; | |
222 | +// $hidden .= '<input type="hidden" name="archive" value="' . htmlspecialchars($archive) . '" />' . "\n"; | |
192 | 223 | sscanf($archive, '%d-%d-%d', $y, $m, $d); |
193 | 224 | if ($d) { |
194 | 225 | $timestamp_start = mktime(0, 0, 0, $m, $d, $y); |
@@ -199,7 +230,8 @@ $monthlimit = 0; | ||
199 | 230 | $timestamp_end = mktime(0, 0, 0, $m+1, 1, $y); |
200 | 231 | $date_str = 'SUBSTRING(i.itime,1,7)'; |
201 | 232 | } |
202 | - $where .= ' AND i.itime >= ' . mysqldate($timestamp_start) . ' AND i.itime < ' . mysqldate($timestamp_end); | |
233 | + $where .= ' AND i.itime >= ' . mysqldate($timestamp_start) . | |
234 | + ' AND i.itime < ' . mysqldate($timestamp_end); | |
203 | 235 | } elseif (!empty($monthlimit)) { |
204 | 236 | $timestamp_end = mysqldate($b->getCorrectTime()); |
205 | 237 | sscanf($timestamp_end, '"%d-%d-%d %s"', $y, $m, $d, $temp); |
@@ -215,7 +247,8 @@ $monthlimit = 0; | ||
215 | 247 | $where .= ' AND ((i.inumber = p.item_id AND (p.categories REGEXP "(^|,)' |
216 | 248 | . intval($catid) . '(,|$)" OR i.icat = ' . intval($catid) . ')) OR (i.icat = ' |
217 | 249 | . intval($catid) . ' AND p.item_id IS NULL))'; |
218 | - $mtable = ' LEFT JOIN ' . sql_table('plug_multiple_categories') . ' as p ON i.inumber = p.item_id'; | |
250 | + $mtable = ' LEFT JOIN ' . sql_table('plug_multiple_categories') . | |
251 | + ' as p ON i.inumber = p.item_id'; | |
219 | 252 | $mplugin =& $manager->getPlugin('NP_MultipleCategories'); |
220 | 253 | if (method_exists($mplugin, 'getRequestName')) { |
221 | 254 | $mplugin->event_PreSkinParse(array()); |
@@ -251,13 +284,15 @@ $monthlimit = 0; | ||
251 | 284 | // } |
252 | 285 | |
253 | 286 | if ($type >= 1) { |
254 | - $page_switch = $this->PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable, $b, $hidden); | |
287 | + $page_switch = $this->PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable); | |
255 | 288 | if ($typeExp != 9 && $skinType != 'item') { |
256 | 289 | echo $page_switch['buf']; |
257 | 290 | } |
258 | 291 | } |
259 | 292 | |
260 | - $sh_query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author, m.mrealname as authorname, UNIX_TIMESTAMP(i.itime) as timestamp, i.itime, i.imore as more, m.mnumber as authorid,'; | |
293 | + $sh_query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author,' . | |
294 | + ' m.mrealname as authorname, UNIX_TIMESTAMP(i.itime) as timestamp, i.itime,' . | |
295 | + ' i.imore as more, m.mnumber as authorid,'; | |
261 | 296 | if (!$catblogname) { |
262 | 297 | $sh_query .= ' c.cname as category,'; |
263 | 298 | } else { |
@@ -277,12 +312,12 @@ $monthlimit = 0; | ||
277 | 312 | foreach ($stickys as $stickynumber) { |
278 | 313 | $tempblogid = getBlogIDFromItemID($stickynumber); |
279 | 314 | if ($bmode != 'all') { |
280 | - $sh_query .= ' AND i.iblog = ' . intval($b->getID()); | |
315 | + $sh_query .= ' AND i.iblog = ' . $nowbid; | |
281 | 316 | } |
282 | 317 | $sh_query .= ' AND i.inumber = ' . intval($stickynumber); |
283 | 318 | $sh_query .= ' AND i.itime <= ' . mysqldate($b->getCorrectTime()); |
284 | 319 | $sh_query .= ' AND i.idraft = 0'; |
285 | - if ($this->getOption('stickmode') == 1 && intval($b->getID()) == $tempblogid) { | |
320 | + if ($this->getOption('stickmode') == 1 && intval($nowbid) == $tempblogid) { | |
286 | 321 | $b->showUsingQuery($sticktemplate, $sh_query, 0, 1, 0); |
287 | 322 | } elseif (!$this->getOption('stickmode')) { |
288 | 323 | $b->showUsingQuery($sticktemplate, $sh_query, 0, 1, 0); |
@@ -300,13 +335,13 @@ $monthlimit = 0; | ||
300 | 335 | $sh_query .= ' AND i.idraft = 0' . $where; |
301 | 336 | |
302 | 337 | if ($skinType == 'item') { |
303 | - $sh_query .= ' ORDER BY FIND_IN_SET(i.inumber,\'' . @join(',', $inumsres) . '\')'; | |
338 | + $sh_query .= ' ORDER BY FIND_IN_SET(i.inumber,\'' . @join(',', $t_where['inumsres']) . '\')'; | |
304 | 339 | } else { |
305 | 340 | $sh_query .= ' ORDER BY i.itime ' . $sort; |
306 | 341 | } |
307 | 342 | |
308 | 343 | if ($skinType != 'item') { |
309 | - $this->_showUsingQuery($template, $sh_query, 0, $page_switch['startpos'], $pageamount, $b, $catid, $sticky); | |
344 | + $this->_showUsingQuery($template, $sh_query, 0, $page_switch['startpos'], $pageamount, $b); | |
310 | 345 | if ($type >= 1 && $typeExp != 1) echo $page_switch['buf']; |
311 | 346 | } elseif ($skinType == 'item') { |
312 | 347 | $sh_query .= ' LIMIT 0, ' . $pageamount; |
@@ -315,7 +350,9 @@ $monthlimit = 0; | ||
315 | 350 | } |
316 | 351 | } |
317 | 352 | |
318 | - function _showUsingQuery($template, $showQuery, $q_startpos, $q_amount, $b, $catid, $sticky) { | |
353 | + function _showUsingQuery($template, $showQuery, $q_startpos, $q_amount, $b, $sticky = '') | |
354 | + { | |
355 | + global $catid; | |
319 | 356 | $ads = 0; |
320 | 357 | $stickys = count(explode('/', $sticky)); |
321 | 358 | $onlyone_query = $showQuery . ' LIMIT ' . intval($q_startpos) .', 1'; |
@@ -343,7 +380,7 @@ $monthlimit = 0; | ||
343 | 380 | $b->showUsingQuery($template, $second_query, 0, 1, 1); |
344 | 381 | } |
345 | 382 | |
346 | - function PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable = '', $b, $hidden = '') | |
383 | + function PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable = '') //, $b) //, $hidden = '') | |
347 | 384 | { |
348 | 385 | global $CONF, $manager, $archive; |
349 | 386 | $startpos = 0; |
@@ -378,10 +415,10 @@ $monthlimit = 0; | ||
378 | 415 | } else { |
379 | 416 | $currentpage = 1; |
380 | 417 | $uri = parse_url($pagelink); |
381 | - if ($pagelink == $CONF['IndexURL'] && $CONF['URLMode'] != 'pathinfo') { // add | |
382 | - $pagelink = $b->getURL(); | |
418 | + if ($pagelink == $CONF['BlogURL'] && $CONF['URLMode'] != 'pathinfo') { // add | |
419 | +// $pagelink = $b->getURL(); | |
383 | 420 | if ($uri['query']) { |
384 | - $pagelink .= '?'.$uri['query']; | |
421 | + $pagelink .= '?' . $uri['query']; | |
385 | 422 | $uri['query'] = true; |
386 | 423 | } |
387 | 424 | } |
@@ -390,7 +427,7 @@ $monthlimit = 0; | ||
390 | 427 | $pagelink .= '&'; |
391 | 428 | // $pagelink = str_replace('&&', '&', $pagelink); |
392 | 429 | $pagelink = str_replace('&&','&',$pagelink); |
393 | - } elseif (strpos('?', $uri) && $CONF['URLMode'] != 'pathinfo') { | |
430 | + } elseif (strpos('?', $pagelink) && $CONF['URLMode'] != 'pathinfo') { | |
394 | 431 | $pagelink .= '?'; |
395 | 432 | } |
396 | 433 | } |
@@ -1,4 +1,7 @@ | ||
1 | 1 | <?php |
2 | + define('_SHOWB_DESC', 'This plugin displays items of ALL or EACH blogs, and the link to other pages. <br />' . | |
3 | + '"MultipleCategories" supported! (NP_MultipleCategories v0.15 is required.)<br />' . | |
4 | + 'Usage: <%ShowBlogs(default/index, 15, all, 2, DESC, 6/15/56/186, default/stick)%>'); | |
2 | 5 | define('_CAT_FORMAT', 'category name disp format'); |
3 | 6 | define('_CATNAME_SHOW', '[allblog mode only] category name to show (0:catname on blogname, 1:catname only, 2:blogname only)'); |
4 | 7 | define('_STICKMODE', '[currentblog mode only] 0:show all stickyID, 1:show current blog stickyID only'); |
@@ -1,7 +1,11 @@ | ||
1 | 1 | <?php |
2 | + define('_SHOWB_DESC', '&t;%blog%>を置き換えるプラグインです。<br />' . | |
3 | + '全ブログ、または任意のブログをページスイッチつきで表示します<br />' . | |
4 | + 'NP_MultipleCategories v0.15 以降のマルチカテゴリ、およびNP_TagEX に対応しています<br />' . | |
5 | + 'Usage: <%ShowBlogs(default/index, 15, all, 2, DESC, 6/15/56/186, default/stick)%>'); | |
2 | 6 | define('_CAT_FORMAT', 'カテゴリー名の表示形式'); |
3 | - define('_CATNAME_SHOW', 'オールブログモードの時のカテゴリー名の表示形式(0:「カテゴリ名 on ブログ名」, 1:カテゴリ名のみ, 2:ブログ名のみ)'); | |
7 | + define('_CATNAME_SHOW', 'オールブログモードの時のカテゴリー名の表示形式(0:「カテゴリ名 on ブログ名」, 1:カテゴリ名のみ, 2:ブログ名のみ)'); | |
4 | 8 | define('_STICKMODE', 'オールブログモードの時に表示する固定表示アイテム(0:全て表示する, 1:表示中のブログに所属するもののみ)'); |
5 | - define('_ADCODE_1', '1番目と2番目に表示されるアイテムの間に表示する広告のコード'); | |
6 | - define('_ADCODE_2', '2番目と3番目に表示されるアイテムの間に表示する広告のコード'); | |
9 | + define('_ADCODE_1', '1番目と2番目に表示されるアイテムの間に表示する広告のコード'); | |
10 | + define('_ADCODE_2', '2番目と3番目に表示されるアイテムの間に表示する広告のコード'); | |
7 | 11 | ?> |
\ No newline at end of file |
@@ -1,7 +1,11 @@ | ||
1 | 1 | <?php |
2 | + define('_SHOWB_DESC', '&t;%blog%>を置き換えるプラグインです。<br />' . | |
3 | + '全ブログ、または任意のブログをページスイッチつきで表示します<br />' . | |
4 | + 'NP_MultipleCategories v0.15 以降のマルチカテゴリ、およびNP_TagEX に対応しています<br />' . | |
5 | + 'Usage: <%ShowBlogs(default/index, 15, all, 2, DESC, 6/15/56/186, default/stick)%>'); | |
2 | 6 | define('_CAT_FORMAT', 'カテゴリー名の表示形式'); |
3 | - define('_CATNAME_SHOW', 'オールブログモードの時のカテゴリー名の表示形式(0:「カテゴリ名 on ブログ名」, 1:カテゴリ名のみ, 2:ブログ名のみ)'); | |
7 | + define('_CATNAME_SHOW', 'オールブログモードの時のカテゴリー名の表示形式(0:「カテゴリ名 on ブログ名」, 1:カテゴリ名のみ, 2:ブログ名のみ)'); | |
4 | 8 | define('_STICKMODE', 'オールブログモードの時に表示する固定表示アイテム(0:全て表示する, 1:表示中のブログに所属するもののみ)'); |
5 | - define('_ADCODE_1', '1番目と2番目に表示されるアイテムの間に表示する広告のコード'); | |
6 | - define('_ADCODE_2', '2番目と3番目に表示されるアイテムの間に表示する広告のコード'); | |
9 | + define('_ADCODE_1', '1番目と2番目に表示されるアイテムの間に表示する広告のコード'); | |
10 | + define('_ADCODE_2', '2番目と3番目に表示されるアイテムの間に表示する広告のコード'); | |
7 | 11 | ?> |
\ No newline at end of file |