**概要 [#x1ca34dd]

tagプラグインは、一覧表示に積集合と差集合の機能はありますが和集合の機能がなかったので追加してみました。
[[tagプラグイン>official:自作プラグイン/tag.inc.php]]は、一覧表示に積集合と差集合の機能はありますが和集合の機能がなかったので追加してみました。

**内容 [#j7aef615]

 diff C3b tag.inc.php.orig tag.inc.php
 *** tag.inc.php.orig	Sat Jan 03 22:47:48 2015
 --- tag.inc.php	Sat Jan 03 22:31:51 2015
 ***************
 *** 642,648 ****
        *
        * @static array
        */
 !     var $reserved_keys = array('prod' => '^', 'diff' => '-');
   
       function Tag($items = array(), $tags = array(), $tagcloud = null)
       {
 --- 642,648 ----
        *
        * @static array
        */
 !     var $reserved_keys = array('prod' => '^', 'diff' => '-', 'add' => '+');
   
       function Tag($items = array(), $tags = array(), $tagcloud = null)
       {
 ***************
 *** 1263,1268 ****
 --- 1263,1271 ----
               case $this->reserved_keys['diff']:
                   array_push($operands, $this->reserved_keys['diff']);
                   break;
 +             case $this->reserved_keys['add']:
 +                 array_push($operands, $this->reserved_keys['add']);
 +                 break;
               case $this->reserved_keys['prod']:
               default:
                   array_push($operands, $this->reserved_keys['prod']);
 ***************
 *** 1279,1284 ****
 --- 1282,1290 ----
               switch ($operands[$i]) {
               case $this->reserved_keys['diff']:
                   $items = array_diff($items, $this->get_items($tag));
 +                 break;
 +             case $this->reserved_keys['add']:
 +                 $items = array_unique(array_merge($items, $this->get_items($tag)));
                   break;
               case $this->reserved_keys['prod']:
               default:
 
**使用法 [#w4aa9bb7]
^(積集合) や -(差集合)と同様に + で和集合になります。

 #taglist(タグ1+タグ2)

//**コメント
//#comment

#comment


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Site admin: PukiWiki Development Team

PukiWiki 1.5.4+ © 2001-2022 PukiWiki Development Team. Powered by PHP 8.2.12. HTML convert time: 0.111 sec.

SourceForge