Пример #1
0
 public function getTree($attr = NULL)
 {
     if (isset($this->_params)) {
         $tree = new xmlTree();
         $text = new xmlNode("#text");
         $this->_params[0]["title"] = iconv("windows-1251", "UTF-8", $this->_params[0]["title"]);
         $text->text($this->_params[0]["title"]);
         $title = new xmlNode("title");
         $title->addChild($text);
         $tree->addChild($title);
         return $tree;
     }
 }
 public function getTree($attr = NULL)
 {
     if (isset($this->_params)) {
         $tree = new xmlTree();
         $text = new xmlNode("#text");
         $text->text($this->_params[0]["dsc"]);
         $div = new xmlNode("div");
         $div->addChild($text);
         $div->setAttribute("class", "error-dsc");
         $tree->addChild($div);
         //echo $tree; die;
         return XMLDocument::buildTree("<div class=\"error-dsc\">{$this->_params[0]["dsc"]}</div>", XMLDocument::BUILD_MODE_FROM_TEXT);
         //return $tree;
     } else {
         return new xmlTree();
     }
 }
Пример #3
0
 public function getTree($attr = NULL)
 {
     if ($this->_isValid) {
         $jsPath = __ROOT_PATH . DS . "template" . DS . "default" . DS . "js" . DS;
         $scripts = Filesystem::getFilesFromDir($jsPath, "js");
         if ($attr !== NULL) {
             if (($scripts = $this->_assignAttr($attr)) !== NULL) {
                 $p = $this->_assignAttr($attr);
                 if (isset($scripts["src"])) {
                     $scripts = explode(",", ereg_replace(" ", "", $scripts["src"]));
                 }
                 if (isset($p["combat"]) && $p["combat"]) {
                     $jsPath = Config::SITE_DIR . "/" . "js" . "/";
                 }
                 for ($i = 0; $i < count($scripts); $i++) {
                     $scripts[$i] = Filesystem::absoluteUrl($jsPath . $scripts[$i]);
                 }
             }
         }
         $tree = new xmlTree();
         for ($i = 0; $i < count($scripts); $i++) {
             $url = Filesystem::absoluteUrl($scripts[$i]);
             if (!$url) {
                 return NULL;
             }
             /* else */
             $script = new xmlNode("script");
             $script->setAttribute("src", $url);
             $script->setAttribute("type", "text/javascript");
             $tree->addChild($script);
         }
         if ($main !== NULL) {
             $script = new xmlNode("script");
             $script->setAttribute("src", $main);
             $script->setAttribute("type", "text/javascript");
             $tree->addChild($script);
         }
         return $tree;
     }
 }