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


PHP Main\Context類代碼示例

本文整理匯總了PHP中Bitrix\Main\Context的典型用法代碼示例。如果您正苦於以下問題:PHP Context類的具體用法?PHP Context怎麽用?PHP Context使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: checkSession

 public static function checkSession()
 {
     $request = Main\Context::getCurrent()->getRequest();
     if (isset($request[static::URL_PARAM_CAMPAIGN]) && isset($request[static::URL_PARAM_BANNER])) {
         $_SESSION['SEO_ADV'] = array("ENGINE" => YandexDirect::ENGINE_ID, "CAMPAIGN_ID" => $request[static::URL_PARAM_CAMPAIGN], "BANNER_ID" => $request[static::URL_PARAM_BANNER]);
     }
 }
開發者ID:Satariall,項目名稱:izurit,代碼行數:7,代碼來源:advsession.php

示例2: getTabs

 public static function getTabs($iblockElementInfo)
 {
     $showTab = false;
     $request = Context::getCurrent()->getRequest();
     if ($iblockElementInfo["ID"] > 0 && (!isset($request['action']) || $request['action'] != 'copy')) {
         $showTab = true;
         if (Loader::includeModule('catalog')) {
             /*
             				$dbRes = CatalogIblockTable::getList(array(
             					'filter' => array(
             						'=IBLOCK_ID' => $iblockElementInfo["IBLOCK"]["ID"],
             						'!PRODUCT_IBLOCK_ID' => 0
             					),
             					'select' => array('IBLOCK_ID'),
             				));
             				if($dbRes->fetch())
             				{
             					$showTab = false;
             				}
             */
             if (\CCatalogSku::getInfoByOfferIBlock($iblockElementInfo["IBLOCK"]["ID"]) !== false) {
                 $showTab = false;
             }
         }
     }
     return $showTab ? array(array("DIV" => "seo_adv", "SORT" => 4, "TAB" => Loc::getMessage("SEO_ADV_TAB"), "TITLE" => Loc::getMessage("SEO_ADV_TAB_TITLE"))) : null;
 }
開發者ID:webgksupport,項目名稱:alpina,代碼行數:27,代碼來源:advtabengine.php

示例3: onBeforeProlog

 public static function onBeforeProlog()
 {
     $id = Context::getCurrent()->getRequest()->getQuery('bx_sender_conversion_id');
     if (is_numeric($id) && $id > 0) {
         $_SESSION[self::CLICK_PARAM_NAME] = $id;
     }
 }
開發者ID:Satariall,項目名稱:izurit,代碼行數:7,代碼來源:conversionhandler.php

示例4: setPage

 /**
  * Set type of the page
  */
 protected function setPage()
 {
     $urlTemplates = [];
     if ($this->arParams['SEF_MODE'] === 'Y') {
         $variables = [];
         $urlTemplates = \CComponentEngine::MakeComponentUrlTemplates($this->defaultUrlTemplates404, $this->arParams['SEF_URL_TEMPLATES']);
         $variableAliases = \CComponentEngine::MakeComponentVariableAliases($this->defaultUrlTemplates404, $this->arParams['VARIABLE_ALIASES']);
         $this->templatePage = \CComponentEngine::ParseComponentPath($this->arParams['SEF_FOLDER'], $urlTemplates, $variables);
         if (!$this->templatePage) {
             if ($this->arParams['SET_404'] === 'Y') {
                 $folder404 = str_replace('\\', '/', $this->arParams['SEF_FOLDER']);
                 if ($folder404 != '/') {
                     $folder404 = '/' . trim($folder404, "/ \t\n\r\v") . "/";
                 }
                 if (substr($folder404, -1) == '/') {
                     $folder404 .= 'index.php';
                 }
                 if ($folder404 != Main\Context::getCurrent()->getRequest()->getRequestedPage()) {
                     $this->return404();
                 }
             }
             $this->templatePage = $this->defaultSefPage;
         }
         if ($this->isSearchRequest() && $this->arParams['USE_SEARCH'] === 'Y') {
             $this->templatePage = 'search';
         }
         \CComponentEngine::InitComponentVariables($this->templatePage, $this->componentVariables, $variableAliases, $variables);
     } else {
         $this->templatePage = $this->defaultPage;
     }
     $this->sefFolder = $this->arParams['SEF_FOLDER'];
     $this->urlTemplates = $urlTemplates;
     $this->variables = $variables;
     $this->variableAliases = $variableAliases;
 }
