Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
counterpost.php
1
<?php
2
3
namespace
Bitrix\Blog\Integration\Socialnetwork
;
4
5
class
CounterPost
6
{
7
public
static
function
increment
($params = array())
8
{
9
$socnetPerms = (
10
is_array($params)
11
&& !empty($params[
'socnetPerms'
])
12
&& is_array($params[
'socnetPerms'
])
13
? $params[
'socnetPerms'
]
14
: array()
15
);
16
17
$logId = (
18
is_array($params)
19
&& !empty($params[
'logId'
])
20
&& intval($params[
'logId'
]) > 0
21
? intval($params[
'logId'
])
22
: 0
23
);
24
25
$logEventId = (
26
is_array($params)
27
&& !empty($params[
'logEventId'
])
28
? $params[
'logEventId'
]
29
:
''
30
);
31
32
$sendToAuthor = (
33
is_array($params)
34
&& !empty($params[
'sendToAuthor'
])
35
? $params[
'sendToAuthor'
]
36
: false
37
);
38
39
if
(
40
$logId <= 0
41
|| empty($logEventId)
42
)
43
{
44
return
false
;
45
}
46
47
$userIdList = array();
48
$forAll = (
49
in_array(
"AU"
, $socnetPerms)
50
|| in_array(
"G2"
, $socnetPerms)
51
);
52
53
if
(!$forAll)
54
{
55
foreach
($socnetPerms as $code)
56
{
57
if
(preg_match(
'/^U(\d+)$/'
, $code, $matches))
58
{
59
$userIdList[] = $matches[1];
60
}
61
elseif (!in_array($code, array(
"SA"
)))
62
{
63
$userIdList = array();
64
break
;
65
}
66
}
67
}
68
69
\CSocNetLog::counterIncrement(array(
70
"ENTITY_ID"
=> $logId,
71
"EVENT_ID"
=> $logEventId,
72
"TYPE"
=>
"L"
,
73
"FOR_ALL_ACCESS"
=> $forAll,
74
"USERS_TO_PUSH"
=> (
75
$forAll
76
|| empty($userIdList)
77
|| count($userIdList) > 20
78
? array()
79
: $userIdList
80
),
81
"SEND_TO_AUTHOR"
=> (
82
$sendToAuthor
83
?
"Y"
84
:
"N"
85
)
86
));
87
88
return
true
;
89
}
90
}
Bitrix\Blog\Integration\Socialnetwork\CounterPost
Definition
counterpost.php:6
Bitrix\Blog\Integration\Socialnetwork\CounterPost\increment
static increment($params=array())
Definition
counterpost.php:7
Bitrix\Blog\Integration\Socialnetwork
Definition
contentviewhandler.php:3
modules
blog
lib
integration
socialnetwork
counterpost.php
Создано системой
1.10.0