• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

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


Commit MetaInfo

Revision363591c23ef84f6ea22cf006a6c4a87f2cfbb3ec (tree)
Time2006-10-02 22:13:40
Authorshizuki <shizuki@1ca2...>
Commitershizuki

Log Message

enable new options

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

Change Summary

Incremental Difference

--- a/trunk/NP_TagEX/NP_TagEX.php
+++ b/trunk/NP_TagEX/NP_TagEX.php
@@ -4,6 +4,13 @@
44 * TAGGING PLUG-IN FOR NucleusCMS
55 * PHP versions 4 and 5
66 *
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+ *
714 * @author Original Author nakahara21
815 * @copyright 2005-2006 nakahara21
916 * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991
@@ -16,22 +23,13 @@
1623 * 0.2 supports and/or query
1724 *
1825 */
19-
2026 /**
21- *
27+ *
2228 * THESE PLUG-INS ARE DEDICATED TO ALL THOSE NucleusCMS USERS
2329 * WHO FIGHT CORRUPTION AND IRRATIONAL IN EVERY DAY OF THEIR LIVES.
2430 *
2531 */
2632
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-
3533 if (!defined('_TAGEX_TABLE_DEFINED')) {
3634 define('_TAGEX_TABLE_DEFINED', 1);
3735 define('_TAGEX_TABLE', sql_table('plug_tagex'));
@@ -47,7 +45,7 @@ class NP_TagEX extends NucleusPlugin
4745 }
4846 function getAuthor()
4947 {
50- return 'nakahara21';
48+ return 'nakahara21 + shizuki';
5149 }
5250 function getURL()
5351 {
@@ -55,7 +53,7 @@ class NP_TagEX extends NucleusPlugin
5553 }
5654 function getVersion()
5755 {
58- return '0.41';
56+ return '0.42';
5957 }
6058 function getDescription()
6159 {
@@ -75,16 +73,18 @@ class NP_TagEX extends NucleusPlugin
7573 function install()
7674 {
7775 $this->createOption('flg_erase', 'Erase data on uninstall.', 'yesno', 'no');
78-/* <editable template mod by shizuki>
76+// <editable template mod by shizuki>
7977 $this->createOption('and', 'template for \'and\'', 'textarea', '<span style="font-family:tahoma;font-size:smaller;"> <a href="<%andurl%>" title="narrow">&amp;</a>.');
8078 $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>');
8280 $this->createOption('tagItemHeader', 'template for \'tagItemHeader\'', 'textarea', '');
8381 $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', ' , ');
8583 $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>');
8888 //</mod by shizuki>*/
8989 $table_q = 'CREATE TABLE IF NOT EXISTS ' . _TAGEX_TABLE . ' ('
9090 . ' `inum` INT(9) NOT NULL default "0" PRIMARY KEY, '
@@ -178,9 +178,11 @@ class NP_TagEX extends NucleusPlugin
178178 $highlightKeys = array_keys($tags);
179179 }
180180 } elseif (eregi('<highlightTags>', $currentTemplateDesc)) {
181-// if (!requestVar('tag')) { <for FancyURL mod by shizuki>
181+// <mod for Fancy mode by shizuki>
182+// if (!requestVar('tag')) {
182183 // return;
183184 // } else {
185+// </mod by shizuki>
184186 // $highlightKeys = explode(' ',requestVar('tag'));
185187 // $highlightKeys = array_map(array(&$this, "_rawdecode"), $highlightKeys);
186188 $requestT = $this->getNoDecodeQuery('tag');
@@ -198,40 +200,43 @@ class NP_TagEX extends NucleusPlugin
198200 } else {
199201 $highlightKeys = $reqAND;
200202 }
201-// }
203+// } <mod for Fancy mode by shizuki />
202204 } else {
203205 return;
204206 }
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 />
207209 $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 {
211215 /**
212216 *
213- * IF use other color for each tags
217+ * use other color for each tags
214218 * mod by shizuki
215219 *
216220 */
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+//
226222 $i = 0;
227223 foreach($highlightKeys as $qValue) {
228224 $pattern = '<span class=\'highlight_'.$i.'\'>\0</span>';
229- $curItem->more = highlight($curItem->more, $qValue, $pattern);
225+ $curItem->body = highlight($curItem->body, $qValue, $pattern);
230226 $i++;
231227 if ($i == 10) $i = 0;
232228 }
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+ }
233238 }
234-//*/
239+// </mod by shizuki>*/
235240 }
236241
237242 /**
@@ -251,6 +256,7 @@ class NP_TagEX extends NucleusPlugin
251256 */
252257 function _ItemFormExtras($oldforj = '', $itags = '', $blogid = 0)
253258 {
259+ $blogid = intval($blogid);
254260 // Exstra form for add or update Item
255261 ?>
256262 <h3>TagEX</h3>
@@ -273,8 +279,12 @@ function resetOlder(old){
273279 </script>
274280 <?php
275281 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){
278288 $existTags = array_keys($existTags);
279289 }
280290 for ($i=0;$i<count($existTags);$i++) {
@@ -286,7 +296,7 @@ function resetOlder(old){
286296
287297 function event_AddItemFormExtras($data)
288298 {
289-/* <current blog onry mod by shizuki />
299+// <current blog onry mod by shizuki>
290300 global $CONF, $blogid;
291301 if (is_numeric($blogid)) {
292302 $blogid = intval($blogid);
@@ -298,26 +308,25 @@ function resetOlder(old){
298308 }
299309 // </mod by shizuki>*/
300310 // 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 />
303313 }
304314
305315 function event_EditItemFormExtras($data)
306316 {
307317 // 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));
310320 if (mysql_num_rows($result) > 0) {
311321 $itags = mysql_result($result,0,0);
312322 }
313323 $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);
316326 $blogid = intval($blogid);
317327 // </mod by shizuki>*/
318328 // 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 />
321330 }
322331
323332 function event_PostAddItem($data)
@@ -552,7 +561,7 @@ function resetOlder(old){
552561 case 2:
553562 asort($tagCount);
554563 break;
555-/* <for sortmode = 3 or 4 mod by shizuki>
564+// <for sortmode = 3 or 4 mod by shizuki>
556565 case 3:
557566 $idx = 0;
558567 foreach ($tagCount as $tag => $cnt) {
@@ -625,7 +634,7 @@ function resetOlder(old){
625634 case 2:
626635 $sortq = ' ORDER by inums_count ASC';
627636 break;
628-/* <for sortmode = 3 or 4 mod by shizuki>
637+//* <for sortmode = 3 or 4 mod by shizuki>
629638 default:
630639 $sortq = '';
631640 break;
@@ -731,7 +740,7 @@ function resetOlder(old){
731740 if (eregi('list', $type[0])) {
732741 $amount = eregi_replace("list", "", $type[0]);
733742 $type[0] = 'list';
734-/* < meta keywords="TAG" mod by shizuki>
743+// < meta keywords="TAG" mod by shizuki>
735744 } elseif (eregi('meta', $type[0])) {
736745 $amount = eregi_replace("meta", "", $type[0]);
737746 $type[0] = 'meta';
@@ -767,7 +776,7 @@ function resetOlder(old){
767776 break;
768777
769778 // < meta keywords="TAG" mod by shizuki>
770-/* and AWS keywords
779+// and AWS keywords
771780 case 'meta':
772781 global $manager, $itemid;
773782 $itemid = intval($itemid);
@@ -836,7 +845,7 @@ tagIndexSeparator
836845 $template['tagItem'] = '<li><%itemid%></li>';
837846 $template['tagItemSeparator'] = '';
838847 $template['tagItemFooter'] = '</ul>';
839-*/
848+*//*
840849 $template['and'] = '<span style="font-family:tahoma;font-size:smaller;"> <a href="<%andurl%>" title="narrow">&amp;</a>.';
841850 $template['or'] = '<a href="<%orurl%>" title="expand">or</a> </span>';
842851 $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
845854 $template['tagItemSeparator'] = ' , ';
846855 $template['tagItemFooter'] = '';
847856 $template['tagIndexSeparator'] = ' | ';
848-/*
857+*//*
849858 $template['tagIndex'] = '<span style="font-size:<%fontlevel%>em" title="<%tagamount%> post(s)!"><a href="<%taglinkurl%>"><%tag%>(<%tagamount%>)</a></span>';
850859 $template['tagItemHeader'] = '';
851860 $template['tagItem'] = "\n<%itemid%>:<%itemtitle%>";
@@ -854,18 +863,18 @@ tagIndexSeparator
854863 $template['tagIndexSeparator'] = ' | ';
855864 */
856865 // 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');
861870 $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');
864873 $template['tagItemFooter'] = $this->getOption('tagItemFooter');
865874 $template['tagIndexSeparator'] = $this->getOption('tagIndexSeparator');
866875 // </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 />
869878 if ($type[3] != $type[4]) {
870879 $minFontSize = min($type[3], $type[4]) - 0.5;
871880 $maxFontSize = max($type[3], $type[4]);
@@ -873,7 +882,7 @@ tagIndexSeparator
873882 list($maxCount, $minCount) = $this->scanCount($tags);
874883 $eachCount = ceil(($maxCount - $minCount) / $levelsum);
875884 }
876-/* <nodisplay selected TAGs mod by shizuki>
885+// <nodisplay selected TAGs mod by shizuki>
877886 $select = array();
878887 if($reqAND){
879888 $req = ($reqOR) ? array_merge($reqAND, $reqOR) : $reqAND;
@@ -972,7 +981,7 @@ tagIndexSeparator
972981 }
973982 break;
974983
975-/* <show selected TAGs mod by shizuki>
984+// <show selected TAGs for <title></title> mod by shizuki>
976985 case 'title':
977986 if ($reqAND) {
978987 $req = ($reqOR) ? array_merge($reqAND, $reqOR) : $reqAND;
@@ -988,7 +997,7 @@ tagIndexSeparator
988997
989998 function doTemplateVar(&$item, $type = '')
990999 {
991-/* <highlight selected TAGs mod by shizuki>
1000+// <highlight selected TAGs mod by shizuki>
9921001 $requestT = $this->getNoDecodeQuery('tag');
9931002 if (!empty($requestT)) {
9941003 $requestTarray = $this->splitRequestTags($requestT);
@@ -1009,7 +1018,7 @@ tagIndexSeparator
10091018 for ($i=0;$i<count($temp_tags_array);$i++) {
10101019 $tag = trim($temp_tags_array[$i]);
10111020 $taglink = $this->creatTagLink($tag, 0);
1012-/* <highlight selected TAGs mod by shizuki>
1021+// <highlight selected TAGs mod by shizuki>
10131022 $key = array_search($tag, $words);
10141023 if ($key >= 10) $key = $key - 10;
10151024 if (in_array($tag, $words)) {
@@ -1018,7 +1027,7 @@ tagIndexSeparator
10181027 } else {
10191028 // </mod by shizuki>*/
10201029 $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 />
10221031 }
10231032 }
10241033 if ($taglist) {
Show on old repository browser