public function parse($datas = array())
 {
     $index_ext = $this->_lemon_tree->option('index_extension');
     $base_path = str_replace($this->_lemon_tree->root_dir(), '', $this->_filepath);
     $base_path = trim($base_path, DIRECTORY_SEPARATOR);
     $base_path = str_replace($this->_lemon_tree->option('root_name'), '', $base_path);
     $base_path = str_replace('.' . $index_ext, '', $base_path);
     $base_path = LemonTree::normalize_path($base_path);
     foreach ($datas as $k => $e) {
         if (is_null($e)) {
             continue;
         }
         if ($k[0] == $this->_lemon_tree->option('meta_token')) {
             $this->_metas[$k] = $e;
         } else {
             if (strpos($k, DIRECTORY_SEPARATOR) !== 0) {
                 // conversion des urls relatives -> absolues
                 $k = LemonTree::normalize_path($base_path, $k);
             }
             $this->_paths[$k] = $e;
             $this->_paths[$k]['path'] = $k;
             $this->_paths[$k]['parent_path'] = $k == DIRECTORY_SEPARATOR ? null : dirname($k);
         }
     }
 }
Example #2
0
function helye_home()
{
    $lemon_tree = _helye_lemon_tree();
    if ($lemon = $lemon_tree->find('/random')) {
        $files = file_list_dir($lemon->file_path());
        $path = $files[array_rand($files)];
        $url = LemonTree::normalize_path('files', $lemon->path(), $path);
        $image_infos = getimagesize(file_path($lemon->file_path(), $path));
        $image = array('url' => $url, 'attr' => $image_infos[3]);
        set('image', $image);
    }
    if ($infos = $lemon_tree->find('/infos.txt')) {
        set('infos', $infos->file_content());
    }
    if ($news = $lemon_tree->find('/news.txt')) {
        set('news', $news->file_content());
    }
    set('page_title', $lemon_tree->find('/')->title());
    set('page_class', 'home');
    return html('home.html.php');
}
 public function file_path()
 {
     return LemonTree::normalize_path($this->_lemon_tree->base_dir(), $this->_datas['path']);
 }