当前位置: 首页>>代码示例>>PHP>>正文


PHP CUtil::PhpToJSObject方法代码示例

本文整理汇总了PHP中CUtil::PhpToJSObject方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtil::PhpToJSObject方法的具体用法?PHP CUtil::PhpToJSObject怎么用?PHP CUtil::PhpToJSObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CUtil的用法示例。


在下文中一共展示了CUtil::PhpToJSObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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)';
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:7,代码来源:enum.php

示例2: ProcessRequest

	public static function ProcessRequest()
	{
		if (isset($_REQUEST['component_params_manager']))
		{
			$reqId = intVal($_REQUEST['component_params_manager']);
			$result = self::GetComponentProperties(
				$_REQUEST['component_name'],
				$_REQUEST['component_template'],
				$_REQUEST['site_template'],
				$_REQUEST['current_values']
			);
			$result['description'] = CComponentUtil::GetComponentDescr($_REQUEST['component_name']);
			?>
			<script>
				window.__bxResult['<?php 
echo $reqId;
?>
'] = <?php 
echo CUtil::PhpToJSObject($result);
?>
;
			</script>
			<?
			self::DisplayFileDialogsScripts();
		}
	}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:26,代码来源:component_params_manager.php

示例3: InputTags

function InputTags($sName="", $sValue="", $arSites=array(), $sHTML="", $sId="")
{
	if(!$sId)
		$sId = GenerateUniqId($sName);
	TagsShowScript();
	$order = class_exists("cuseroptions")? CUserOptions::GetOption("search_tags", "order", "CNT"): "CNT";
	return '<input name="'.htmlspecialcharsbx($sName).'" id="'.htmlspecialcharsbx($sId).'" type="text" autocomplete="off" value="'.htmlspecialcharsex($sValue).'" onfocus="'.htmlspecialcharsbx('window.oObject[this.id] = new JsTc(this, '.CUtil::PhpToJSObject($arSites).');').'" '.$sHTML.'/><input type="checkbox" id="ck_'.$sId.'" name="ck_'.htmlspecialcharsbx($sName).'" '.($order=="NAME"? "checked": "").' title="'.GetMessage("SEARCH_TAGS_SORTING_TIP").'">';
}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:8,代码来源:tags.php

示例4: __fcParseAnswer

 function __fcParseAnswer(&$output, $arParams, $arResult)
 {
     $GLOBALS["APPLICATION"]->RestartBuffer();
     while (ob_end_clean()) {
     }
     echo CUtil::PhpToJSObject($arResult["OUTPUT_LIST"]["JSON"]);
     die;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:8,代码来源:component_epilog.php

示例5: GetPathTemplateParam

 public static function GetPathTemplateParam($menuType, $ID, $parameterName, $defaultValue = "", $parentID = "URL_TEMPLATES")
 {
     if ($menuType == "LISTS") {
         return array("PARENT" => $parentID, "NAME" => $parameterName, "TYPE" => "STRING", "DEFAULT" => $defaultValue);
     } else {
         return array("PARENT" => $parentID, "NAME" => $parameterName, "TYPE" => "CUSTOM", "DEFAULT" => $defaultValue, "JS_FILE" => BX_ROOT . "/js/iblock/path_templates.js", "JS_EVENT" => "IBlockComponentProperties", "JS_DATA" => str_replace("\n", "", CUtil::PhpToJSObject(array("mnu_" . $ID, 5000, CListsParameters::GetPathTemplateMenuItems($menuType, "window.IBlockComponentPropertiesObj.Action", "mnu_" . $ID)))));
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:8,代码来源:parameters.php

示例6: getListChooser

 /**
  * @param $arParameter
  * @param array $arChooserCurVals - если arParameter[MULTIPLE] == Y
  * 			тогда надо обазательно пробрасывать arCurrentValues["PARAM_NAME"] во второй агрумент
  * @return array
  *
  * @example
  * $arChooserValues = (empty($arCurrentValues['CHOOSER'])?array():$arCurrentValues['CHOOSER']);
  * $arComponentParameters['PARAMETERS']['CHOOSER'] = $ParameterTools->getListChooser(
  * 		array(
  * 			'NAME' => 'CHOOSER',
  * 			'VALUES' => array(
  * 				'key1' => 'значение 1',
  * 				'key2' => 'значение 2',
  * 				'key3' => 'значение 3',
  * 				'key4' => 'значение 4',
  * 			),
  * 			'DEFAULT' => 'key2',
  * 			'MULTIPLE' => 'Y',
  * 			'PARENT' => 'BASE'
  * 		),
  * 		$arChooserValues
  * );
  */
 public function getListChooser($arParameter, &$arChooserCurVals = array())
 {
     if (!is_array($arChooserCurVals)) {
         $arChooserCurVals = array();
     }
     $arParameter['IX_CUR_VALS'] = array_flip($arChooserCurVals);
     //TODO: Сделать обработку $arParameter
     return array('NAME' => $arParameter['NAME'], 'TYPE' => 'CUSTOM', 'JS_DATA' => \CUtil::PhpToJSObject($arParameter), 'JS_FILE' => $this->_customParamsJSLib, 'JS_EVENT' => 'obx.componentParams.showListChooser');
 }
开发者ID:OpenBX,项目名称:obx.core,代码行数:33,代码来源:parameters.php

示例7: __CrmMobileDealEditEndResonse

 function __CrmMobileDealEditEndResonse($result)
 {
     $GLOBALS['APPLICATION']->RestartBuffer();
     Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
     if (!empty($result)) {
         echo CUtil::PhpToJSObject($result);
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
     die;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:10,代码来源:ajax.php

示例8: injectDataParams

 private static function injectDataParams()
 {
     $result = "";
     foreach (static::$data as $index => $arItem) {
         foreach ($arItem as $key => $value) {
             $jsValue = is_array($value) ? \CUtil::PhpToJSObject($value) : \CUtil::JSEscape($value);
             $result .= '_ba.push(["ad[' . $index . '][' . \CUtil::JSEscape($key) . ']", "' . $jsValue . '"]);';
         }
     }
     return $result;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:11,代码来源:counter.php

示例9: IMIncludeJSLangFile

function IMIncludeJSLangFile($lang_file)
{
    $pathLang = BX_ROOT . '/modules/im/lang/' . LANGUAGE_ID . '/';
    $mess_lang = array();
    if ($pathLang . $lang_file) {
        $lang_filename = $_SERVER['DOCUMENT_ROOT'] . $pathLang . $lang_file;
        if (file_exists($lang_filename)) {
            $mess_lang = __IncludeLang($lang_filename, true);
            $GLOBALS['APPLICATION']->AddHeadString('<script type="text/javascript">BX.message(' . CUtil::PhpToJSObject($mess_lang, false) . ')</script>', true);
        }
    }
    return true;
}
开发者ID:Satariall,项目名称:izurit,代码行数:13,代码来源:tools.php

示例10: __CrmCompanyShowEndJsonResonse

 function __CrmCompanyShowEndJsonResonse($result)
 {
     $GLOBALS['APPLICATION']->RestartBuffer();
     Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
     if (!empty($result)) {
         echo CUtil::PhpToJSObject($result);
     }
     if (!defined('PUBLIC_AJAX_MODE')) {
         define('PUBLIC_AJAX_MODE', true);
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
     die;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:13,代码来源:ajax.php

示例11: injectDataParams

 private static function injectDataParams()
 {
     $result = "";
     foreach (static::$data as $index => $arItem) {
         foreach ($arItem as $key => $value) {
             if (is_array($value)) {
                 $jsValue = '"' . \CUtil::PhpToJSObject($value) . '"';
             } elseif ($value instanceof JsExpression) {
                 $jsValue = $value;
             } else {
                 $jsValue = '"' . \CUtil::JSEscape($value) . '"';
             }
             $result .= '_ba.push(["ad[' . $index . '][' . \CUtil::JSEscape($key) . ']", ' . $jsValue . ']);';
         }
     }
     return $result;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:17,代码来源:counter.php

示例12: getResult

	public function getResult($arParams = array())
	{
		$ID 		= $_REQUEST['AJAX'] == "Y" ? $_REQUEST['ID'] : $arParams['ID'];
		$stOptions 	= COption::GetOptionString(self::$module_id, $ID);
		$arOptions 	= $stOptions != '' ? unserialize($stOptions) : array();
		$uPWD 		= md5($_REQUEST['PR_PWD']);
		
		$arResult 	= array(
			'status' => '',
			'result' => '',
		);
		
		if((count(array_diff($arParams, $arOptions)) > 0 OR count($arOptions) == 0) AND $_REQUEST['AJAX'] != "Y")
		{
			$arOptions = $arParams;
			COption::SetOptionString(self::$module_id, $ID, serialize($arOptions));
		}

		if($_REQUEST['PR_PWD'] AND $uPWD != $arOptions["PWD"])
		{
			$arResult = array(
				'status' => false,
				'result' => $arOptions['ERROR'],
			);
		}
		
		if($uPWD == $arOptions["PWD"])
		{
			require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
			ob_start();
				include($_SERVER['DOCUMENT_ROOT'].SITE_DIR.$arOptions["FILE"]);
				$ob_get = ob_get_contents();
			ob_clean();
			ob_end_clean();
			
			$arResult = array(
				'status' => true,
				'result' => $ob_get,
			);
		}
		
		if($_REQUEST['AJAX'] == "Y")
			return CUtil::PhpToJSObject($arResult);

		return $arResult;
	}
开发者ID:ASDAFF,项目名称:bitrix-pr.pwd,代码行数:46,代码来源:prPWD.class.php

示例13: LoadList

    public static function LoadList($Params)
    {
        global $CACHE_MANAGER;
        $template = CFileMan::SecurePathVar($Params["template"]);
        if ($template == '') {
            $template = '.default';
        }
        $arSNIPPETS = false;
        $CACHE_SNIPPETS = array();
        if ($Params['bClearCache']) {
            CSnippets::ClearCache();
        }
        $ttl = 30 * 24 * 60 * 60;
        // 30 days
        if ($CACHE_MANAGER->Read($ttl, "fileman_snippet_array")) {
            $CACHE_SNIPPETS = $CACHE_MANAGER->Get("fileman_snippet_array");
            if (isset($CACHE_SNIPPETS[$template])) {
                $arSNIPPETS = $CACHE_SNIPPETS[$template];
            }
        }
        if (!$arSNIPPETS || !is_array($arSNIPPETS)) {
            $arSNIPPETS = array();
            $arTemplateKeys = array();
            //Array contain keys of snippets for each template for correct writing .content.php
            CSnippets::HandleForTemplate('.default', $arSNIPPETS, $arTemplateKeys);
            if ($template != '.default') {
                CSnippets::HandleForTemplate($template, $arSNIPPETS, $arTemplateKeys);
            }
            $CACHE_SNIPPETS[$template] = $arSNIPPETS;
            $CACHE_MANAGER->Set("fileman_snippet_array", $CACHE_SNIPPETS);
        }
        if ($Params['returnArray']) {
            return $arSNIPPETS;
        } else {
            ?>
<script>window.arSnippets = <?php 
            echo CUtil::PhpToJSObject($arSNIPPETS);
            ?>
; </script><?php 
        }
    }
开发者ID:spas-viktor,项目名称:books,代码行数:41,代码来源:snippets.php

示例14: LoadList

	public static function LoadList($Params)
	{

		$template = CFileMan::SecurePathVar($Params["template"]);
		if ($template == '')
			$template = '.default';

		$arSNIPPETS = false;
		$CACHE_SNIPPETS = Array();

		if ($Params['bClearCache'])
			CSnippets::ClearCache();

		if (!$arSNIPPETS || !is_array($arSNIPPETS))
		{
			$arSNIPPETS = Array();
			$arTemplateKeys = Array(); //Array contain keys of snippets for each template for correct writing .content.php

			CSnippets::HandleForTemplate('.default', $arSNIPPETS, $arTemplateKeys);
			if ($template != '.default')
				CSnippets::HandleForTemplate($template, $arSNIPPETS, $arTemplateKeys);

			$CACHE_SNIPPETS[$template] = $arSNIPPETS;
		}

		if ($Params['returnArray'])
		{
			return $arSNIPPETS;
		}
		else
		{
			?><script>window.arSnippets = <?php 
echo CUtil::PhpToJSObject($arSNIPPETS);
?>
; </script><?
		}
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:37,代码来源:snippets.php

示例15: LocalRedirectHandler

 function LocalRedirectHandler(&$url)
 {
     $bSuccess = false;
     if (strpos($url, "?") > 0) {
         $arUrlParam = explode("&", substr($url, strpos($url, "?") + 1));
         foreach ($arUrlParam as $url_param) {
             list($key, $val) = explode("=", $url_param, 2);
             if ($key == "new_post_id") {
                 $new_post_id = $val;
                 break;
             }
         }
     }
     if (strpos($url, "success=Y") > 0 && intval($new_post_id) > 0) {
         unset($_SESSION["MFU_UPLOADED_FILES"]);
         unset($_SESSION["MFU_UPLOADED_DOCS"]);
         unset($_SESSION["MFU_UPLOADED_FILES_" . $GLOBALS["USER"]->GetId()]);
         unset($_SESSION["MFU_UPLOADED_DOCS_" . $GLOBALS["USER"]->GetId()]);
         $GLOBALS["APPLICATION"]->RestartBuffer();
         $rsLogSrc = CSocNetLog::GetList(array(), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $new_post_id), false, false, array("ID"), array("CHECK_RIGHTS" => "Y", "USE_SUBSCRIBE" => "N"));
         if ($arLogSrc = $rsLogSrc->Fetch()) {
             ob_start();
             $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:mobile.socialnetwork.log.ex", ".default", array("NEW_LOG_ID" => intval($arLogSrc["ID"]), "PATH_TO_LOG_ENTRY" => SITE_DIR . "mobile/log/?detail_log_id=#log_id#", "PATH_TO_LOG_ENTRY_EMPTY" => SITE_DIR . "mobile/log/?empty=Y", "PATH_TO_USER" => SITE_DIR . "mobile/users/?user_id=#user_id#", "SET_LOG_CACHE" => "N", "IMAGE_MAX_WIDTH" => 550, "DATE_TIME_FORMAT" => ""), false, array("HIDE_ICONS" => "Y"));
             $postText = ob_get_contents();
             ob_end_clean();
             $bSuccess = true;
         }
     }
     $GLOBALS["APPLICATION"]->RestartBuffer();
     if (!$bSuccess) {
         echo $_POST["response_type"] == "json" ? CUtil::PhpToJSObject(array("error" => "*")) : "*";
     } else {
         echo $_POST["response_type"] == "json" ? CUtil::PhpToJSObject(array("text" => $postText)) : $postText;
     }
     die;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:36,代码来源:index.php


注:本文中的CUtil::PhpToJSObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。