本文整理汇总了PHP中CUtil类的典型用法代码示例。如果您正苦于以下问题:PHP CUtil类的具体用法?PHP CUtil怎么用?PHP CUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowPanel
function ShowPanel()
{
if ($GLOBALS["USER"]->IsAdmin() && COption::GetOptionString("main", "wizard_solution", "", SITE_ID) == "eshop")
{
$GLOBALS["APPLICATION"]->SetAdditionalCSS("/bitrix/wizards/bitrix/eshop/css/panel.css");
$arMenu = Array(
Array(
"ACTION" => "jsUtils.Redirect([], '".CUtil::JSEscape("/bitrix/admin/wizard_install.php?lang=".LANGUAGE_ID."&wizardSiteID=".SITE_ID."&wizardName=bitrix:eshop&".bitrix_sessid_get())."')",
"ICON" => "bx-popup-item-wizard-icon",
"TITLE" => GetMessage("STOM_BUTTON_TITLE_W1"),
"TEXT" => GetMessage("STOM_BUTTON_NAME_W1"),
)
);
$GLOBALS["APPLICATION"]->AddPanelButton(array(
"HREF" => "/bitrix/admin/wizard_install.php?lang=".LANGUAGE_ID."&wizardName=bitrix:eshop&wizardSiteID=".SITE_ID."&".bitrix_sessid_get(),
"ID" => "eshop_wizard",
"ICON" => "bx-panel-site-wizard-icon",
"MAIN_SORT" => 2500,
"TYPE" => "BIG",
"SORT" => 10,
"ALT" => GetMessage("SCOM_BUTTON_DESCRIPTION"),
"TEXT" => GetMessage("SCOM_BUTTON_NAME"),
"MENU" => $arMenu,
));
}
}
示例2: actionUpgradeversion
/**
* Upgrade version method
*/
public function actionUpgradeversion()
{
// check is newest
$aryVersionData = $this->actionHasnew(true);
$isok = 0;
$data = array();
$msg = "";
try {
if ($aryVersionData['ISOK'] !== 1 || empty($aryVersionData['DATA']['v'])) {
throw new CModelException(CUtil::i18n('exception,version_upgrad_withoutUpgrad'));
}
// get up to version
$strVersion = $aryVersionData['DATA']['v'];
if (empty($strVersion)) {
throw new CModelException(CUtil::i18n('exception,version_upgrad_upgradFaild'));
}
if ($strVersion <= CUR_VERSION_NUM) {
throw new CModelException(CUtil::i18n('exception,version_upgrad_withoutUpgrad'));
}
// execute upgrade
$command = SUDO_COMMAND . "cd " . WEB_ROOT . ";" . SUDO_COMMAND . "wget " . MAIN_DOMAIN . "/down/v{$strVersion}.zip;" . SUDO_COMMAND . "unzip -o v{$strVersion}.zip;" . SUDO_COMMAND . "rm -rf v{$strVersion}.zip;";
exec($command);
$isok = 1;
} catch (CModelException $e) {
$msg = $e->getMessage();
} catch (CException $e) {
$msg = NBT_DEBUG ? $e->getMessage() : CUtil::i18n('exception,sys_error');
}
header('Content-Type: text/html; charset=utf-8');
echo $this->encodeAjaxData($isok, $data, $msg);
exit;
}
示例3: __CrmFieldMultiEditRenderItem
function __CrmFieldMultiEditRenderItem($item, $mnemonic, $typeID, $referenceData, $editorID)
{
$itemID = isset($item['ID']) ? $item['ID'] : '';
$itemVal = isset($item['VALUE']) ? $item['VALUE'] : '';
?>
<div class="bx-crm-edit-fm-item">
<input type="text" class="bx-crm-edit-input" name="<?php
echo htmlspecialcharsbx($mnemonic);
?>
[<?php
echo htmlspecialcharsbx($typeID);
?>
][<?php
echo htmlspecialcharsbx($itemID);
?>
][VALUE]" value="<?php
echo htmlspecialcharsbx($itemVal);
?>
"><?php
echo SelectBoxFromArray(CUtil::JSEscape($mnemonic) . '[' . htmlspecialcharsbx($typeID) . '][' . htmlspecialcharsbx($itemID) . '][VALUE_TYPE]', $referenceData, isset($item['VALUE_TYPE']) ? $item['VALUE_TYPE'] : '', '', "class='bx-crm-edit-input bx-crm-edit-input-small'");
?>
<div class="delete-action" onclick="BX.CrmFieldMultiEditor.items['<?php
echo CUtil::addslashes($editorID);
?>
'].deleteItem('<?php
echo CUtil::addslashes($itemID);
?>
');" title="<?php
echo GetMessage('CRM_STATUS_LIST_DELETE');
?>
"></div>
</div><?php
}
示例4: Authorize
public function Authorize()
{
// var_dump( $skip_check_user_data);
$GLOBALS["APPLICATION"]->RestartBuffer();
if(isset($_REQUEST["vk_session"]["user"]["id"]))
{
global $skip_check_user_data;
if(self::CheckUserData($_REQUEST["vk_session"]["sig"]) || $skip_check_user_data)
{
CUtil::decodeURIComponent($_REQUEST);
$u_id = $_REQUEST["vk_session"]["user"]["id"];
$arFields = array(
'EXTERNAL_AUTH_ID' => self::ID,
'WORK_NOTES' => self::ID, //это для того, чтоб можно было избавится от EXTERNAL_AUTH_ID и разрешить авторизовываться несколькими способами одновременно
'XML_ID' => $u_id,
'LOGIN' => "id".$u_id,
'NAME'=> $_REQUEST["vk_session"]["user"]["first_name"],
'LAST_NAME'=> $_REQUEST["vk_session"]["user"]["last_name"],
);
if($this->AuthorizeUser($arFields)){
if($skip_check_user_data){
return true;
}
die("OK");
}
}
}
die("FAILURE");
}
示例5: getJSPrice
protected static function getJSPrice(array $prices)
{
if (empty($prices)) {
return "";
}
return '(function(value){var prices=' . \CUtil::PhpToJSObject($prices) . '; return prices[value]["PRICE"];})(this.value)';
}
示例6: getJsTitle
function getJsTitle()
{
$title = $GLOBALS["APPLICATION"]->GetTitle("title", true);
$title = html_entity_decode($title, ENT_QUOTES, SITE_CHARSET);
$title = CUtil::JSEscape($title);
return $title;
}
示例7: doPostAction
protected function doPostAction($isEdit, $action)
{
/** @global CMain $APPLICATION */
global $APPLICATION;
if ($isEdit) {
$APPLICATION->RestartBuffer();
header('Content-Type: application/json', true);
echo CSecurityJsonHelper::encode($this->arResult);
die;
} else {
switch ($action) {
case 'download':
$APPLICATION->restartBuffer();
header('Content-Type: text/plain', true);
header('Content-Disposition: attachment; filename="recovery_codes.txt"');
header('Content-Transfer-Encoding: binary');
header(sprintf('Content-Length: %d', CUtil::BinStrlen($this->arResult['PLAIN_RESPONSE'])));
echo $this->arResult['PLAIN_RESPONSE'];
exit;
break;
case 'print':
$APPLICATION->restartBuffer();
$this->includeComponentTemplate(static::PRINT_PAGE);
exit;
break;
case 'view':
default:
$this->includeComponentTemplate(static::VIEW_PAGE);
break;
}
}
}
示例8: __sbpc_bind_post_to_form
function __sbpc_bind_post_to_form($xml_id, $form_id_get = null, $arParams)
{
static $form_id = null;
if ($form_id_get !== null) {
$form_id = $form_id_get;
return;
}
?>
<script type="text/javascript">BX.ready(function(){__blogLinkEntity({'<?php
echo CUtil::JSEscape($xml_id);
?>
' : ['BG', <?php
echo $arParams["ID"];
?>
, '<?php
echo $arParams["LOG_ID"];
?>
']}, <?php
if ($form_id == null) {
?>
window.SBPC.form.id<?php
} else {
?>
"<?php
echo $form_id;
?>
"<?php
}
?>
);});</script><?php
}
示例9: AddByChannel
public static function AddByChannel($channelId, $arParams = array())
{
global $DB;
if (!is_array($channelId)) {
$channelId = array($channelId);
}
if (strlen($arParams['module_id']) > 0 || strlen($arParams['command']) > 0) {
$arData = array('module_id' => $arParams['module_id'], 'command' => $arParams['command'], 'params' => is_array($arParams['params']) ? $arParams['params'] : array());
if (CPullOptions::GetQueueServerStatus()) {
$command = array('MESSAGE' => array($arData), 'ERROR' => '');
if (!is_array($channelId) && CPullOptions::GetQueueServerVersion() == 1) {
$command['CHANNEL_ID'] = $channelId;
}
$message = CUtil::PhpToJsObject($command);
if (!defined('BX_UTF') || !BX_UTF) {
$message = $GLOBALS['APPLICATION']->ConvertCharset($message, SITE_CHARSET, 'utf-8');
}
$res = CPullChannel::Send($channelId, str_replace("\n", " ", $message));
$result = $res ? true : false;
} else {
foreach ($channelId as $channel) {
$arParams = array('CHANNEL_ID' => $channel, 'MESSAGE' => str_replace("\n", " ", serialize($arData)), '~DATE_CREATE' => $DB->CurrentTimeFunction());
$res = IntVal($DB->Add("b_pull_stack", $arParams, array("MESSAGE")));
$result = $res ? true : false;
}
}
if (isset($arParams['push_text']) && strlen($arParams['push_text']) > 0 && isset($arParams['push_user']) && intval($arParams['push_user']) > 0) {
$CPushManager = new CPushManager();
$CPushManager->AddQueue(array('USER_ID' => $arParams['push_user'], 'MESSAGE' => str_replace("\n", " ", $arParams['push_text']), 'PARAMS' => $arParams['push_params'], 'BADGE' => isset($arParams['push_badge']) ? intval($arParams['push_badge']) : '', 'TAG' => isset($arParams['push_tag']) ? $arParams['push_tag'] : '', 'SUB_TAG' => isset($arParams['push_sub_tag']) ? $arParams['push_sub_tag'] : '', 'APP_ID' => isset($arParams['push_app_id']) ? $arParams['push_app_id'] : ''));
}
return $result;
}
return false;
}
示例10: AddByChannel
public static function AddByChannel($channelId, $arParams = array())
{
global $DB;
if (!is_array($channelId)) {
$channelId = array($channelId);
}
$result = false;
if (strlen($arParams['module_id']) > 0 || strlen($arParams['command']) > 0) {
$arData = array('module_id' => $arParams['module_id'], 'command' => $arParams['command'], 'params' => is_array($arParams['params']) ? $arParams['params'] : array());
if (CPullOptions::GetQueueServerStatus()) {
$command = array('SERVER_TIME_WEB' => time(), 'SERVER_NAME' => COption::GetOptionString('main', 'server_name', $_SERVER['SERVER_NAME']), 'MESSAGE' => array($arData), 'ERROR' => '');
if (!is_array($channelId) && CPullOptions::GetQueueServerVersion() == 1) {
$command['CHANNEL_ID'] = $channelId;
}
$message = CUtil::PhpToJsObject($command);
if (!defined('BX_UTF') || !BX_UTF) {
$message = $GLOBALS['APPLICATION']->ConvertCharset($message, SITE_CHARSET, 'utf-8');
}
$options = isset($arParams['expiry']) ? array('expiry' => intval($arParams['expiry'])) : array();
$res = CPullChannel::Send($channelId, str_replace("\n", " ", $message), $options);
$result = $res ? true : false;
} else {
foreach ($channelId as $channel) {
$arParams = array('CHANNEL_ID' => $channel, 'MESSAGE' => str_replace("\n", " ", serialize($arData)), '~DATE_CREATE' => $DB->CurrentTimeFunction());
$res = IntVal($DB->Add("b_pull_stack", $arParams, array("MESSAGE")));
$result = $res ? true : false;
}
}
return $result;
}
return false;
}
示例11: print_rrr
function print_rrr($var)
{
if (is_array($var)) {
if ($var == array_values($var)) {
foreach ($var as $key => $value) {
$var[$key] = print_rrr($value);
}
return "Array(" . implode(", ", $var) . ")";
}
$res = "\nArray(\n";
$first = true;
foreach ($var as $key => $value) {
if ($first) {
$first = false;
} else {
$res .= ",\n";
}
$res .= "'" . CUtil::JSEscape($key) . "' => " . print_rrr($value);
}
$res .= "\n)";
return $res;
} elseif (is_bool($var)) {
if ($var === true) {
return 'true';
} else {
return 'false';
}
} else {
return "'" . CUtil::JSEscape($var) . "'";
}
}
示例12: fetchUserDetails
public function fetchUserDetails($ident, $type)
{
$search_cond = 'users.user_id = ' . $ident;
if ($type == 'code') {
$search_cond = 'users.user_code = ' . $ident;
}
$user_details = array();
$user_details['err_msg'] = '';
$user_details['own_profile'] = 'No';
$udetails = User::whereRaw($search_cond)->first(array('users.first_name', 'users.id', 'users.last_name', 'users.email', 'users.activated', 'users.activated_at'));
if (count($udetails) > 0) {
$user_details['user_code'] = CUtil::setUserCode($udetails['id']);
$user_details['email'] = $udetails['email'];
$user_details['user_id'] = $user_id = $udetails['id'];
$user_details['first_name'] = $udetails['first_name'];
$user_details['last_name'] = $udetails['last_name'];
$user_display_name = $udetails['first_name'] . ' ' . substr($udetails['last_name'], 0, 1);
$user_details['display_name'] = ucwords($user_display_name);
$user_details['activated_at'] = $udetails['activated_at'];
$user_details['activated'] = $udetails['activated'];
} else {
$user_details['err_msg'] = 'No such user found';
}
return $user_details;
}
示例13: ShowPanel
function ShowPanel()
{
if ($GLOBALS["USER"]->IsAdmin() && COption::GetOptionString("main", "wizard_solution", "", SITE_ID) == "eshop") {
$GLOBALS["APPLICATION"]->SetAdditionalCSS("/bitrix/wizards/bitrix/eshop/css/panel.css");
$arMenu = array(array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape("/bitrix/admin/wizard_install.php?lang=" . LANGUAGE_ID . "&wizardSiteID=" . SITE_ID . "&wizardName=bitrix:eshop&" . bitrix_sessid_get()) . "')", "ICON" => "bx-popup-item-wizard-icon", "TITLE" => GetMessage("STOM_BUTTON_TITLE_W1"), "TEXT" => GetMessage("STOM_BUTTON_NAME_W1")), array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape("/bitrix/admin/wizard_install.php?lang=" . LANGUAGE_ID . "&site_id=" . SITE_ID . "&wizardName=bitrix:eshop.mobile&" . bitrix_sessid_get()) . "')", "ICON" => "bx-popup-item-wizard-icon", "TITLE" => GetMessage("STOM_BUTTON_TITLE_W5"), "TEXT" => GetMessage("STOM_BUTTON_NAME_W5")));
/*if(COption::GetOptionString("bitrix.eshop", "demo_deleted", "", SITE_ID) != 'Y')
{
CModule::IncludeModule("iblock");
$dbr = CIBlock::GetList(Array(), Array("XML_ID"=>"furniture_".SITE_ID));
if($arR = $dbr->Fetch())
{
if($_REQUEST['delete_demo']=='eshop' && check_bitrix_sessid())
{
if(CIBlock::Delete($arR['ID']))
{
DeleteDirFilesEx(SITE_DIR.'catalog/furniture');
COption::GetOptionString("bitrix.eshop", "demo_deleted", "Y", SITE_ID);
}
unset($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]);
}
else
$arMenu[] = Array(
"ACTION" => "if(confirm('".GetMessage("STOM_BUTTON_CONFIRM_W2")."')) jsUtils.Redirect([], '".CUtil::JSEscape(SITE_DIR)."catalog/?delete_demo=eshop&".bitrix_sessid_get()."');",
"ICON" => "bx-popup-item-delete-icon",
"TITLE" => GetMessage("STOM_BUTTON_TITLE_W3"),
"TEXT" => GetMessage("STOM_BUTTON_NAME_W3"),
);
}
else
COption::SetOptionString("bitrix.eshop", "demo_deleted", "Y", "", SITE_ID);
} */
$GLOBALS["APPLICATION"]->AddPanelButton(array("HREF" => "/bitrix/admin/wizard_install.php?lang=" . LANGUAGE_ID . "&wizardName=bitrix:eshop&wizardSiteID=" . SITE_ID . "&" . bitrix_sessid_get(), "ID" => "eshop_wizard", "ICON" => "bx-panel-site-wizard-icon", "MAIN_SORT" => 2500, "TYPE" => "BIG", "SORT" => 10, "ALT" => GetMessage("SCOM_BUTTON_DESCRIPTION"), "TEXT" => GetMessage("SCOM_BUTTON_NAME"), "MENU" => $arMenu));
}
}
示例14: addWMVJSConfig
function addWMVJSConfig(&$str, $key, $value, $default = false)
{
if (!isset($value) || $value == '' || $value === $default)
return;
if ($str != '{')
$str .= ',';
$str .= $key.': \''.CUtil::JSEscape($value).'\'';
}
示例15: GetValue
public function GetValue()
{
$result = $this->value;
if (ord($result[0]) == 0x0) {
$result = CUtil::BinSubstr($result, 1);
}
return $result;
}