Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/seo/lib/engine/ |
Upload File : |
<?php namespace Bitrix\Seo\Engine; use Bitrix\Main\Web\Json; class YandexJson extends Json { public static function encode($data, $options = null) { // php 5.4.0+ if(defined('JSON_UNESCAPED_UNICODE')) { return parent::encode($data, JSON_UNESCAPED_UNICODE); } else { return static::_encode(static::convertData($data)); } } protected static function _encode($data) { $str = ''; if(is_array($data)) { $assoc = array_diff_key($data,array_keys(array_keys($data))); $str .= $assoc ? '{' : '['; $first = true; foreach($data as $key => $value) { $str .= $first ? '' : ','; $str .= $assoc ? static::_quote($key).':' : ''; $str .= static::_encode($value); $first = false; } $str .= $assoc ? '}' : ']'; } elseif(is_int($data)) { $str = $data; } elseif($data === null) { $str = "null"; } else { $str = static::_quote($data); } return $str; } protected static function _quote($s) { return '"'.str_replace(array('\\', '"'), array('\\\\', '\"'), $s).'"'; } }