Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
content.php
1<?php
2
4
6
7class Content
8{
9 const TYPE_STRING = 1;
10 const TYPE_INTEGER = 2;
11 const TYPE_MIXED = 3;
12
18 public static function prepareStringToken($token)
19 {
20 return str_rot13($token);
21 }
22
28 public static function prepareIntegerToken($token)
29 {
30 $token = intval($token);
31 return str_pad($token, Filter\Helper::getMinTokenSize(), '0', STR_PAD_LEFT);
32 }
33
39 public static function isIntegerToken($token)
40 {
41 return preg_match('/^[0-9]{1,}$/i', $token);
42 }
43
50 public static function canUseFulltextSearch($token, $type = self::TYPE_STRING)
51 {
52 if ((int)$type > 1)
53 {
54 $result = static::isIntegerToken($token) || mb_strlen($token) >= Filter\Helper::getMinTokenSize();
55 }
56 else
57 {
58 $result = mb_strlen($token) >= Filter\Helper::getMinTokenSize();
59 }
60
61 return $result;
62 }
63}
static canUseFulltextSearch($token, $type=self::TYPE_STRING)
Definition content.php:50
static prepareIntegerToken($token)
Definition content.php:28
static isIntegerToken($token)
Definition content.php:39
static prepareStringToken($token)
Definition content.php:18