本文整理汇总了PHP中CLanguage类的典型用法代码示例。如果您正苦于以下问题:PHP CLanguage类的具体用法?PHP CLanguage怎么用?PHP CLanguage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CLanguage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkParams
/**
* @param array $langId
* @return mixed|void
* @throws BimException
* @internal param array $params
*/
public function checkParams($langId)
{
$lang = new \CLanguage();
if (!isset($langId) || empty($langId)) {
throw new BimException('В параметрах не найден langId');
}
$this->ownerItemDbData = array();
$langDbRes = $lang->GetList($by = "lid", $order = "desc", array('LID' => $langId));
if ($langDbRes === false || !$langDbRes->SelectedRowsCount()) {
throw new BimException('Не найден язык системы с id = ' . $langId);
}
$langData = $langDbRes->Fetch();
$this->ownerItemDbData = $langData;
}
示例2: Delete
/**
* Удаление
*
* @param $ID
* @return array
* @throws BimException
*/
public static function Delete($ID)
{
$obLang = new \CLanguage();
if ($ID) {
$dbLang = $obLang->GetList($by = "lid", $order = "desc", array('ID' => $ID));
if ($arLang = $dbLang->Fetch()) {
$res = $obLang->Delete($ID);
if (!$res) {
throw new BimException($obLang->LAST_ERROR);
}
}
} else {
throw new BimException("Language ID is empty");
}
}
示例3: Add
/**
* Add
* @param $arFields
* @return bool
* @throws \Exception
*/
public static function Add($arFields)
{
if (!isset($arFields['SECTIONS']) || empty($arFields['SECTIONS'])) {
$arFields['SECTIONS'] = 'Y';
}
if (!isset($arFields['IN_RSS']) || empty($arFields['IN_RSS'])) {
$arFields['IN_RSS'] = 'N';
}
if (isset($arFields['SORT'])) {
if (!is_int($arFields['SORT'])) {
if (intval($arFields['SORT'])) {
$arFields['SORT'] = intval($arFields['SORT']);
} else {
$arFields['SORT'] = 500;
}
}
} else {
$arFields['SORT'] = 500;
}
if (!isset($arFields['LANG']) || empty($arFields['LANG'])) {
$langDefaults = array('ru' => array('NAME' => 'Название', 'SECTION_NAME' => 'Разделы', 'ELEMENT_NAME' => 'Элементы'), 'en' => array('NAME' => 'Common', 'SECTION_NAME' => 'Sections', 'ELEMENT_NAME' => 'Elements'));
$l = \CLanguage::GetList($lby = "sort", $lorder = "asc");
while ($arIBTLang = $l->GetNext()) {
if (array_key_exists($arIBTLang["LID"], $langDefaults)) {
$arFields["LANG"][$arIBTLang["LID"]] = $langDefaults[$arIBTLang["LID"]];
}
}
}
$CIblockType = new \CIBlockType();
if ($CIblockType->Add($arFields)) {
return true;
} else {
throw new BimException($CIblockType->LAST_ERROR);
}
}
示例4: __wd_check_uf_use_bp_property
function __wd_check_uf_use_bp_property($iblock_id)
{
$iblock_id = intval($iblock_id);
$db_res = CUserTypeEntity::GetList(array($by=>$order), array("ENTITY_ID" => "IBLOCK_".$iblock_id."_SECTION", "FIELD_NAME" => "UF_USE_BP"));
if (!$db_res || !($res = $db_res->GetNext()))
{
$arFields = Array(
"ENTITY_ID" => "IBLOCK_".$iblock_id."_SECTION",
"FIELD_NAME" => "UF_USE_BP",
"USER_TYPE_ID" => "string",
"MULTIPLE" => "N",
"MANDATORY" => "N",
"SETTINGS" => array("DEFAULT_VALUE" => "Y"));
$arFieldName = array();
$rsLanguage = CLanguage::GetList($by, $order, array());
while($arLanguage = $rsLanguage->Fetch()):
// GetMessage("SONET_UF_USE_BP");
$dir = str_replace(array("\\", "//"), "/", dirname(__FILE__));
$dirs = explode("/", $dir);
array_pop($dirs);
$file = trim(implode("/", $dirs)."/lang/".$arLanguage["LID"]."/include/webdav_settings.php");
$tmp_mess = __IncludeLang($file, true);
$arFieldName[$arLanguage["LID"]] = (empty($tmp_mess["SONET_UF_USE_BP"]) ? "Use Business Process" : $tmp_mess["SONET_UF_USE_BP"]);
endwhile;
$arFields["EDIT_FORM_LABEL"] = $arFieldName;
$obUserField = new CUserTypeEntity;
$obUserField->Add($arFields);
$GLOBALS["USER_FIELD_MANAGER"]->arFieldsCache = array();
}
}
示例5: installEvents
/**
* Creates events for sending e-mail.
* @return bool
*/
public static function installEvents()
{
$dbEvent = \CEventMessage::GetList($b = "ID", $order = "ASC", array("EVENT_NAME" => "SALE_EBAY_ERROR"));
if (!$dbEvent->Fetch()) {
$langs = \CLanguage::GetList($b = "", $o = "");
while ($lang = $langs->Fetch()) {
$lid = $lang["LID"];
$obEventType = new \CEventType();
$obEventType->Add(array("EVENT_NAME" => "SALE_EBAY_ERROR", "NAME" => Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_ERROR"), "LID" => $lid, "DESCRIPTION" => "\n\t\t\t\t\t#ERROR_TYPE# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_ERROR_TYPE") . "\n\t\t\t\t\t#ERROR_DETAILS# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_ERROR_DETAIL") . "\n\t\t\t\t\t#EMAIL_FROM# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_FROM") . "\n\t\t\t\t\t#EMAIL_TO# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_TO") . "\n\t\t\t\t\t#BCC# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_BCC")));
$arSites = array();
$sites = \CSite::GetList($b = "", $o = "", array("LANGUAGE_ID" => $lid));
while ($site = $sites->Fetch()) {
$arSites[] = $site["LID"];
}
if (count($arSites) > 0) {
$arr = array();
$arr["ACTIVE"] = "Y";
$arr["EVENT_NAME"] = "SALE_EBAY_ERROR";
$arr["LID"] = $arSites;
$arr["EMAIL_FROM"] = "#DEFAULT_EMAIL_FROM#";
$arr["EMAIL_TO"] = "#EMAIL_TO#";
$arr["BCC"] = "#BCC#";
$arr["SUBJECT"] = "#SITE_NAME# " . Loc::getMessage("SALE_EBAY_EVNT_MSG_SBUJ']") . ".";
$arr["BODY_TYPE"] = "text";
$arr["MESSAGE"] = Loc::getMessage("SALE_EBAY_EVNT_MSG_INFO_SITE") . " #SITE_NAME#.\n\n" . Loc::getMessage("SALE_EBAY_EVNT_MSG") . ":\n\n" . "#ERROR_TYPE#\n\n" . "#ERROR_DETAILS#";
$obTemplate = new \CEventMessage();
$obTemplate->Add($arr);
}
}
}
return true;
}
示例6: stemming_init
function stemming_init($sLang = "ru")
{
static $arStemFunc = false;
//Init all languages
if ($arStemFunc === false) {
$arStemFunc = array();
$rsLanguages = CLanguage::GetList($b = "", $o = "");
while ($arLanguage = $rsLanguages->Fetch()) {
stemming_init($arLanguage["LID"]);
}
}
//Check if language was not used
if ($sLang !== false && !isset($arStemFunc[$sLang])) {
$stemming_function_suf = $sLang;
if (!function_exists("stemming_" . $sLang)) {
$strFileName = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/" . $sLang . "/search/stemming.php";
if (file_exists($strFileName)) {
@(include $strFileName);
}
if (!function_exists("stemming_" . $sLang)) {
$strFileName = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/search/tools/" . $sLang . "/stemming.php";
if (file_exists($strFileName)) {
@(include $strFileName);
}
if (!function_exists("stemming_" . $sLang)) {
$stemming_function_suf = "default";
}
}
}
$stemming_stop_function = "stemming_stop_" . $sLang;
if (!function_exists($stemming_stop_function)) {
$stemming_stop_function = "stemming_stop_default";
}
$stemming_upper_function = "stemming_upper_" . $sLang;
if (!function_exists($stemming_upper_function)) {
$stemming_upper_function = "stemming_upper_default";
}
$letters = stemming_letter_default();
$stemming_letter_function = "stemming_letter_" . $sLang;
if (function_exists($stemming_letter_function)) {
$letters .= $stemming_letter_function();
}
$letters .= COption::GetOptionString("search", "letters");
if (function_exists($stemming_letter_function)) {
$abc = $stemming_letter_function();
} else {
$abc = "";
}
if (strlen($abc) <= 0) {
$abc = stemming_letter_default();
}
$arStemFunc[$sLang] = array("stem" => "stemming_" . $stemming_function_suf, "stop" => $stemming_stop_function, "upper" => $stemming_upper_function, "letters" => $letters, "pcre_letters" => str_replace(array("\\", "-", "^", "]", "/"), array("\\\\", "\\-", "\\^", "\\]", "\\/"), $letters), "abc" => $abc, "pcre_abc" => str_replace(array("\\", "-", "^", "]", "/"), array("\\\\", "\\-", "\\^", "\\]", "\\/"), $abc));
}
if ($sLang === false) {
return $arStemFunc;
} else {
return $arStemFunc[$sLang];
}
}
示例7: getAllLangIDs
protected static function getAllLangIDs()
{
if (self::$allLangIDs !== null) {
return self::$allLangIDs;
}
self::$allLangIDs = array();
$sort = 'sort';
$order = 'asc';
$langEntity = new \CLanguage();
$dbLangs = $langEntity->GetList($sort, $order);
while ($lang = $dbLangs->Fetch()) {
if (isset($lang['LID'])) {
self::$allLangIDs[] = $lang['LID'];
}
}
return self::$allLangIDs;
}
示例8: GetLang
function GetLang($cur_dir = false, $cur_host = false)
{
global $DB, $lang, $MAIN_LANGS_CACHE, $MAIN_LANGS_ADMIN_CACHE;
if ($cur_dir === false) {
$cur_dir = $this->GetCurDir();
}
if ($cur_host === false) {
$cur_host = $_SERVER["HTTP_HOST"];
}
if (strpos($cur_dir, FX_ROOT . "/admin/") === 0 || strpos($cur_dir, FX_ROOT . "/updates/") === 0 || defined("ADMIN_SECTION") && ADMIN_SECTION === true || defined("FX_PUBLIC_TOOLS") && FX_PUBLIC_TOOLS === true) {
//if admin section
//lang by global var
if (strlen($lang) <= 0) {
$lang = COption::GetOptionString("main", "admin_lid", "ru");
}
$R = CLanguage::GetList($o, $b, array("LID" => $lang, "ACTIVE" => "Y"));
if ($res = $R->Fetch()) {
$MAIN_LANGS_ADMIN_CACHE[$res["LID"]] = $res;
return $res;
}
//no lang param - get default
$R = CLanguage::GetList($by = "def", $order = "desc", array("ACTIVE" => "Y"));
if ($res = $R->Fetch()) {
$MAIN_LANGS_ADMIN_CACHE[$res["LID"]] = $res;
return $res;
}
//core default
return array("en", "MM/DD/YYYY", "MM/DD/YYYY HH24:MI:SS");
} else {
// all other sections
$arURL = parse_url("http://" . $cur_host);
if ($arURL["scheme"] == "" && strlen($arURL["host"]) > 0) {
$CURR_DOMAIN = $arURL["host"];
} else {
$CURR_DOMAIN = $cur_host;
}
if (strpos($CURR_DOMAIN, ':') > 0) {
$CURR_DOMAIN = substr($CURR_DOMAIN, 0, strpos($CURR_DOMAIN, ':'));
}
$CURR_DOMAIN = trim($CURR_DOMAIN, "\t\r\n .");
$strSql = "SELECT L.*, L.LID as ID, L.LID as SITE_ID, " . "\tC.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION " . "FROM b_lang L " . "\tLEFT JOIN b_lang_domain LD ON L.LID=LD.LID AND '" . $DB->ForSql($CURR_DOMAIN, 255) . "' LIKE CONCAT('%', LD.DOMAIN) " . "\tINNER JOIN b_culture C ON C.ID=L.CULTURE_ID " . "WHERE " . "\t('" . $DB->ForSql($cur_dir) . "' LIKE CONCAT(L.DIR, '%') OR LD.LID IS NOT NULL)" . "\tAND L.ACTIVE='Y' " . "ORDER BY " . "\tIF((L.DOMAIN_LIMITED='Y' AND LD.LID IS NOT NULL) OR L.DOMAIN_LIMITED<>'Y', " . "\t\tIF('" . $DB->ForSql($cur_dir) . "' LIKE CONCAT(L.DIR, '%'), 3, 1), " . "\t\tIF('" . $DB->ForSql($cur_dir) . "' LIKE CONCAT(L.DIR, '%'), 2, 0) " . "\t) DESC, " . "\tLENGTH(L.DIR) DESC, " . "\tL.DOMAIN_LIMITED DESC, " . "\tL.SORT, " . "\tLENGTH(LD.DOMAIN) DESC ";
$R = $DB->Query($strSql, false, "File: " . __FILE__ . " Line:" . __LINE__);
$res = $R->Fetch();
if ($res) {
$MAIN_LANGS_CACHE[$res["LID"]] = $res;
return $res;
}
//get default site
$strSql = "SELECT L.*, L.LID as ID, L.LID as SITE_ID, " . "\tC.FORMAT_DATE, C.FORMAT_DATETIME, C.FORMAT_NAME, C.WEEK_START, C.CHARSET, C.DIRECTION " . "FROM b_lang L, b_culture C " . "WHERE C.ID=L.CULTURE_ID AND L.ACTIVE='Y' " . "ORDER BY L.DEF DESC, L.SORT";
$R = $DB->Query($strSql);
while ($res = $R->Fetch()) {
$MAIN_LANGS_CACHE[$res["LID"]] = $res;
return $res;
}
}
return array("en", "MM/DD/YYYY", "MM/DD/YYYY HH24:MI:SS");
}
示例9: CleanCache
protected static function CleanCache()
{
global $CACHE_MANAGER;
$by = 'lid';
$order = 'asc';
$rsLangs = CLanguage::GetList($by, $order);
while ($arLang = $rsLangs->Fetch()) {
$CACHE_MANAGER->Clean("admin_notify_list_" . $arLang['LANGUAGE_ID']);
}
$CACHE_MANAGER->Clean("admin_notify_list");
}
示例10: __cat_LoadMess
function __cat_LoadMess($__current_file)
{
$__current_dir = dirname($__current_file);
$__current_file = basename($__current_file);
$arMess = array();
$dbLang = CLanguage::GetList($by = 'SORT', $order = 'ASC');
while ($arLang = $dbLang->Fetch()) {
$arMess[$arLang['LID']] = __IncludeLang($__current_dir . "/lang/" . $arLang['LID'] . '/' . $__current_file, true);
}
return $arMess;
}
示例11: isValidLang
function isValidLang($lang)
{
$rsLang = CLanguage::GetList($by = "sort", $order = "desc");
$is_valid_lang = false;
while ($arLang = $rsLang->Fetch()) {
if ($lang == $arLang["LID"]) {
$is_valid_lang = true;
break;
}
}
return $is_valid_lang;
}
示例12: getLangs
public function getLangs($filter = array())
{
$by = 'def';
$order = 'desc';
$lids = array();
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$dbRes = \CLanguage::GetList($by, $order, $filter);
while ($aItem = $dbRes->Fetch()) {
$lids[] = $aItem;
}
return $lids;
}
示例13: CreateForm
function CreateForm($arForm, $arFormFields, $langFile)
{
if (!CModule::IncludeModule("form")) {
return false;
}
// set defaults
$arFieldDefaults = array("ACTIVE" => "Y", "C_SORT" => 0, "ADDITIONAL" => "N", "TITLE_TYPE" => "text", "IN_RESULTS_TABLE" => "Y", "IN_EXCEL_TABLE" => "Y");
foreach ($arFormFields as $key => $arField) {
if ($arFormFields['ADDITIONAL'] == 'Y' && !is_set($arFormFields['C_SORT'])) {
$arFormFields['C_SORT'] = 5000;
}
$arFieldDefaults["C_SORT"] += 100;
$arFormFields[$key] = array_merge($arFieldDefaults, $arField);
$arFormFields[$key]["TITLE"] = GetMessage($arField["SID"] . "_QUESTION");
}
$rsLanguage = CLanguage::GetList($by, $order, array());
while ($arLanguage = $rsLanguage->Fetch()) {
WizardServices::IncludeServiceLang($langFile, $arLanguage["LID"]);
$arForm["arMENU"][$arLanguage["LID"]] = GetMessage(substr($arForm["SID"], 0, -3) . "_MENU_NAME");
}
$dbForm = CForm::GetBySID($arForm["SID"]);
if ($dbForm->Fetch()) {
return;
}
WizardServices::IncludeServiceLang("status.php");
if ($formID = CForm::Set($arForm, false, "N")) {
// setup form fields
foreach ($arFormFields as $key => $arField) {
$arField["FORM_ID"] = $formID;
$fieldID = CFormField::Set($arField, false, "N");
}
if ($arTemplates = CForm::SetMailTemplate($formID)) {
CForm::Set(array('SID' => $arForm['SID'], 'arMAIL_TEMPLATE' => $arTemplates), $formID, 'N');
}
$arStatuses = array(array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_NEW"), "C_SORT" => 100, "ACTIVE" => "Y", "DEFAULT_VALUE" => "Y", "CSS" => "statusgray", "arPERMISSION_VIEW" => array(0), "arPERMISSION_MOVE" => array(0), "arPERMISSION_EDIT" => array(0), "arPERMISSION_DELETE" => array(0)), array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_RECEIVED"), "C_SORT" => 200, "ACTIVE" => "Y", "DEFAULT_VALUE" => "N", "CSS" => "statusblue", "arPERMISSION_VIEW" => array(0)), array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_DONE"), "C_SORT" => 300, "ACTIVE" => "Y", "DEFAULT_VALUE" => "N", "CSS" => "statusgreen", "arPERMISSION_VIEW" => array(0)), array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_REFUSE"), "C_SORT" => 400, "ACTIVE" => "Y", "DEFAULT_VALUE" => "N", "CSS" => "statusred", "arPERMISSION_VIEW" => array(0)));
foreach ($arStatuses as $key => $arStatus) {
if ($STATUS_ID = CFormStatus::Set($arStatus, false, "N")) {
if ($arStatus['DEFAULT_VALUE'] == 'N' && ($arTemplates = CFormStatus::SetMailTemplate($formID, $STATUS_ID))) {
foreach ($arTemplates as $TEMPLATE_ID) {
if (null == $em) {
$em = new CEventMessage();
}
$em->Update($TEMPLATE_ID, array('MESSAGE' => GetMessage('STATUS_MESSAGE')));
}
CFormStatus::Set(array('FORM_ID' => $formID, 'arMAIL_TEMPLATE' => $arTemplates), $STATUS_ID, 'N');
}
}
}
}
return $formID;
}
示例14: GetDefaultCurrencyID
public static function GetDefaultCurrencyID()
{
if (self::$DEFAULT_CURRENCY_ID !== '') {
return self::$DEFAULT_CURRENCY_ID;
}
self::$DEFAULT_CURRENCY_ID = 'USD';
$rsLang = CLanguage::GetByID('ru');
if ($arLang = $rsLang->Fetch()) {
self::$DEFAULT_CURRENCY_ID = 'RUB';
} else {
$rsLang = CLanguage::GetByID('de');
if ($arLang = $rsLang->Fetch()) {
self::$DEFAULT_CURRENCY_ID = 'EUR';
}
}
return self::$DEFAULT_CURRENCY_ID;
}
示例15: InstallFiles
function InstallFiles()
{
if ($_ENV["COMPUTERNAME"] != 'BX') {
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/admin", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/admin", false);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/images", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/images/controller", true, true);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/themes", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/themes", true, true);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/components", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", True, True);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/activities", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/activities", True, True);
if (IsModuleInstalled('bizproc')) {
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/bizproc/templates", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/bizproc/templates", true, true);
$langs = CLanguage::GetList($b = "", $o = "");
while ($lang = $langs->Fetch()) {
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/lang/" . $lang["LID"] . "/install/bizproc/templates", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/bizproc/lang/" . $lang["LID"] . "/templates", true, true);
}
}
}
return true;
}