/** * Get an array of all the parts of this request, including: * 'controller', 'method', 'parameters', 'baseurl', 'rewriteurl' * * @return array */ public function splitParts() { return PageModel::SplitBaseURL($this->uriresolved); }
/** * Resolve a url or application path to a fully-resolved URL. * * This can also be an already-resolved link. If so, no action is taken * and the original URL is returned unchanged. * * @param string $url * * @return string The full url of the link, including the http://... */ function resolve_link($url) { // Allow "#" to be verbatim without translation. if ($url == '#') return $url; // Allow already-resolved links to be returned verbatim. if (strpos($url, '://') !== false) return $url; // <strike>FIRST</strike> Second THING!?!?! // All URLs should be case insensitive. // As such, I *should* be able to safely strlower everything and be fine. // This is particularly important because all URL lookups from the database are performed in lowercase. //$url = strtolower($url); // Allow links starting with ? to be read as the current page. if($url{0} == '?'){ $url = REL_REQUEST_PATH . $url; } // Allow multisite URLs to be passed in natively. if(stripos($url, 'site:') === 0){ $slashpos = strpos($url, '/'); $site = substr($url, 5, $slashpos-5); $url = substr($url, $slashpos); } else{ $site = null; } try{ $a = \PageModel::SplitBaseURL($url, $site); } catch(\Exception $e){ // Well, this isn't a fatal error, so just warn the admin and continue on. \Core\ErrorManagement\exception_handler($e); error_log('Unable to resolve URL [' . $url . '] due to exception [' . $e->getMessage() . ']'); return ''; } // Instead of going through the overhead of a pagemodel call, SplitBaseURL provides what I need! return $a['fullurl']; }