public static function urlBasePath() { return \Jelix\Core\App::urlBasePath(); }
/** * Create a jurl object with the given action data. * * @param \jUrlAction $url information about the action * * @return \jUrl the url correspondant to the action * * @author Laurent Jouanneau * @copyright 2005 CopixTeam, 2005-2006 Laurent Jouanneau * very few lines of code are copyrighted by CopixTeam, written by Laurent Jouanneau * and released under GNU Lesser General Public Licence, * in an experimental version of Copix Framework v2.3dev20050901, * http://www.copix.org. */ public function create(\jUrlAction $urlact) { $url = new \jUrl('', $urlact->params, ''); // retrieve informations corresponding to the action // warning: it may delete module and action parameter from $url $urlinfo = $this->getUrlBuilderInfo($urlact, $url); // at this step, we have informations to build the url // setup script name $url->scriptName = App::urlBasePath() . $urlinfo[1]; if ($urlinfo[2]) { $url->scriptName = App::router()->request->getServerURI(true) . $url->scriptName; } if ($urlinfo[1] && $this->config->extensionNeeded) { $url->scriptName .= '.php'; } // for some request types, parameters aren't in the url // so we remove them // it's a bit dirty to do that hardcoded here, but it would be a pain // to load the request class to check whether we can remove or not if (in_array($urlact->requestType, $this->entryPointTypeHavingActionInBody)) { $url->clearParam(); return $url; } if ($urlinfo[0] == 0) { $this->buildWithHandler($urlact, $url, $urlinfo); } elseif ($urlinfo[0] == 1) { $this->buildWithSpecificPathinfo($urlact, $url, $urlinfo); } elseif ($urlinfo[0] == 3) { $this->buildForDedicatedModule($urlact, $url, $urlinfo); } elseif ($urlinfo[0] == 5) { $this->buildForWholeController($urlact, $url, $urlinfo); } elseif ($urlinfo[0] == 2) { $url->pathInfo = '/' . $urlact->getParam('module', App::getCurrentModule()) . '/' . str_replace(':', '/', $urlact->getParam('action')); $url->delParam('module'); $url->delParam('action'); } return $url; }