Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの
Revision | 363591c23ef84f6ea22cf006a6c4a87f2cfbb3ec (tree) |
---|---|
Time | 2006-10-02 22:13:40 |
Author | shizuki <shizuki@1ca2...> |
Commiter | shizuki |
enable new options
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@397 1ca29b6e-896d-4ea0-84a5-967f57386b96
@@ -4,6 +4,13 @@ | ||
4 | 4 | * TAGGING 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 | + * | |
13 | + * | |
7 | 14 | * @author Original Author nakahara21 |
8 | 15 | * @copyright 2005-2006 nakahara21 |
9 | 16 | * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991 |
@@ -16,22 +23,13 @@ | ||
16 | 23 | * 0.2 supports and/or query |
17 | 24 | * |
18 | 25 | */ |
19 | - | |
20 | 26 | /** |
21 | - * | |
27 | + * | |
22 | 28 | * THESE PLUG-INS ARE DEDICATED TO ALL THOSE NucleusCMS USERS |
23 | 29 | * WHO FIGHT CORRUPTION AND IRRATIONAL IN EVERY DAY OF THEIR LIVES. |
24 | 30 | * |
25 | 31 | */ |
26 | 32 | |
27 | -// plugin needs to work on Nucleus versions <=2.0 as well | |
28 | -if (!function_exists('sql_table')) { | |
29 | - function sql_table($name) | |
30 | - { | |
31 | - return 'nucleus_' . $name; | |
32 | - } | |
33 | -} | |
34 | - | |
35 | 33 | if (!defined('_TAGEX_TABLE_DEFINED')) { |
36 | 34 | define('_TAGEX_TABLE_DEFINED', 1); |
37 | 35 | define('_TAGEX_TABLE', sql_table('plug_tagex')); |
@@ -47,7 +45,7 @@ class NP_TagEX extends NucleusPlugin | ||
47 | 45 | } |
48 | 46 | function getAuthor() |
49 | 47 | { |
50 | - return 'nakahara21'; | |
48 | + return 'nakahara21 + shizuki'; | |
51 | 49 | } |
52 | 50 | function getURL() |
53 | 51 | { |
@@ -55,7 +53,7 @@ class NP_TagEX extends NucleusPlugin | ||
55 | 53 | } |
56 | 54 | function getVersion() |
57 | 55 | { |
58 | - return '0.41'; | |
56 | + return '0.42'; | |
59 | 57 | } |
60 | 58 | function getDescription() |
61 | 59 | { |
@@ -75,16 +73,18 @@ class NP_TagEX extends NucleusPlugin | ||
75 | 73 | function install() |
76 | 74 | { |
77 | 75 | $this->createOption('flg_erase', 'Erase data on uninstall.', 'yesno', 'no'); |
78 | -/* <editable template mod by shizuki> | |
76 | +// <editable template mod by shizuki> | |
79 | 77 | $this->createOption('and', 'template for \'and\'', 'textarea', '<span style="font-family:tahoma;font-size:smaller;"> <a href="<%andurl%>" title="narrow">&</a>.'); |
80 | 78 | $this->createOption('or', 'template for \'or\'', 'textarea', '<a href="<%orurl%>" title="expand">or</a> </span>'); |
81 | - $this->createOption('tagIndex', 'template for \'tagIndex\'', 'textarea', '<%and%><%or%><span style="font-size:<%fontlevel%>em" title="<%tagamount%> post(s)! <%tagitems%>"><a href="<%taglinkurl%>"><%tag%></a></span>'); | |
79 | + $this->createOption('tagIndex', 'template for \'tagIndex\'', 'textarea', '<%and%><%or%><span style="font-size:<%fontlevel%>em" title="<%tagamount%> post(s)! <%tagitems%>"><a href="<%taglinkurl%>"><%tag%></a></span>'); | |
82 | 80 | $this->createOption('tagItemHeader', 'template for \'tagItemHeader\'', 'textarea', ''); |
83 | 81 | $this->createOption('tagItem', 'template for \'tagItem\'', 'textarea', '<%itemid%>:<%itemtitle%>'); |
84 | - $this->createOption('tagItemSeparator', 'template for \'tagItemSeparator\'', 'textarea', ' , '); | |
82 | + $this->createOption('tagItemSeparator', 'template for \'tagItemSeparator\'', 'textarea', ' , '); | |
85 | 83 | $this->createOption('tagItemFooter', 'template for \'tagItemFooter\'', 'textarea', ''); |
86 | - $this->createOption('tagIndexSeparator', 'template for \'tagIndexSeparator\'', 'text', ' | '); | |
87 | -// $this->createOption('highlight', 'template for \'highlight\'', 'text', '<span class="highlight">\0</span>'); | |
84 | + $this->createOption('tagIndexSeparator', 'template for \'tagIndexSeparator\'', 'text', ' | '); | |
85 | + $this->createOption('tagsonlycurrent', 'show tags only current items have', 'yesno', 'no'); | |
86 | + $this->createOption('colorfulhighlight', 'colorful highlight mode ?', 'yesno', 'no'); | |
87 | + $this->createOption('highlight', 'template for normal highlightmode', 'text', '<span class="highlight">\0</span>'); | |
88 | 88 | //</mod by shizuki>*/ |
89 | 89 | $table_q = 'CREATE TABLE IF NOT EXISTS ' . _TAGEX_TABLE . ' (' |
90 | 90 | . ' `inum` INT(9) NOT NULL default "0" PRIMARY KEY, ' |
@@ -178,9 +178,11 @@ class NP_TagEX extends NucleusPlugin | ||
178 | 178 | $highlightKeys = array_keys($tags); |
179 | 179 | } |
180 | 180 | } elseif (eregi('<highlightTags>', $currentTemplateDesc)) { |
181 | -// if (!requestVar('tag')) { <for FancyURL mod by shizuki> | |
181 | +// <mod for Fancy mode by shizuki> | |
182 | +// if (!requestVar('tag')) { | |
182 | 183 | // return; |
183 | 184 | // } else { |
185 | +// </mod by shizuki> | |
184 | 186 | // $highlightKeys = explode(' ',requestVar('tag')); |
185 | 187 | // $highlightKeys = array_map(array(&$this, "_rawdecode"), $highlightKeys); |
186 | 188 | $requestT = $this->getNoDecodeQuery('tag'); |
@@ -198,40 +200,43 @@ class NP_TagEX extends NucleusPlugin | ||
198 | 200 | } else { |
199 | 201 | $highlightKeys = $reqAND; |
200 | 202 | } |
201 | -// } | |
203 | +// } <mod for Fancy mode by shizuki /> | |
202 | 204 | } else { |
203 | 205 | return; |
204 | 206 | } |
205 | - $template['highlight'] = '<span class="highlight">\0</span>'; // original code | |
206 | -// $template['highlight'] = $this->getOption('highlight'); // <editable template mod by shizuki /> | |
207 | +// $template['highlight'] = '<span class="highlight">\0</span>'; // original code | |
208 | + $template['highlight'] = $this->getOption('highlight'); // <editable template mod by shizuki /> | |
207 | 209 | $curItem = &$data["item"]; |
208 | -// $curItem->title = highlight($curItem->title, $highlightKeys, $template['highlight']); | |
209 | - $curItem->body = highlight($curItem->body, $highlightKeys, $template['highlight']); // original mode | |
210 | - $curItem->more = highlight($curItem->more, $highlightKeys, $template['highlight']); // original mode | |
210 | + if ($this->getOption('colorfulhighlight') == 'no') { | |
211 | +// $curItem->title = highlight($curItem->title, $highlightKeys, $template['highlight']); | |
212 | + $curItem->body = highlight($curItem->body, $highlightKeys, $template['highlight']); // original mode | |
213 | + $curItem->more = highlight($curItem->more, $highlightKeys, $template['highlight']); // original mode | |
214 | + } else { | |
211 | 215 | /** |
212 | 216 | * |
213 | - * IF use other color for each tags | |
217 | + * use other color for each tags | |
214 | 218 | * mod by shizuki |
215 | 219 | * |
216 | 220 | */ |
217 | -/* | |
218 | - $i = 0; | |
219 | - foreach($highlightKeys as $qValue) { | |
220 | - $pattern = '<span class=\'highlight_'.$i.'\'>\0</span>'; | |
221 | - $curItem->body = highlight($curItem->body, $qValue, $pattern); | |
222 | - $i++; | |
223 | - if ($i == 10) $i = 0; | |
224 | - } | |
225 | - if ($curItem->more) { | |
221 | +// | |
226 | 222 | $i = 0; |
227 | 223 | foreach($highlightKeys as $qValue) { |
228 | 224 | $pattern = '<span class=\'highlight_'.$i.'\'>\0</span>'; |
229 | - $curItem->more = highlight($curItem->more, $qValue, $pattern); | |
225 | + $curItem->body = highlight($curItem->body, $qValue, $pattern); | |
230 | 226 | $i++; |
231 | 227 | if ($i == 10) $i = 0; |
232 | 228 | } |
229 | + if ($curItem->more) { | |
230 | + $i = 0; | |
231 | + foreach($highlightKeys as $qValue) { | |
232 | + $pattern = '<span class=\'highlight_'.$i.'\'>\0</span>'; | |
233 | + $curItem->more = highlight($curItem->more, $qValue, $pattern); | |
234 | + $i++; | |
235 | + if ($i == 10) $i = 0; | |
236 | + } | |
237 | + } | |
233 | 238 | } |
234 | -//*/ | |
239 | +// </mod by shizuki>*/ | |
235 | 240 | } |
236 | 241 | |
237 | 242 | /** |
@@ -251,6 +256,7 @@ class NP_TagEX extends NucleusPlugin | ||
251 | 256 | */ |
252 | 257 | function _ItemFormExtras($oldforj = '', $itags = '', $blogid = 0) |
253 | 258 | { |
259 | + $blogid = intval($blogid); | |
254 | 260 | // Exstra form for add or update Item |
255 | 261 | ?> |
256 | 262 | <h3>TagEX</h3> |
@@ -273,8 +279,12 @@ function resetOlder(old){ | ||
273 | 279 | </script> |
274 | 280 | <?php |
275 | 281 | echo '<div style="height: 200px;overflow: auto;">' . "\n"; |
276 | - if($existTags = $this->scanExistTags(0,99999999,1)){ // original code | |
277 | -// if ($existTags = $this->scanExistTags(1, 99999999, 1, $blogid)) { // <current blog onry mod by shizuki /> | |
282 | + if ($this->getOption('tagsonlycurrent') == no) { | |
283 | + $existTags = $this->scanExistTags(0,99999999,1); | |
284 | + } else { | |
285 | + $existTags = $this->scanExistTags(1,99999999,1, $blogid); | |
286 | + } | |
287 | + if($existTags){ | |
278 | 288 | $existTags = array_keys($existTags); |
279 | 289 | } |
280 | 290 | for ($i=0;$i<count($existTags);$i++) { |
@@ -286,7 +296,7 @@ function resetOlder(old){ | ||
286 | 296 | |
287 | 297 | function event_AddItemFormExtras($data) |
288 | 298 | { |
289 | -/* <current blog onry mod by shizuki /> | |
299 | +// <current blog onry mod by shizuki> | |
290 | 300 | global $CONF, $blogid; |
291 | 301 | if (is_numeric($blogid)) { |
292 | 302 | $blogid = intval($blogid); |
@@ -298,26 +308,25 @@ function resetOlder(old){ | ||
298 | 308 | } |
299 | 309 | // </mod by shizuki>*/ |
300 | 310 | // Call exstra form |
301 | -// $this->_ItemFormExtras($oldforj, $itags, $blogid); // <current blog onry mod by shizuki /> | |
302 | - $this->_ItemFormExtras($oldforj, $itags); // original mode | |
311 | + $oldforj = $itags = ''; | |
312 | + $this->_ItemFormExtras($oldforj, $itags, $blogid); // <current blog only /> | |
303 | 313 | } |
304 | 314 | |
305 | 315 | function event_EditItemFormExtras($data) |
306 | 316 | { |
307 | 317 | // Initialize tags when it have |
308 | - $id = intval($data['variables']['itemid']); | |
309 | - $result = sql_query(sprintf('SELECT itags FROM %s WHERE inum = %d', _TAGEX_TABLE, $id)); | |
318 | + $item_id = intval($data['variables']['itemid']); | |
319 | + $result = sql_query(sprintf('SELECT itags FROM %s WHERE inum = %d', _TAGEX_TABLE, $item_id)); | |
310 | 320 | if (mysql_num_rows($result) > 0) { |
311 | 321 | $itags = mysql_result($result,0,0); |
312 | 322 | } |
313 | 323 | $oldforj = str_replace("\n",'\n',htmlspecialchars($itags)); |
314 | -/* <current blog onry mod by shizuki /> | |
315 | - $blogid = getBlogIDFromItemID($id); | |
324 | +// <current blog onry mod by shizuki> | |
325 | + $blogid = getBlogIDFromItemID($item_id); | |
316 | 326 | $blogid = intval($blogid); |
317 | 327 | // </mod by shizuki>*/ |
318 | 328 | // Call exstra form |
319 | -// $this->_ItemFormExtras($oldforj, $itags, $blogid); // <current blog onry mod by shizuki /> | |
320 | - $this->_ItemFormExtras($oldforj, $itags); // original mode | |
329 | + $this->_ItemFormExtras($oldforj, $itags, $blogid); // <current blog onry mod by shizuki /> | |
321 | 330 | } |
322 | 331 | |
323 | 332 | function event_PostAddItem($data) |
@@ -552,7 +561,7 @@ function resetOlder(old){ | ||
552 | 561 | case 2: |
553 | 562 | asort($tagCount); |
554 | 563 | break; |
555 | -/* <for sortmode = 3 or 4 mod by shizuki> | |
564 | +// <for sortmode = 3 or 4 mod by shizuki> | |
556 | 565 | case 3: |
557 | 566 | $idx = 0; |
558 | 567 | foreach ($tagCount as $tag => $cnt) { |
@@ -625,7 +634,7 @@ function resetOlder(old){ | ||
625 | 634 | case 2: |
626 | 635 | $sortq = ' ORDER by inums_count ASC'; |
627 | 636 | break; |
628 | -/* <for sortmode = 3 or 4 mod by shizuki> | |
637 | +//* <for sortmode = 3 or 4 mod by shizuki> | |
629 | 638 | default: |
630 | 639 | $sortq = ''; |
631 | 640 | break; |
@@ -731,7 +740,7 @@ function resetOlder(old){ | ||
731 | 740 | if (eregi('list', $type[0])) { |
732 | 741 | $amount = eregi_replace("list", "", $type[0]); |
733 | 742 | $type[0] = 'list'; |
734 | -/* < meta keywords="TAG" mod by shizuki> | |
743 | +// < meta keywords="TAG" mod by shizuki> | |
735 | 744 | } elseif (eregi('meta', $type[0])) { |
736 | 745 | $amount = eregi_replace("meta", "", $type[0]); |
737 | 746 | $type[0] = 'meta'; |
@@ -767,7 +776,7 @@ function resetOlder(old){ | ||
767 | 776 | break; |
768 | 777 | |
769 | 778 | // < meta keywords="TAG" mod by shizuki> |
770 | -/* and AWS keywords | |
779 | +// and AWS keywords | |
771 | 780 | case 'meta': |
772 | 781 | global $manager, $itemid; |
773 | 782 | $itemid = intval($itemid); |
@@ -836,7 +845,7 @@ tagIndexSeparator | ||
836 | 845 | $template['tagItem'] = '<li><%itemid%></li>'; |
837 | 846 | $template['tagItemSeparator'] = ''; |
838 | 847 | $template['tagItemFooter'] = '</ul>'; |
839 | -*/ | |
848 | +*//* | |
840 | 849 | $template['and'] = '<span style="font-family:tahoma;font-size:smaller;"> <a href="<%andurl%>" title="narrow">&</a>.'; |
841 | 850 | $template['or'] = '<a href="<%orurl%>" title="expand">or</a> </span>'; |
842 | 851 | $template['tagIndex'] = '<%and%><%or%><span style="font-size:<%fontlevel%>em" title="<%tagamount%> post(s)! <%tagitems%>"><a href="<%taglinkurl%>"><%tag%></a></span>'; |
@@ -845,7 +854,7 @@ tagIndexSeparator | ||
845 | 854 | $template['tagItemSeparator'] = ' , '; |
846 | 855 | $template['tagItemFooter'] = ''; |
847 | 856 | $template['tagIndexSeparator'] = ' | '; |
848 | -/* | |
857 | +*//* | |
849 | 858 | $template['tagIndex'] = '<span style="font-size:<%fontlevel%>em" title="<%tagamount%> post(s)!"><a href="<%taglinkurl%>"><%tag%>(<%tagamount%>)</a></span>'; |
850 | 859 | $template['tagItemHeader'] = ''; |
851 | 860 | $template['tagItem'] = "\n<%itemid%>:<%itemtitle%>"; |
@@ -854,18 +863,18 @@ tagIndexSeparator | ||
854 | 863 | $template['tagIndexSeparator'] = ' | '; |
855 | 864 | */ |
856 | 865 | // print_r($tags); |
857 | -/* <editable template mod by shizuki> | |
858 | - $template['and'] = $this->getOption('and'); | |
859 | - $template['or'] = $this->getOption('or'); | |
860 | - $template['tagIndex'] = $this->getOption('tagIndex'); | |
866 | +// <editable template mod by shizuki> | |
867 | + $template['and'] = $this->getOption('and'); | |
868 | + $template['or'] = $this->getOption('or'); | |
869 | + $template['tagIndex'] = $this->getOption('tagIndex'); | |
861 | 870 | $template['tagItemHeader'] = $this->getOption('tagItemHeader'); |
862 | - $template['tagItem'] = $this->getOption('tagItem'); | |
863 | - $template['tagItemSeparator'] = $this->getOption('tagItemSeparator'); | |
871 | + $template['tagItem'] = $this->getOption('tagItem'); | |
872 | + $template['tagItemSeparator'] = $this->getOption('tagItemSeparator'); | |
864 | 873 | $template['tagItemFooter'] = $this->getOption('tagItemFooter'); |
865 | 874 | $template['tagIndexSeparator'] = $this->getOption('tagIndexSeparator'); |
866 | 875 | // </mod by shizuki>*/ |
867 | - if($tags = $this->scanExistTags($type[1], $amount, $type[2])){ // original mode | |
868 | -// if ($tags = $this->scanExistTags($type[1])) { // <nodisplay selected TAGs mod by shizuki /> | |
876 | +// if($tags = $this->scanExistTags($type[1], $amount, $type[2])){ // original mode | |
877 | + if ($tags = $this->scanExistTags($type[1])) { // <nodisplay selected TAGs mod by shizuki /> | |
869 | 878 | if ($type[3] != $type[4]) { |
870 | 879 | $minFontSize = min($type[3], $type[4]) - 0.5; |
871 | 880 | $maxFontSize = max($type[3], $type[4]); |
@@ -873,7 +882,7 @@ tagIndexSeparator | ||
873 | 882 | list($maxCount, $minCount) = $this->scanCount($tags); |
874 | 883 | $eachCount = ceil(($maxCount - $minCount) / $levelsum); |
875 | 884 | } |
876 | -/* <nodisplay selected TAGs mod by shizuki> | |
885 | +// <nodisplay selected TAGs mod by shizuki> | |
877 | 886 | $select = array(); |
878 | 887 | if($reqAND){ |
879 | 888 | $req = ($reqOR) ? array_merge($reqAND, $reqOR) : $reqAND; |
@@ -972,7 +981,7 @@ tagIndexSeparator | ||
972 | 981 | } |
973 | 982 | break; |
974 | 983 | |
975 | -/* <show selected TAGs mod by shizuki> | |
984 | +// <show selected TAGs for <title></title> mod by shizuki> | |
976 | 985 | case 'title': |
977 | 986 | if ($reqAND) { |
978 | 987 | $req = ($reqOR) ? array_merge($reqAND, $reqOR) : $reqAND; |
@@ -988,7 +997,7 @@ tagIndexSeparator | ||
988 | 997 | |
989 | 998 | function doTemplateVar(&$item, $type = '') |
990 | 999 | { |
991 | -/* <highlight selected TAGs mod by shizuki> | |
1000 | +// <highlight selected TAGs mod by shizuki> | |
992 | 1001 | $requestT = $this->getNoDecodeQuery('tag'); |
993 | 1002 | if (!empty($requestT)) { |
994 | 1003 | $requestTarray = $this->splitRequestTags($requestT); |
@@ -1009,7 +1018,7 @@ tagIndexSeparator | ||
1009 | 1018 | for ($i=0;$i<count($temp_tags_array);$i++) { |
1010 | 1019 | $tag = trim($temp_tags_array[$i]); |
1011 | 1020 | $taglink = $this->creatTagLink($tag, 0); |
1012 | -/* <highlight selected TAGs mod by shizuki> | |
1021 | +// <highlight selected TAGs mod by shizuki> | |
1013 | 1022 | $key = array_search($tag, $words); |
1014 | 1023 | if ($key >= 10) $key = $key - 10; |
1015 | 1024 | if (in_array($tag, $words)) { |
@@ -1018,7 +1027,7 @@ tagIndexSeparator | ||
1018 | 1027 | } else { |
1019 | 1028 | // </mod by shizuki>*/ |
1020 | 1029 | $taglist[$i] = '<a href="' . $this->creatTagLink($tag, 0) . '" rel="tag">' . htmlspecialchars($tag) . '</a>'; |
1021 | -// } // <highlight selected TAGs mod by shizuki /> | |
1030 | + } // <highlight selected TAGs mod by shizuki /> | |
1022 | 1031 | } |
1023 | 1032 | } |
1024 | 1033 | if ($taglist) { |