flagflag  If you want to see English page, please click "English" Button at Left.
1: 2008-12-26 (金) 01:39:38 admin ソース
Line 1: Line 1:
 + <?php
 + // PukiWiki - Yet another WikiWikiWeb clone.
 + // $Id: list.inc.php,v 1.2 2007/02/11 00:11:58 nao-pon Exp $
 + //
 + // IndexPages plugin: Show a list of page names
 + //
 + // Modified by Fumi.Iseki '09 12/25
 + //
 + class xpwiki_plugin_title_list extends xpwiki_plugin
 + {
 +   function plugin_title_list_init () {
 +
 +   }
 +
 +   function plugin_title_list_action()
 +   {
 +       // Redirected from filelist plugin?
 +       $filelist = (isset($this->root->vars['cmd']) && $this->root->vars['cmd'] == 'filelist');
 +
 +       if ($filelist && !empty($this->root->filelist_only_admin)​ && !$this->root->userinfo['admin']) {
 +           return array(
 +               'msg'  => $this->root->_msg_not_readable,
 +               'body' => '');
 +       } else {
 +           return array(
 +               'msg'  => $filelist ? $this->root->_title_filelist : $this->root->_title_page,
 +               'body' => $this->plugin_list_getlist($filelist));
 +       }
 +   }
 +
 +   // Get a list
 +   function plugin_list_getlist($withfilename = FALSE)
 +   {
 +       $pages = array_diff($this->func->get_existpages()​, array($this->root->whatsnew));
 +       if (! $withfilename)
 +           $pages = array_diff($pages, preg_grep('/' . $this->root->non_list . '/S', $pages));
 +       if (empty($pages)) return '';
 +
 +       return $this->page_title_list($pages, 'read', $withfilename);
 +   }
 +
 +
 +   // Create list of pages
 +   function page_title_list($pages, $cmd = 'read', $withfilename = FALSE)
 +   {
 +       // �\�[�g�L�[��肷��B ' ' < '[a-zA-Z]' < 'zz'�Ƃ����O��B
 +       $symbol = ' ';
 +       $other  = 'zz';
 +       $retval = '';
 +
 +       if($this->root->pagereading_enable) {
 +           mb_regex_encoding($this->cont['SOURCE_EN​CODING']);
 +       }
 +       list($readings, $titles) = $this->func->get_readings($pages);
 +
 +       $list = $matches = array();
 +
 +       // Shrink URI for read
 +       if ($cmd === 'read') {
 +           $href = $this->root->script . ($this->root->static_url? '' : '?');
 +       } else {
 +           $href = $this->root->script . '?cmd=' . $cmd . '&page=';
 +       }
 +
 +
 +       // Fumi.Iseki
 +       $pagesx = array();
 +       foreach($pages as $file=>$page) {
 +           $topname = mb_split('/', $page);
 +           $pagesx[$topname[0]][$page] = $file;
 +       }
 +       ksort($pagesx);
 +
 +       $pcount = array();
 +       $pages  = array();
 +       foreach($pagesx as $topname=>$vals) {
 +           ksort($vals);
 +           $pfrst = each($vals);
 +           $page  = $pfrst["key"];
 +           $file  = $pfrst["value"];
 +           $pages[$file]  = $page;
 +           $pcount[$page] = count($vals);
 +       }
 +
 +
 +       foreach($pages as $file=>$page) {
 +           $r_page  = ($cmd === 'read' && $this->root->static_url)? $this->func->get_page_uri($page) : rawurlencode($page);
 +           $s_page  = htmlspecialchars($page, ENT_QUOTES);
 +           $passage = $this->func->get_pg_passage($page);
 +           $title = (empty($titles[$page]))? '' : ' [ ' . htmlspecialchars($titles[$page]) . ' ]';
 +
 +           $pcnt = "<small>(+".$pcount[$page].")</small>";
 +           $str  = '  <li><a href="'.$href.$r_page.'">'.$s_page.'</a>'." ".$pcnt." ".$passage.$title;
 +
 +           if ($withfilename) {
 +               $s_file = htmlspecialchars($file);
 +               $str .= "\n".'    <ul><li>'.$s_file.'</li></ul>'."\n".'  ';
 +           }
 +           $str .= '</li>';
 +
 +           if($this->root->pagereading_enable) {
 +               // WARNING: Japanese code hard-wired
 +               $katakana = '�@-��';
 +               $kanji = '��-��-�';
 +               if ($this->cont['SOURCE_ENCODING'] === 'UTF-8') {
 +                   $katakana = mb_convert_encoding($katakana, 'UTF-8', 'EUC-JP');
 +                   $kanji = mb_convert_encoding($kanji, 'UTF-8', 'EUC-JP');
 +               }
 +               if(mb_ereg('^([A-Za-z])', mb_convert_kana($page, 'a'), $matches)) {
 +                   $head = $matches[1];
 +               } elseif (isset($readings[$page]) && mb_ereg('^([' . $katakana . '])', $readings[$page], $matches)) { // here
 +                   $head = $matches[1];
 +               } elseif (mb_ereg('^[ -~]|[^' . $kanji . ']', $page)) { // and here
 +                   $head = $symbol;
 +               } else {
 +                   $head = $other;
 +               }
 +           } else {
 +               $head = (preg_match('/^([A-Za-z])/', $page, $matches)) ? $matches[1] : (preg_match('/^([ -~])/', $page) ? $symbol : $other);
 +           }
 +           if ($this->root->page_case_insensitive) {
 +               $head = strtoupper($head);
 +           }
 +           $list[$head][$page] = $str;
 +       }
 +       //ksort($list);
 +
 +
 +       $cnt = 0;
 +       $arr_index = array();
 +       $retval .= '<ul>' . "\n";
 +       foreach ($list as $head=>$pages) {
 +           if ($head === $symbol) {
 +               $head = $this->root->_msg_symbol;
 +           } else if ($head === $other) {
 +               $head = $this->root->_msg_other;
 +           }
 +
 +           if ($this->root->list_index) {
 +               ++$cnt;
 +               $arr_index[] = '<a id="top_'.$cnt.'" href="#head_'.$cnt.'"> <strong>'.$head.'</strong> </a>';
 +               $retval .= ' <li><a id="head_'.$cnt.'" href="#top_'.$cnt.'"><strong>'.$head.'</strong></a>'."\n".'  <ul>'."\n";
 +           }
 +           ksort($pages);
 +           $retval .= join("\n", $pages);
 +           if ($this->root->list_index) $retval .= "\n  </ul>\n </li>\n";
 +       }
 +
 +       $retval .= '</ul>' . "\n";
 +       if ($this->root->list_index && $cnt > 0) {
 +           $top = array();
 +           while (! empty($arr_index)) {
 +               $top[] = join('|', array_splice($arr_index, 0, 16))."\n";
 +           }
 +           $retval = '<div id="top" style="text-align:center">'."\n".join('<br />', $top).'</div>'."\n". $retval;
 +       }
 +       return $retval;
 +   }
 +
 +
 + }
 +
 + ?>


トップ   新規 ページ一覧 単語検索 最終更新   ヘルプ   最終更新のRSS 1.0 最終更新のRSS 2.0 最終更新のRSS Atom

サイト内 検索

ログイン

ユーザー名:

パスワード:


パスワード紛失
新規登録

サブ メニュー

ミニカレンダー

前月2024年 5月翌月
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
<今日>

オンライン状況

75 人のユーザが現在オンラインです。 (17 人のユーザが xpwiki を参照しています。)

登録ユーザ: 0
ゲスト: 75

もっと...

アクセスカウンタ

今日 : 1618161816181618
昨日 : 1265612656126561265612656
総計 : 2352704923527049235270492352704923527049235270492352704923527049
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com