本文整理汇总了PHP中Bitrix\Main\Config\Option类的典型用法代码示例。如果您正苦于以下问题:PHP Option类的具体用法?PHP Option怎么用?PHP Option使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Option类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
protected static function save()
{
$ary = array();
foreach (self::$items as $entityTypeID => $time) {
$ary[\CCrmOwnerType::ResolveName($entityTypeID)] = $time->format(\DateTime::ISO8601);
}
Main\Config\Option::set('crm', 'crm_uf_history', serialize($ary), '');
}
示例2: DoUninstall
public function DoUninstall()
{
$this->uninstallFiles();
\Bitrix\Main\Config\Option::delete($this->MODULE_ID);
\Bitrix\Main\ModuleManager::unRegisterModule($this->MODULE_ID);
return true;
}
示例3: DoProcessOrder
/**
* @param $arOrder
* @param $deliveryCode
* @param $arErrors
* @return bool
* @throws \Bitrix\Main\ArgumentNullException
* @throws \Bitrix\Main\SystemException
* @internal
* @deprecated
*/
static function DoProcessOrder(&$arOrder, $deliveryCode, &$arErrors)
{
if (strlen($deliveryCode) <= 0 || $deliveryCode == '0') {
return false;
}
if ($service = \Bitrix\Sale\Delivery\Services\Manager::getServiceByCode($deliveryCode)) {
$isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
$arOrderTmpDel = array("PRICE" => $arOrder["ORDER_PRICE"] + $arOrder["TAX_PRICE"] - $arOrder["DISCOUNT_PRICE"], "WEIGHT" => $arOrder["ORDER_WEIGHT"], "LOCATION_FROM" => COption::GetOptionString('sale', 'location', '2961', $arOrder["SITE_ID"]), "LOCATION_TO" => isset($arOrder["DELIVERY_LOCATION"]) ? $arOrder["DELIVERY_LOCATION"] : 0, "LOCATION_ZIP" => $arOrder["DELIVERY_LOCATION_ZIP"], "ITEMS" => $arOrder["BASKET_ITEMS"], "CURRENCY" => $arOrder["CURRENCY"]);
if ($isOrderConverted == "Y" && !empty($arOrder['ORDER_PROP']) && is_array($arOrder['ORDER_PROP'])) {
$arOrderTmpDel['PROPERTIES'] = $arOrder['ORDER_PROP'];
}
//$r = $propCollection->setValuesFromPost($fields, $_FILES);
$arOrder["DELIVERY_ID"] = $deliveryCode;
$shipment = self::convertOrderOldToNew($arOrderTmpDel);
if (isset($arOrder["DELIVERY_EXTRA_SERVICES"])) {
$service->getExtraServices()->setValues($arOrder["DELIVERY_EXTRA_SERVICES"]);
}
$calculationResult = $service->calculate($shipment);
if (!$calculationResult->isSuccess()) {
$arErrors[] = array("CODE" => "CALCULATE", "TEXT" => implode("<br>\n", $calculationResult->getErrorMessages()));
} else {
$arOrder["DELIVERY_PRICE"] = roundEx($calculationResult->getPrice(), SALE_VALUE_PRECISION);
}
} else {
$arErrors[] = array("CODE" => "CALCULATE", "TEXT" => GetMessage('SKGD_DELIVERY_NOT_FOUND'));
}
}
示例4: __construct
public function __construct()
{
$diskEnabled = \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk');
if (!$diskEnabled) {
$this->validUrls = array_merge($this->validUrls, array("/company/personal.php", "/extranet/contacts/personal.php", "/docs/index.php", "/docs/shared/index.php", "/workgroups/index.php"));
}
}
示例5: showTab
public static function showTab($div, $iblockElementInfo)
{
$engineList = array();
if (Option::get('main', 'vendor', '') == '1c_bitrix') {
$engineList[] = array("DIV" => "yandex_direct", "TAB" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT"), "TITLE" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT_TITLE"), "HANDLER" => IO\Path::combine(Application::getDocumentRoot(), BX_ROOT, "/modules/seo/admin/tab/seo_search_yandex_direct.php"));
}
if (count($engineList) > 0) {
$engineTabControl = new \CAdminViewTabControl("engineTabControl", $engineList);
?>
<tr>
<td colspan="2">
<?php
$engineTabControl->begin();
foreach ($engineList as $engineTab) {
$engineTabControl->beginNextTab();
$file = new IO\File($engineTab["HANDLER"]);
if ($file->isExists()) {
require $file->getPath();
}
}
$engineTabControl->end();
?>
</td>
</tr>
<?php
}
}
示例6: create
/**
* @return Form
*/
public function create()
{
if (!in_array($this->params->get('TYPE'), array('IBLOCK', 'HLBLOCK', 'CUSTOM'))) {
$this->params->set('TYPE', 'CUSTOM');
}
switch ($this->params->get('TYPE')) {
case 'IBLOCK':
$builder = 'Citfact\\Form\\Builder\\IBlockBuilder';
$storage = 'Citfact\\Form\\Storage\\IBlockStorage';
$validator = 'Citfact\\Form\\Validator\\IBlockValidator';
break;
case 'HLBLOCK':
$builder = 'Citfact\\Form\\Builder\\UserFieldBuilder';
$storage = 'Citfact\\Form\\Storage\\HighLoadBlockStorage';
$validator = 'Citfact\\Form\\Validator\\UserFieldValidator';
break;
case 'CUSTOM':
$builder = $this->params->get('BUILDER') ?: Config\Option::get('citfact.form', 'BUILDER');
$storage = $this->params->get('STORAGE') ?: Config\Option::get('citfact.form', 'STORAGE');
$validator = $this->params->get('VALIDATOR') ?: Config\Option::get('citfact.form', 'VALIDATOR');
break;
}
$mailer = new Mailer($this->params, new \CEventType(), new \CEvent());
$form = new Form($this->params, new $builder(), new $validator(), new $storage());
$form->setMailer($mailer);
return $form;
}
示例7: AddBlogPost
public static function AddBlogPost($arFields)
{
if (!is_array($_POST)) {
$_POST = array();
}
$_POST = array_merge($_POST, array("apply" => "Y", "decode" => "N"), $arFields);
$strPathToPost = COption::GetOptionString("socialnetwork", "userblogpost_page", false, SITE_ID);
$strPathToSmile = COption::GetOptionString("socialnetwork", "smile_page", false, SITE_ID);
$BlogGroupID = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, SITE_ID);
$arBlogComponentParams = array("IS_REST" => "Y", "ID" => "new", "PATH_TO_POST" => $strPathToPost, "PATH_TO_SMILE" => $strPathToSmile, "GROUP_ID" => $BlogGroupID, "USER_ID" => $GLOBALS["USER"]->GetID(), "USE_SOCNET" => "Y", "MICROBLOG" => "Y");
ob_start();
$result = $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:socialnetwork.blog.post.edit", "", $arBlogComponentParams, false, array("HIDE_ICONS" => "Y"));
ob_end_clean();
if (!$result) {
throw new Exception('Error');
} else {
if (isset($arFields["FILES"]) && \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk') && ($storage = \Bitrix\Disk\Driver::getInstance()->getStorageByUserId($GLOBALS["USER"]->GetID())) && ($folder = $storage->getFolderForUploadedFiles($GLOBALS["USER"]->GetID()))) {
// upload to storage
$arResultFile = array();
foreach ($arFields["FILES"] as $tmp) {
$arFile = CRestUtil::saveFile($tmp);
if (is_array($arFile)) {
$file = $folder->uploadFile($arFile, array('NAME' => $arFile["name"], 'CREATED_BY' => $GLOBALS["USER"]->GetID()), array(), true);
if ($file) {
$arResultFile[] = \Bitrix\Disk\Uf\FileUserType::NEW_FILE_PREFIX . $file->getId();
}
}
}
if (!empty($arResultFile)) {
CBlogPost::Update($result, array("HAS_PROPS" => "Y", "UF_BLOG_POST_FILE" => $arResultFile));
}
}
return $result;
}
}
示例8: __construct
public function __construct()
{
$window = (int) Option::get('security', 'hotp_user_window', 10);
if ($window && $window > 0) {
$this->window = $window;
}
}
示例9: reset
public function reset()
{
$this->isPersistent = false;
if ($this->name !== '') {
Main\Config\Option::delete('crm', array('name' => $this->name));
}
}
示例10: needProxyToDiskByDocType
private static function needProxyToDiskByDocType($documentType)
{
if (!(\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk'))) {
return false;
}
if (empty($documentType)) {
return false;
}
$storage = null;
if (substr($documentType, 0, 7) == 'STORAGE') {
$storageId = (int) substr($documentType, 8);
if ($storageId) {
$storage = \Bitrix\Disk\Storage::loadById($storageId);
}
if ($storage) {
return $storage;
}
}
list(, $iblockId, $typeLib, $entityId) = explode('_', $documentType);
if ($typeLib == 'user') {
$storage = \Bitrix\Disk\Driver::getInstance()->getStorageByUserId($entityId);
} elseif ($typeLib == 'group') {
$storage = \Bitrix\Disk\Driver::getInstance()->getStorageByGroupId($entityId);
} else {
return false;
}
return $storage;
}
示例11: onBeforeElementAddHandler
static function onBeforeElementAddHandler($arFields)
{
$IBLOCK_ID = Config\Option::get("citfact.replaceurl", "IBLOCK_ID", "");
$SECTION_ID = Config\Option::get("citfact.replaceurl", "SECTION_BREND_ID", "BRENDI");
$CODE_PROP = Config\Option::get("citfact.replaceurl", "PROPERTY_CODE_BRENDI", "BRENDI");
if ($IBLOCK_ID == $arFields["IBLOCK_ID"]) {
$propertyBrand = \CIBlockProperty::GetByID($CODE_PROP, $arFields["IBLOCK_ID"]);
if ($arResultProperty = $propertyBrand->GetNext()) {
$propertyBrandValue = \CIBlockPropertyEnum::GetByID($arFields["PROPERTY_VALUES"][$arResultProperty["ID"]][0]["VALUE"]);
}
$rqParentSection = \CIBlockSection::GetByID($SECTION_ID);
if ($arParentSection = $rqParentSection->GetNext()) {
$arFilter = array('IBLOCK_ID' => $arParentSection['IBLOCK_ID'], '>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'], '<RIGHT_MARGIN' => $arParentSection['RIGHT_MARGIN'], '>DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']);
// выберет потомков без учета активности
$rqSectChild = \CIBlockSection::GetList(array('left_margin' => 'asc'), $arFilter);
while ($arSectChild = $rqSectChild->GetNext()) {
$arSections[$arSectChild["NAME"]] = $arSectChild["ID"];
}
}
if (array_key_exists($propertyBrandValue["VALUE"], $arSections)) {
$arFields["IBLOCK_SECTION"][] = $arSections[$propertyBrandValue["VALUE"]];
} else {
$arParams = array("replace_space" => "-", "replace_other" => "-");
$trans = \Cutil::translit($propertyBrandValue["VALUE"], "ru", $arParams);
$bs = new \CIBlockSection();
$arFieldsNewSection = array("ACTIVE" => "Y", "IBLOCK_SECTION_ID" => $SECTION_ID, "IBLOCK_ID" => $IBLOCK_ID, "NAME" => $propertyBrandValue["VALUE"], "CODE" => $trans);
$resultAdd = $bs->Add($arFieldsNewSection);
$arFields["IBLOCK_SECTION"][] = $resultAdd;
}
}
return true;
}
示例12: actualizeAgent
/**
* @param null $mailingId
* @param null $mailingChainId
* @throws \Bitrix\Main\ArgumentException
*/
public static function actualizeAgent($mailingId = null, $mailingChainId = null)
{
$agent = new \CAgent();
$isSendByTimeMethodCron = \Bitrix\Main\Config\Option::get("sender", "auto_method") === 'cron';
$arFilter = array();
if ($mailingId) {
$arFilter['=MAILING_ID'] = $mailingId;
}
if ($mailingChainId) {
$arFilter['=ID'] = $mailingChainId;
}
$mailingChainDb = MailingChainTable::getList(array('select' => array('ID', 'STATUS', 'AUTO_SEND_TIME', 'MAILING_ACTIVE' => 'MAILING.ACTIVE'), 'filter' => $arFilter));
while ($mailingChain = $mailingChainDb->fetch()) {
$agentName = static::getAgentName($mailingChain['ID']);
$rsAgents = $agent->GetList(array("ID" => "DESC"), array("MODULE_ID" => "sender", "NAME" => $agentName));
while ($arAgent = $rsAgents->Fetch()) {
$agent->Delete($arAgent["ID"]);
}
if ($isSendByTimeMethodCron || empty($mailingChain['AUTO_SEND_TIME'])) {
continue;
}
if ($mailingChain['MAILING_ACTIVE'] == 'Y' && $mailingChain['STATUS'] == MailingChainTable::STATUS_SEND) {
if (!empty($mailingChain['AUTO_SEND_TIME'])) {
$dateExecute = $mailingChain['AUTO_SEND_TIME'];
} else {
$dateExecute = "";
}
$interval = \Bitrix\Main\Config\Option::get('sender', 'auto_agent_interval', "0");
$agent->AddAgent($agentName, "sender", "N", intval($interval), null, "Y", $dateExecute);
}
}
}
示例13: setPageMeta
public static function setPageMeta($sectionId, $propertyValues)
{
$page = self::getPageByUrl($GLOBALS['APPLICATION']->GetCurPage(false));
if (!$page) {
$seoTitleTemplate = Option::get('xpage.seofilter', 'SEO_TITLE', null);
$seoDescriptionTemplate = Option::get('xpage.seofilter', 'SEO_DESCRIPTION', null);
$seoKeywordsTemplate = Option::get('xpage.seofilter', 'SEO_KEYWORDS', null);
$pageTitleTemplate = Option::get('xpage.seofilter', 'SEO_H1', null);
$page['PAGE_TITLE'] = self::compileTemplate($seoTitleTemplate, $sectionId, $propertyValues);
$page['PAGE_TITLE_H1'] = self::compileTemplate($pageTitleTemplate, $sectionId, $propertyValues);
$page['META_KEYWORDS'] = self::compileTemplate($seoKeywordsTemplate, $sectionId, $propertyValues);
$page['META_DESCRIPTION'] = self::compileTemplate($seoDescriptionTemplate, $sectionId, $propertyValues);
}
if ($page['PAGE_TITLE_H1']) {
$GLOBALS['APPLICATION']->SetTitle(trim($page['PAGE_TITLE_H1']));
}
if ($page['PAGE_TITLE']) {
$GLOBALS['APPLICATION']->SetPageProperty('title', trim($page['PAGE_TITLE']));
}
if ($page['META_KEYWORDS']) {
$GLOBALS['APPLICATION']->SetPageProperty('keywords', trim($page['META_KEYWORDS']));
}
if ($page['META_DESCRIPTION']) {
$GLOBALS['APPLICATION']->SetPageProperty('description', trim($page['META_DESCRIPTION']));
}
}
示例14: hasProperFilename
protected function hasProperFilename($filename)
{
if (!$this->filename_pattern) {
$this->filename_pattern = Option::get(UM_BM_MODULE_NAME, 'migration_filename_regexp', self::DEFAULT_FILENAME_PATTERN);
}
return preg_match($this->filename_pattern, $filename);
}
示例15: __construct
public function __construct()
{
$interval = (int) Option::get('security', 'totp_interval');
if ($interval && $interval > 0) {
$this->interval = $interval;
}
}