function tagInclude($Item) { $src = $this->attr("src"); $res = 0; $did = $this->attr("data-id"); $dad = $this->attr("data-add"); $header = $this->attr("data-header"); if ($header > "") { $Item["header"] = $header; } $footer = $this->attr("data-footer"); if ($footer > "") { $Item["footer"] = $footer; } $vars = $this->attr("vars"); if ($vars > "") { $Item = attrAddData($vars, $Item); } $json = $this->attr("json"); if ($json > "") { $Item = json_decode($json, true); } $dfs = $this->attr("data-formsave"); $class = $this->attr("data-class"); if ($src == "comments") { $src = "/engine/forms/comments/comments_widget.php"; $this->attr("data-role-hide", "true"); } if ($src == "modal") { $src = "/engine/forms/form_comModal.php"; $this->attr("data-role-hide", "true"); } if ($src == "imgviewer") { $src = "/engine/js/imgviewer.php"; $this->attr("data-role-hide", "true"); } if ($src == "uploader") { $src = "/engine/js/uploader.php"; $this->attr("data-role-hide", "true"); } if ($src == "editor") { $src = "/engine/js/editor.php"; $this->attr("data-role-hide", "true"); } $vars = $this->attr("vars"); if ($vars > "") { $Item = attrAddData($vars, $Item); } if ($src == "") { $src = $this->html(); $this_content = ki::fromString($src); } else { $tplpath = explode("/", $src); $tplpath = array_slice($tplpath, 0, -1); $tplpath = implode("/", $tplpath) . "/"; if (!isset($_SESSION["tplpath"]) or $_SESSION["tplpath"] == "") { $_SESSION["tplpath"] = normalizePath($tplpath); } $src = contentSetValuesStr($src, $Item); $file = $_SESSION["prj_path"] . $src; if (is_file($_SERVER["DOCUMENT_ROOT"] . $file)) { $src = $_SERVER["DOCUMENT_ROOT"] . $file; } else { if (substr($src, 0, 7) !== "http://") { if (substr($src, 0, 1) != "/") { $src = "/" . $src; } $src = "http://" . $_SERVER['HTTP_HOST'] . $src; } } $this_content = ki::fromFile($src); } if ($did > "") { $this_content->find(":first")->attr("id", $did); } if ($dad == "false") { $this_content->find("[data-formsave]")->attr("data-add", $dad); } if ($dfs > "") { $this_content->find("[data-formsave]")->attr("data-formsave", $dfs); } if ($dfs == "false") { $this_content->find("[data-formsave]")->remove(); } if ($class > "") { $this_content->find(":first")->addClass($class); } if (count($this->find("include")) > 0) { $this->append("<div id='___include___' style='display:none;'>{$this_content}</div>"); foreach ($this->find("include") as $inc) { $attr = array("html", "outer", "htmlOuter", "outerHtml", "innerHtml", "htmlInner", "text", "value"); foreach ($attr as $key => $attribute) { $find = $inc->attr($attribute); if ($attribute == "outer" or $attribute == "htmlOuter") { $attribute = "outerHtml"; } if ($attribute == "html" or $attribute == "innerHtml" or $attribute == "htmlInner") { $attribute = "html"; } if ($find > "") { foreach ($this->find("#___include___")->find($find) as $text) { $inc->after($text->{$attribute}()); } } } unset($attribute); $inc->remove(); } unset($inc); $this->find("#___include___")->remove(); } else { $this->append($this_content->outerHtml()); } $this->contentSetData($Item); }
function aikiWherePhp($str = "", $item = array()) { $str = contentSetValuesStr($str, $item); $str = " " . trim(strtr($str, array("(" => " ( ", ")" => " ) ", "=" => " == ", ">" => " > ", "<" => " < ", ">=" => " >= ", "<=" => " <= ", "<>" => " !== "))) . " "; $exclude = array("AND", "OR", "LIKE"); preg_match_all('/\\w+(?!\\")\\b/iu', $str, $arr); foreach ($arr[0] as $a => $fld) { if (!in_array(strtoupper($fld), $exclude)) { $str = str_replace(" {$fld} ", ' $item["' . $fld . '"] ', $str); } } if (strpos(strtolower($str), " like ")) { preg_match_all('/\\S*\\slike\\s\\S*/iu', $str, $arr); foreach ($arr[0] as $a => $cls) { $tmp = explode(" like ", $cls); if (count($tmp) == 2) { $str = str_replace($cls, 'aikiWhereLike(' . $tmp[0] . ',' . $tmp[1] . ')', $str); } } } return $str; }