flagflag  
1: 2008-12-26 (Fri) 01:39:38 admin source 2: 2008-12-26 (Fri) 02:10:02 admin source
Line 1: Line 1:
- <?php+** title_list.inc.php [#o61ec9cb] 
 +- ページの先頭の階層のみを表示するコマンド (2階層以降を表示しない) 
 +- pukiWiki の list コマンドに相当
- // PukiWiki - Yet another WikiWikiWeb clone. +*** ソース [#r05f298b]
- // $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 () {+
-   } +*** メッセージの変更 [#rd7423f3
- +以下のファイルに ''$root->_title_page'' を追加 
-   function plugin_title_list_action() +- xoops_trust_path/modules/xpwiki/language/xpwiki/en 
-   { +- xoops_trust_path/modules/xpwiki/language/xpwiki/ja_utf8 
-       // Redirected from filelist plugin? +- xoops_trust_path/modules/xpwiki/language/xpwiki/ja
-       $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; +
-   } +
- +
- +
- } +
- +
- ?>+


Front page   New List of Pages Search Recent changes   Help   RSS of recent changes (RSS 1.0) RSS of recent changes (RSS 2.0) RSS of recent changes (RSS Atom)

Site Search

Login

Username:

Password:


Lost Password?
Register now!!

Sub Menu

mini Calendar

Last MonthMay 2024Next Month
Su Mo Tu We Th Fr Sa
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
Today

Who's Online

45 user(s) are online (3 user(s) are browsing xpwiki)

Members: 0
Guests: 45

more...

Access Counter

Today : 627627627
Yesterday : 4345434543454345
Total : 2365776823657768236577682365776823657768236577682365776823657768
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com