Пример #1
0
 /**
  * Get tree states of pages
  *
  * PukiWiki API Extension
  *
  * @access public
  * @static
  * @param array $pages
  * @return array $leafs 
  *   array whose keys are pagenames and values are boolean
  *   true if the page is a leaf in tree, false if not. 
  * @uses sonots::sort_filenames
  * @version $Id: v 1.0 2008-06-05 11:14:46 sonots $
  */
 function get_tree($pages)
 {
     sonots::sort_filenames($pages);
     $currpage = current($pages);
     $leafs = array();
     while ($nextpage = next($pages)) {
         if (strpos($nextpage, $currpage . '/') === false) {
             $leafs[$currpage] = true;
         } else {
             $leafs[$currpage] = false;
         }
         $currpage = $nextpage;
     }
     $leafs[$currpage] = true;
     return $leafs;
 }