本文整理汇总了PHP中COption::GetOptionString方法的典型用法代码示例。如果您正苦于以下问题:PHP COption::GetOptionString方法的具体用法?PHP COption::GetOptionString怎么用?PHP COption::GetOptionString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COption
的用法示例。
在下文中一共展示了COption::GetOptionString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetConfig
function GetConfig($siteId = false)
{
$shopLocationId = CSaleHelper::getShopLocationId($siteId);
$arShopLocation = CSaleHelper::getLocationByIdHitCached($shopLocationId);
if (!$arShopLocation) {
$arShopLocation = array();
}
$shopPrevLocationId = COption::GetOptionString('sale', 'delivery_rus_post_first_prev_loc', 0);
/* if shop's location was changed */
if ($shopPrevLocationId != $shopLocationId) {
COption::SetOptionString('sale', 'delivery_rus_post_first_prev_loc', $shopLocationId);
COption::RemoveOption('sale', 'delivery_rus_post_first_tarifs');
}
$arConfig = array('CONFIG_GROUPS' => array('wrapper' => GetMessage('SALE_DH_RPF_WRP_TITLE')));
$aviableBoxes = self::getAviableBoxes();
foreach ($aviableBoxes as $boxId => $arBox) {
CSaleDeliveryHelper::makeBoxConfig($boxId, $arBox, 'wrapper', $arConfig);
}
$arConfig['CONFIG']['tarif_section_1'] = array('TYPE' => 'SECTION', 'TITLE' => GetMessage('SALE_DH_RPF_TARIFS'), 'GROUP' => 'wrapper');
$arTarifs = CSaleHelper::getOptionOrImportValues('delivery_rus_post_first_tarifs', array('CDeliveryRusPostFirst', 'getTarifsByRegionFromCsv'), array($arShopLocation));
foreach (self::$TARIFS as $arTarif) {
$tarifId = $arTarif[self::$TARIF_IDX];
$arConfig['CONFIG']['TARIF_' . $tarifId] = array('TYPE' => 'STRING', 'DEFAULT' => isset($arTarifs[$tarifId]) ? $arTarifs[$tarifId] : '0', 'TITLE' => $arTarif[self::$TARIF_DESCR], 'GROUP' => 'wrapper');
}
/* Additional services */
foreach (self::$SERVICES as $serviceId => $arService) {
$tarifId = $arService[self::$TARIF_IDX];
$arConfig['CONFIG']['service_' . $tarifId . '_section'] = array('TYPE' => 'SECTION', 'TITLE' => $arService[self::$TARIF_DESCR], 'GROUP' => 'wrapper');
$arConfig['CONFIG']['service_' . $tarifId . '_enabled'] = array('TYPE' => 'CHECKBOX', 'TITLE' => GetMessage('SALE_DH_RPF_SRV_ALLOW'), 'GROUP' => 'wrapper', 'DEFAULT' => $serviceId == 'NOTIFICATION_REG' ? 'N' : 'Y', 'HIDE_BY_NAMES' => array('service_' . $tarifId . '_value'));
$arConfig['CONFIG']['service_' . $tarifId . '_value'] = array('TYPE' => 'STRING', 'TITLE' => GetMessage('SALE_DH_RPF_SRV_PRICE'), 'GROUP' => 'wrapper', 'DEFAULT' => isset($arTarifs[$tarifId]) ? $arTarifs[$tarifId] : '0');
}
return $arConfig;
}
示例2: CSeoPageChecker
function CSeoPageChecker($site, $url, $get = true, $check_errors = true)
{
global $APPLICATION;
if (CModule::IncludeModule('search')) {
$this->bSearch = true;
} else {
$APPLICATION->ThrowException(GetMessage('SEO_ERROR_NO_SEARCH'));
}
// don't return false or set bError!
$this->__bCheckErrors = $check_errors;
$this->__site = $site;
$dbRes = CSite::GetByID($this->__site);
if ($arRes = $dbRes->Fetch()) {
$this->__lang = $arRes['LANGUAGE_ID'];
$this->__server_name = $arRes['SERVER_NAME'];
if (strlen($this->__server_name) <= 0) {
$this->__server_name = COption::GetOptionString('main', 'server_name', '');
}
if (strlen($this->__server_name) > 0) {
$this->__url = 'http://' . $this->__server_name . $url;
return $get ? $this->GetHTTPData() : true;
} else {
$this->bError = true;
$APPLICATION->ThrowException(str_replace('#SITE_ID#', $this->__site, GetMessage('SEO_ERROR_NO_SERVER_NAME')));
return false;
}
}
return false;
}
示例3: GetPHPFilesMark
public static function GetPHPFilesMark()
{
$res = array();
$file_name = $_SERVER["DOCUMENT_ROOT"] . "/" . COption::GetOptionString("main", "upload_dir", "/upload/") . "/perfmon#i#.php";
$content = "<?\$s='" . str_repeat("x", 1024) . "';?><?/*" . str_repeat("y", 1024) . "*/?><?\$r='" . str_repeat("z", 1024) . "';?>";
for ($j = 0; $j < 4; $j++) {
$s1 = getmicrotime();
for ($i = 0; $i < 100; $i++) {
$fn = str_replace("#i#", $i, $file_name);
}
$e1 = getmicrotime();
$N1 = $e1 - $s1;
$s2 = getmicrotime();
for ($i = 0; $i < 100; $i++) {
//This is one op
$fn = str_replace("#i#", $i, $file_name);
$fh = fopen($fn, "wb");
fwrite($fh, $content);
fclose($fh);
include $fn;
unlink($fn);
}
$e2 = getmicrotime();
$N2 = $e2 - $s2;
if ($N2 > $N1) {
$res[] = 100 / ($N2 - $N1);
}
}
if (count($res)) {
return array_sum($res) / doubleval(count($res));
} else {
return 0;
}
}
示例4: 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;
}
}
示例5: InstallDB
function InstallDB()
{
global $DB, $APPLICATION;
$this->errors = false;
if (!$DB->Query("SELECT 'x' FROM b_seo_keywords", true)) {
$this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/seo/install/db/" . strtolower($DB->type) . "/install.sql");
}
if ($this->errors !== false) {
$APPLICATION->ThrowException(implode("", $this->errors));
return false;
}
RegisterModule("seo");
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/seo/install/tasks/install.php";
RegisterModuleDependences('main', 'OnPanelCreate', 'seo', 'CSeoEventHandlers', 'SeoOnPanelCreate');
if (COption::GetOptionString('seo', 'searchers_list', '') == '' && CModule::IncludeModule('statistic')) {
$arFilter = array('ACTIVE' => 'Y', 'NAME' => 'Google|MSN|Bing', 'NAME_EXACT_MATCH' => 'Y');
if (COption::GetOptionString('main', 'vendor') == '1c_bitrix') {
$arFilter['NAME'] .= '|Yandex';
}
$strSearchers = '';
$dbRes = CSearcher::GetList($by = 's_id', $order = 'asc', $arFilter, $is_filtered);
while ($arRes = $dbRes->Fetch()) {
$strSearchers .= ($strSearchers == '' ? '' : ',') . $arRes['ID'];
}
COption::SetOptionString('seo', 'searchers_list', $strSearchers);
}
return true;
}
示例6: InstallDB
function InstallDB($arParams = array())
{
global $DB, $DBType, $APPLICATION;
$this->errors = false;
// Database tables creation
if (!$DB->Query("SELECT 'x' FROM b_sec_iprule WHERE 1=0", true)) {
$this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/security/install/db/" . strtolower($DB->type) . "/install.sql");
}
if ($this->errors !== false) {
$APPLICATION->ThrowException(implode("<br>", $this->errors));
return false;
} else {
$this->InstallTasks();
RegisterModule("security");
RegisterModuleDependences("main", "OnUserDelete", "security", "CSecurityUser", "OnUserDelete");
RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "security", "CSecurityFilter", "GetAuditTypes");
RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "security", "CSecurityAntiVirus", "GetAuditTypes");
RegisterModuleDependences("main", "OnAdminInformerInsertItems", "security", "CSecurityFilter", "OnAdminInformerInsertItems");
RegisterModuleDependences("main", "OnAdminInformerInsertItems", "security", "CSecuritySiteChecker", "OnAdminInformerInsertItems");
CModule::IncludeModule("security");
//agents
CAgent::RemoveAgent("CSecuritySession::CleanUpAgent();", "security");
CAgent::Add(array("NAME" => "CSecuritySession::CleanUpAgent();", "MODULE_ID" => "security", "ACTIVE" => "Y", "AGENT_INTERVAL" => 1800, "IS_PERIOD" => "N"));
CAgent::RemoveAgent("CSecurityIPRule::CleanUpAgent();", "security");
CAgent::Add(array("NAME" => "CSecurityIPRule::CleanUpAgent();", "MODULE_ID" => "security", "ACTIVE" => "Y", "AGENT_INTERVAL" => 3600, "IS_PERIOD" => "N"));
if (!COption::GetOptionString("security", "ipcheck_disable_file")) {
COption::SetOptionString("security", "ipcheck_disable_file", "/bitrix/modules/ipcheck_disable_" . md5(mt_rand()));
}
CAgent::RemoveAgent("CSecurityFilter::ClearTmpFiles();", "security");
CSecurityFilter::SetActive(true);
CSecurityAntiVirus::SetActive(true);
return true;
}
}
示例7: __construct
public function __construct($docRoot)
{
foreach ($this->arParams as $key => $value) {
$paramValue = \COption::GetOptionString(self::$MODULE_NAME, $key);
if (!$paramValue) {
$this->errors .= \Helper::boldColorText("Not value for {$key}", "red");
} elseif ($value == "dir") {
$this->arParams[$key] = $docRoot . $paramValue;
if ($key != 'LOG_FILE') {
if (!is_dir($this->arParams[$key])) {
if (!mkdir($this->arParams[$key])) {
$this->errors .= \Helper::boldColorText("Dir {$this->arParams[$key]} is absent", "red");
}
}
}
} else {
$this->arParams[$key] = $paramValue;
}
}
if (!empty($this->errors)) {
$logFile = $this->arParams['LOG_FILE'];
if ($logFile == 'dir') {
$logFile = $docRoot . '/local/logs/lot_info';
}
file_put_contents($this->errors, $logFile, FILE_APPEND);
throw new \Exception($this->errors);
}
}
示例8: GetAbsoluteRoot
public static function GetAbsoluteRoot()
{
if(defined('FX_TEMPORARY_FILES_DIRECTORY'))
return FX_TEMPORARY_FILES_DIRECTORY;
else
return $_SERVER["DOCUMENT_ROOT"]."/".(COption::GetOptionString("main", "upload_dir", "upload"))."/tmp";
}
示例9: checkAccountNumberValue
function checkAccountNumberValue($templateType, $number_data, $number_prefix)
{
$res = true;
switch ($templateType)
{
case 'NUMBER':
if (strlen($number_data) <= 0
|| strlen($number_data) > 7
|| !ctype_digit($number_data)
|| intval($number_data) < intval(COption::GetOptionString("sale", "account_number_data", ""))
)
$res = false;
break;
case 'PREFIX':
if (strlen($number_prefix) <= 0
|| strlen($number_prefix) > 7
|| preg_match('/[^a-zA-Z0-9_-]/', $number_prefix)
)
$res = false;
break;
}
return $res;
}
示例10: GetModuleConnection
public static function GetModuleConnection($module_id, $bModuleInclude = false)
{
$node_id = COption::GetOptionString($module_id, "dbnode_id", "N");
if (is_numeric($node_id)) {
if ($bModuleInclude) {
$status = COption::GetOptionString($module_id, "dbnode_status", "ok");
if ($status === "move") {
return false;
}
}
$moduleDB = CDatabase::GetDBNodeConnection($node_id, $bModuleInclude);
if (is_object($moduleDB)) {
$moduleDB->bModuleConnection = true;
return $moduleDB;
}
//There was an connection error
if ($bModuleInclude && CModule::IncludeModule('cluster')) {
CClusterDBNode::SetOffline($node_id);
}
//TODO: unclear what to return when node went offline
//in the middle of the hit.
return false;
} else {
return $GLOBALS["DB"];
}
}
示例11: CalcUserBonus
function CalcUserBonus($arConfigs)
{
global $DB;
$err_mess = (CRatings::err_mess())."<br>Function: CalcUserBonus<br>Line: ";
$communityLastVisit = COption::GetOptionString("main", "rating_community_last_visit", '90');
CRatings::AddComponentResults($arConfigs);
$strSql = "DELETE FROM b_rating_component_results WHERE RATING_ID = '".IntVal($arConfigs['RATING_ID'])."' AND COMPLEX_NAME = '".$DB->ForSql($arConfigs['COMPLEX_NAME'])."'";
$res = $DB->Query($strSql, false, $err_mess.__LINE__);
$strSql = "INSERT INTO b_rating_component_results (RATING_ID, MODULE_ID, RATING_TYPE, NAME, COMPLEX_NAME, ENTITY_ID, ENTITY_TYPE_ID, CURRENT_VALUE)
SELECT
'".IntVal($arConfigs['RATING_ID'])."' RATING_ID,
'".$DB->ForSql($arConfigs['MODULE_ID'])."' MODULE_ID,
'".$DB->ForSql($arConfigs['RATING_TYPE'])."' RATING_TYPE,
'".$DB->ForSql($arConfigs['NAME'])."' NAME,
'".$DB->ForSql($arConfigs['COMPLEX_NAME'])."' COMPLEX_NAME,
RB.ENTITY_ID as ENTITY_ID,
'".$DB->ForSql($arConfigs['ENTITY_ID'])."' ENTITY_TYPE_ID,
RB.BONUS*".floatval($arConfigs['CONFIG']['COEFFICIENT'])." CURRENT_VALUE
FROM
b_rating_user RB
LEFT JOIN b_user U ON U.ID = RB.ENTITY_ID AND U.ACTIVE = 'Y' AND U.LAST_LOGIN > DATE_SUB(NOW(), INTERVAL ".intval($communityLastVisit)." DAY)
WHERE
RB.RATING_ID = ".IntVal($arConfigs['RATING_ID'])."
AND U.ID IS NOT NULL
";
$res = $DB->Query($strSql, false, $err_mess.__LINE__);
return true;
}
示例12: __construct
public function __construct($arDBRecord = false)
{
parent::__construct($arDBRecord);
$DB = CDatabase::GetModuleConnection('statistic');
if (!$arDBRecord) {
$country_recs = COption::GetOptionString("statistic", "COUNTRY_INDEX_LOADED", "N");
if ($country_recs !== "Y") {
$rs = $DB->Query(CStatistics::DBTopSql("SELECT /*TOP*/ * FROM b_stat_country", 1));
if ($rs->Fetch()) {
$country_recs = "Y";
COption::SetOptionString("statistic", "COUNTRY_INDEX_LOADED", "Y");
}
}
$this->country_avail = $country_recs === "Y";
if ($this->country_avail) {
$city_recs = COption::GetOptionString("statistic", "CITY_INDEX_LOADED", "N");
if ($city_recs !== "Y") {
$rs = $DB->Query(CStatistics::DBTopSql("SELECT /*TOP*/ * FROM b_stat_city_ip", 1));
if ($rs->Fetch()) {
COption::SetOptionString("statistic", "CITY_INDEX_LOADED", "Y");
}
}
$this->city_avail = COption::GetOptionString("statistic", "CITY_INDEX_LOADED", "N") === "Y";
}
$this->is_installed = $this->country_avail;
}
}
示例13: IsTreelikeModerator
function IsTreelikeModerator()
{
global $USER;
if($USER->IsAdmin())
return true;
$currentGroups = array();
$currentGroups = $USER->GetUserGroupArray();
$arGroups = explode(',', COption::GetOptionString('prmedia.treelikecomments', 'moderators'));
$IsModerator = false;
if(count($arGroups) > 0){
foreach($currentGroups as $oneCurrent)
{
foreach($arGroups as $oneModerator)
{
if($oneModerator == $oneCurrent) $IsModerator = true;
}
}
}
return $IsModerator;
}
示例14: DoPayOrderFromAccount
static function DoPayOrderFromAccount($userId, $currency, $orderId, $orderSum, $arOptions, &$arErrors)
{
if (!array_key_exists("ONLY_FULL_PAY_FROM_ACCOUNT", $arOptions)) {
$arOptions["ONLY_FULL_PAY_FROM_ACCOUNT"] = COption::GetOptionString("sale", "ONLY_FULL_PAY_FROM_ACCOUNT", "N");
}
$dbUserAccount = CSaleUserAccount::GetList(array(), array("USER_ID" => $userId, "CURRENCY" => $currency));
$arUserAccount = $dbUserAccount->Fetch();
if (!$arUserAccount) {
return false;
}
if ($arUserAccount["CURRENT_BUDGET"] <= 0) {
return false;
}
if ($arOptions["ONLY_FULL_PAY_FROM_ACCOUNT"] == "Y" && doubleval($arUserAccount["CURRENT_BUDGET"]) < doubleval($orderSum)) {
return false;
}
$withdrawSum = CSaleUserAccount::Withdraw($userId, $orderSum, $currency, $orderId);
if ($withdrawSum > 0) {
$arFields = array("SUM_PAID" => $withdrawSum, "USER_ID" => $userId);
CSaleOrder::Update($orderId, $arFields);
if ($withdrawSum == $orderSum) {
CSaleOrder::PayOrder($orderId, "Y", False, False);
}
return true;
}
return false;
}
示例15: processActionInstallProcesses
protected function processActionInstallProcesses()
{
$this->iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id");
$this->checkPermission();
$this->checkRequiredPostParams(array('processes'));
if ($this->errorCollection->hasErrors()) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_CPAC_NOT_SELECTED_PROCESSES'))));
$this->sendJsonErrorResponse();
}
$siteId = SITE_ID;
if ($this->request->getPost('siteId')) {
$siteId = $this->request->getPost('siteId');
}
try {
$processes = $this->request->getPost('processes');
if (is_array($processes)) {
foreach ($processes as $filePath) {
\Bitrix\Lists\Importer::installProcess($filePath, $siteId);
}
} else {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_CPAC_INCORRECT_DATA'))));
}
} catch (Exception $e) {
$this->errorCollection->add(array(new Error($e->getMessage())));
}
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
$this->sendJsonSuccessResponse(array('message' => Loc::getMessage('LISTS_CPAC_MESSAGE_SUCCESS')));
}