1
0
mirror of synced 2024-11-22 05:16:07 +03:00

Remove custom cyrillic converter

This commit is contained in:
Ilyas Salikhov 2013-07-18 19:47:06 +04:00
parent c908a8cc8f
commit a492d61eaa

View File

@ -3,31 +3,6 @@ namespace IntaroCrm;
class RestApi class RestApi
{ {
protected static $jsonReplaceSource = array(
'\u0410','\u0430','\u0411','\u0431','\u0412','\u0432','\u0413','\u0433',
'\u0414','\u0434','\u0415','\u0435','\u0401','\u0451','\u0416','\u0436',
'\u0417','\u0437','\u0418','\u0438','\u0419','\u0439','\u041a','\u043a',
'\u041b','\u043b','\u041c','\u043c','\u041d','\u043d','\u041e','\u043e',
'\u041f','\u043f','\u0420','\u0440','\u0421','\u0441','\u0422','\u0442',
'\u0423','\u0443','\u0424','\u0444','\u0425','\u0445','\u0426','\u0446',
'\u0427','\u0447','\u0428','\u0448','\u0429','\u0449','\u042a','\u044a',
'\u042b','\u044b','\u042c','\u044c','\u042d','\u044d','\u042e','\u044e',
'\u042f','\u044f'
);
protected static $jsonReplaceTarget = array(
'А', 'а', 'Б', 'б', 'В', 'в', 'Г', 'г',
'Д', 'д', 'Е', 'е', 'Ё', 'ё', 'Ж', 'ж',
'З', 'з', 'И', 'и', 'Й', 'й', 'К', 'к',
'Л', 'л', 'М', 'м', 'Н', 'н', 'О', 'о',
'П', 'п', 'Р', 'р', 'С', 'с', 'Т', 'т',
'У', 'у', 'Ф', 'ф', 'Х', 'х', 'Ц', 'ц',
'Ч', 'ч', 'Ш', 'ш', 'Щ', 'щ', 'Ъ', 'ъ',
'Ы', 'ы', 'Ь', 'ь', 'Э', 'э', 'Ю', 'ю',
'Я', 'я'
);
protected $apiUrl; protected $apiUrl;
protected $apiKey; protected $apiKey;
protected $apiVersion = '1'; protected $apiVersion = '1';
@ -95,8 +70,6 @@ class RestApi
public function orderCreate($order) public function orderCreate($order)
{ {
$dataJson = json_encode($order); $dataJson = json_encode($order);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['order'] = $dataJson; $this->parameters['order'] = $dataJson;
$url = $this->apiUrl.'orders/create'; $url = $this->apiUrl.'orders/create';
@ -113,8 +86,6 @@ class RestApi
public function orderEdit($order) public function orderEdit($order)
{ {
$dataJson = json_encode($order); $dataJson = json_encode($order);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['order'] = $dataJson; $this->parameters['order'] = $dataJson;
$url = $this->apiUrl.'orders/'.$order['externalId'].'/edit'; $url = $this->apiUrl.'orders/'.$order['externalId'].'/edit';
@ -131,8 +102,6 @@ class RestApi
public function orderUpload($orders) public function orderUpload($orders)
{ {
$dataJson = json_encode($orders); $dataJson = json_encode($orders);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['orders'] = $dataJson; $this->parameters['orders'] = $dataJson;
$url = $this->apiUrl.'orders/upload'; $url = $this->apiUrl.'orders/upload';
@ -149,8 +118,6 @@ class RestApi
public function orderFixExternalIds($order) public function orderFixExternalIds($order)
{ {
$dataJson = json_encode($order); $dataJson = json_encode($order);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['orders'] = $dataJson; $this->parameters['orders'] = $dataJson;
$url = $this->apiUrl.'orders/fix-external-ids'; $url = $this->apiUrl.'orders/fix-external-ids';
@ -223,8 +190,6 @@ class RestApi
public function customerCreate($customer) public function customerCreate($customer)
{ {
$dataJson = json_encode($customer); $dataJson = json_encode($customer);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['customer'] = $dataJson; $this->parameters['customer'] = $dataJson;
$url = $this->apiUrl.'customers/create'; $url = $this->apiUrl.'customers/create';
@ -241,8 +206,6 @@ class RestApi
public function customerEdit($customer) public function customerEdit($customer)
{ {
$dataJson = json_encode($customer); $dataJson = json_encode($customer);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['customer'] = $dataJson; $this->parameters['customer'] = $dataJson;
$url = $this->apiUrl.'customers/'.$customer['externalId'].'/edit'; $url = $this->apiUrl.'customers/'.$customer['externalId'].'/edit';
@ -315,8 +278,6 @@ class RestApi
public function deliveryTypeEdit($deliveryType) public function deliveryTypeEdit($deliveryType)
{ {
$dataJson = json_encode($deliveryType); $dataJson = json_encode($deliveryType);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['deliveryType'] = $dataJson; $this->parameters['deliveryType'] = $dataJson;
$url = $this->apiUrl.'delivery-types/'.$deliveryType['code'].'/edit'; $url = $this->apiUrl.'delivery-types/'.$deliveryType['code'].'/edit';
@ -346,8 +307,6 @@ class RestApi
public function paymentTypesEdit($paymentType) public function paymentTypesEdit($paymentType)
{ {
$dataJson = json_encode($paymentType); $dataJson = json_encode($paymentType);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['paymentType'] = $dataJson; $this->parameters['paymentType'] = $dataJson;
$url = $this->apiUrl.'payment-types/'.$paymentType['code'].'/edit'; $url = $this->apiUrl.'payment-types/'.$paymentType['code'].'/edit';
@ -377,8 +336,6 @@ class RestApi
public function paymentStatusesEdit($paymentStatus) public function paymentStatusesEdit($paymentStatus)
{ {
$dataJson = json_encode($paymentStatus); $dataJson = json_encode($paymentStatus);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['paymentStatus'] = $dataJson; $this->parameters['paymentStatus'] = $dataJson;
$url = $this->apiUrl.'payment-statuses/'.$paymentStatus['code'].'/edit'; $url = $this->apiUrl.'payment-statuses/'.$paymentStatus['code'].'/edit';
@ -408,8 +365,6 @@ class RestApi
public function orderTypesEdit($orderType) public function orderTypesEdit($orderType)
{ {
$dataJson = json_encode($orderType); $dataJson = json_encode($orderType);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['orderType'] = $dataJson; $this->parameters['orderType'] = $dataJson;
$url = $this->apiUrl.'order-types/'.$orderType['code'].'/edit'; $url = $this->apiUrl.'order-types/'.$orderType['code'].'/edit';
@ -438,8 +393,6 @@ class RestApi
public function orderStatusEdit($status) public function orderStatusEdit($status)
{ {
$dataJson = json_encode($status); $dataJson = json_encode($status);
$dataJson = str_replace(self::$jsonReplaceSource, self::$jsonReplaceTarget,
$dataJson);
$this->parameters['status'] = $dataJson; $this->parameters['status'] = $dataJson;
$url = $this->apiUrl.'statuses/'.$status['code'].'/edit'; $url = $this->apiUrl.'statuses/'.$status['code'].'/edit';