本文整理汇总了PHP中Bitrix\Main\Web\Json类的典型用法代码示例。如果您正苦于以下问题:PHP Json类的具体用法?PHP Json怎么用?PHP Json使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Json类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: Process
private function Process($service, $id = false, $jsdecode = true)
{
$token = $this->GetToken();
$s = curl_init();
if ($id !== false) {
$service = str_replace("#ID#", $id, $service);
}
curl_setopt($s, CURLOPT_URL, "https://api.ozon.ru/{$service}");
//?applicationid={$this->appID}&token=$token
curl_setopt($s, CURLOPT_HTTPHEADER, array("x-ApiVersion: 0.1", "accept:application/json", "x-applicationid:{$this->appID}", "x-token:{$token}"));
curl_setopt($s, CURLOPT_RETURNTRANSFER, true);
$reply = curl_exec($s);
curl_close($s);
if ($jsdecode) {
if (strtoupper(SITE_CHARSET) == "UTF-8") {
$reply = mb_convert_encoding($reply, "utf8", "cp1251");
}
try {
$reply = \Bitrix\Main\Web\Json::decode($reply);
} catch (Exception $e) {
$reply = array();
}
}
return $reply;
}
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:25,代码来源:ozon.php
示例2: renderMenu
function renderMenu($id, $items)
{
?>
<script>
BX('<?php
echo $id;
?>
').onclick = function()
{
this.blur();
BX.adminShowMenu(this,
<?php
$json = array();
foreach ($items as $name => $params) {
$json[] = array('TEXT' => $name, 'ONCLICK' => "window.location.href = '?" . http_build_query($params) . "'");
}
echo Json::encode($json);
?>
, {active_class: 'adm-btn-save-active'});
return false;
};
</script>
<?php
}
开发者ID:Satariall,项目名称:izurit,代码行数:26,代码来源:scale.php
示例3: onBeforeHTMLEditorScriptRuns
public static function onBeforeHTMLEditorScriptRuns()
{
$asset = Asset::getInstance();
$asset->addJs('/bitrix/js/newkaliningrad.typografru/typograf.js');
$messages = Loc::loadLanguageFile(Path::normalize(__FILE__));
$asset->addString(sprintf('<script>BX.message(%s)</script>', Json::encode($messages, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)));
}
开发者ID:askew-,项目名称:bitrix-typograf,代码行数:7,代码来源:typograf.php
示例4: doPostAction
protected function doPostAction($isEdit, $action)
{
/** @global CMain $APPLICATION */
global $APPLICATION;
if ($isEdit) {
$APPLICATION->RestartBuffer();
header('Content-Type: application/json', true);
echo Json::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;
}
}
}
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:32,代码来源:class.php
示例5: GetAccessToken
public function GetAccessToken()
{
if (($tokens = $this->getStorageTokens()) && is_array($tokens)) {
$this->access_token = $tokens["OATOKEN"];
if ($this->checkAccessToken()) {
return true;
}
}
if ($this->code === false) {
return false;
}
$h = new \Bitrix\Main\Web\HttpClient(array("socketTimeout" => $this->httpTimeout));
$h->setAuthorization($this->appID, $this->appSecret);
$result = $h->post(self::TOKEN_URL, array("grant_type" => "authorization_code", "code" => $this->code, "client_id" => $this->appID));
$this->arResult = \Bitrix\Main\Web\Json::decode($result);
if (isset($this->arResult["access_token"]) && $this->arResult["access_token"] != '') {
// yandex doesn't send refresh tokens but I leave it here in case they will
if (isset($this->arResult["refresh_token"]) && $this->arResult["refresh_token"] != '') {
$this->refresh_token = $this->arResult["refresh_token"];
}
$this->access_token = $this->arResult["access_token"];
$this->accessTokenExpires = $this->arResult["expires_in"] + time();
$_SESSION["OAUTH_DATA"] = array("OATOKEN" => $this->access_token);
return true;
}
return false;
}
开发者ID:Satariall,项目名称:izurit,代码行数:27,代码来源:seo.php
示例6: sendJsonResponse
protected function sendJsonResponse($response)
{
global $APPLICATION;
$APPLICATION->restartBuffer();
header('Content-Type:application/json; charset=UTF-8');
echo Json::encode($response);
$this->end();
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:8,代码来源:basecomponent.php
示例7: sendJsonResponse
protected function sendJsonResponse($response)
{
$this->getApplication()->restartBuffer();
while (ob_end_clean()) {
}
header('Content-Type:application/json; charset=UTF-8');
echo Json::encode($response);
$this->end();
}
开发者ID:Satariall,项目名称:izurit,代码行数:9,代码来源:class.php
示例8: __construct
/**
* Response constructor.
* @param $response
*/
public function __construct($response)
{
$this->response = $response;
$this->fields = Json::decode($this->response);
if ($this->fields['error_code']) {
$this->setError($this->fields);
}
$this->state = 'ok';
if ($this->getErrors()) {
$this->state = 'error';
}
}
开发者ID:SidiGi,项目名称:shantilab.yandexdirect,代码行数:16,代码来源:Response.php
示例9: sendJsonResponse
protected function sendJsonResponse($response)
{
if (!defined('PUBLIC_AJAX_MODE')) {
define('PUBLIC_AJAX_MODE', true);
}
global $APPLICATION;
$APPLICATION->restartBuffer();
while (ob_end_clean()) {
}
header('Content-Type:application/json; charset=UTF-8');
echo Json::encode($response);
$this->end();
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:13,代码来源:ajax.php
示例10: sendJsonResponse
protected function sendJsonResponse($response, $params = null)
{
if (!defined('PUBLIC_AJAX_MODE')) {
// define('PUBLIC_AJAX_MODE', true);
}
global $APPLICATION;
$APPLICATION->restartBuffer();
if (!empty($params['http_status']) && $params['http_status'] == 403) {
header('HTTP/1.0 403 Forbidden', true, 403);
}
if (!empty($params['http_status']) && $params['http_status'] == 500) {
header('HTTP/1.0 500 Internal Server Error', true, 500);
}
header('Content-Type:application/json; charset=UTF-8');
echo Json::encode($response);
$this->end();
}
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:17,代码来源:controller.php
示例11: executeComponent
public function executeComponent()
{
/** @global CMain $APPLICATION */
global $APPLICATION;
if ($this->request->isPost() && $this->request['action']) {
// try to connect
$result = $this->toEdit();
$result = Json::encode($result);
$APPLICATION->RestartBuffer();
header('Content-Type: application/json', true);
echo $result;
die;
} else {
$APPLICATION->SetTitle(Loc::getMessage("SECURITY_OTP_TITLE"));
// get data for new OTP connection
$this->arResult = $this->toView();
$this->IncludeComponentTemplate();
}
}
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:19,代码来源:class.php
示例12: GetCurrentUser
public function GetCurrentUser()
{
if ($this->access_token === false) {
return false;
}
$h = new \Bitrix\Main\Web\HttpClient();
$result = $h->get(self::USERINFO_URL . '?format=json&oauth_token=' . urlencode($this->access_token));
$result = \Bitrix\Main\Web\Json::decode($result);
if (is_array($result)) {
$result["access_token"] = $this->access_token;
$result["refresh_token"] = $this->refresh_token;
$result["expires_in"] = $this->accessTokenExpires;
}
return $result;
}
开发者ID:Satariall,项目名称:izurit,代码行数:15,代码来源:yandex.php
示例13: showJsonAnswer
protected function showJsonAnswer($result)
{
if (!defined("PUBLIC_AJAX_MODE")) {
define("PUBLIC_AJAX_MODE", true);
}
if (!defined("NO_KEEP_STATISTIC")) {
define("NO_KEEP_STATISTIC", "Y");
}
if (!defined("NO_AGENT_STATISTIC")) {
define("NO_AGENT_STATISTIC", "Y");
}
if (!defined("NO_AGENT_CHECK")) {
define("NO_AGENT_CHECK", true);
}
if (!defined("DisableEventsCheck")) {
define("DisableEventsCheck", true);
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
$GLOBALS["APPLICATION"]->RestartBuffer();
while (ob_end_clean()) {
}
$version = IsIE();
if (!(0 < $version && $version < 10)) {
header('Content-Type:application/json; charset=UTF-8');
}
echo Json::encode($result);
\CMain::finalActions();
die;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:29,代码来源:uploader.php
示例14: htmlspecialcharsbx
?>
">
<?php
echo htmlspecialcharsbx($value);
?>
<a href="javascript:void(0);" data-role="delete-access" data-code="<?php
echo htmlspecialcharsbx($code);
?>
" class="access-delete"></a>
</div>
<?php
}
?>
</div>
<a href="javascript:void(0)" class="bx-action-href" id="add_access" data-role="add-access"><?php
echo GetMessage("SEC_OTP_MANDATORY_RIGHTS_SELECT");
?>
</a>
</td>
</tr>
<?php
$tabControl->Buttons(array("disabled" => !$canWrite, "back_url" => $_GET["return_url"] ? $_GET["return_url"] : "security_otp.php?lang=" . LANG));
$tabControl->End();
?>
</form>
<script id="settings" type="application/json"><?php
echo \Bitrix\Main\Web\Json::encode(array('rights' => array_flip($targetRights)));
?>
</script>
<?php
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
开发者ID:sharapudinov,项目名称:tovarov.top,代码行数:31,代码来源:security_otp.php
示例15: function
<script type="text/javascript">
BX(function () {
BX['LiveFeedClass_<?php
echo $arResult['RAND_STRING'];
?>
'] = new BX.LiveFeedClass({
socnetGroupId: '<?php
echo $arResult['SOCNET_GROUP_ID'];
?>
',
randomString: '<?php
echo $arResult['RAND_STRING'];
?>
',
listData: <?php
echo \Bitrix\Main\Web\Json::encode($arResult['LIST_DATA']);
?>
});
BX.bind(BX('bx-lists-settings-btn'), 'click', function(e) {
BX['LiveFeedClass_<?php
echo $arResult['RAND_STRING'];
?>
'].createSettingsDropdown(e);
});
});
</script>
<?php
$frame->end();
?>
<script type="text/javascript">
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:template.php
示例16: unsign
public function unsign($signedValue, $salt = null)
{
$encodedValue = parent::unsign($signedValue, $salt);
return Json::decode(base64_decode($encodedValue));
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:5,代码来源:bitrix24signer.php
示例17: GetAppInfo
public function GetAppInfo()
{
if ($this->access_token === false) {
return false;
}
$h = new \Bitrix\Main\Web\HttpClient();
$h->setTimeout($this->httpTimeout);
$result = $h->post(static::TOKENINFO_URL . '?access_token=' . urlencode($this->access_token));
$result = \Bitrix\Main\Web\Json::decode($result);
if (is_array($result) && $result["audience"]) {
$result["id"] = $result["audience"];
}
return $result;
}
开发者ID:webgksupport,项目名称:alpina,代码行数:14,代码来源:google.php
示例18: array
case 'original_texts':
$res = $engine->getOriginalTexts($arDomain['DOMAIN'], $arDomain['SITE_DIR']);
break;
case 'crawling':
$res = array('excluded' => $engine->getExcluded($arDomain['DOMAIN'], $arDomain['SITE_DIR']), 'indexed' => $engine->getIndexed($arDomain['DOMAIN'], $arDomain['SITE_DIR']));
break;
default:
$res = array('error' => 'unknown action');
break;
}
} catch (Engine\YandexException $e) {
$res = array('error' => array('message' => $e->getMessage(), 'status' => $e->getStatus(), 'code' => $e->getCode()));
}
}
Header('Content-type: application/json; charset=' . LANG_CHARSET);
echo \Bitrix\Main\Web\Json::encode($res);
} elseif (isset($_REQUEST['get'])) {
switch ($_REQUEST['get']) {
case 'original_text_form':
$arSettings = $engine->getSettings();
$arDomains = \CSeoUtils::getDomainsList();
foreach ($arDomains as $key => $domain) {
if (!isset($arSettings['SITES'][$domain['DOMAIN']])) {
unset($arDomains[$key]);
}
}
if (count($arDomains) <= 0) {
$msg = new CAdminMessage(array('MESSAGE' => Loc::getMessage('SEO_YANDEX_ERROR'), 'HTML' => 'Y'));
echo $msg->Show();
} else {
?>
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:seo_yandex.php
示例19: array
$availableTypesDescription = \Bitrix\Security\Mfa\Otp::getTypesDescription();
$currentPage = $APPLICATION->GetCurPageParam(sprintf('%s_active_tab=%s', $tabControl->name, $tabControl->tabs[$tabControl->tabIndex]['DIV']), array(sprintf('%s_active_tab', $tabControl->name)));
$deactivateDays = array();
$deactivateDays[] = GetMessage("SEC_OTP_NO_DAYS");
for ($i = 1; $i <= 10; $i++) {
$deactivateDays[$i] = FormatDate("ddiff", time() - 60 * 60 * 24 * $i);
}
$jsMessages = array('SEC_OTP_ERROR_TITLE' => GetMessage('SEC_OTP_ERROR_TITLE'), 'SEC_OTP_UNKNOWN_ERROR' => GetMessage('SEC_OTP_UNKNOWN_ERROR'));
$jsSettings = array('userId' => (int) $ID, 'successfulUrl' => $currentPage, 'deactivateDays' => $deactivateDays, 'availableTypes' => $availableTypesDescription);
?>
<script id="otp-user-edit-messages" type="application/json"><?php
echo \Bitrix\Main\Web\Json::encode($jsMessages);
?>
</script>
<script id="otp-user-edit-settings" type="application/json"><?php
echo \Bitrix\Main\Web\Json::encode($jsSettings);
?>
</script>
<!--Popup starts-->
<tr style="display: none;">
<td colspan="2">
<div id="otp-mobile-popup" class="otp-popup otp-mobile" data-title="<?php
echo GetMessage('SEC_OTP_CONNECT_MOBILE_TITLE');
?>
">
<div class="otp-description">
<ol>
<li><?php
echo GetMessage('SEC_OTP_CONNECT_MOBILE_STEP_1');
?>
</li>
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:options_user_settings_1.php
示例20: register
public static function register()
{
$httpClient = new HttpClient();
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/update_client.php";
$queryParams = array("action" => "register", "key" => md5(\CUpdateClient::GetLicenseKey()), "redirect_uri" => static::getRedirectUri());
$result = $httpClient->post(static::SERVICE_URL . static::REGISTER, $queryParams);
$result = Json::decode($result);
if ($result["error"]) {
throw new SystemException($result["error"]);
} else {
static::setAccessSettings($result);
}
}
开发者ID:webgksupport,项目名称:alpina,代码行数:13,代码来源:service.php
注:本文中的Bitrix\Main\Web\Json类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论