pluglist.inc.php

サマリプラグイン一覧
リビジョン1.02
対応バージョン1.5.x
投稿者K
投稿日2020-12-05 (土) 14:37:19

概要

標準プラグインのversionlistを基にしてつくった、プラグインの一覧を表示するプラグインです。

コード

ダウンロード

ダウンロード、それか下のコードをpluglist.inc.phpとして保存し、PukiWikiのplugin/に入れて下さい。

<?php
// $Id: pluglist.inc.php,v 1.02 2020/12/05 14:21:00 K Exp $

/** 
* @link http&#58;//pkom.ml/?%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3/PlugList
* @author K
* @license http&#58;//www.gnu.org/licenses/gpl.ja.html GPL
*/

function plugin_pluglist_convert()
{
	if (PKWK_SAFE_MODE) return 'PKWK_SAFE_MODEが有効なので表示できません。'; // Show nothing
	$SCRIPT_DIR = array(PLUGIN_DIR);
	array_push($SCRIPT_DIR);
	$comments = array();
    $plug_count = 0;
	foreach ($SCRIPT_DIR as $sdir)
	{
		if (!$dir = @dir($sdir))
		{
			continue;
		}
		while($file = $dir->read())
		{
			if (!preg_match("/\.(inc.php)$/i",$file))
			{
				continue;
			}
            $plug_count++;
			$data = join('',file($sdir.$file));
			$comment = array('file'=>htmlsc($file),'rev'=>'','date'=>'');
            //mypluglist用 URL:https&#58; //pukiwiki.osdn.jp/?%E8%87%AA%E4%BD%9C%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3/mypluglist.inc.php
            if (preg_match('/\/\*\*/', $data, $matches)) {
                $docc_start = TRUE;
			}
            if ($docc_start){
				if (preg_match('/\@author(.+)/u', $data, $matches)) {
				    $comment['author'] = htmlsc(trim($matches[1]));
				}
        	    if (preg_match('/\@tutorial(.+)/u', $data, $matches)) {
				    $comment['tutorial'] = htmlsc(trim($matches[1]));
				}
				if (preg_match('/\@link(.+)/u', $data, $matches)) {
				    $comment['tutorial'] = htmlsc(trim($matches[1]));
				}
            }
            //--------
            if ((preg_match('/\$'.'Id: (.+),v (\d+\.\d+) (\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2})Z (.+) \$/u',$data,$matches))||(preg_match('/\$'.'Id: (.+),v (\d+\.\d+) (\d{4}\/\d{1,2}\/\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}) (.+) Exp \$/u',$data,$matches))||(preg_match('/\$'.'Id: (.+),v (\d+\.\d+) (\d{4}\/\d{1,2}\/\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}) (.+) \$/u',$data,$matches))||(preg_match('/\$'.'Id: (.+),v (\d+\.\d+) (\d{4}\/\d{1,2}\/\d{1,2} \d{1,2}:\d{1,2}:\d{1,2})Z (.+) \$/u',$data,$matches))||(preg_match('/\$'.'Id: (.+),v (\d+\.\d+) (\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}) (.+) \$/u',$data,$matches)))
			{
				$comment['rev'] = htmlsc($matches[2]);
				$comment['date'] = preg_replace("/-/","/",htmlsc($matches[3]));
				$comment['author'] = htmlsc($matches[4]);
			}
			$comments[$sdir.$file] = $comment;
        }
		$dir->close();
	}
	if (count($comments) == 0)
	{
		return '';
	}
	ksort($comments, SORT_STRING);
	$retval = '';
	foreach ($comments as $comment)
	{
        if (isset($comment['tutorial'])){
            $comment_file = '<a href="'.$comment['tutorial'].'">'.$comment['file'].'</a>';
        }else{
            $comment_file = $comment['file'];
        }
		$retval .= <<<EOD

  <tr>
   <td>{$comment_file}</td>
   <td align="right">{$comment['rev']}</td>
   <td>{$comment['date']}</td>
   <td>{$comment['author']}</td>
  </tr>
EOD;
	}
	$retval = <<<EOD
<table class="style_table" cellspacing="1" border="1">
 <thead>
  <tr>
   <th>ファイル名</th>
   <th>リビジョン</th>
   <th>更新日時</th>
   <th>作者</th>
  </tr>
 </thead>
 <tbody>
{$retval}
<tr>
   <th>合計</th>
   <td colspan="3">{$plug_count}個</td>
</tr>
 </tbody>
</table>
EOD;
	return $retval;
}
?>

使い方

書式

#pluglist

ライセンス

GPLv3

コメント



トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-11-21 (火) 23:42:13
Site admin: PukiWiki Development Team

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

SourceForge