DoboWiki
Top
> PukiWiki/自作プラグイン/relatedlist.inc.php をテンプレートにして作成
PukiWiki/自作プラグイン/relatedlist.inc.php をテンプレートにして作成
開始行:
*relatedlist.inc.php [#nfd6d9b3]
関連付けられているページを、listプラグインのように、ペー...
**書式 [#b306cf4c]
#relatedlist([pagename])
:pagename|対象とするページ名。ここで指定されたページに関...
**使い方 [#k9d0de7f]
例を示す。
#relatedlist(FrontPage)
とすると、次のようになる。
#relatedlist(FrontPage)
**仕様 [#rab27d5f]
relatedプラグインと違って、そのページからリンクしているペ...
**ダウンロード [#c79eea11]
簡単なので、コードを貼り付けておきます。
#code(php){{
<?php
//relatedlist.inc.php
//based on related.inc.php
//Version 0.0.1
//作成者:どぼん!
//除外するページの正規表現パターン
define('PLUGIN_RELATEDLIST_EXCEPT', '/(?:^|\/)template$/');
function plugin_relatedlist_init()
{
global $whatsnew, $whatsdeleted, $menubar;
//除外するページを指定する
$_plugin_relatedlist_messages = array(
'_plugin_relatedlist_except_pages'=>
array($whatsnew, $whatsdeleted, $menubar),
);
set_plugin_messages($_plugin_relatedlist_messages);
}
function plugin_relatedlist_convert()
{
global $vars, $script, $non_list, $defaultpage;
global $_plugin_relatedlist_except_pages;
$args = func_get_args();
$page = isset($args[0]) ?
strip_bracket(array_shift($args)) : $vars['page'];
if (empty($page)) $page = $defaultpage;
$pages = array_keys(links_get_related_db($page));
//$non_listを除外する
$pages = array_diff($pages,
preg_grep('/' . $non_list . '/S', $pages));
//設定によりさらにページを除外する
if (PLUGIN_RELATEDLIST_EXCEPT != '')
$pages = array_diff($pages,
preg_grep(PLUGIN_RELATEDLIST_EXCEPT, $pages));
if (!empty($_plugin_relatedlist_except_pages))
$pages = array_diff($pages, $_plugin_relatedlist_except...
if (empty($pages))
return '<ul><li>No related pages found.</li></ul>' . "\...
return page_list($pages);
}
?>
}}
**ライセンス [#tcb1a5ab]
GPL
**コメント [#r313725e]
#comment
#pageinfo([[:Category/PukiWiki]],2006-06-06 (火) 00:51:59...
終了行:
*relatedlist.inc.php [#nfd6d9b3]
関連付けられているページを、listプラグインのように、ペー...
**書式 [#b306cf4c]
#relatedlist([pagename])
:pagename|対象とするページ名。ここで指定されたページに関...
**使い方 [#k9d0de7f]
例を示す。
#relatedlist(FrontPage)
とすると、次のようになる。
#relatedlist(FrontPage)
**仕様 [#rab27d5f]
relatedプラグインと違って、そのページからリンクしているペ...
**ダウンロード [#c79eea11]
簡単なので、コードを貼り付けておきます。
#code(php){{
<?php
//relatedlist.inc.php
//based on related.inc.php
//Version 0.0.1
//作成者:どぼん!
//除外するページの正規表現パターン
define('PLUGIN_RELATEDLIST_EXCEPT', '/(?:^|\/)template$/');
function plugin_relatedlist_init()
{
global $whatsnew, $whatsdeleted, $menubar;
//除外するページを指定する
$_plugin_relatedlist_messages = array(
'_plugin_relatedlist_except_pages'=>
array($whatsnew, $whatsdeleted, $menubar),
);
set_plugin_messages($_plugin_relatedlist_messages);
}
function plugin_relatedlist_convert()
{
global $vars, $script, $non_list, $defaultpage;
global $_plugin_relatedlist_except_pages;
$args = func_get_args();
$page = isset($args[0]) ?
strip_bracket(array_shift($args)) : $vars['page'];
if (empty($page)) $page = $defaultpage;
$pages = array_keys(links_get_related_db($page));
//$non_listを除外する
$pages = array_diff($pages,
preg_grep('/' . $non_list . '/S', $pages));
//設定によりさらにページを除外する
if (PLUGIN_RELATEDLIST_EXCEPT != '')
$pages = array_diff($pages,
preg_grep(PLUGIN_RELATEDLIST_EXCEPT, $pages));
if (!empty($_plugin_relatedlist_except_pages))
$pages = array_diff($pages, $_plugin_relatedlist_except...
if (empty($pages))
return '<ul><li>No related pages found.</li></ul>' . "\...
return page_list($pages);
}
?>
}}
**ライセンス [#tcb1a5ab]
GPL
**コメント [#r313725e]
#comment
#pageinfo([[:Category/PukiWiki]],2006-06-06 (火) 00:51:59...
ページ名:
▲
▼
[
トップ
] [
新規
|
子ページ作成
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]