Develop/Modification1/51へもどる

diff -w pagetree.inc.php_20 pagetree.inc.php_21paraedit

7,8c7,8
<  * @licence    http://www.gnu.org/licenses/gpl.html  GPLv2
<  * @version    2.0
---
>  * @licence    http://www.gnu.org/licenses/old-licenses/gpl-2.0.html  GPLv2
>  * @version    2.1
64,65c64
<         $args = func_get_args();
<         $current = $args[0];
---
>         $current = func_get_arg(0);
70a70,71
>     plugin_pagetree_filter_pages($pages);
>     plugin_pagetree_sort_pages($pages);
76,80d76
<     global $defaultpage, $non_list;
<
<     $allpages = plugin_pagetree_get_allpages();
<     $leaf     = plugin_pagetree_get_leaf_flags();
<
82,87c78,81
<     $level  = count($tokens);
<     for ($i = 0; $i <= $level; $i++) {
<         $ancestors[$i] = implode('/', array_slice($tokens, 0, $i));
<     }
<     for ($i = $level + 1; $i <= 5; $i++) {
<         $ancestors[$i] = '';
---
>     $depth  = count($tokens);
>     $ancestors[0] = '';
>     for ($i = 0; $i < $depth; $i++) {
>         $ancestors[$i + 1] = $ancestors[$i] . $tokens[$i] . '/';
90,91c84
<     $pages      = array();
<     $top_leaves = array();
---
>     $allpages =& plugin_pagetree_get_allpages();
92a86
>     $pages = array();
94,102c88,89
<         $parent_level = substr_count($page, '/');
<         if (PLUGIN_PAGETREE_HIDE_TOPLEVEL_LEAVES && $parent_level === 0 && $leaf[$page] === true) {
<             if (PLUGIN_PAGETREE_INCLUDE_LIST !== '') {
<                 $top_leaves[] = $page;
<             }
<             continue;
<         }
<         $parent = substr($page, 0, strrpos($page, '/'));
<         if ($parent === $ancestors[$parent_level]) {
---
>         $count = substr_count($page, '/');
>         if ($count === 0 || ($count <= $depth && strpos($page, $ancestors[$count]) === 0)) {
106,111c93
<
<     if (PLUGIN_PAGETREE_TOP_DEFAULTPAGE) {
<         $key = array_search($defaultpage, $pages);
<         if ($key !== false) {
<             unset($pages[$key]);
<         }
---
>     return $pages;
113a96,99
> function plugin_pagetree_filter_pages(&$pages)
> {
>     global $non_list;
>
115,116c101
<         $includes = array_merge($pages, $top_leaves);
<         $includes = preg_grep('/' . PLUGIN_PAGETREE_INCLUDE_LIST . '/', $includes);
---
>         $includes = preg_grep('/' . PLUGIN_PAGETREE_INCLUDE_LIST . '/', $pages);
120a106,114
>     if (PLUGIN_PAGETREE_HIDE_TOPLEVEL_LEAVES) {
>         $leaf =& plugin_pagetree_get_leaf_flags();
>         foreach ($pages as $key => $page) {
>             if (strpos($page, '/') === false && $leaf[$page] === true) {
>                 unset($pages[$key]);
>             }
>         }
>     }
>
133,148c127
<         $pages = array_merge($pages, $includes);
<         $pages = array_unique($pages);
<         plugin_pagetree_sort_pages($pages);
<     } else {
<         $pages = array_values($pages);
<     }
<     return $pages;
< }
<
< function &plugin_pagetree_get_allpages()
< {
<     static $pages = null;
<
<     if ($pages === null) {
<         $pages = get_existpages();
<         plugin_pagetree_sort_pages($pages);
---
>         $pages += $includes;
150d128
<     return $pages;
160,179d137
< function &plugin_pagetree_get_leaf_flags()
< {
<     static $leaf = array();
<
<     if ($leaf === array()) {
<         $pages = plugin_pagetree_get_allpages();
<         $page  = current($pages);
<         while ($next_page = next($pages)) {
<             if (strpos($next_page, $page . '/') === false) {
<                 $leaf[$page] = true;
<             } else {
<                 $leaf[$page] = false;
<             }
<             $page = $next_page;
<         }
<         $leaf[$page] = true;
<     }
<     return $leaf;
< }
<
182c140,143
<     global $defaultpage, $script, $_pagetree_messages;
---
>     global $defaultpage, $_pagetree_messages;
>
>     $script = get_script_uri();
>     $script = './' . substr($script, strrpos($script, '/') + 1);
193c154
<         if ($current === $defaultpage) {
---
>         if ($defaultpage === $current) {
196a158
>             $url   = $script;
198c160
<             $html .= '<a href="' . $script . '" title="' . $title . '">'
---
>             $html .= '<a href="' . $url . '" title="' . $title . '">'
206c168
<     $leaf = plugin_pagetree_get_leaf_flags();
---
>     $leaf =& plugin_pagetree_get_leaf_flags();
263a226,265
> function &plugin_pagetree_get_allpages()
> {
>     static $pages = null;
>     global $defaultpage;
>
>     if ($pages === null) {
>         $pages = get_existpages();
>         if (PLUGIN_PAGETREE_TOP_DEFAULTPAGE) {
>             $key = encode($defaultpage) . '.txt';
>             unset($pages[$key]);
>         }
>     }
>     return $pages;
> }
>
> function &plugin_pagetree_get_leaf_flags()
> {
>     static $leaf = array();
>
>     if ($leaf === array()) {
>         $pages =& plugin_pagetree_get_allpages();
>         foreach ($pages as $page) {
>             if (isset($leaf[$page])) {
>                 continue;
>             }
>             $leaf[$page] = true;
>
>             while (($pos = strrpos($page, '/')) !== false) {
>                 $page  = substr($page, 0, $pos);
>                 $isset = isset($leaf[$page]);
>                 $leaf[$page] = false;
>                 if ($isset === true) {
>                     break;
>                 }
>             }
>         }
>     }
>     return $leaf;
> }
>

トップ 編集凍結差分バックアップ添付複製名前変更リロード 新規一覧 単語検索 最終更新  ヘルプ  最終更新のRSS
Last-modified: 2010-09-12 (日) 12:45:14 (4154d)