本文整理汇总了PHP中Phpfox_Url::_isMobile方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox_Url::_isMobile方法的具体用法?PHP Phpfox_Url::_isMobile怎么用?PHP Phpfox_Url::_isMobile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox_Url
的用法示例。
在下文中一共展示了Phpfox_Url::_isMobile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setParams
/**
* Prepare the main requests.
*
*/
private function _setParams()
{
if (Phpfox::getParam('core.url_rewrite') == 3)
{
/**
* @todo This method needs to be tested a little more on different OSsss
*/
$aServer = explode('.', (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['SERVER_NAME']));
if ($aServer[0] == 'www')
{
$aServer[0] = Phpfox::getParam('core.module_core');
}
$_GET[PHPFOX_GET_METHOD] = '/' . $aServer[0] . '/' . (isset($_GET[PHPFOX_GET_METHOD]) ? $_GET[PHPFOX_GET_METHOD] : '');
}
if (!isset($_GET[PHPFOX_GET_METHOD]))
{
return '';
}
if (!defined('PHPFOX_INSTALLER'))
{
$oModule = Phpfox::getLib('module');
$sDefaultModule = Phpfox::getParam('core.module_core');
}
$sRequest = $_GET[PHPFOX_GET_METHOD];
$aRequest = explode("/", $sRequest);
$iCnt = 0;
foreach($aRequest as $sVar)
{
$sVar = trim($sVar);
if (!empty($sVar))
{
if ($sVar == 'mobile')
{
self::$_isMobile = true;
continue;
}
$iCnt++;
$bPass = true;
if ($iCnt == 1 && !preg_match("/^frame_(.*)$/", $sVar))
{
$bPass = false;
}
if ($bPass && preg_match('/\_/', $sVar))
{
$aPart = explode('_', $sVar);
if (isset($aPart[0]))
{
if (count($aPart) > 2)
{
$this->_aParams[$aPart[0]] = (substr_replace($sVar, '', 0, (strlen($aPart[0]) + 1)));
}
else
{
$this->_aParams[$aPart[0]] = (isset($aPart[1]) ? $aPart[1] : '');
}
}
}
else
{
// Override our default requests incase the user has created some special URL rewrites
/**
* @todo We need to look over this routine. Currently it might be eating up a little too
* much extra memory, however from recent tests it seems to be working fine.
*/
if (($iCnt == 1 && isset($this->aRewrite[$sVar])))
{
$this->_aParams['req1'] = $this->aRewrite[$sVar]['module'];
if ($this->aRewrite[$sVar]['component'] != 'index')
{
$this->_aParams['req2'] = $this->aRewrite[$sVar]['component'];
$iCnt++;
}
continue;
}
if (!defined('PHPFOX_INSTALLER') && $iCnt == 1 && $sDefaultModule != PHPFOX_MODULE_CORE && isset($this->aRewrite['']['module']) && ($sModule = $this->aRewrite['']['module']) == $sDefaultModule && !$oModule->isModule($sVar))
{
$this->_aParams['req1'] = strtolower($sDefaultModule);
$this->_aParams['req2'] = $sVar;
$iCnt++;
continue;
}
$sVar = rawurldecode($sVar);
$sVar = rawurlencode($sVar);
$this->_aParams['req' . $iCnt] = $sVar;
}
}
}
//.........这里部分代码省略.........
示例2: _setParams
/**
* Prepare the main requests.
*
*/
private function _setParams()
{
if (PHPFOX_IS_AJAX) {
if (isset($_REQUEST['params'])) {
foreach ($_REQUEST['params'] as $sReq => $sVal) {
if (strpos($sVal, '_') !== false) {
$aParts = explode('_', $sVal);
$this->_aParams[$aParts[0]] = $aParts[1];
} else {
if (strpos($sReq, 'req') !== false) {
$this->_aParams[$sReq] = $sVal;
}
}
}
}
}
if (!isset($_GET[PHPFOX_GET_METHOD])) {
$_GET[PHPFOX_GET_METHOD] = $this->getUri();
}
if (!defined('PHPFOX_INSTALLER')) {
$oModule = Phpfox_Module::instance();
$sDefaultModule = Phpfox::getParam('core.module_core');
}
$sRequest = $_GET[PHPFOX_GET_METHOD];
$sRequest = trim($sRequest, '/');
$aRequest = explode("/", $sRequest);
$iCnt = 0;
foreach ($aRequest as $sVar) {
$sVar = trim($sVar);
if (!empty($sVar)) {
if ($iCnt == 0 && $sVar == 'mobile') {
self::$_isMobile = true;
// http://www.phpfox.com/tracker/view/15019/
$sRequest = preg_replace('/mobile\\//i', '', $sRequest, 1);
//$sRequest = str_replace('mobile/', '', $sRequest);
break;
}
}
}
$aRequest = explode("/", $sRequest);
// Remove params from sRequest
preg_match('/([a-z0-9]+_[a-z0-9]+)/i', $sRequest, $aParams);
$sRequest = str_replace($aParams, '', $sRequest);
$sRequest = trim($sRequest, '/');
if (isset($this->aRewrite[$sRequest])) {
// this is the final url, do not rewrite
} else {
if (isset($this->aReverseRewrite[$sRequest])) {
$sRequest = $this->aReverseRewrite[$sRequest];
$aRequest = explode('/', $sRequest);
$iCnt++;
foreach ($aRequest as $sReq) {
$this->_aParams['req' . $iCnt] = $sReq;
}
$iCnt = 0;
if (!empty($aParams)) {
$aRequest = $aRequest + $aParams;
}
} else {
if (isset($aRequest[0]) && isset($this->aReverseRewrite[$aRequest[0]])) {
$sRequest = $this->aReverseRewrite[$aRequest[0]];
$aRequest[0] = $sRequest;
$iCnt++;
foreach ($aRequest as $sReq) {
$this->_aParams['req' . $iCnt] = $sReq;
}
$iCnt = 0;
if (!empty($aParams)) {
$aRequest = $aRequest + $aParams;
}
}
}
}
$sRequest = trim($sRequest, '/');
$bRedirected = false;
if (isset($this->aReverseRewrite[$sRequest])) {
// we already redirected and should stop now.
$bRedirected = true;
} else {
if (isset($this->aRewrite[$sRequest])) {
}
}
foreach ($aRequest as $sVar) {
$sVar = trim($sVar);
if (!empty($sVar)) {
if ($iCnt == 0 && $sVar == 'mobile') {
self::$_isMobile = true;
continue;
}
$iCnt++;
$bPass = true;
if ($iCnt == 1 && !preg_match("/^frame_(.*)\$/", $sVar)) {
$bPass = false;
}
if ($bPass && preg_match('/\\_/', $sVar)) {
$aPart = explode('_', $sVar);
//.........这里部分代码省略.........