1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
listsitem.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Livefeed;
4
5
use Bitrix\Socialnetwork\LogTable;
6
use Bitrix\Main\Config\Option;
7
8
final
class
ListsItem
extends
Provider
9
{
10
public
const
PROVIDER_ID
=
'LISTS_NEW_ELEMENT'
;
11
public
const
CONTENT_TYPE_ID
=
'LISTS_NEW_ELEMENT'
;
12
13
protected
static
$logTableClass
= LogTable::class;
14
15
public
static
function
getId
(): string
16
{
17
return
static::PROVIDER_ID;
18
}
19
20
public
function
getEventId
():
array
21
{
22
return
[
'lists_new_element'
];
23
}
24
25
public
function
getType
(): string
26
{
27
return
Provider::TYPE_POST
;
28
}
29
30
public
function
getCommentProvider
(): Provider
31
{
32
return
new
ForumPost
();
33
}
34
35
public
function
initSourceFields
()
36
{
37
static
$cache = [];
38
39
$elementId =
$this->entityId
;
40
41
if
($elementId <= 0)
42
{
43
return
;
44
}
45
46
if
(isset($cache[$elementId]))
47
{
48
$logEntryFields = $cache[$elementId];
49
}
50
else
51
{
52
$res
= self::$logTableClass::getList([
53
'filter'
=> [
54
'SOURCE_ID'
=> $elementId,
55
'@EVENT_ID'
=> $this->
getEventId
(),
56
],
57
'select'
=> [
'ID'
,
'TITLE'
,
'MESSAGE'
,
'TEXT_MESSAGE'
,
'PARAMS'
]
58
]);
59
60
$logEntryFields =
$res
->fetch();
61
$cache[$elementId] = $logEntryFields;
62
}
63
64
if
(empty($logEntryFields))
65
{
66
return
;
67
}
68
69
$this->
setLogId
($logEntryFields[
'ID'
]);
70
$this->
setSourceFields
($logEntryFields);
71
$this->
setSourceTitle
($logEntryFields[
'TITLE'
]);
72
73
$description
= $logEntryFields[
'TEXT_MESSAGE'
];
74
$description
= preg_replace(
'/<script(.*?)>(.*?)<\/script>/is'
,
''
,
$description
);
75
$description
=
\CTextParser::clearAllTags
(
$description
);
76
$this->
setSourceDescription
(
$description
);
77
}
78
79
public
function
getPinnedTitle
()
80
{
81
$result
=
''
;
82
83
if
(empty($this->sourceFields))
84
{
85
$this->
initSourceFields
();
86
}
87
88
$logEntryFields = $this->
getSourceFields
();
89
if
(empty($logEntryFields))
90
{
91
return
$result
;
92
}
93
94
return
$logEntryFields[
'TITLE'
];
95
}
96
97
public
function
getPinnedDescription
()
98
{
99
$result
=
''
;
100
101
if
(empty($this->sourceFields))
102
{
103
$this->
initSourceFields
();
104
}
105
106
$logEntryFields = $this->
getSourceFields
();
107
if
(empty($logEntryFields))
108
{
109
return
$result
;
110
}
111
112
$description
= $logEntryFields[
'TEXT_MESSAGE'
];
113
$description
= preg_replace(
'/<script(.*?)>(.*?)<\/script>/is'
,
''
,
$description
);
114
$description
=
\CTextParser::clearAllTags
(
$description
);
115
116
return
truncateText(
htmlspecialcharsback
(
$description
), 100);
117
}
118
119
public
function
getLiveFeedUrl
(): string
120
{
121
$pathToLogEntry = Option::get(
'socialnetwork'
,
'log_entry_page'
);
122
if
(!empty($pathToLogEntry))
123
{
124
$pathToLogEntry =
\CComponentEngine::makePathFromTemplate
($pathToLogEntry,
array
(
"log_id"
=> $this->
getLogId
()));
125
}
126
127
return
$pathToLogEntry;
128
}
129
}
Bitrix\Socialnetwork\Livefeed\ForumPost
Определения
forumpost.php:22
Bitrix\Socialnetwork\Livefeed\ListsItem
Определения
listsitem.php:9
Bitrix\Socialnetwork\Livefeed\ListsItem\initSourceFields
initSourceFields()
Определения
listsitem.php:35
Bitrix\Socialnetwork\Livefeed\ListsItem\getCommentProvider
getCommentProvider()
Определения
listsitem.php:30
Bitrix\Socialnetwork\Livefeed\ListsItem\CONTENT_TYPE_ID
const CONTENT_TYPE_ID
Определения
listsitem.php:11
Bitrix\Socialnetwork\Livefeed\ListsItem\getPinnedTitle
getPinnedTitle()
Определения
listsitem.php:79
Bitrix\Socialnetwork\Livefeed\ListsItem\getType
getType()
Определения
listsitem.php:25
Bitrix\Socialnetwork\Livefeed\ListsItem\getLiveFeedUrl
getLiveFeedUrl()
Определения
listsitem.php:119
Bitrix\Socialnetwork\Livefeed\ListsItem\getEventId
getEventId()
Определения
listsitem.php:20
Bitrix\Socialnetwork\Livefeed\ListsItem\getId
static getId()
Определения
listsitem.php:15
Bitrix\Socialnetwork\Livefeed\ListsItem\PROVIDER_ID
const PROVIDER_ID
Определения
listsitem.php:10
Bitrix\Socialnetwork\Livefeed\ListsItem\getPinnedDescription
getPinnedDescription()
Определения
listsitem.php:97
Bitrix\Socialnetwork\Livefeed\ListsItem\$logTableClass
static $logTableClass
Определения
listsitem.php:13
Bitrix\Socialnetwork\Livefeed\Provider\setLogId
setLogId($logId)
Определения
provider.php:624
Bitrix\Socialnetwork\Livefeed\Provider\setSourceFields
setSourceFields(array $fields)
Определения
provider.php:639
Bitrix\Socialnetwork\Livefeed\Provider\setSourceTitle
setSourceTitle($title)
Определения
provider.php:677
Bitrix\Socialnetwork\Livefeed\Provider\getSourceFields
getSourceFields()
Определения
provider.php:649
Bitrix\Socialnetwork\Livefeed\Provider\TYPE_POST
const TYPE_POST
Определения
provider.php:25
Bitrix\Socialnetwork\Livefeed\Provider\setSourceDescription
setSourceDescription($description)
Определения
provider.php:654
Bitrix\Socialnetwork\Livefeed\Provider\$entityId
$entityId
Определения
provider.php:53
Bitrix\Socialnetwork\Livefeed\Provider\getLogId
getLogId($params=[])
Определения
provider.php:336
CComponentEngine\makePathFromTemplate
static makePathFromTemplate($template, $arParams=array())
Определения
component_engine.php:355
CTextParser\clearAllTags
static clearAllTags($text)
Определения
textparser.php:2358
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$res
$res
Определения
filter_act.php:7
$result
$result
Определения
get_property_values.php:14
$description
if(Loader::includeModule( 'bitrix24')) elseif(Loader::includeModule('intranet') &&CIntranetUtils::getPortalZone() !=='ru') $description
Определения
.description.php:24
htmlspecialcharsback
htmlspecialcharsback($str)
Определения
tools.php:2693
bitrix
modules
socialnetwork
lib
livefeed
listsitem.php
Создано системой
1.14.0