public static function getHref($href) { if ($href != '') { if ($href[0] == '#') { $href = Manager::getStaticURL(Manager::getApp(), substr($href, 1)); } else { $href = MAction::getHrefAction($href); } } return $href; }
public function buildURL($action = '', $parameters = array()) { $app = Manager::getApp(); $module = Manager::getModule(); if ($action[0] == '@') { $url = Manager::getAppURL($app); $action = substr($action, 1); } elseif ($action[0] == '>') { $url = Manager::getAppURL($app); $action = substr($action, 1); } elseif ($action[0] == '#') { $url = Manager::getStaticURL(); $action = substr($action, 1); } else { $url = Manager::getAppURL($app); } $path = ''; $parts = explode('/', $action); $i = 0; $n = count($parts); if ($parts[$i] == $app) { ++$i; --$n; } if ($n == 3) { //module $path = '/' . $parts[$i] . '/' . $parts[$i + 1] . '/' . $parts[$i + 2]; } elseif ($n == 2) { $path = '/' . $parts[$i] . '/' . $parts[$i + 1]; } elseif ($n == 1) { $path = '/' . $parts[$i]; } else { throw new EMException(_M('Error building URL. Action = ' . $action)); } if (count($parameters)) { $query = http_build_query($parameters); $path .= (strpos($path, '?') === false ? '?' : '') . $query; } $url .= $path; return $url; }