本文整理汇总了PHP中JUri::setPort方法的典型用法代码示例。如果您正苦于以下问题:PHP JUri::setPort方法的具体用法?PHP JUri::setPort怎么用?PHP JUri::setPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUri
的用法示例。
在下文中一共展示了JUri::setPort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetPort
/**
* Test the setPort method.
*
* @return void
*
* @since 11.1
* @covers JUri::setPort
*/
public function testSetPort()
{
$this->object->setPort('8888');
$this->assertThat($this->object->getPort(), $this->equalTo('8888'));
}
示例2: onAfterInitialise
function onAfterInitialise()
{
/** @var JSite $app */
$app = JFactory::getApplication();
if ($app->isAdmin()) {
// don't use MobileJoomla in backend
return;
}
$is_joomla15 = $this->isJoomla15();
//load MobileJoomla class
require_once JPATH_ADMINISTRATOR . '/components/com_mobilejoomla/classes/mobilejoomla.php';
//load config
$MobileJoomla_Settings =& MobileJoomla::getConfig();
$MobileJoomla_Device =& MobileJoomla::getDevice();
// check for legacy redirect
if (@$_GET['option'] == 'com_mobilejoomla' && @$_GET['task'] == 'setmarkup' && isset($_GET['markup']) && isset($_GET['return'])) {
$desktop_uri = new JUri($MobileJoomla_Settings['desktop_url']);
$uri = new JUri(base64_decode($_GET['return']));
if (!$uri->getScheme()) {
$uri->setScheme('http');
}
$uri->setHost($desktop_uri->getHost());
$uri->setPort($desktop_uri->getPort());
$app->redirect($uri->toString());
}
JPluginHelper::importPlugin('mobile');
$cached_data = $app->getUserState('mobilejoomla.cache');
if ($cached_data !== null) {
$cached_data = @gzinflate(@base64_decode($cached_data));
if ($cached_data !== false) {
$cached_data = @unserialize($cached_data);
}
}
if (is_array($cached_data)) {
$MobileJoomla_Device = $cached_data['device'];
} else {
$app->triggerEvent('onDeviceDetection', array(&$MobileJoomla_Settings, &$MobileJoomla_Device));
$gzlevel = 5;
$cached_data = array('device' => $MobileJoomla_Device);
$cached_data = base64_encode(gzdeflate(serialize($cached_data), $gzlevel));
$app->setUserState('mobilejoomla.cache', $cached_data);
}
$MobileJoomla_Device['markup'] = self::CheckMarkup($MobileJoomla_Device['markup']);
$MobileJoomla_Device['real_markup'] = $MobileJoomla_Device['markup'];
$app->triggerEvent('onAfterDeviceDetection', array(&$MobileJoomla_Settings, &$MobileJoomla_Device));
$MobileJoomla_Device['markup'] = self::CheckMarkup($MobileJoomla_Device['markup']);
$markup = $MobileJoomla_Device['markup'];
$MobileJoomla_Device['default_markup'] = $markup;
//get user choice
$user_markup = $this->getUserMarkup();
if ($user_markup !== false) {
$markup = $user_markup;
}
// template preview
$getTemplate = isset($_GET['template']) ? $_GET['template'] : null;
if (version_compare(JVERSION, '1.7', '>=')) {
if ($getTemplate === null && isset($_GET['templateStyle']) && is_int($_GET['templateStyle'])) {
$db = JFactory::getDBO();
$query = 'SELECT template FROM #__template_styles WHERE id = ' . intval($_GET['templateStyle']) . ' AND client_id = 0';
$db->setQuery($query);
$getTemplate = $db->loadResult();
}
} elseif (version_compare(JVERSION, '1.6', '>=')) {
if (is_int($getTemplate)) {
$db = JFactory::getDBO();
$query = 'SELECT template FROM #__template_styles WHERE id = ' . intval($getTemplate) . ' AND client_id = 0';
$db->setQuery($query);
$getTemplate = $db->loadResult();
}
}
if ($getTemplate) {
switch ($getTemplate) {
case $MobileJoomla_Settings['xhtml.template']:
$markup = 'xhtml';
break;
case $MobileJoomla_Settings['iphone.template']:
$markup = 'iphone';
break;
case $MobileJoomla_Settings['wml.template']:
$markup = 'wml';
break;
case $MobileJoomla_Settings['chtml.template']:
$markup = 'chtml';
break;
}
}
$MobileJoomla_Device['markup'] = $markup;
if ($MobileJoomla_Device['screenwidth'] == 0 || $MobileJoomla_Device['screenheight'] == 0) {
switch ($markup) {
case 'wml':
$MobileJoomla_Device['screenwidth'] = 64;
$MobileJoomla_Device['screenheight'] = 96;
break;
case 'chtml':
$MobileJoomla_Device['screenwidth'] = 120;
$MobileJoomla_Device['screenheight'] = 128;
break;
case 'xhtml':
$MobileJoomla_Device['screenwidth'] = 320;
$MobileJoomla_Device['screenheight'] = 480;
//.........这里部分代码省略.........