• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの


Commit MetaInfo

Revisiona43c8ba8a995f8d9914a89ed699bc78343bba0a3 (tree)
Time2006-11-29 15:07:03
Authorshizuki <shizuki@1ca2...>
Commitershizuki

Log Message

fix default arg

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@506 1ca29b6e-896d-4ea0-84a5-967f57386b96

Change Summary

Incremental Difference

--- a/trunk/NP_ShowBlogs/NP_ShowBlogs.php
+++ b/trunk/NP_ShowBlogs/NP_ShowBlogs.php
@@ -13,16 +13,17 @@
1313 * @author Original Author nakahara21
1414 * @copyright 2005-2006 nakahara21
1515 * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991
16- * @version 2.65
17- * @link http://nakahara21.com
16+ * @version 2.66
17+ * @link http://japan.nucleuscms.org/wiki/plugins:showblogs
1818 *
19+ * 2.66 default argument bug fix
1920 * 2.65 add AD code control
2021 * add Category mode
2122 * fix stickies bug
2223 * 2.64 fix page switch URL generate
2324 * 2.62 security fix and tag related
2425 * 2.61 security fix
25- * 2.6 security fix
26+ * 2.6 security fix
2627 *
2728 ****************************************************************************
2829 *
@@ -51,12 +52,12 @@ class NP_ShowBlogs extends NucleusPlugin
5152
5253 function getURL()
5354 {
54- return 'http://nakahara21.com/';
55+ return 'http://japan.nucleuscms.org/wiki/plugins:showblogs';
5556 }
5657
5758 function getVersion()
5859 {
59- return '2.65';
60+ return '2.66';
6061 }
6162
6263 function getDescription()
@@ -126,38 +127,55 @@ class NP_ShowBlogs extends NucleusPlugin
126127
127128 function doSkinVar($skinType,
128129 $template = 'default/index',
129- $amount = 10,
130- $bmode = '',
131- $type = 1,
132- $sort = 'DESC',
133- $sticky = '',
130+ $amount = 10, // amount/page
131+ $bmode = '', // show or hide Blogs
132+ $type = 1, // pagw switch type
133+ $sort = 'DESC', // item sort mode (DESC or ASC)
134+ $sticky = '', // sticky item id
134135 $sticktemplate = '',
135- $catmode = 'all',
136- $showAdCode = 1,
137- $catStick = 0
136+ $catmode = 'all', // show or hide categories
137+ $showAdCode = 1, // AdCode switch
138+ $catStick = 0 // show sticky item when category selected ?
138139 )
139140 {
140141 global $manager, $CONF, $blog, $blogid, $catid, $itemid, $archive, $subcatid;
141142
142-//***************************************
143-// extra setting
144-//***************************************
145-/* blogid(blogshortname) you want to hide
146- example:
147- $hide =array(5)
148- $hide = array(3,5);
149- $hide = array('private');
150- $hide =array('private','atloss');
151-*/
143+ if (!$template) {
144+ $template = 'default/index';
145+ }
146+
147+// initialize hide blogID
152148 $hide = array();
153-//show blogID
149+// initialize show blogID
154150 $show = array();
155151 // limit number of pages(months)
156152 $pagelimit = 0;
157153 $monthlimit = 0;
158- $catformat = $this->getOption('catformat');
154+ $catformat = $this->getOption('catformat');
155+
156+ $params = func_get_args();
157+ switch ($amount) {
158+ case '0':
159+ $type = $amount;
160+ break;
161+ case 'all':
162+ $bmode = $amount;
163+ if (is_numeric($params[3]) ||is_float($params[3])) {
164+ $type = $params[3];
165+ }
166+ break;
167+ }
159168
160-/**************************************************************************************/
169+ if (preg_match("/^(<>)?([0-9\/]+)$/", $bmode, $matches)) {
170+ if ($matches[1]) {
171+ $hide = explode("/", $matches[2]);
172+ $show = array();
173+ } else {
174+ $hide = array();
175+ $show = explode("/", $matches[2]);
176+ }
177+ $bmode = 'all';
178+ }
161179
162180 $type = (float) $type;
163181 $typeExp = intval(($type - floor($type))*10); //0 or 1 or 9
@@ -167,26 +185,21 @@ class NP_ShowBlogs extends NucleusPlugin
167185 if (!$pageamount) {
168186 $pageamount = 10;
169187 }
170- if ($sort != 'ASC' && $sort != 'DESC') {
188+
189+ if ($sort != 'ASC') {
190+ $sort = 'DESC';
191+ }
192+
193+/* if ($sort != 'ASC' && $sort != 'DESC') {
171194 $sticktemplate = $sticky;
172195 $sticky = $sort;
173196 $sort = 'DESC';
174- }
197+ }*/
198+
175199 if (!empty($sticky) && empty($sticktemplate)) {
176200 $sticktemplate = $template;
177201 }
178202
179- if (preg_match("/^(<>)?([0-9\/]+)$/", $bmode, $matches)) {
180- if ($matches[1]) {
181- $hide = explode("/", $matches[2]);
182- $show = array();
183- } else {
184- $hide = array();
185- $show = explode("/", $matches[2]);
186- }
187- $bmode = 'all';
188- }
189-
190203 if (preg_match("/^(<>)?([0-9\/]+)$/", $catmode, $matches)) {
191204 if ($matches[1]) {
192205 $hideCat = explode("/", $matches[2]);
@@ -882,4 +895,3 @@ class NP_ShowBlogs extends NucleusPlugin
882895
883896 }
884897
885-?>
\ No newline at end of file
Show on old repository browser