本文整理汇总了PHP中JURI::getPort方法的典型用法代码示例。如果您正苦于以下问题:PHP JURI::getPort方法的具体用法?PHP JURI::getPort怎么用?PHP JURI::getPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JURI
的用法示例。
在下文中一共展示了JURI::getPort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setRenderUrl
/**
* Set URL for get front-end content. Correct URL
*
* @param string $url Link
*
* @return void
*/
public static function setRenderUrl($url = '')
{
$uri = new JURI($url);
if ($uri->getScheme() == '') {
$scheme = 'http';
if (@$_SERVER['HTTPS']) {
$scheme = 'https';
}
$uri->setScheme($scheme);
}
@(list($host, $port) = explode(':', $_SERVER['HTTP_HOST']));
if ($uri->getHost() == '') {
$uri->setHost($host);
}
if ($uri->getPort() == '') {
$uri->setPort($port);
}
if (strtolower($uri->getHost()) != strtolower($host)) {
self::$_isExternal = true;
} else {
if (!$uri->hasVar('jsntpl_position')) {
$uri->setVar('jsntpl_position', '1');
}
if (!$uri->hasVar('secret_key')) {
$config = JFactory::getConfig();
$secret = $config->get('secret');
$uri->setVar('secret_key', md5($secret));
}
if ($uri->hasVar('Itemid') and $uri->getVar('Itemid') == '') {
$uri->delVar('Itemid');
}
self::$_renderUrl = $uri->toString();
}
}
示例2: testSetPort
public function testSetPort() {
$this->object->setPort('8888');
$this->assertThat(
$this->object->getPort(),
$this->equalTo('8888')
);
}
示例3: setRenderUrl
/**
* Set URL for get front-end content. Correct URL
*
* @param string $url Link
*
* @return void
*/
public function setRenderUrl($url = '')
{
$uri = new JURI($url);
if ($uri->getScheme() == '') {
$scheme = 'http';
if (@$_SERVER['HTTPS']) {
$scheme = 'https';
}
$uri->setScheme($scheme);
}
@(list($host, $port) = explode(':', $_SERVER['HTTP_HOST']));
if ($uri->getHost() == '') {
$uri->setHost($host);
}
if ($uri->getPort() == '') {
$uri->setPort($port);
}
if (JString::strtolower($uri->getHost()) != JString::strtolower($host)) {
$this->_isExternal = true;
} else {
if (!$uri->hasVar('poweradmin')) {
$uri->setVar('poweradmin', '1');
}
if ($uri->hasVar('Itemid') and $uri->getVar('Itemid') == '') {
$uri->delVar('Itemid');
}
$this->_renderUrl = $uri->toString();
}
}