1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
event.php
См. документацию.
1<?php
2
9
10namespace Bitrix\Main\Mail\Internal;
11
12use Bitrix\Main\ORM\Fields\ArrayField;
13use Bitrix\Main\Type as Type;
14use Bitrix\Main\ORM\Data\DataManager;
15use Bitrix\Main\ORM\Fields\StringField;
16
34{
38 public static function getTableName()
39 {
40 return 'b_event';
41 }
42
46 public static function getMap()
47 {
48 return array(
49 'ID' => array(
50 'data_type' => 'integer',
51 'primary' => true,
52 'autocomplete' => true,
53 ),
54 'EVENT_NAME' => array(
55 'data_type' => 'string',
56 'required' => true,
57 ),
58 'MESSAGE_ID' => array(
59 'data_type' => 'integer',
60 ),
61 'LID' => array(
62 'data_type' => 'string',
63 'required' => true,
64 ),
65
66 (new ArrayField('C_FIELDS'))
67 ->configureSerializeCallback(function ($value){
68 return EventTable::serialize($value);
69 })
70 ->configureUnserializeCallback(function ($str) {
71 return unserialize(
73 ['allowed_classes' => false]
74 );
75 }),
76
77 'DATE_INSERT' => array(
78 'data_type' => 'datetime',
79 'default_value' => function(){return new Type\DateTime();},
80 ),
81 'DATE_EXEC' => array(
82 'data_type' => 'datetime',
83 ),
84 'SUCCESS_EXEC' => array(
85 'data_type' => 'string',
86 ),
87 'DUPLICATE' => array(
88 'data_type' => 'string',
89 ),
90 'LANGUAGE_ID' => array(
91 'data_type' => 'string',
92 ),
93 );
94 }
95
99 public static function getSaveModificatorsForFieldsField()
100 {
101 return array(
102 array(__CLASS__, "serialize")
103 );
104 }
105
109 public static function getFetchModificatorsForFieldsField()
110 {
111 return array(
112 array(__CLASS__, "getFetchModificationForFieldsField"),
113 array(new StringField('FIELDS', array()), "unserialize")
114 );
115 }
116
117 public static function serialize($fields)
118 {
119 if(!is_array($fields))
120 {
121 $fields = array();
122 }
123
124 array_walk_recursive($fields, array(__CLASS__, 'replaceValuesBeforeSerialize'));
125
126 if(!is_array($fields))
127 {
128 $fields = array();
129 }
130
131 return serialize($fields);
132 }
133
134 protected static function replaceValuesBeforeSerialize(&$item)
135 {
136 if(is_object($item))
137 {
138 if(method_exists($item, '__toString'))
139 $item = (string) $item;
140 else
141 $item = '';
142 }
143 }
144
149 protected static function isFieldSerialized($str)
150 {
151 $str = trim($str);
152
153 if ($str == 'N;')
154 return true;
155
156 if ( !preg_match( '/^([abdiOs]):/', $str, $matches ) )
157 return false;
158
159 switch($matches[1])
160 {
161 case 'b':
162 case 'i':
163 case 'd':
164 if(preg_match( "/^".$matches[1].":[0-9.E-]+;\$/", $str))
165 return true;
166 break;
167
168 case 'a':
169 case 'O':
170 case 's':
171 if(preg_match( "/^".$matches[1].":[0-9]+:.*[;}]\$/s", $str))
172 return true;
173 break;
174 }
175
176 return false;
177 }
178
184 {
185 if(static::isFieldSerialized($str))
186 return $str;
187
188 $ar = explode("&", $str);
189 $newar = array();
190 foreach($ar as $val)
191 {
192 $val = str_replace("%1", "&", $val);
193 $tar = explode("=", $val);
194 $key = $tar[0];
195 $val = $tar[1];
196 $key = str_replace("%3", "=", $key);
197 $val = str_replace("%3", "=", $val);
198 $key = str_replace("%2", "%", $key);
199 $val = str_replace("%2", "%", $val);
200 if($key != "")
201 $newar[$key] = $val;
202 }
203
204 $field = new StringField('FIELDS', array());
205 return $field->serialize($newar);
206 }
207}
static isFieldSerialized($str)
Определения event.php:149
static getMap()
Определения event.php:46
static replaceValuesBeforeSerialize(&$item)
Определения event.php:134
static getFetchModificatorsForFieldsField()
Определения event.php:109
static serialize($fields)
Определения event.php:117
static getSaveModificatorsForFieldsField()
Определения event.php:99
static getFetchModificationForFieldsField($str)
Определения event.php:183
static getTableName()
Определения event.php:38
$str
Определения commerceml2.php:63
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения collection.php:2
$ar
Определения options.php:199
if(empty($signedUserToken)) $key
Определения quickway.php:257
$val
Определения options.php:1793
$matches
Определения index.php:22
$fields
Определения yandex_run.php:501