当前位置: 首页>>代码示例>>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;未经允许,请勿转载。