コード例 #1
0
 function set($name = '', $input = '', $path = './')
 {
     $root = $GLOBALS['root'];
     $this->subdir = Path::linkto($path, $root);
     $tmpl_path = $root . 'tmpl/' . $this->subdir;
     parent::set($name, '', $tmpl_path);
     $this->set_lang();
     $this->add_input($input);
 }
コード例 #2
0
 function format_menuitem($url, $caption, $level, $dir = false)
 {
     $url = Path::linkto($GLOBALS['root'] . $url);
     $caption = output::mask($caption);
     $m = array('menu_spacer' => array(), 'menu_entry' => array(), 'menu_dir' => array(), 'menu_url' => $url, 'menu_caption' => array(), 'menu_caption_this' => array());
     for ($i = 0; $i < $level; $i++) {
         $m['menu_spacer'][] = array();
     }
     if ($dir) {
         $m['menu_dir'][] = array();
     } else {
         $m['menu_entry'][] = array();
     }
     $document_root = $_SERVER['DOCUMENT_ROOT'];
     if (substr($document_root, -1) == '/') {
         $document_root = substr($document_root, 0, -1);
     }
     $a = Path::absolute($url);
     $b = sessionurl($a);
     $c = $document_root . $_SERVER['REQUEST_URI'];
     if ($a == $c || $b == $c) {
         $m['menu_caption_this'][0]['menu_caption'] = $caption;
     } else {
         $m['menu_caption'][0]['menu_caption'] = $caption;
     }
     return $m;
 }
コード例 #3
0
 function test_linkto()
 {
     $source = 'a/b/c/d.php';
     $destination = 'a/b/e/d.php';
     $this->assertEquals('../e/d.php', Path::linkto($destination, $source));
 }