本文整理汇总了PHP中Bitrix\Main\Context类的典型用法代码示例。如果您正苦于以下问题:PHP Context类的具体用法?PHP Context怎么用?PHP Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Context类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: initFromUri
/**
* Initializes the navigation from URI.
*/
public function initFromUri()
{
$navParams = array();
$request = \Bitrix\Main\Context::getCurrent()->getRequest();
if (($value = $request->getQuery($this->id)) !== null) {
//parameters are in the QUERY_STRING
$params = explode("-", $value);
for ($i = 0, $n = count($params); $i < $n; $i += 2) {
$navParams[$params[$i]] = $params[$i + 1];
}
} else {
//probably parametrs are in the SEF URI
$matches = array();
if (preg_match("'/" . preg_quote($this->id, "'") . "/page-([\\d]|all)+(/size-([\\d]+))?'", $request->getRequestUri(), $matches)) {
$navParams["page"] = $matches[1];
if (isset($matches[3])) {
$navParams["size"] = $matches[3];
}
}
}
if (isset($navParams["size"])) {
//set page size from user request
if (in_array($navParams["size"], $this->pageSizes)) {
$this->setPageSize((int) $navParams["size"]);
}
}
if (isset($navParams["page"])) {
if ($navParams["page"] == "all" && $this->allowAll == true) {
//show all records in one page
$this->allRecords = true;
} else {
//set current page within boundaries
$currentPage = (int) $navParams["page"];
if ($currentPage >= 1) {
if ($this->recordCount !== null) {
$maxPage = $this->getPageCount();
if ($currentPage > $maxPage) {
$currentPage = $maxPage;
}
}
$this->setCurrentPage($currentPage);
}
}
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:48,代码来源:pagenavigation.php
示例17: checkAccessPermissions
protected static function checkAccessPermissions($parameters = array())
{
if (!is_array($parameters)) {
$parameters = array();
}
$errors = array();
$CCrmPerms = new CCrmPerms($GLOBALS['USER']->GetID());
if ($CCrmPerms->HavePerm('CONFIG', BX_CRM_PERM_NONE, 'WRITE')) {
$errors[] = Loc::getMessage("SALE_CCLI2_CRM_MODULE_WRITE_ACCESS_DENIED");
}
if (!LocationHelper::checkLocationEnabled()) {
$errors[] = 'Locations were disabled or data has not been converted';
}
if ($parameters['CHECK_CSRF']) {
$post = \Bitrix\Main\Context::getCurrent()->getRequest()->getPostList();
if (!strlen($post['csrf']) || bitrix_sessid() != $post['csrf']) {
$errors[] = 'CSRF token is not valid';
}
}
return $errors;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:21,代码来源:class.php
示例18: setEnable
/**
* Sets isEnable property value
* @param bool $isEnable
*/
public static function setEnable($isEnable = true)
{
if ($isEnable && !self::$isEnable) {
self::$onBeforeHandleKey = AddEventHandler("main", "OnBeforeEndBufferContent", array(__CLASS__, "OnBeforeEndBufferContent"));
self::$onHandleKey = AddEventHandler("main", "OnEndBufferContent", array(__CLASS__, "OnEndBufferContent"));
self::$isEnable = true;
\CJSCore::init(array("fc"), false);
$actionType = \Bitrix\Main\Context::getCurrent()->getServer()->get("HTTP_BX_ACTION_TYPE");
if ($actionType == "get_dynamic") {
//Is it the background request?
self::$isBackgroundRequest = true;
}
} elseif (!$isEnable && self::$isEnable) {
if (self::$onBeforeHandleKey >= 0) {
RemoveEventHandler("main", "OnBeforeEndBufferContent", self::$onBeforeHandleKey);
}
if (self::$onBeforeHandleKey >= 0) {
RemoveEventHandler("main", "OnEndBufferContent", self::$onHandleKey);
}
self::$isEnable = false;
}
}
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:26,代码来源:framecache.php
示例19: isset
{
$currentUser = $engine->getCurrentUser();
}
catch(Exception $e)
{
$currentUser = null;
$bNeedAuth = true;
}
$bReadOnly = $bNeedAuth;
$bAllowUpdate = !$bNeedAuth;
$bSale = Main\ModuleManager::isModuleInstalled('sale')
&& Main\ModuleManager::isModuleInstalled('catalog')
&& Main\Loader::includeModule('currency');
$request = Main\Context::getCurrent()->getRequest();
$back_url = isset($request["back_url"]) ? $request["back_url"] : '';
$campaignId = intval($request["campaign"]);
$elementId = intval($request["element"]);
$ID = intval($request["ID"]);
if($ID > 0)
{
$dbRes = Adv\YandexBannerTable::getByPrimary($ID);
$banner = $dbRes->fetch();
if($banner)
{
$campaignId = $banner["CAMPAIGN_ID"];
}
开发者ID:nycmic,项目名称:bittest,代码行数:31,代码来源:seo_search_yandex_direct_banner_edit.php
示例20: implode
$metaKeywords = \Bitrix\Main\Type\Collection::firstNotEmpty($arResult, $arParams["META_KEYWORDS"], $arResult["IPROPERTY_VALUES"], "SECTION_META_KEYWORDS");
if (is_array($metaKeywords)) {
$APPLICATION->SetPageProperty("keywords", implode(" ", $metaKeywords), $arTitleOptions);
} elseif ($metaKeywords != "") {
$APPLICATION->SetPageProperty("keywords", $metaKeywords, $arTitleOptions);
}
}
if ($arParams["SET_META_DESCRIPTION"] === 'Y') {
$metaDescription = \Bitrix\Main\Type\Collection::firstNotEmpty($arResult, $arParams["META_DESCRIPTION"], $arResult["IPROPERTY_VALUES"], "SECTION_META_DESCRIPTION");
if (is_array($metaDescription)) {
$APPLICATION->SetPageProperty("description", implode(" ", $metaDescription), $arTitleOptions);
} elseif ($metaDescription != "") {
$APPLICATION->SetPageProperty("description", $metaDescription, $arTitleOptions);
}
}
if (!empty($arResult['BACKGROUND_IMAGE']) && is_array($arResult['BACKGROUND_IMAGE'])) {
$APPLICATION->SetPageProperty("backgroundImage", 'style="background-image: url(\'' . $arResult['BACKGROUND_IMAGE']['SRC'] . '\')"');
}
if ($arParams["ADD_SECTIONS_CHAIN"] && isset($arResult["PATH"]) && is_array($arResult["PATH"])) {
foreach ($arResult["PATH"] as $arPath) {
if ($arPath["IPROPERTY_VALUES"]["SECTION_PAGE_TITLE"] != "") {
$APPLICATION->AddChainItem($arPath["IPROPERTY_VALUES"]["SECTION_PAGE_TITLE"], $arPath["~SECTION_PAGE_URL"]);
} else {
$APPLICATION->AddChainItem($arPath["NAME"], $arPath["~SECTION_PAGE_URL"]);
}
}
}
if ($arParams["SET_LAST_MODIFIED"] && $arResult["ITEMS_TIMESTAMP_X"]) {
Context::getCurrent()->getResponse()->setLastModified($arResult["ITEMS_TIMESTAMP_X"]);
}
return $arResult["ID"];
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php
注:本文中的Bitrix\Main\Context类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论