Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
content.php
1
<?php
2
3
namespace
Bitrix\Main\Search
;
4
5
use
Bitrix\Main\ORM\Query\Filter
;
6
7
class
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
}
Bitrix\Main\ORM\Query\Filter\Helper\getMinTokenSize
static getMinTokenSize()
Definition
helper.php:76
Bitrix\Main\Search\Content
Definition
content.php:8
Bitrix\Main\Search\Content\canUseFulltextSearch
static canUseFulltextSearch($token, $type=self::TYPE_STRING)
Definition
content.php:50
Bitrix\Main\Search\Content\prepareIntegerToken
static prepareIntegerToken($token)
Definition
content.php:28
Bitrix\Main\Search\Content\TYPE_MIXED
const TYPE_MIXED
Definition
content.php:11
Bitrix\Main\Search\Content\isIntegerToken
static isIntegerToken($token)
Definition
content.php:39
Bitrix\Main\Search\Content\TYPE_STRING
const TYPE_STRING
Definition
content.php:9
Bitrix\Main\Search\Content\prepareStringToken
static prepareStringToken($token)
Definition
content.php:18
Bitrix\Main\Search\Content\TYPE_INTEGER
const TYPE_INTEGER
Definition
content.php:10
Bitrix\Main\ORM\Query\Filter
Definition
condition.php:9
Bitrix\Main\Search
Definition
content.php:3
modules
main
lib
search
content.php
Создано системой
1.10.0