public function compile(JsUtils $js = NULL, View $view = NULL) { $result = $this->getTemplate(); foreach ($this as $key => $value) { if (PhalconUtils::startsWith($key, "_") === false && $key !== "events") { if (is_array($value)) { $v = PropertyWrapper::wrap($value, $js); } else { $v = $value; } $result = str_ireplace("%" . $key . "%", $v, $result); } } if (isset($js)) { $this->run($js); } if (isset($view) === true) { $controls = $view->getVar("q"); if (isset($controls) === false) { $controls = array(); } $controls[$this->identifier] = $result; $view->setVar("q", $controls); } return $result; }
public static function wrap($input, $js = NULL, $separator = ' ', $valueQuote = '"') { $output = ""; if (is_string($input)) { $output = $input; } if (is_array($input)) { if (sizeof($input) > 0) { $value1 = reset($input); if (is_object($value1)) { $output = PropertyWrapper::wrapObjects($input, $js, $separator = ' '); } else { $output = PropertyWrapper::wrapStrings($input, $separator = ' ', $valueQuote = '"'); } } } return $output; }