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