當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PageModel::SplitBaseURL方法代碼示例

本文整理匯總了PHP中PageModel::SplitBaseURL方法的典型用法代碼示例。如果您正苦於以下問題:PHP PageModel::SplitBaseURL方法的具體用法?PHP PageModel::SplitBaseURL怎麽用?PHP PageModel::SplitBaseURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PageModel的用法示例。


在下文中一共展示了PageModel::SplitBaseURL方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: splitParts

	/**
	 * 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);
	}
開發者ID:nicholasryan,項目名稱:CorePlus,代碼行數:9,代碼來源:PageRequest.class.php

示例2: resolve_link

/**
 * 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'];
}
開發者ID:nicholasryan,項目名稱:CorePlus,代碼行數:51,代碼來源:Core.functions.php


注:本文中的PageModel::SplitBaseURL方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。