public static function __callStatic($method, $options) { $content = $options[0]; $tag = $options[1]; switch ($tag) { case 'form': // get form information $nodes = $content->XPath("//form"); // loop through all nodes for ($i = 0; $i < count($nodes); $i++) { $formMethod = $nodes[$i]["action"]; $nodes[$i]["method"] = "post"; $nodes[$i]["accept-charset"] = "utf-8"; // if no action -> insert correct url if (!$formMethod) { $nodes[$i]["action"] = OLIVRoute::makeUrl(status::lang(), status::url()); } else { $nodes[$i]["action"] = OLIVRoute::makeUrl(status::lang(), (string) $formMethod); } } break; case 'input': // if $xxx in value of input tag // replace by argv::xxx() value $nodes = $content->XPath("//input[contains(@value,'\$')]"); foreach ($nodes as $entry) { if ($entry) { $val = substr((string) $entry['value'], 1); $entry['value'] = argv::$val(); } } // set checked value for radio and checkbox $nodes = $content->XPath("//input[@type = 'radio' or @type = 'checkbox']"); foreach ($nodes as $entry) { $name = (string) $entry['name']; $value = (string) $entry['value']; $arg = argv::$name(); if ($arg == $value) { $entry['checked'] = "checked"; } } break; } return $content; }
public static function url($lang, $url, $val) { $url = strtolower($url); if (!$lang) { $lang = status::lang(); } // if no language use current $path = OLIVRoute::makeUrl($lang, $url) . "/"; if ($val) { $path .= $val . "/"; } // return url string return $path; }