Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
signaturehelper.php
1<?php
3
5{
6 public static function getSignature(SignatureManager $signatureManager, array $fieldParam)
7 {
8 return $signatureManager->getSignature(
9 static::getSignatureParam($fieldParam)
10 );
11 }
12
13 public static function validateSignature(SignatureManager $signatureManager, array $fieldParam, $signature)
14 {
15 return $signatureManager->validateSignature(
16 static::getSignatureParam($fieldParam),
17 $signature
18 );
19 }
20
21 protected static function getSignatureParam(array $fieldParam)
22 {
23 array_walk_recursive($fieldParam, function(&$item)
24 {
25 $item = strval($item);
26 });
27
28 $signatureParam = array(
29 'ENTITY_ID' => $fieldParam['ENTITY_ID'],
30 'FIELD' => $fieldParam['FIELD'],
31 );
32
33 if(!empty($fieldParam['VALUE']))
34 {
35 $fieldParam['VALUE'] = str_replace("\r\n", "\n", $fieldParam['VALUE']);
36 $signatureParam['VALUE'] = $fieldParam['VALUE'];
37 }
38
39 if(!empty($fieldParam['CONTEXT']))
40 {
41 $signatureParam['CONTEXT'] = $fieldParam['CONTEXT'];
42 }
43
44 return serialize($signatureParam);
45 }
46}
static validateSignature(SignatureManager $signatureManager, array $fieldParam, $signature)
static getSignature(SignatureManager $signatureManager, array $fieldParam)
static getSignatureParam(array $fieldParam)