Ejemplo n.º 1
0
Archivo: s.php Proyecto: rigidus/ea
 function parseTree($code)
 {
     preg_match_all(self::$regex_tree, $code, $out);
     if ($out) {
         foreach ($out[0] as $k => $v) {
             $key = self::$tree_key = $out[1][$k];
             if (isset(self::$tree[$key]) && is_array(self::$tree[$key])) {
                 self::$tree_tmpl[$key] = $out[2][$k];
                 preg_match_all(self::$regex_item, self::$tree_tmpl[$key], $out2);
                 if ($out2) {
                     self::$tree_item[$key] = $out2[1][0];
                     self::$tree_item_r[$key] = $out2[0][0];
                     $res = self::childTree(self::$tree[$key], 0);
                 }
                 $code = str_replace($out[0][$k], $res, $code);
             } else {
                 $code = str_replace($out[0][$k], '', $code);
             }
         }
     }
     return $code;
 }