開發者ID:lithium-li,項目名稱:bbc-module,代碼行數:38,代碼來源:basisrouter.php

示例5: getCurrentLang

 private static function getCurrentLang()
 {
     $context = Context::getCurrent();
     if ($context !== null) {
         return $context->getLanguage();
     }
     return 'en';
 }
開發者ID:spas-viktor,項目名稱:books,代碼行數:8,代碼來源:loc.php

示例6: filter

 public function filter()
 {
     if ($this->getSiteId() == Context::getCurrent()->getSite()) {
         return true;
     } else {
         return false;
     }
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:8,代碼來源:sendertriggeruserauth.php

示例7: onBeforeEndBufferContent

 public static function onBeforeEndBufferContent()
 {
     $server = Context::getCurrent()->getServer();
     $ajax = $server->get("HTTP_BX_AJAX");
     if (SiteSpeed::isOn() && static::$enabled === true && $ajax === null && (!defined("ADMIN_SECTION") || ADMIN_SECTION !== true)) {
         Counter::injectIntoPage();
     }
 }
開發者ID:Satariall,項目名稱:izurit,代碼行數:8,代碼來源:counter.php

示例8: validateTokenByPost

 /**
  * Проверка токена напрямую из запроса
  * @return boolean TRUE - если токен валидный
  */
 public static function validateTokenByPost()
 {
     $token = Context::getCurrent()->getRequest()->getPost("csrf");
     if ($token) {
         return self::validateToken($token);
     }
     self::removeToken();
     return false;
 }
開發者ID:irpsv,項目名稱:juggernaut.bitrix,代碼行數:13,代碼來源:Csrf.php

示例9: checkSession

 public static function checkSession()
 {
     $request = Main\Context::getCurrent()->getRequest();
     if (isset($request[static::URL_PARAM_CAMPAIGN]) && isset($request[static::URL_PARAM_BANNER])) {
         $dbRes = YandexBannerTable::getList(array('filter' => array('=XML_ID' => $request[static::URL_PARAM_BANNER], '=ENGINE.CODE' => YandexDirect::ENGINE_ID), 'select' => array('ID', 'CAMPAIGN_ID')));
         $banner = $dbRes->fetch();
         if ($banner) {
             $_SESSION['SEO_ADV'] = array("ENGINE" => YandexDirect::ENGINE_ID, "CAMPAIGN_ID" => $banner['CAMPAIGN_ID'], "BANNER_ID" => $banner['ID']);
         }
     }
 }
開發者ID:ASDAFF,項目名稱:1C_Bitrix_info_site,代碼行數:11,代碼來源:advsession.php

示例10: initProperties

 /**
  * Инициализация свойств класса из входных параметров
  */
 protected function initProperties()
 {
     $this->request = Context::getCurrent()->getRequest();
     foreach ($this->arParams as $name => $value) {
         if ($name === "CACHE_TIME") {
             $this->cacheTime = (int) $value;
         } elseif (property_exists($this, $name)) {
             $this->{$name} = is_numeric($value) ? +$value : $value;
         }
     }
 }
開發者ID:irpsv,項目名稱:juggernaut.bitrix,代碼行數:14,代碼來源:BaseComponent.php

示例11: parseRequest

 /**
  * Преобразует номер старницы и количество показываемых элементов,
  * в свойства 'limit' и 'offset'
  * @param integer $defaultPageNow номер страницы по умолчанию
  * @param integer $defaultPerPage количество записей на странице по умолчанию
  * @return array массив с ключами 'limit' и 'offset'
  */
 public function parseRequest($defaultPageNow, $defaultPerPage)
 {
     $pageNow = (int) Context::getCurrent()->getRequest()->getQuery($this->pageNowRequestName);
     $perPage = (int) Context::getCurrent()->getRequest()->getQuery($this->limitRequestName);
     //
     $this->pageNow = $pageNow > 0 ? $pageNow : $defaultPageNow;
     $this->limit = $perPage > 0 ? $perPage : $defaultPerPage;
     //
     $this->init();
     return ["limit" => $this->limit, "offset" => $this->getOffset()];
 }
開發者ID:irpsv,項目名稱:juggernaut.bitrix,代碼行數:18,代碼來源:Paginator.php

示例12: checkScope

 /**
  * Checks the valid scope for the applicaton.
  *
  * @return bool
  */
 public function checkScope()
 {
     /** @var Main\HttpRequest $request */
     $request = Main\Context::getCurrent()->getRequest();
     $realPath = $request->getScriptFile();
     foreach ($this->validUrls as $url) {
         if (strpos($realPath, $url) === 0) {
             return true;
         }
     }
     return false;
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:17,代碼來源:application.php

示例13: getCurrentLang

 private static function getCurrentLang()
 {
     if (self::$currentLang === null) {
         $context = Context::getCurrent();
         if ($context !== null) {
             self::$currentLang = $context->getLanguage();
         } else {
             self::$currentLang = 'en';
         }
     }
     return self::$currentLang;
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:12,代碼來源:loc.php

示例14: catchCatalogOrderPayment

 public static function catchCatalogOrderPayment($orderId, $value)
 {
     if (!static::isOn()) {
         return;
     }
     if ($value == 'Y') {
         $data = static::getOrderInfo($orderId);
         $data['paid'] = '1';
         $data['bx_user_id'] = static::getBxUserId();
         $data['domain'] = Context::getCurrent()->getServer()->getHttpHost();
         $data['date'] = date(DATE_ISO8601);
         CounterDataTable::add(array('TYPE' => 'order_pay', 'DATA' => $data));
     }
 }
開發者ID:rasuldev,項目名稱:torino,代碼行數:14,代碼來源:catalog.php

示例15: __construct

 private function __construct()
 {
     global $APPLICATION;
     $this->setDeviceWidth($_COOKIE["MOBILE_RESOLUTION_WIDTH"]);
     $this->setDeviceHeight($_COOKIE["MOBILE_RESOLUTION_HEIGHT"]);
     $this->setScreenCategory($_COOKIE["MOBILE_SCREEN_CATEGORY"]);
     $this->setPixelratio($_COOKIE["MOBILE_SCALE"]);
     $this->setPgVersion($_COOKIE["PG_VERSION"]);
     if (isset($_COOKIE["MOBILE_DEV"]) && $_COOKIE["MOBILE_DEV"] == "Y") {
         self::$isDev = true;
     }
     $this->setDevice($_COOKIE["MOBILE_DEVICE"]);
     if ($_COOKIE["IS_WEBRTC_SUPPORTED"] && $_COOKIE["IS_WEBRTC_SUPPORTED"] == "Y") {
         $this->setWebRtcSupport(true);
     }
     if ($_COOKIE["IS_BXSCRIPT_SUPPORTED"] && $_COOKIE["IS_BXSCRIPT_SUPPORTED"] == "Y") {
         $this->setBXScriptSupported(true);
     }
     if ($this->getDevice() == "iPad") {
         $this->setScreenCategory("LARGE");
         if (intval($this->getPixelRatio()) == 2) {
             $this->setDeviceWidth($_COOKIE["MOBILE_RESOLUTION_WIDTH"] / 2);
             $this->setDeviceHeight($_COOKIE["MOBILE_RESOLUTION_HEIGHT"] / 2);
         }
     }
     //detecting OS
     if (array_key_exists("MOBILE_DEVICE", $_COOKIE)) {
         $deviceDetectSource = $_COOKIE["MOBILE_DEVICE"];
     } else {
         $deviceDetectSource = strtolower(Context::getCurrent()->getServer()->get("HTTP_USER_AGENT"));
     }
     if (strrpos(ToUpper($deviceDetectSource), "IPHONE") > 0 || strrpos(ToUpper($deviceDetectSource), "IPAD") > 0) {
         self::$platform = "ios";
     } elseif (strrpos(ToUpper($deviceDetectSource), "ANDROID") > 0 || strrpos(ToUpper($deviceDetectSource), "ANDROID") === 0) {
         self::$platform = "android";
     }
     if (array_key_exists("emulate_platform", $_REQUEST)) {
         self::$platform = $_REQUEST["emulate_platform"];
     }
     if (array_key_exists("MOBILE_API_VERSION", $_COOKIE)) {
         self::$apiVersion = intval($_COOKIE["MOBILE_API_VERSION"]);
     } elseif ($APPLICATION->get_cookie("MOBILE_APP_VERSION")) {
         self::$apiVersion = $APPLICATION->get_cookie("MOBILE_APP_VERSION");
     } elseif (array_key_exists("api_version", $_REQUEST)) {
         self::$apiVersion = intval($_REQUEST["api_version"]);
     }
 }
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:47,代碼來源:mobile.php


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